Repository navigation
refactor(distcheck): give select_tarball its own module - #1045
Merged
Merged
Conversation
node_flow/gate.py held two functions over the 12-line one-function-per-file threshold, so the gate flagged `run` (89 lines) as sharing a file with its holder `select_tarball` (13). Move the holder, not `run`: gate.py is the orchestration entry point the flow's CLI imports from. select_tarball raises DistcheckError, which gate.py defined, so the class moves to errors.py to keep the new dependency one-way. gate.py re-exports it, leaving node_flow/cli.py's import untouched. Its five test cases move to tarball_test.py rather than being duplicated.
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 (parent #1020). PR E of that campaign, targeting
max_lines = 12rather than 10.internals/distcheck/src/distcheck/node_flow/gate.pyholds two module-scope functions over a 12-line threshold, soone-function-per-fileflagsrun(89 lines) for sharing a file with its holder,select_tarball(13 lines).What moved
The holder, not
run— following #1040's precedent thatgate.pyis the orchestration entry point callers import from (node_flow/cli.pyimportsrunandDistcheckErrorfrom it).node_flow/tarball.py—select_tarball, with colocatedtarball_test.py. Its five test cases were relocated out ofgate_test.py, not duplicated, plus one new case asserting the diagnostic names the prefix, the matches and the full candidate list.node_flow/errors.py—DistcheckError, with colocatederrors_test.py.select_tarballraises it andgate.pyimportsselect_tarball, so leaving the class ingate.pywould have made the new edge a cycle.gate.pyre-exports it, sonode_flow/cli.pyandgate_test.py's import site are unchanged.runis untouched — at 12 it holds its own file. Both new imports ingate.pyare relative, per AGENTS.md.No
testing-conventions.tomlis edited. A follow-up PR drops the ceilings once every split in the campaign has landed; this one is a pure refactor.Verification
Gate, with
testing-conventions@0.0.111pinned and a throwaway config supplyingmax_lines = 12(the root config is untouched, and this root passes noconfig:so it reads the root[python]table):gate.py:69: one-function-per-file — run runs 89 lines, and select_tarball already holds this file— 1 violation.just preflight --conventions .github/workflows/internals-distcheck-ci.yml: 0 failing pairs, 0 skipped —uv-sync,declared-deps,colocated-test,one-function-per-file,unit-lint,integration-lint,unit-coverage,mutation. Mutation:no surviving mutants — every mutation was caught (13 mutant(s) tested). Fulljust preflightalso run.uv run pytest -qininternals/distcheck: 69 passed, 1 skipped.Manual run:
uv run --project internals/distcheck dirsql-distcheck node— the flow imports and executes through the split modules and stops at its documented prerequisite (prerequisite missing: <repo>/packages/ts/build/linux-x64-gnu/dirsql.linux-x64-gnu.node. Run pnpm build from packages/ts first.) rather than an ImportError, which is the observable proof the new module graph resolves end to end from the CLI entry point.Red/green does not apply. This is a behaviour-preserving move: no new behaviour, no changed behaviour, no removed behaviour. The relocated tests were green before the move and are green after it, in their new file.
Obligations
Each re-confirmed against the repo rather than assumed.
internals/checks/src/checks/changelog_gate/decide.pyhas_ROOTS = ("packages", "plugins");internals/is outside the gate entirely.internals-distcheck-ci.ymldeclaresgates: '["colocated-test", "unit-lint", "integration-lint", "unit-coverage", "mutation"]'— noe2e-verify, unlikeinternals-checks-ci.ymlwhich does declare it. Independently corroborated byjust preflight --dry-run, whose matrix lists ane2e-verifypair forinternals-checks,python-sdk,typescript-sdkandplugins-embeddings, and none forinternals-distcheck.gate.pyre-export.PARITY.md.E2E Verification
N/A - no SDK source touched (
internals/distcheckonly).Changelog / Migrations
changelog_gatescopes topackages/andplugins/only