feat: turn the 400-line diff cap into a 1000-line runaway guard excluding tests #470
No reviewers
Labels
No labels
Agent
Compat/Breaking
Kind/Bug
Kind/Documentation
Kind/Enhancement
Kind/Feature
Kind/Security
Kind/Testing
Priority
Critical
Priority
High
Priority
Low
Priority
Medium
Reviewed
Confirmed
Reviewed
Duplicate
Reviewed
Invalid
Reviewed
Won't Fix
Status
Abandoned
Status
Blocked
Status
Need More Info
No milestone
No assignees
1 participant
Notifications
Total time spent: 2 minutes 15 seconds
Due date
igor
2 minutes 15 seconds
No due date set.
Dependencies
No dependencies set
Reference
joshtronic/igor!470
Loading…
Reference in a new issue
No description provided.
Delete branch "agent/467-feat-diff-cap-1000-line-runaway-guard-excluding"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
What this PR does
lib/scope-gate.sh:is_test_pathclassifier +scope_gate_sum_numstat, used by the finalize-time gate inbin/tick.sh(threshold nowSCOPE_GATE_MAX_LINES=1000, counted viagit diff --numstatinstead of--shortstat)AGENTS.mdworker contract: diffs should be the size the task honestly requires (no padding, no drive-by refactors), the 1000-non-test-line hard block is a runaway guard not a target, and add explicit comment discipline (comments state a non-obvious why/invariant only; no narration, no changelog-style comments)bin/lib/review-directive.md: diff-appropriateness (padding/redundant abstraction/drive-by changes are findings regardless of diff size) and comment bloat (narrating/unnecessary comments are findings; pervasive bloat licenses REQUEST_CHANGES on its own)CLAUDE.md,docs/architecture.md,bin/lib/ceo-digest-directive.md,lib/security-gate.shbin/test-scope-gate.shcovering the classifier (positive/negative paths for every pattern) and the numstat summer (test-file exclusion, lockfile/dist exclusion, binary files, empty input)Test plan
make testpasses (bin/check-sync.shoutcome-sentinel/helper contract check + allbin/test-*.sh, including the new suite)make lintpasses (shellcheck+mdl)Closes #467
🤖 Review —
APPROVE(automated)CI for
e2d4af54: successReplaces the finalize-time 400-line scope cap with a 1000-non-test-line runaway guard, extracting the counting logic into
lib/scope-gate.shwith unit tests, and updates the worker contract / review directive / docs to match. CI green, diff ~250 lines, scope matches issue #467.Verified against the contract
lib/scope-gate.sh,bin/tick.sh,AGENTS.md,bin/lib/review-directive.md,CLAUDE.md,docs/architecture.md,bin/lib/ceo-digest-directive.md,lib/security-gate.sh,bin/test-scope-gate.sh). No fabricated boxes found.check-sync.shcontract preserved: the AGENTS.md rewrite doesn't touch anyOUTCOME:sentinel,# OUTCOME: blockedis still on the block branch intick.sh, andagent-block.shis still referenced by name in AGENTS.md so the helper-existence grep still fires.--shortstatpath: the lockfile/dist/buildexclusions are reproduced ascasepatterns covering both top-level and nested forms, binary (-\t-) rows contribute 0, empty input yields 0. Test arithmetic (10+5 + 3+1 = 19) checks out.set -esafety inscope_gate_sum_numstatis fine:[ -z "$path" ] && continueandis_test_path "$path" && continueboth fail on the left side of&&, which is exempt fromerrexit.latest-version.sh,contest.js,foo_test.txt).Non-blocking notes
lib/scope-gate.sh:36—git diff --numstatrenders renames aspkg/{old => new}.go(rename detection is on by default). Such a row won't match the lockfile/distcasepatterns, and a{src => test}/foo.gorename won't match(^|/)test[s]?/. Both fail conservatively (counted rather than skipped), so the guard can only over-count, but it's a latent surprise if someone later relies on the exclusions being exact.--numstat --no-renameswould remove the ambiguity.lib/scope-gate.sh:28—(^|/)spec/will classify non-testspec/trees (e.g. OpenAPI specs) as test files, silently exempting them from the guard. Acceptable given the issue hardcoded this list, worth knowing.is_test_pathforks agrepper changed path; on a genuinely runaway branch (thousands of files) that's thousands of subprocesses. Fine in practice, but a bashcase/[[ =~ ]]would avoid it.tick.shgate comment, AGENTS.md). The issue asked for it at the gate, so this isn't a violation, but by the comment-discipline rule this same PR introduces, thetick.shcopy could be a one-liner pointing atlib/scope-gate.sh.tick.shwiring (CHANGED -gt $SCOPE_GATE_MAX_LINESand the pipe fromgit diff --numstat); coverage stops at the pure functions. Consistent with how the rest oftick.shis (not) tested, and the comparison is trivially readable in the diff.Nothing here blocks. Approving.
Independent review by the harness on
claude-opus-5(effort: high). The human reviewer is requested once Igor has reviewed; a human still merges.