Skip to content

refactor(pathfinder): ask a search result whether it found something - #3614

Closed
rparolin wants to merge 2 commits into
pathfinder-readability/11-move-test-only-datafrom
pathfinder-readability/12-result-found-flag
Closed

rparolin wants to merge 2 commits into
pathfinder-readability/11-move-test-only-datafrom
pathfinder-readability/12-result-found-flag

Conversation

@rparolin

@rparolin rparolin commented Nov 25, 2026 •

Copy link
Copy Markdown
Collaborator

Description

Part 12 of 12 of a readability stack for cuda.pathfinder (stack: #3602 → #3603 → #3604 → #3605 → #3606 → #3607 → #3608 → #3609 → #3610 → #3611 → #3613 → #3614). No behavior change.

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. 1291 passed, 6 skipped, and every comparison against main is still byte-identical, including simulated Windows.

Testing

  • Full cuda_pathfinder test suite at this commit: 1291 passed, 6 skipped (Linux, Python 3.14).
  • pre-commit clean, including mypy-pathfinder.
  • Not run on Windows. Windows rules are exercised by tests that simulate Windows on Linux.

PLC Local Security Evidence (Advisory)

Local advisory checks only, run over the whole stack. Not release-gate results.

Check Status Tool Details
Secrets SKIP Pulse Secret Scanner scanner image not available locally (registry login); the repo trufflehog pre-commit hook passed
SAST WARN Semgrep 1 finding, not from this stack: the existing subprocess.run call in the canary probe in load_nvidia_dynamic_lib.py
Dependencies WARN pip-audit / osv-scanner no manifest or lockfile in scope, so the local scan could not run; this stack changes no dependencies
License N/A - no dependencies changed
Container N/A - no container changed

Checklist

  • I have read the Contributing Guidelines.
  • New or existing tests cover these changes.
  • The documentation is up to date with these changes.

🤖 Generated with Claude Code

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. 1291 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>
@rparolin
rparolin added this pull request to stack #3612 November 25, 2026 22:06
@copy-pr-bot

copy-pr-bot Bot commented Nov 25, 2026

Copy link
Copy Markdown
Contributor

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.

…hfinder-readability/12-result-found-flag

Signed-off-by: Rob Parolin <rparolin@nvidia.com>
@rparolin

Copy link
Copy Markdown
Collaborator Author

Folded into #3607, where this code is introduced. Closing this one: it no longer has any changes.

@rparolin rparolin closed this Nov 25, 2026
@rparolin
rparolin removed this pull request from stack #3612 November 25, 2026 22:28
@rparolin
rparolin deleted the pathfinder-readability/12-result-found-flag branch November 25, 2026 23:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

cuda.pathfinder Everything related to the cuda.pathfinder module enhancement Any code-related improvements

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant