Repository navigation
ci: split internals/checks so one_function_per_file is clean at 9 - #1058
Merged
Merged
Conversation
Five module-scope functions shared a file with another function over the 9-line threshold. Each moves to its own module, with its colocated unit tests: artifact_completeness/gate.py::run -> artifact_completeness/run.py declared_deps/gate.py::run -> declared_deps/run.py platforms_mirror/decide.py::field_problems -> platforms_mirror/field_problems.py platforms_mirror/decide.py::problems -> platforms_mirror/problems.py platforms_mirror/python_table.py::_table_elements -> platforms_mirror/table_elements.py `_table_elements` takes its only caller `_assigned_names` with it: leaving that helper behind would have made python_table.py and the new module import each other. It loses its underscore to match the module-per-function naming the package already uses (`python_table`, `row`). No config change -- the ceiling stays at 15 here and drops in a separate PR once every lane is clean at 9.
The two CLI tests mock `run` at its import site and say so in their docstrings; that site moved. The platforms-mirror gate test's isolation note now covers the verdict module it runs through for real.
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.
Fixes #1054. Step under #1053 (census/plan) and #1020 (tracker); lane C, the rung after #1042 / PR #1051 (
16->12).Makes
internals/checks/srcclean atone_function_per_filemax_lines = 9by splitting files only.No config change.
internals/checks/testing-conventions.tomlstill readsmax_lines = 15. Per invariant 1 in #1053, split PRs never touch amax_linesline -- the ceiling drops in its own PR once every lane is clean at 9, so five concurrent lanes never contend for the same config line.Work list, measured
Throwaway shallow clone of
origin/mainatb2c4651,internals/checks/testing-conventions.tomlrewritten tomax_lines = 9, nothing committed.npx -y testing-conventions@0.0.111because npmlatestis what the reusable workflow runs; the PyPI CLI is a separately versioned distribution (0.0.104) and does not reproduce the gate.Five, matching #1053's ladder. With this branch and the same temporary
max_lines = 9the run is silent.Moves
runartifact_completeness/gate.pyartifact_completeness/run.pyrundeclared_deps/gate.pydeclared_deps/run.pyfield_problemsplatforms_mirror/decide.pyplatforms_mirror/field_problems.pyproblemsplatforms_mirror/decide.pyplatforms_mirror/problems.py_table_elements->table_elementsplatforms_mirror/python_table.pyplatforms_mirror/table_elements.pyColocated unit tests move with the code they cover rather than being duplicated. Call sites switch through relative imports:
cli.pyin both check packages, andplatforms_mirror/gate.py(from .decide import problems->from .problems import problems). Two integration tests that drove the check throughgate.runnow import fromrun.Two notes on the last row.
_table_elementstakes its only caller_assigned_nameswith it -- leaving that helper inpython_table.pywould have made the two modules import each other, the cycle hazard #1053 calls out. And it loses its leading underscore, since a module existing only to hold a private function reads badly and the package already names modules after their function (python_table,row,typescript_table).No constant moved, so none of #1053's relocated-constant mutation survivors apply.
wheel_extension_load->npm_binary_extension_load, the tree's one cross-package import, is untouched at this threshold.Red/green
Does not apply. These are pure moves with no behavior change: no new observable behavior to capture in a red test, and the tests that cover the moved functions move with them and stay green throughout. Section "Removals are exempt" in AGENTS.md is the nearest analogue; the pushed-RED-CI gate has nothing to assert here.
Gates
just preflight-- 0 failing pairs, 3 skipped (the threepackagingpairs, which need a built artifact). Notable results in theinternals-checkslane:one-function-per-fileclean at the committed ceiling, and clean at 9 with the config temporarily rewritten.unit-coverage100%, unchanged.unit mutation: 63 mutants tested, no survivors.colocated-test(including the PR-only co-change check) clean.unit lintisolation clean -- every new test file imports exactly one source module, the invariant the package already held.internals/checksintegration suite: 43 passed. E2E suite: 24 passed.Manual run
Exercised all three affected CLIs against the real repo, output unchanged from
main:dirsql-checks platforms-mirror->ok platforms-mirror: ... mirrors the shared fields ... across 5 published target(s)., exit 0dirsql-checks declared-deps internals/checks/src-> silent, exit 0dirsql-checks artifact-completeness --dist-dir <scratch dist with one staged target> --config putitoutthere.toml-> the skip line fordirsql-py, fourincomplete artifact --lines, the summary naming the likely cause, exit 1E2E Verification
packages/pythonchangepackages/tschangepackages/rustchangeinternals/checks/e2e-attestations/claude-1054-checks-ofpf9.jsonreceipt written (just e2e-attest-internals-checks);git show --staton the attest commit confirms it adds one file and deletes no sibling receipt (e2e attest silently deletes other branches' attestation receipts #1041)just test-e2e-internals-checks,just test-integration-internals-checks,just e2e-attest-internals-checks,just preflightChangelog / Migrations
Neither is required.
changelog_gate/decide.py's_ROOTS = ("packages", "plugins")putsinternals/**outside the gate; no public API changes, so no migration fragment and noPARITY.mdchange.