Repository navigation
Conversation
|
Auto-sync is disabled for draft pull requests in this repository. Workflows must be run manually. Contributors can view more details about this message here. |
|
Warning Review limit reachedEnable usage-based reviews in Billing to review now. Otherwise, wait until the next included review is available. Next included review available in 26 minutes. View limit details
No actionable comments were generated in the recent review. Summary
Change: Refactor Merge Risk:
|
|
Until now a failed probe appended its error text to two lists on the search context, so every step mutated shared state as a side effect. Now a step returns either a `FindResult` (hit) or a `NotFound` (miss) that carries its error text. `run_find_steps` combines the misses, and `_load_lib_no_cache` hands the combined result to `raise_not_found`. `SearchContext` loses both lists and is a plain immutable record. `FindResult` is frozen too. A step that does not apply returns an empty `NotFound()`, not `None`. Tests: `result is None` becomes `isinstance(result, NotFound)`, and `result is not None` becomes `isinstance(result, FindResult)`, for step results only. Tests that read `ctx.error_messages` read `result.error_messages`. One new test covers how misses are combined. No behavior change. Checked beyond the test suite: for every catalog entry on Linux, Windows x64 and Windows arm64, each step's hit (path and `found_via`) or miss (messages and listings) and the final error text are byte-identical to `main`, over two fake install trees (1800 step results), as is `_load_lib_no_cache` for all 50 libraries. Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com> Signed-off-by: Rob Parolin <rparolin@nvidia.com>
Callers told a hit from a miss with `isinstance(result, FindResult)`. Both result types now carry a `found` flag, so callers write `if result.found:` instead. The flag is typed as a literal `True` on `FindResult` and `False` on `NotFound`, so a type checker still narrows the type inside the `if`. To make that uniform, the two file probes in `search_platform.py` return a `FindResult` instead of a bare path, and `FindResult` moves there, next to `NotFound`. `search_steps.py` still exports it. No behavior change. 1647 passed, 6 skipped, and every comparison against `main` is still byte-identical, including simulated Windows. Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com> Signed-off-by: Rob Parolin <rparolin@nvidia.com>
The search steps now return their misses, and the error text is put together in six places. Only `run_find_steps` was tested, so reversing or dropping any of the other five went unnoticed. Three new tests pin the exact text: the full `DynamicLibNotFoundError` for a library that misses in the early steps, the late steps and the canary root, and the misses reported by the product-root and Program Files steps. Each of the seven ways to reverse or drop a part now fails a test. Also renames eight tests whose names still said "returns none"; a miss is a `NotFound` now. Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com> Signed-off-by: Rob Parolin <rparolin@nvidia.com>
…ance Package code asks a search result `result.found`. The tests still used `isinstance(result, FindResult)` and `isinstance(result, NotFound)` in 41 places. They now ask `.found` too, so tests read like the code they cover. One assert became redundant and is removed: the line above it already checks the same flag. Test only. No package code changes. Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com> Signed-off-by: Rob Parolin <rparolin@nvidia.com>
Signed-off-by: Ralf W. Grosse-Kunstleve <rgrossekunst@nvidia.com>
8206eaf to
07afb1a
Compare
— codex on behalf of Ralf —
Description
Part 7 of 23 of a readability stack for
cuda.pathfinder(stack: #3623 → #3602 → #3603 → #3604 → #3605 → #3606 → #3607 → #3608 → #3609 → #3610 → #3611 → #3613 → #3618 → #3619 → #3620 → #3621 → #3622 → #3627 → #3628 → #3629 → #3630 → #3631 → #3632). No behavior change.Until now a failed probe appended its error text to two lists on the search context, so every step mutated shared state as a side effect.
Now a step returns either a
FindResult(hit) or aNotFound(miss) that carries its error text.run_find_stepscombines the misses, and_load_lib_no_cachehands the combined result toraise_not_found.SearchContextloses both lists and is a plain immutable record.FindResultis frozen too.A step that does not apply returns an empty
NotFound(), notNone.Tests:
result is Nonebecomesnot result.found, andresult is not Nonebecomesresult.found, for step results only. Tests that readctx.error_messagesreadresult.error_messages. One new test covers how misses are combined.No behavior change. Checked beyond the test suite: for every catalog entry on Linux, Windows x64 and Windows arm64, each step's hit (path and
found_via) or miss (messages and listings) and the final error text are byte-identical tomain, over two fake install trees (1800 step results), as is_load_lib_no_cachefor all 50 libraries.Also in this PR: ask a search result whether it found something.
Callers told a hit from a miss with
isinstance(result, FindResult). Both result types now carry afoundflag, so callers writeif result.found:instead. Tests ask.foundtoo. The flag is typed as a literalTrueonFindResultandFalseonNotFound, so a type checker still narrows the type inside theif.To make that uniform, the two file probes in
search_platform.pyreturn aFindResultinstead of a bare path, andFindResultmoves there, next toNotFound.search_steps.pystill exports it.Also in this PR: pin the not-found error text and its order.
The search steps now return their misses, and the error text is put together in six places. Only
run_find_stepswas tested, so reversing or dropping any of the other five went unnoticed.Three tests pin the exact text. The first pins the full
DynamicLibNotFoundErrorfor a library that misses in the early steps, the late steps and the canary root. It lives in #3606: it passes there on the old code and is untouched here, which shows the text did not change. Two new tests here pin the misses reported by the product-root and Program Files steps. Seven planted bugs that reverse or drop a part each fail a test.Also renames ten tests whose names still said "returns none"; a miss is a
NotFoundnow.Testing
cuda_pathfindertest suite at this commit: 1650 passed, 6 skipped (Linux, Python 3.14).mypy-pathfinder.PLC Local Security Evidence (Advisory)
Local advisory checks only, run over the whole stack. Not release-gate results.
subprocess.runcall in the canary probe inload_nvidia_dynamic_lib.pyChecklist
🤖 Generated with Claude Code