Repository navigation
ci: split packages/python to clean one_function_per_file at 9 - #1059
Merged
Merged
Conversation
…-per-file 9
`packages/python/dirsql` carries two violations once the
`one_function_per_file` ceiling drops from 12 to 9, both in
`resolve_config_extensions.py`:
resolve_config_extensions.py:70: `_resolve_entries` runs 12 lines
resolve_config_extensions.py:105: `resolve_configs_extension_specs` runs 10 lines
`_load_extension_entries` is the first over-threshold function in source
order, so it holds the file. Move the other two out:
`_resolve_entries` -> dirsql/resolve_entries.py
`resolve_configs_extension_specs` -> dirsql/resolve_configs_extension_specs.py
Both keep their names and bodies verbatim. Nothing is re-exported back into
`resolve_config_extensions`, so the import graph stays acyclic:
`resolve_config_extensions` -> `resolve_entries`, and the plural module ->
both. `_async.py` and `cli/resolve_config_extensions.py` import the plural
resolver from its new home.
The colocated tests move with the code. Each new module's test mocks its own
collaborator -- `resolve_extension_path` for `resolve_entries`,
`_resolve_entries` for the two callers -- so every unit test still isolates
its subject.
No behavior change, so red/green does not apply.
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 #1056. Step under #1053 (census/plan) and #1020 (tracker). Lane P, the rung after #1042 / PR #1051 (
16->12).Makes
packages/python/dirsqlclean atone_function_per_filemax_lines = 9by splitting files only. This PR touches notesting-conventions.toml— the ceiling drops in a separate config PR once every lane is clean at 9, per invariant 1 in #1053.Measured work list
Throwaway shallow clone of
origin/main,packages/python/testing-conventions.tomlrewritten tomax_lines = 9, nothing committed:Two, matching #1053's ladder (python: 2 at 9).
resolve_extension.pyis already clean at 9.Moves
dirsql/resolve_config_extensions.py_resolve_entriesdirsql/resolve_entries.pydirsql/resolve_config_extensions.pyresolve_configs_extension_specsdirsql/resolve_configs_extension_specs.py_load_extension_entriesis the first over-threshold function in source order, so it holdsresolve_config_extensions.pyalongside_load_toml_module,_has_bare_nameand the single-configresolve_config_extension_specs. Both moved functions keep their names and bodies verbatim.No import cycle. Nothing is re-exported back into
resolve_config_extensions, so the graph stays acyclic:resolve_config_extensions->resolve_entries, andresolve_configs_extension_specs-> both. Call sites (dirsql/_async.py,dirsql/cli/resolve_config_extensions.py) import the plural resolver from its new home.Tests move with the code, each new module's test mocking its own collaborator —
resolve_extension_pathforresolve_entries,_resolve_entriesfor the two callers — so every unit test still isolates its subject. The two call sites gain an assertion pinning which module the resolver is imported from, which is the only thing that changed in them (and satisfies thecolocated-testco-change check honestly rather than with a whitespace edit).Red/green does not apply: pure moves, no behavior change. Tests move with the code and stay green throughout.
Parity: no
PARITY.mdchange. It namesresolve_config_extension_specs/resolve_configs_extension_specsby function, not by module, and both keep their names; neither is indirsql.__all__. No drift introduced, none restored. The TypeScript mirror of this file (packages/ts/src/resolve-config-extensions.ts) is lane T's to split; the two lanes reorganise mirrored files independently.Verification
just preflight— 0 failing pairs, 3 skipped (thepackagingpairs, which need a built artifact). Notable lines:Plus, in
packages/python:ruff check/ruff format --checkclean,ty check --error all --error-on-warning dirsql/clean, 115 unit / 26 hermetic integration / 105 binding tests pass.dirsql-checks changelog-gate --base-sha origin/main --head-sha HEADexits 0.Gate re-measured on a throwaway clone with the post-split files and
max_lines = 9: 0 violations.Manual exercise.
cargo build -p dirsql --features cli,uv run maturin develop, then the e2e suite drives the real CLI through the launcher (with_resolved_extensions-> the relocatedresolve_configs_extension_specs) 37 times; all pass. The SDKconfig=path is exercised the same way by the binding tier.E2E Verification
packages/python/e2e-attestations/<branch>.jsonreceipt written ifpackages/pythonchanged (just e2e-attest-python)packages/ts/e2e-attestations/<branch>.jsonreceipt written ifpackages/tschanged (just e2e-attest-ts) — N/A, nopackages/tschangejust test-e2e, thenjust e2e-attest-pythonpackages/python/e2e-attestations/claude-1056-py-ofpf9.json.git show --staton the attest commit confirms it adds only its own receipt and deletes no sibling receipts (e2e attest silently deletes other branches' attestation receipts #1041).Changelog / Migrations
<root>/<pkg>/changelog.d/for each changed package (or:skip-changelogtrailer on a commit with reason)<root>/<pkg>/migrations.d/(or: not required — additive/bugfix only) — not required: pure refactor, no public API change