Skip to content

refactor(pathfinder): resolve_path returns a string - #3628

Open
rparolin wants to merge 1 commit into
pathfinder-readability/18-drop-constant-wheel-dir-argfrom
pathfinder-readability/19-resolve-path-returns-str
Open

rparolin wants to merge 1 commit into
pathfinder-readability/18-drop-constant-wheel-dir-argfrom
pathfinder-readability/19-resolve-path-returns-str

Conversation

@rparolin

@rparolin rparolin commented Nov 26, 2026 •

Copy link
Copy Markdown
Collaborator

— codex on behalf of Ralf —

Description

Part 19 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.

resolve_path returned a Path, and all five callers wrapped it in str(...). It now returns the string, and the wrappers are gone.

Tests: the three resolve_path tests compare against str(target.resolve()) instead of the Path. The expected paths are the same.

No behavior change: every caller gets the same string as before.

Testing

  • Full cuda_pathfinder test suite at this commit: 1297 passed, 6 skipped (Linux, Python 3.14).
  • pre-commit clean, including mypy-pathfinder. mypy also passes with --platform win32.
  • The step-by-step comparisons against main are still byte-identical (Linux, simulated Windows x64 and arm64), and all 526 public-API scenarios give the same result as fix(pathfinder): check for an already-loaded library before searching the disk #3623.
  • 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, now in canary_probe.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

@copy-pr-bot

copy-pr-bot Bot commented Nov 26, 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.

@github-actions github-actions Bot added the cuda.pathfinder Everything related to the cuda.pathfinder module label Nov 26, 2026
@rparolin
rparolin added this pull request to stack #3616 November 26, 2026 18:40
@rparolin rparolin added the enhancement Any code-related improvements label Nov 26, 2026
@rparolin rparolin added this to the cuda.pathfinder next milestone Nov 26, 2026
@rparolin rparolin self-assigned this Nov 26, 2026
@rparolin
rparolin requested review from juenglin and rwgk November 26, 2026 18:42
This was referenced Nov 26, 2026
@rparolin
rparolin marked this pull request as ready for review November 26, 2026 18:53
@coderabbitai

coderabbitai Bot commented Nov 26, 2026 •

Copy link
Copy Markdown

Explain Change →

Important

Review skipped

Review was skipped as selected files did not have any reviewable changes.

Run configuration

Commits

Reviewing files that changed from the base of the PR and between 1978894 and 16a8c1f.

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • Trigger review

No actionable comments were generated in the recent review.

Summary

Summary by CodeRabbit

  • Bug Fixes
    • Resolved paths are now returned as strings consistently across file discovery and lookup operations. Relative paths continue to resolve to absolute paths, and searches still return no result when no executable candidate is found.

resolve_path now returns the resolved absolute path as a string. Callers pass through its result, and tests check string results.

Changes: Resolved path return type

Layer / File(s) Summary
Resolver contract
cuda_pathfinder/cuda/pathfinder/_utils/resolve_path.py
resolve_path now returns the resolved absolute path as a string instead of a Path.
Caller and test updates
cuda_pathfinder/cuda/pathfinder/_binaries/find_nvidia_binary_utility.py, cuda_pathfinder/cuda/pathfinder/_dynamic_libs/search_steps.py, cuda_pathfinder/cuda/pathfinder/_headers/find_nvidia_headers.py, cuda_pathfinder/cuda/pathfinder/_static_libs/locate_file.py, cuda_pathfinder/tests/test_utils_resolve_path.py
Path discovery callers pass through resolver results directly. Tests expect strings and convert the result to Path when checking file existence.

Change: Refactor

Merge Risk: Minimal · previous review fd155

This refactor changes the return type of an internal path helper and removes redundant string conversions at its callers. Lookup results should be unchanged, so the risk of merging is minimal.

Architecture risk: Medium · up to fd155

The resolver now provides a string path, so its in-package lookup callers rely on that return type and no longer need string coercions.

The resolver now provides a resolved path string, allowing lookup callers to forward it directly; consumers needing Path operations must construct a Path from that string.

Changed areas: cuda_pathfinder

Review details

Systems and components

  • observed — 6 changed files mapped to cuda_pathfinder.

Reliability and maintainability

  • inferred — Risk-relevant change factors for cuda_pathfinder: blast_radius_3; direct_dependents_3
- [ ] Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts
Recent review info

Run configuration

Commits

Reviewing files that changed from the base of the PR and between 5fe686a and fd155b3.

Files selected for processing: 4

  • cuda_pathfinder/cuda/pathfinder/_binaries/find_nvidia_binary_utility.py
  • cuda_pathfinder/cuda/pathfinder/_headers/find_nvidia_headers.py
  • cuda_pathfinder/cuda/pathfinder/_static_libs/locate_file.py
  • cuda_pathfinder/cuda/pathfinder/_utils/resolve_path.py

Included review availability: This review used your included allowance. Your plan provides up to 12 included reviews per hour; 10 remain after this review.

@rwgk
rwgk removed this pull request from stack #3616 November 26, 2026 19:19
@rwgk
rwgk force-pushed the pathfinder-readability/19-resolve-path-returns-str branch from f47941a to 9437518 Compare November 26, 2026 19:19
@copy-pr-bot

copy-pr-bot Bot commented Nov 26, 2026

Copy link
Copy Markdown
Contributor

This pull request requires additional validation before any workflows can run on NVIDIA's runners.

Pull request vetters can view their responsibilities here.

Contributors can view more details about this message here.

@rwgk
rwgk added this pull request to stack #3633 November 26, 2026 19:19
@github-actions

Copy link
Copy Markdown
Contributor

@rparolin

rparolin commented Dec 4, 2026

Copy link
Copy Markdown
Collaborator Author

/ok to test fd155b3

@rparolin
rparolin force-pushed the pathfinder-readability/19-resolve-path-returns-str branch from fd155b3 to 1978894 Compare December 4, 2026 17:54
`resolve_path` returned a `Path`, and all five callers wrapped it in
`str(...)`. It now returns the string itself and the wrappers are gone.

Its tests compare against `str(target.resolve())` instead of the `Path`.
The expected paths are the same.

No behavior change: every caller gets the same string as before.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
Signed-off-by: Rob Parolin <rparolin@nvidia.com>
@rparolin
rparolin force-pushed the pathfinder-readability/19-resolve-path-returns-str branch from 1978894 to 16a8c1f Compare December 4, 2026 20:44

This branch has not been deployed

No deployments
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.

2 participants