Skip to content

ci: ratchet one-function-per-file from max_lines = 100 to 24 - #1035

Merged
thekevinscott merged 1 commit into
mainfrom
claude/tackle-1033-ofpf24
Sep 4, 2026
Merged

thekevinscott merged 1 commit into
mainfrom
claude/tackle-1033-ofpf24

Conversation

@thekevinbot

@thekevinbot thekevinbot commented Sep 4, 2026 •

Copy link
Copy Markdown
Collaborator

Fixes #1033. Step under #1020, which ratchets one-function-per-file from max_lines = 100 toward the default of 1, one PR per step.

What changed

Six lines of TOML across five configs, 100 -> 24:

  • testing-conventions.toml (two occurrences: [python] and [typescript])
  • packages/python/testing-conventions.toml
  • packages/ts/testing-conventions.toml
  • internals/checks/testing-conventions.toml
  • plugins/dirsql-plugin-embeddings/testing-conventions.toml

No source file moves. Nothing about the tree changes.

Why 24 and not 40

#1033 originally proposed 40. 24 is the lowest uniform value green across the whole repo today, and it costs exactly what 40 costs: zero file splits. Stopping at 40 would spend a ratchet step on a threshold no file is near, then need a second PR to land here.

internals/checks is the binding constraint: checks/preflight/gate.py:167 run runs 24 lines, sharing a file with invocation. At 23 the gate fires on it. So 24 is a measured floor, not a round number.

Re-verified at 24 on this base

The enumeration in #1033 predates later merges and the margin is one line wide, so it was re-run against this PR's base (249ac46). Version pinned to testing-conventions@0.0.111 (the current latest) rather than a bare npx testing-conventions, which resolves engine-aware and can silently pick an older release (#1018, and #1020's closing note):

npx -y testing-conventions@0.0.111 unit one-function-per-file \
  --language <lang> --config <config> <source>
Scan root Language Config it reads Violations at 24
packages/python/dirsql python packages/python/testing-conventions.toml 0
packages/ts/src typescript packages/ts/testing-conventions.toml 0
internals/checks/src python internals/checks/testing-conventions.toml 0
internals/distcheck/src python testing-conventions.toml (root default) 0
plugins/dirsql-plugin-embeddings/src python plugins/dirsql-plugin-embeddings/testing-conventions.toml 0

All five exit 0. Negative control, same harness, internals/checks at 23:

internals/checks/src/checks/preflight/gate.py:167: one-function-per-file — `run` runs 24 lines,
  and `invocation` already holds this file; move it to its own module
error: 1 function(s) sharing a file with another function over the 23-line threshold

Exit 1. The zero above is a real pass, not a misread config.

just preflight also run over the full matrix (not just this gate, since a threshold change can surface interactions): 0 failing pairs, 3 skipped (packaging, which needs a built artifact).

Rust stays out of scope

Not opted in, and this PR does not change that. Upstream defaults the rule off for Rust because a Rust file is a module. Opting it in is a separate design call (#1020 says the same).

Changelog

The changelog-check workflow does trigger on this diff -- three of the five configs sit under packages/** / plugins/**, which its path filter matches. The gate then passes with no fragment: changelog_gate/decide.py's _is_exempt explicitly waives <pkg>/testing-conventions.toml as gate config that ships in no published artifact. Verified locally against this base, exit 0. No skip-changelog line was used -- the exemption carries it, and CI proves it on this PR.

E2E Verification

N/A - docs/lint/typo only

Changelog / Migrations

  • Changelog fragment added under <root>/<pkg>/changelog.d/ for each changed package -- not required: no package source changed; testing-conventions.toml is exempt in the gate
  • Migration fragment added under <root>/<pkg>/migrations.d/ -- not required: no public API or runtime behavior change

CI note

The first CI Gate run failed on a prediction gap, not a check: willfire's expected set omitted changelog-check.yml, which then reported, so the gate flagged an unpredicted run. Every other check was green at that moment. Re-running willfire locally at the same version (0.1.47) against this PR predicts changelog-check.yml as run -- the CI prediction had been computed against a test-merge commit GitHub had not finished materializing (the same log shows no workflow file at the test merge commit for workflows that plainly exist). gh run rerun --failed passed with no code change.

24 is the lowest uniform threshold green across every opted-in scan root
today; internals/checks binds it, where preflight/gate.py's `run` is 24
lines. At 23 that file fails, so this is the floor, not a round number.

Re-verified at 24 on this base with testing-conventions@0.0.111: all five
roots exit 0, and a 23 probe fails as expected.
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.

ci: ratchet one-function-per-file from max_lines = 100 to 24

2 participants