You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
refactor(pathfinder): give the found_via labels one home - #3609
The found_via strings ("site-packages", "conda", "CUDA_PATH", ...) are public: they appear on every result object. They were typed by hand in six modules, and load_dl_linux.py branches on two of them, so a typo in one module would silently change loader behavior.
They are now constants in _utils/found_via.py, and every producer and the one consumer use the constants. A new test pins the eight public values.
No behavior change: the strings are identical. 1652 passed, 6 skipped, and the step-by-step comparisons against main are still byte-identical.
Also in this PR: tell agents where the found_via labels live.
AGENTS.md now says package code uses the constants in _utils/found_via.py and never types the label strings. Tests type them on purpose: that pins the public values.
Testing
Full cuda_pathfinder test suite at this commit: 1652 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
Reviewing files that changed from the base of the PR and between 017b2ad and 7b79036.
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
Refactor
Standardized the labels that describe where libraries and headers were found, while preserving their existing values, search order, and loading behavior. Discovery results continue to identify sources such as site-packages, Conda, system search, and CUDA paths.
Tests
Added checks to verify discovery labels retain their expected values.
The change defines shared Final constants for discovery labels and replaces matching string literals in search and loader code. It adds a test for seven label values and updates contributor guidance.
Changes: Discovery provenance labels
Layer / File(s)
Summary
Define and verify discovery labels cuda_pathfinder/cuda/pathfinder/_utils/found_via.py, cuda_pathfinder/tests/test_utils_found_via.py, cuda_pathfinder/AGENTS.md
The utility module defines eight public label constants. A test checks seven exact values. Contributor guidance directs code to use these constants.
Use labels in discovery searches cuda_pathfinder/cuda/pathfinder/_dynamic_libs/search_steps.py, cuda_pathfinder/cuda/pathfinder/_dynamic_libs/search_platform.py, cuda_pathfinder/cuda/pathfinder/_headers/find_nvidia_headers.py, cuda_pathfinder/cuda/pathfinder/_static_libs/locate_file.py
Search results for libraries, headers, and static files use constants for their existing discovery sources.
Use labels in dynamic-library loaders cuda_pathfinder/cuda/pathfinder/_dynamic_libs/load_dl_linux.py, cuda_pathfinder/cuda/pathfinder/_dynamic_libs/load_dl_windows.py
Loader results and Linux source checks use shared constants in place of equivalent string literals.
Change: Refactor
Merge Risk: Minimal · previous review a2835
This refactor centralizes the public found_via labels without changing their values or the search and loading behavior. No merge-blocking risk was identified.
Architecture risk: Low · up to a2835
CUDA Pathfinder discovery and loader code now share exported FOUND_VIA_* constants instead of maintaining equivalent provenance-label literals, without changing search or loading behavior.
Changed areas:cuda_pathfinder
Review details
Systems and components
observed — 9 changed files mapped to cuda_pathfinder.
- [ ] Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts
Included review availability: This review used your included allowance. Your plan provides up to 12 included reviews per hour; 2 remain after this review.
The `found_via` strings ("site-packages", "conda", "CUDA_PATH", ...) are
public: they appear on every result object. They were typed by hand in
five modules, and `load_dl_linux.py` branches on two of them, so a typo
in one module would silently change loader behavior.
They are now constants in `_utils/found_via.py`, and every producer and
the one consumer use the constants. A new test pins the eight public
values.
No behavior change: the strings are identical. 1647 passed, 6 skipped,
and the step-by-step comparisons against `main` are still byte-identical.
Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
Signed-off-by: Rob Parolin <rparolin@nvidia.com>
docs(pathfinder): tell agents where the found_via labels live
`AGENTS.md` now says to use the constants in `_utils/found_via.py` and
not to type the label strings anywhere else.
Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
Signed-off-by: Rob Parolin <rparolin@nvidia.com>
docs(pathfinder): say the label rule is for package code
AGENTS.md told agents not to type `found_via` label strings anywhere
but `found_via.py`. Tests type them in many places on purpose: that is
how they pin the public values. A review bot already quoted the rule
against a test.
The rule now says what was meant: package code uses the constants,
tests may type the strings.
Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
Signed-off-by: Rob Parolin <rparolin@nvidia.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
— codex on behalf of Ralf —
Description
Part 9 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.The
found_viastrings ("site-packages", "conda", "CUDA_PATH", ...) are public: they appear on every result object. They were typed by hand in six modules, andload_dl_linux.pybranches on two of them, so a typo in one module would silently change loader behavior.They are now constants in
_utils/found_via.py, and every producer and the one consumer use the constants. A new test pins the eight public values.No behavior change: the strings are identical. 1652 passed, 6 skipped, and the step-by-step comparisons against
mainare still byte-identical.Also in this PR: tell agents where the found_via labels live.
AGENTS.mdnow says package code uses the constants in_utils/found_via.pyand never types the label strings. Tests type them on purpose: that pins the public values.Testing
cuda_pathfindertest suite at this commit: 1652 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