feat(spec,validate)!: add §20.5 1000-line source file cap with opt-in exception marker#37
Merged
niclaslindstedt merged 1 commit intomainfrom Apr 19, 2026
Merged
Conversation
… exception marker
Bumps OSS_SPEC.md to v2.3.0 and retitles §20 to "Source and test
organization". The new §20.5 caps non-test source files at 1000
physical lines and lets files opt out with
`oss-spec:allow-large-file: <reason>` in any comment within the
first 20 lines (non-empty reason required).
The validator enforces the rule; `oss-spec fix` only auto-resolves
the easy case (extracting inline test blocks that push a file over
the cap). Genuinely large source files are left for humans to split
or annotate.
`src/validate.rs` (1151 lines) is split into `src/validate/{mod,
structural,content,agent_skills,toolchain}.rs` so the reference impl
exemplifies the new mandate instead of using its own escape hatch.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
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.
Summary
Adds a new mandate to
OSS_SPEC.md(§20.5) capping non-test source files at 1000 physical lines, with an opt-in exception viaoss-spec:allow-large-file: <reason>in a comment within the file's first 20 lines (non-empty reason required).src/validate/content.rswalkssrc//lib/, skips files whose stem matches the §20.2 test regex, and honours the marker only when the reason is non-empty.src/validate.rs(1151 lines) is split intosrc/validate/{mod,structural,content,agent_skills,toolchain}.rsso the reference impl exemplifies §20.5 rather than using its own escape hatch. Public re-exports (Report,Violation,AiFinding,run,check_*,version_ge, …) keep the external API stable; internal callers that diduse crate::validate::foocontinue to work.prompts/fix-conformancebumped to 1.2.0. Guidance: only resolve §20.5 when the file also has a §20 inline-test violation (extracting the test block typically brings it back under the cap); otherwise leave the file alone and surface for manual split or marker annotation.AGENTS.md(architecture, "Source file size" section, sync-points),templates/_common/AGENTS.md.tmpl,docs/architecture.md, and the update-spec / sync-oss-spec skill mapping tables (both repo and template versions).Test plan
make build— cleanmake test— 76 validator tests pass (70 previous + 6 new: over-limit flags, test-file exempt, marker-with-reason exempts, empty-reason marker doesn't exempt, exact-1000 boundary clean, marker-beyond-line-20 doesn't exempt); self-conformance passesmake lint— zero clippy warningsmake fmt-check— appliedsrc/bloat.rs→ §20.5 violation with correct message; add marker with reason → cleanChecklist
tests/validate_test.rs+tests/prompts_test.rs)README.md(spec version badge)OSS_SPEC.md(v2.3.0, §20 retitle, §20.5)AGENTS.md+templates/_common/AGENTS.md.tmpldocs/architecture.md.agent/skills/{update-spec,sync-oss-spec}/SKILL.md+ template versionsfeat!— breaking because existing repos with >1000-line files now failoss-spec validate)