Repository navigation
Enforce the file-length rule and delete its empty baseline - #4062
Merged
Merged
Conversation
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## master #4062 +/- ##
===========================================
+ Coverage 50.75% 87.83% +37.08%
===========================================
Files 254 270 +16
Lines 14634 16057 +1423
Branches 2339 2626 +287
===========================================
+ Hits 7427 14104 +6677
+ Misses 6580 1284 -5296
- Partials 627 669 +42 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
anth-volk
force-pushed
the
file-length-enforce
branch
2 times, most recently
from
October 27, 2026 14:49
cf86585 to
49f68b3
Compare
anth-volk
force-pushed
the
file-length-enforce
branch
2 times, most recently
from
October 27, 2026 16:31
c4140ed to
debdc13
Compare
No Python file is over its api.quality.file-length limit any more, so the rule moves from ratcheted to enforced, its [rule.baseline] table and the empty rules/baselines/file-length.txt are removed, and the skills doc says the rule has no baseline. The rule has no downgrade record to remove: the rules tool needs one only when a rule is weakened. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The rule fails when a file's line count crosses a threshold, which is the registry's metric tier (rules-registry.md: "A number crosses a threshold"), not the mechanical tier it was added in. Anthony decided on 2026-10-27 to move it. Its proof already tests both sides of the limit: a file exactly at its limit passes and one a line over fails. The proof now names those fixtures as below_fixture and above_fixture, with threshold = 800, the source-file limit; the same fixtures also cover the 1,500-line limit for test code. The fixtures themselves are unchanged. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
anth-volk
force-pushed
the
file-length-enforce
branch
from
October 27, 2026 16:51
debdc13 to
4963752
Compare
anth-volk
marked this pull request as ready for review
October 27, 2026 17:11
This branch was previously deployed
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 #4053
Top pull request of a stack of five, on #4061. Only the bottom pull request of a stack runs full CI;
CI completefails here by design.Update, 2026-10-27: metric tier
Anthony decided today to register
api.quality.file-lengthin themetrictier instead ofmechanical: the rule fails when a file's line count crosses a threshold, which is whatdocs/engineering/skills/rules-registry.mdcalls the metric tier. The second commit:tier = "metric";[rule.proof]the metric fields in place ofbad_fixtureandgood_fixture:below_fixture(good_tree.toml, every file exactly at its limit),above_fixture(bad_tree.toml, every file one line over),threshold = 800and the sametest.thresholdholds one number, so it names the 800-line source-file limit; the same fixtures also cover the 1,500-line limit for test code. The fixtures and the proof test are unchanged;docs/generated/rules.md(the rule moves from the mechanical row to the metric row) and updates the changelog fragment.Against
origin/file-length-cloud-run-deploy-tests,python -m scripts.rules guardpasses, so the metric proof fields validate. Thefile-lengthguard andtest_repository_has_no_violationsfail there only becausemasterhas the 805-linepolicyengine_api/services/report_output_service.py, which #4066 splits. With #4066 merged in, every quality guard and all 142 rules-tool tests pass.What this changes
#4056, #4059 and #4061 split the five files that were over their limit, so
rules/baselines/file-length.txtlists nothing. This pull request makesapi.quality.file-lengthenforced without it:rules/registry.toml:statusgoes fromratchetedtoenforced; the[rule.baseline]table (count = 0) and the comment recording the ratcheted start are removed. The rule never had a[rule.downgrade]record: the rules tool requires one only when a rule moves toadvisoryordoc-only, so there is none to remove. The Alembic revision exception stays.rules/baselines/file-length.txt: deleted.docs/engineering/skills/file-length.md: the baseline section now says the rule is enforced and has no baseline.docs/generated/rules.mdand the Rules block inAGENTS.md: regenerated. The rule moves from the ratcheted list to the enforced rules.changelog.d/file-length-enforce.changed.md.The
file-lengthguard needs no change: with no[rule.baseline]it tolerates no file, so any tracked Python file over its limit fails it. Its tests already cover a registry without a baseline (test_unlisted_oversized_file_fails).Testing
python scripts/run_quality_guards.py: all guards pass, includingfile-length. With an 801-line module staged temporarily,file-lengthfailed and named it:policyengine_api/file_length_probe.py has 801 lines, over the 800-line limit for source files.python -m scripts.rules guard --base-ref file-length-cloud-run-deploy-tests: pass (moving fromratchetedtoenforcedneeds no downgrade reason);python -m scripts.rules render: no changes after regenerating;python -m unittest discover -s scripts/rules/tests -t .: 142 pass, including the 10file-lengthtests.ruff format --check .,ruff check .: pass.uv lock --check: pass.pytest tests/unit/test_ci_complete_gate.py tests/unit/test_locked_test_environments.py tests/unit/test_alembic_skill.py: 28 passed. No Python code changes here; themake testpaths passed (3,445) on Split the Cloud Run deployment script tests under the file-length limit #4061.# noqacomments: 94 before and after;type: ignore/pyright: ignore: 9 before and after.Environment variables
None. No workflow, image or deployment file changed.
🤖 Generated with Claude Code