Skip to content

Enforce the file-length rule and delete its empty baseline - #949

Merged
anth-volk merged 1 commit into
mainfrom
file-length-enforce
Oct 27, 2026
Merged

anth-volk merged 1 commit into
mainfrom
file-length-enforce

Conversation

@anth-volk

Copy link
Copy Markdown
Contributor

Fixes #921

Same-Repository Draft PR Check

  • This PR is a draft.
  • This PR is from a branch in PolicyEngine/policyengine-sim-api, not a personal fork.

Summary

Last of nine stacked PRs; it builds on #946, which split the last two files over their limit. Every tracked Python file is now within the file-length limits, so this PR enforces sim.quality.python-file-length.

  • Enforced: status goes from ratcheted to enforced. The baseline is empty, so rules/baselines/python-file-length.txt and the rule's [rule.baseline] table are deleted. A file over its limit now fails the quality-guards job with no way to list it.
  • [rule.downgrade] removed: an enforced rule can't keep one. The section named Enforce the file-length rule and delete its empty baseline #921, which this PR's Fixes line closes when it merges.
  • Tier corrected from mechanical to metric, because the rule measures a number, a file's line count, against a threshold, which is what docs/engineering/skills/rules-registry.md calls a metric rule. The proof now uses the metric fields the registry's Proof table asks for:
    • below_fixture: rules/fixtures/sim.quality.python-file-length/good_files.toml, the files at their limit (800 lines for source, 1,500 for test code), which pass;
    • above_fixture: .../bad_files.toml, the files one line over their limit, which fail;
    • threshold = 800, the source limit; both fixtures also cover the 1,500-line limit for test code, as a comment in the registry says;
    • test: the same proof test, scripts/rules/tests/test_file_length.py::TestFileLengthProof::test_rule_proof_python_file_length, run by the same job. The fixtures keep their names: the validator only requires that they exist.
  • docs/engineering/skills/file-length.md replaces its baseline section with one saying there is no baseline or exception; docs/generated/rules.md is regenerated (the rule now counts as one enforced metric rule).

Environment variables

None: no workflow or deployment file changes.

Testing

  • python scripts/run_quality_guards.py: every guard passed, including file-length with no baseline.
  • python -m scripts.rules guard --base-ref origin/file-length-split-entry-app: passed; python -m scripts.rules render leaves no diff.
  • python -m unittest discover -s scripts/rules/tests -t .: passed.
  • Ruff 0.15.22 lint: clean.

Only the lowest PR in the stack runs full CI, so this PR's CI complete check fails by design until the PRs below it merge.

🤖 Generated with Claude Code

@anth-volk
anth-volk added this pull request to stack #928 October 27, 2026 14:15
@anth-volk
anth-volk force-pushed the file-length-enforce branch 6 times, most recently from 57e26ff to 50351d5 Compare October 27, 2026 17:11
Base automatically changed from file-length-split-entry-app to main October 27, 2026 17:23
Every tracked Python file is now within its limit, so
sim.quality.python-file-length becomes enforced: the empty baseline,
rules/baselines/python-file-length.txt, is deleted, and the rule's
[rule.downgrade] section, which an enforced rule can't keep, is removed.
Merging this closes its tracking issue.

The rule's tier is corrected from mechanical to metric, because it
measures a number, a file's line count, against a threshold, which is
what the registry's tiers call a metric rule. Its proof uses the metric
fields: below_fixture is the manifest of files at their limit,
above_fixture the manifest of files one line over it, and threshold is
the 800-line source limit; both fixtures also cover the 1,500-line limit
for test code, and the proof test is unchanged.

docs/engineering/skills/file-length.md says there is no baseline or
exception, and the rendered rules are regenerated.

Fixes #921

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@anth-volk
anth-volk force-pushed the file-length-enforce branch from 50351d5 to 445408c Compare October 27, 2026 17:23
@anth-volk
anth-volk marked this pull request as ready for review October 27, 2026 17:30
@anth-volk
anth-volk requested a review from a team as a code owner October 27, 2026 17:30
@anth-volk
anth-volk merged commit 58445d1 into main Oct 27, 2026
22 checks passed
@anth-volk
anth-volk deleted the file-length-enforce branch October 27, 2026 17:30
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.

Enforce the file-length rule and delete its empty baseline

1 participant