Follow-ups from the review of the gate.diff-rules lane that are not P0/P1 fixes.
Fail closed on a hunk header the walker cannot parse.
internal/domain/workflow/diff_rules.go: hunkNewStart's three failure returns are
swallowed (inHunk = ok), so every added line of that hunk is silently dropped and the
rules report no violation for a diff the parser did not understand. The rest of the
step fails closed (a settings mistake refuses the definition, a Diff read failure
fails the stage), so this path should too: propagate a parse failure as a stage error
and add a malformed-header case to the test table. Blast radius today is theoretical
(both Trees implementations hand the walker go-git's UnifiedEncoder output), which is
why it is not fixed in the lane.
Share the blocking threshold instead of re-inlining it.
diffFinding carries no Blocking(); finding.Level == DiffRuleLevelError is written
twice (runDiffRules and logRuleFinding). The sibling finding type in the same package
answers the same question with ReviewFinding.Blocking (review_findings.go:142), and the
commit that fixed this area before (daeb1f61 "share the blocking threshold") states the
intent: one source of truth for park-vs-log. Give diffFinding a Blocking() method and
call it from both sites.
Bound the park detail against the store's real cap.
diffRuleDetailBytes = 4000 and clip() appends a 15-byte truncation marker beyond that,
while the store clips a park reason at exactly 4000 (internal/store/store.go), so an
overflowing detail is re-cut by the store. The comment claims "headroom" that does not
exist (reviewDetailBytes copies the same idiom). Pick a number below the cap and tie
the two with a test.
Correct comments that claim more than the code does.
diffTargetPath's comment says a path may be quoted/escaped by git, but the code only
trims quote runes and decodes nothing; the only producer (go-git's unified encoder)
never quotes. Either drop the git-quoting clause or decode with strconv.Unquote.
repoHooks' comment says "the step types replacing the repository-authored hooks"
(plural) while it contributes exactly one step type and .archie/stages/*.go still has
no equivalent (see the .archie/stages decision bead).
Two assertions in the new registration test restate the constants they claim to pin
(diff_rules_test.go: the stage-name comparison and DiffRulesStepName == "gate.diff-rules"),
which AGENTS.md forbids: they cannot fail for an interesting reason. Keep the Run and
settings-refusal halves and drop or replace the vacuous ones.
Close reason
Items 2-3 fixed (diffFinding.Blocking; clip now keeps marker within n). Items 1, 4, 5 obsolete: the walker is the shared prreview parser, diffTargetPath/repoHooks and the vacuous assertions no longer exist.
Imported from beads archie-core-s1jz · GitHub #1145 · type task · priority P2 · created 2026-09-21 · closed 2026-10-16
Follow-ups from the review of the gate.diff-rules lane that are not P0/P1 fixes.
1. Fail closed on a hunk header the walker cannot parse.
internal/domain/workflow/diff_rules.go: hunkNewStart's three failure returns are
swallowed (inHunk = ok), so every added line of that hunk is silently dropped and the
rules report no violation for a diff the parser did not understand. The rest of the
step fails closed (a settings mistake refuses the definition, a Diff read failure
fails the stage), so this path should too: propagate a parse failure as a stage error
and add a malformed-header case to the test table. Blast radius today is theoretical
(both Trees implementations hand the walker go-git's UnifiedEncoder output), which is
why it is not fixed in the lane.
2. Share the blocking threshold instead of re-inlining it.
diffFinding carries no Blocking(); `finding.Level == DiffRuleLevelError` is written
twice (runDiffRules and logRuleFinding). The sibling finding type in the same package
answers the same question with ReviewFinding.Blocking (review_findings.go:142), and the
commit that fixed this area before (daeb1f61 "share the blocking threshold") states the
intent: one source of truth for park-vs-log. Give diffFinding a Blocking() method and
call it from both sites.
3. Bound the park detail against the store's real cap.
diffRuleDetailBytes = 4000 and clip() appends a 15-byte truncation marker beyond that,
while the store clips a park reason at exactly 4000 (internal/store/store.go), so an
overflowing detail is re-cut by the store. The comment claims "headroom" that does not
exist (reviewDetailBytes copies the same idiom). Pick a number below the cap and tie
the two with a test.
4. Correct comments that claim more than the code does.
- diffTargetPath's comment says a path may be quoted/escaped by git, but the code only
trims quote runes and decodes nothing; the only producer (go-git's unified encoder)
never quotes. Either drop the git-quoting clause or decode with strconv.Unquote.
- repoHooks' comment says "the step types replacing the repository-authored hooks"
(plural) while it contributes exactly one step type and .archie/stages/*.go still has
no equivalent (see the .archie/stages decision bead).
5. Two assertions in the new registration test restate the constants they claim to pin
(diff_rules_test.go: the stage-name comparison and DiffRulesStepName == "gate.diff-rules"),
which AGENTS.md forbids: they cannot fail for an interesting reason. Keep the Run and
settings-refusal halves and drop or replace the vacuous ones.
### Close reason
Items 2-3 fixed (diffFinding.Blocking; clip now keeps marker within n). Items 1, 4, 5 obsolete: the walker is the shared prreview parser, diffTargetPath/repoHooks and the vacuous assertions no longer exist.
---
_Imported from beads `archie-core-s1jz` · GitHub #1145 · type task · priority P2 · created 2026-09-21 · closed 2026-10-16_
sam
added the mediumtask labels 2026-10-27 13:40:53 +00:00
Blocking a user prevents them from interacting with repositories, such as opening or commenting on pull requests or issues. Learn more about blocking a user.
Follow-ups from the review of the gate.diff-rules lane that are not P0/P1 fixes.
Fail closed on a hunk header the walker cannot parse.
internal/domain/workflow/diff_rules.go: hunkNewStart's three failure returns are
swallowed (inHunk = ok), so every added line of that hunk is silently dropped and the
rules report no violation for a diff the parser did not understand. The rest of the
step fails closed (a settings mistake refuses the definition, a Diff read failure
fails the stage), so this path should too: propagate a parse failure as a stage error
and add a malformed-header case to the test table. Blast radius today is theoretical
(both Trees implementations hand the walker go-git's UnifiedEncoder output), which is
why it is not fixed in the lane.
Share the blocking threshold instead of re-inlining it.
diffFinding carries no Blocking();
finding.Level == DiffRuleLevelErroris writtentwice (runDiffRules and logRuleFinding). The sibling finding type in the same package
answers the same question with ReviewFinding.Blocking (review_findings.go:142), and the
commit that fixed this area before (
daeb1f61"share the blocking threshold") states theintent: one source of truth for park-vs-log. Give diffFinding a Blocking() method and
call it from both sites.
Bound the park detail against the store's real cap.
diffRuleDetailBytes = 4000 and clip() appends a 15-byte truncation marker beyond that,
while the store clips a park reason at exactly 4000 (internal/store/store.go), so an
overflowing detail is re-cut by the store. The comment claims "headroom" that does not
exist (reviewDetailBytes copies the same idiom). Pick a number below the cap and tie
the two with a test.
Correct comments that claim more than the code does.
trims quote runes and decodes nothing; the only producer (go-git's unified encoder)
never quotes. Either drop the git-quoting clause or decode with strconv.Unquote.
(plural) while it contributes exactly one step type and .archie/stages/*.go still has
no equivalent (see the .archie/stages decision bead).
Two assertions in the new registration test restate the constants they claim to pin
(diff_rules_test.go: the stage-name comparison and DiffRulesStepName == "gate.diff-rules"),
which AGENTS.md forbids: they cannot fail for an interesting reason. Keep the Run and
settings-refusal halves and drop or replace the vacuous ones.
Close reason
Items 2-3 fixed (diffFinding.Blocking; clip now keeps marker within n). Items 1, 4, 5 obsolete: the walker is the shared prreview parser, diffTargetPath/repoHooks and the vacuous assertions no longer exist.
Imported from beads
archie-core-s1jz· GitHub #1145 · type task · priority P2 · created 2026-09-21 · closed 2026-10-16