Skip to content

refactor(python): split resolve_config_extensions into one module per function - #1087

Merged
thekevinbot merged 2 commits into
claude/1066-p1-resolve-extensionfrom
claude/1079-p2-resolve-config-extensions
Sep 5, 2026
Merged

thekevinbot merged 2 commits into
claude/1066-p1-resolve-extensionfrom
claude/1079-p2-resolve-config-extensions

Conversation

@thekevinbot

Copy link
Copy Markdown
Collaborator

Step 2 of 2 in the packages/python/dirsql lane of the #1020 ratchet endgame. Stacked on #1077 (claude/1066-p1-resolve-extension) — the new has_bare_name module imports is_bare_name, which #1077 moves to its own file. GitHub retargets this to main when #1077 merges.

resolve_config_extensions.py held four module-scope functions and the gate flagged three at max_lines = 1. The holder is a free choice, so the module's named export resolve_config_extension_specs keeps the file and the helpers move out:

Moved To Carried with it
_load_toml_module dirsql/toml_module.py the _toml binding it produces (its only reader is _load_extension_entries)
_load_extension_entries dirsql/load_extension_entries.py —
_has_bare_name dirsql/has_bare_name.py —

3 flagged, 3 moves plus the _toml binding riding along — no extra modules needed.

resolve_configs_extension_specs.py imports _has_bare_name and _load_extension_entries; it now takes each from its own module rather than reaching through the singular resolver, matching how it already imports _resolve_entries. Its colocated test gains three __module__ assertions pinning where each helper is bound from, so the co-change is a real assertion rather than a whitespace edit.

With this the whole packages/python/dirsql tree reports zero violations at max_lines = 1. Verified by temporarily setting packages/python/testing-conventions.toml to 1 and re-running the gate; the config change is not in this diff (per #1020, the committed ceiling stays at 12 until the final PR deletes the key).

Red/green does not apply: pure moves, no behavior change.

PARITY.md needs no change. None of these functions is in dirsql.__all__. PARITY.md names resolve_config_extension_specs and resolve_configs_extension_specs; both keep their names and their modules. No parity drift — file layout inside one SDK.

Gates

just preflight: 0 failing pairs, 3 skipped (the three packaging pairs, which need a built artifact).

  • unit mutation, diff-scoped against the stack parent (--base claude/1066-p1-resolve-extension): 20 mutants tested, 0 survivors
  • unit coverage: 100% line + branch across packages/python/dirsql (307 stmts, 90 branches, 0 miss)
  • unit one-function-per-file at max_lines = 1: the whole tree clean
  • unit lint, colocated-test (incl. co-change), integration lint, declared-deps: clean
  • Unit suite 134 passed; hermetic integration 26 passed

Two tests were added rather than relocated, both to keep mutation at zero on newly-moved lines: an OSError-on-open case for the unreadable-config arm, and a traversal-segment case pinning that the base directory is normalised.

Manual run (uv run python -c ... against the package, with a .dirsql.toml naming sqlite_vec):

bare name reached the resolver: could not resolve extension package 'sqlite_vec': not installed
missing config -> None
plural, empty -> None

E2E Verification

  • Ran e2e suites locally for every affected SDK
  • Python SDK e2e: pass
  • TypeScript SDK e2e: N/A
  • Rust core e2e (if applicable): N/A
  • packages/python/e2e-attestations/<branch>.json receipt written if packages/python changed (just e2e-attest-python)
  • packages/ts/e2e-attestations/<branch>.json receipt written if packages/ts changed (just e2e-attest-ts)
  • Command(s) run: cargo build -p dirsql --features cli, just e2e-attest-python
  • Result summary: 37 passed in 15.31s. Receipt at packages/python/e2e-attestations/claude-1079-p2-resolve-config-extensions.json; git show --stat on the attest commit confirms it adds one file and deletes no sibling receipts (e2e attest silently deletes other branches' attestation receipts #1041).

Changelog / Migrations

  • Changelog fragment added under <root>/<pkg>/changelog.d/ for each changed package (or: skip-changelog trailer on a commit with reason)
  • Migration fragment added under <root>/<pkg>/migrations.d/ (or: not required -- additive/bugfix only)

packages/python/changelog.d/2026-09-05-config-extension-loader-split.md. No migration fragment: pure refactor, no public API or runtime behavior change.

Fixes #1079

… function

The one-function-per-file gate at max_lines = 1 flags every module-scope
function past the first substantial one. resolve_config_extensions.py held
four: _load_toml_module, _load_extension_entries, _has_bare_name and the
module's named export resolve_config_extension_specs.

Keep the export in place and move the three helpers out, one module each:
toml_module.py (carrying the _toml binding it produces),
load_extension_entries.py and has_bare_name.py. The plural resolver now
imports the two it uses from their own modules rather than through the
singular one; its test pins where each is bound from.

With this the whole packages/python/dirsql tree is clean at max_lines = 1.

Refs #1079
@thekevinbot
thekevinbot merged commit d182aed into claude/1066-p1-resolve-extension Sep 5, 2026
16 of 17 checks passed
@thekevinbot
thekevinbot deleted the claude/1079-p2-resolve-config-extensions branch September 5, 2026 02:10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant