Skip to content

chore: lower ADR-015 source-file cap to 500 lines - #749

Merged
Brad-Edwards merged 1 commit into
devfrom
561-lower-adr015-file-cap
Jul 12, 2026
Merged

chore: lower ADR-015 source-file cap to 500 lines#749
Brad-Edwards merged 1 commit into
devfrom
561-lower-adr015-file-cap

Conversation

@Brad-Edwards

Copy link
Copy Markdown
Collaborator

Summary

Lowers the non-test source-file cap in ADR-015 §2 from 600 to 500 lines so
the repo's documented file-size policy matches SonarCloud's S104 threshold
(500). Previously the two disagreed, letting files land in the 500–599 band that
were repo-compliant but failed the SonarCloud quality gate at the dev → main
integration PR (see #545).

What changed

  • ADR-015 §2 — cap prose 600 → 500, re-baseline framing, and a new
    ## Amendments row (Lower ADR-015 source-file cap from 600 to 500 lines (align with SonarCloud S104) #561). Its acceptance pin in
    docs/decisions/adrs/adr-index.yaml is recomputed and an amendments ref
    added (ADR-059 immutability gate).
  • tools/policy/adr_policy.yamloversized_source_files.line_cap 600 → 500.
  • tools/policy/repo_policy.py_ADR015_INITIAL_OVERSIZED_FILES
    re-baselined to the 25 files currently over 500 lines; header/docstring/failure
    message updated. No control-flow change.
  • tools/policy/oversized_allowlist.yaml — set to those same 25 files (the
    new debt baseline). The allowlist stays a subset of the code constant, so the
    shrink-only drain rule continues unchanged from the new baseline.
  • implementations/python/tests/test_repo_policy_tools.py — stale
    600/14-count comments refreshed to 500.

Why re-baseline instead of splitting

18 files sit in the 500–599 band today; splitting them all is far beyond one PR
and out of scope for this cap change. The issue explicitly sanctions the
allowlist path ("consistent with the ADR's allowlist-may-only-shrink rule"), and
ADR-015's own design makes a lowered cap a code-constant diff that PR review
scrutinises. Three band files (inspection.py, orchestration.py, stubs.py)
were in the original locked set but drained below 600 — at cap 500 they would
trip the config-wide debt-consistency check even if untouched, so the
comprehensive re-baseline is required for the lowered cap to be enforceable.

Verification

  • tools/check_repo_policy.py (full + config-wide changed set): PASS
  • tools/check_adr_immutability.py --staged: PASS (pin + amendment ref consistent)
  • test_repo_policy_tools.py: 119 passed
  • nox -s lint (ruff project + tooling): PASS
  • pre-commit hygiene / gitleaks / conftest / repo policy: PASS

Closes #561

Lower the non-test source-file cap in ADR-015 section 2 from 600 to 500
lines to match SonarCloud's S104 threshold, removing the 500-599 band
where files were repo-compliant but failed the Sonar quality gate at the
dev -> main integration PR (#545). Re-baseline
_ADR015_INITIAL_OVERSIZED_FILES and tools/policy/oversized_allowlist.yaml
to the files over 500 lines as of this change; the allowlist shrink-only
rule continues from the new baseline. Record the change as an ADR-015
amendment and update its acceptance pin.

Closes #561
@sonarqubecloud

Copy link
Copy Markdown

@Brad-Edwards
Brad-Edwards merged commit bf82a77 into dev Jul 12, 2026
13 checks passed
@Brad-Edwards
Brad-Edwards deleted the 561-lower-adr015-file-cap branch July 12, 2026 22:38
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