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
build(pathfinder): let mypy see the package's own imports - #3622
pre-commit runs mypy from the repository root with only a config file, so mypy could not resolve cuda.pathfinder.* imports and typed every name imported from another module in the package as Any. Type errors that cross a module boundary went unreported, and cast() calls were needed to quiet "returning Any" warnings.
mypy_path = "$MYPY_CONFIG_FILE_DIR" points mypy at this directory whatever the working directory is. It works without the generated _version.py, as in CI.
With imports resolved, mypy reports three things:
Two cast() calls in header_descriptor.py are no longer needed; removed.
A real mismatch that was hidden, in the Linux loader and the Windows loader: load_with_abs_path accepted found_via: str | None = None and passed it to LoadedDL, which declares found_via: str. Every caller passes found_via (three calls in the loader, two in tests), so it is now a required str in both loaders and in the PlatformLoader protocol. No type: ignore is needed.
On Windows only: LoadedDL.abs_path is typed str | None, and it is passed to the Windows driver loader, which is declared to take str. Linux does not analyse that branch, so only the Windows pre-commit job caught it. Fixing it changes a declared type, so it is marked with a targeted type: ignore and a comment. unused-ignore is listed too, since the ignore is only needed on Windows.
Risk: load_with_abs_path is a private function. A caller outside this repository that omits found_via would now get a TypeError instead of a LoadedDL whose found_via is None.
No runtime change for any caller in this repository. 1294 passed, 6 skipped. mypy passes for both --platform linux and --platform win32.
Testing
Full cuda_pathfinder test suite at this commit: 1294 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, 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
Reviewing files that changed from the base of the PR and between 02e00f7 and 91a8678.
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
Chores
Library-loading calls now require callers to specify how the library was located; omitting this information is no longer supported.
Updated type-checking configuration and diagnostics. These changes do not alter library-loading behavior or add user-facing features.
The mypy configuration now sets an import search path relative to its file. Loader methods require found_via as a string. Other source changes remove explicit casts and add type-checker suppressions.
Changes: Mypy type checks
Layer / File(s)
Summary
Configure and update type checks cuda_pathfinder/pyproject.toml, cuda_pathfinder/cuda/pathfinder/_dynamic_libs/*, cuda_pathfinder/cuda/pathfinder/_headers/header_descriptor.py, cuda_pathfinder/cuda/pathfinder/_utils/driver_info.py
The mypy configuration sets mypy_path relative to the configuration file. Linux and Windows loader signatures require found_via as a string. The driver loader call adds type-checker suppressions, and platform_include_subdirs removes explicit cast wrappers without changing its return values.
Suggested reviewers:cpcloud, mdboom
Change: Other
Merge Risk: Minimal · previous review b354c
This change tightens type checking for the pathfinder package and requires a discovery-source argument when loading libraries by absolute path. Library loading behavior is unchanged for in-repository callers, so merge risk is minimal.
Security architecture risk: Minimal · up to b354c
cuda.pathfinder now requires its internal loader calls to pass the discovery label they already provide. Applications using the public API do not need to change. Code that directly calls the private helper without the label will now receive a TypeError before the helper attempts to load a library.
- [ ] 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; 5 remain after this review.
pre-commit runs mypy from the repository root with only a config file,
so mypy could not resolve `cuda.pathfinder.*` imports and typed every
name imported from another module in the package as `Any`. Type errors
that cross a module boundary went unreported, and `cast()` calls were
needed to quiet "returning Any" warnings.
`mypy_path = "$MYPY_CONFIG_FILE_DIR"` points mypy at this directory
whatever the working directory is. It works without the generated
`_version.py`, as in CI.
With imports resolved, mypy reports four things:
- Two `cast()` calls in `header_descriptor.py` are no longer needed;
removed.
- Two real mismatches that were hidden: `load_with_abs_path` accepts
`found_via: str | None` and passes it to `LoadedDL`, which declares
`found_via: str`. Fixing that means changing a public annotation or a
signature, so this change only marks both lines with a targeted
`type: ignore` and a comment. Nothing else needed attention.
No runtime change. 1293 passed, 6 skipped.
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 17 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.pre-commit runs mypy from the repository root with only a config file, so mypy could not resolve
cuda.pathfinder.*imports and typed every name imported from another module in the package asAny. Type errors that cross a module boundary went unreported, andcast()calls were needed to quiet "returning Any" warnings.mypy_path = "$MYPY_CONFIG_FILE_DIR"points mypy at this directory whatever the working directory is. It works without the generated_version.py, as in CI.With imports resolved, mypy reports three things:
cast()calls inheader_descriptor.pyare no longer needed; removed.load_with_abs_pathacceptedfound_via: str | None = Noneand passed it toLoadedDL, which declaresfound_via: str. Every caller passesfound_via(three calls in the loader, two in tests), so it is now a requiredstrin both loaders and in thePlatformLoaderprotocol. Notype: ignoreis needed.LoadedDL.abs_pathis typedstr | None, and it is passed to the Windows driver loader, which is declared to takestr. Linux does not analyse that branch, so only the Windows pre-commit job caught it. Fixing it changes a declared type, so it is marked with a targetedtype: ignoreand a comment.unused-ignoreis listed too, since the ignore is only needed on Windows.Risk:
load_with_abs_pathis a private function. A caller outside this repository that omitsfound_viawould now get aTypeErrorinstead of aLoadedDLwhosefound_viaisNone.No runtime change for any caller in this repository. 1294 passed, 6 skipped. mypy passes for both
--platform linuxand--platform win32.Testing
cuda_pathfindertest suite at this commit: 1294 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, now incanary_probe.pyChecklist
🤖 Generated with Claude Code