Repository navigation
refactor: split diagnose out of the two extension-load probe gates - #1046
Merged
Merged
Conversation
Both `checks/*_extension_load/gate.py` files hold two functions over the one-function-per-file threshold the #1042 ratchet is heading for, so the gate flags `run` -- the second one in each file -- even though `run` is the orchestration entry point every `checks/*` package exposes. Move the holder instead: `diagnose` and the `STATIC_MARKER` it is the only consumer of go to a sibling `diagnose.py` in each package, leaving `run` first in `gate.py` where its callers expect it. Behavior is unchanged; the diagnose cases move to the new colocated test files rather than being duplicated. Part of #1042.
`unit lint` reads an import of a sibling source module as an unmocked collaborator, so the gate tests patch `diagnose` by string and assert on the probe result handed to it instead of on its rendered wording. The wording itself is asserted in diagnose_test.py.
This was referenced Sep 5, 2026
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Part of #1042.
PR B1 of the
one-function-per-fileratchet toward Kevin's chosen target ofmax_lines = 12. Pure refactor of twointernals/checksprobe packages; notesting-conventions.tomlis touched — a separate PR sets the ceilings once every split has landed.What moved
Both extension-load probes carry two functions over the threshold, so the gate flags
run— the second function in the file — even thoughrunis the orchestration entry point everychecks/*package exposes and every caller imports. Per #1040, the fix is to move the holder instead:internals/checks/src/checks/npm_binary_extension_load/diagnose.py+diagnose_test.pydiagnose,STATIC_MARKERinternals/checks/src/checks/wheel_extension_load/diagnose.py+diagnose_test.pydiagnose,STATIC_MARKERSTATIC_MARKERrides along becausediagnoseis its only consumer.gate.pypicks the function back up with a relativefrom .diagnose import diagnose, sorunis now first in each file and the callers (cli.py) are unchanged. Thedescribe_diagnosecases were relocated out of eachgate_test.py, not duplicated.Second commit:
unit lintreads a unit test's import of a sibling source module as an unmocked collaborator, so eachgate_test.pynow patchesdiagnoseby string and asserts on the probe result handed to it. The rendered wording is asserted in the newdiagnose_test.pyfiles, which also gained one case pinning the literal SQLite error text ("Dynamic loading not supported") rather than routing the fixture through the constant.Verification
internals/checks/srcatmax_lines = 12,testing-conventions@0.0.111pinned, config copied to /tmp with the ceiling lowered (the repo config is deliberately untouched):Both files in this PR's scope report zero. The three remaining are PR B2's scope.
just preflight(full matrix, 47 pairs): 0 failing, 3 skipped (packaging, which needs a built artifact).unit mutationon the changed lines: no surviving mutants. Zero exemptions added.Manual run
Ran both CLIs against an empty dist dir (skip path, exit 0), then the npm probe against a fake
dirsqlthat writes the real SQLite error to stderr, which exercises the moveddiagnosethroughrunend to end:Red/green
Does not apply — this is a behavior-preserving move, so there is no new behavior to turn a test red. The suite stayed green throughout (400 unit, 43 integration, 24 e2e).
E2E Verification
packages/pythonchangepackages/tschangepackages/rustchangeinternals/checks/e2e-attestations/claude-tackle-1042-b1-extload.jsonreceipt written (just e2e-attest-internals-checks)cd internals/checks && uv run python -m pytest tests/e2e -x -qChangelog / Migrations
changelog_gate/decide.pyscopes the gate to_ROOTS = ("packages", "plugins"), sointernals/checks/**is outside it.PARITY
No change. Neither function is part of any SDK's public surface;
internals/checksis repo tooling and appears nowhere inPARITY.md.