Skip to content

fix(guardrails): stale-path-verify test comment claims only uppercase S is exempt, contradicting the shipped [Ss] guard #1555

Closed

Description

@kyle-sexton

Summary

plugins/guardrails/hooks/stale-path-verify.test.sh carries a comment that states the opposite of
the shipped behaviour, and the opposite of the test case sitting 9 lines below it.

The hook exempts both skip-worktree spellings
(plugins/guardrails/hooks/stale-path-verify.sh:395):

[[ "$ls_tag" == [Ss] ]] && continue

ls-files -v lowercases the tag letter when the assume-unchanged bit is also set, so a
skip-worktree entry can be tagged S or s; both carry the skip-worktree bit and both are
exempt. That is exactly what the plugin CHANGELOG says (plugins/guardrails/CHANGELOG.md, 0.17.2):

ls-files -v tags a sparse entry S — lowercase s when the assume-unchanged bit is also set
[...] Only the skip-worktree letter, in either case, is exempted

But stale-path-verify.test.sh:419 says:

# skip-worktree; only `S` earns the exemption, and this case pins that.

That claim is false in two ways:

  1. It contradicts the shipped [Ss] comparison — lowercase s is exempt too.
  2. It contradicts the very next test in the same file (:428-438), whose own comment reads "an
    exact-uppercase comparison would misread the combination as a genuine deletion" and whose
    assertion is assert_silent "lowercase s still carries the skip-worktree exemption → silent".

The comment reads as residue from before the [Ss] widening landed. The tests are correct and
green — only the prose is wrong.

Impact

No behavioural defect; the gate does the right thing. The cost is that a future reader (or agent)
auditing this hook is told by an in-file comment that the exemption is uppercase-only, which is the
precise misreading the [Ss] fix exists to prevent — and comment-vs-code contradictions in a
security-adjacent guard are how a correct fix gets "corrected" back out.

Suggested fix

Reword :419 to state what the comparison actually does — the exemption is the skip-worktree bit in
either letter case, and what this case pins is that assume-unchanged alone (h) does not earn
it. One-line prose change; no code or test change.

Repro

$ grep -n '\[Ss\]' plugins/guardrails/hooks/stale-path-verify.sh
395:  [[ "$ls_tag" == [Ss] ]] && continue

$ sed -n '419p;438p' plugins/guardrails/hooks/stale-path-verify.test.sh
# skip-worktree; only `S` earns the exemption, and this case pins that.
assert_silent "lowercase s still carries the skip-worktree exemption → silent" "$OUT"

Verified against origin/main at 403873d0.

Related


Filed from a concurrent PR-drain sweep; found while checking whether any statement on main
contradicts the shipped [Ss] behaviour. The CHANGELOG does not — this test comment does.

Activity

  1. added
    needs-triage
    on Jul 26, 2026
  2. kyle-sexton commented on Jul 26, 2026

    @kyle-sexton
    MemberAuthor

    This was generated by AI during triage.

    Triage: verified → briefed, delegable

    Category: Bug (prose contradicts shipped behavior). No behavioral defect; the gate is correct
    and its tests are green.

    Verification — REPRODUCED this pass, not accepted on report. Ran the two commands from the
    item's repro block against the working tree. Both confirm exactly as filed:

    • The shipped guard compares the tag against a bracket expression matching either letter case,
      so both skip-worktree spellings are exempt.
    • The test comment nine lines above the relevant case asserts that only the uppercase letter
      earns the exemption.
    • The assertion further down the same file asserts the opposite of that comment — that the lowercase
      tag still carries the skip-worktree exemption and stays silent.

    So the contradiction is three-way and real: comment versus shipped comparison, and comment versus
    the neighbouring assertion in its own file. The plugin changelog entry that introduced the widening
    states the correct behavior ("in either case"), which corroborates the reading that the comment is
    residue predating the widening.

    Redundancy check. Searched the guard, its test file, and the plugin changelog for any other
    statement asserting an uppercase-only exemption: this one comment is the sole contradicting
    statement on the branch. Nothing has already fixed it. No docs/out-of-scope/ ledger in this repo.

    Why delegable — no open decision. The correct behavior is already shipped, already tested, and
    already documented correctly in the changelog. Only the prose is wrong, and what it should say is
    determined by the code rather than chosen. There is no fork for a maintainer to resolve.

    Brief

    Behavioral contract. No statement in the stale-path-verify surface may assert that the
    skip-worktree exemption is uppercase-only.

    Acceptance:

    1. The stale comment is reworded to state what the comparison actually does: the exemption is the
      skip-worktree bit in either letter case.
    2. The reworded comment states what its adjacent case actually pins — that the assume-unchanged bit
      alone does not earn the exemption. That is the distinction the case exists to protect, and
      the current wording obscures it.
    3. No code change and no test change. The tests are correct and green; this is prose only.

    Why it is worth the pass despite zero behavioral impact. A comment contradicting the code inside
    a security-adjacent guard is the exact misreading the widening exists to prevent, and is the
    mechanism by which a correct fix gets "corrected" back out by a future reader or agent auditing the
    hook.

    Durability note. The site is named by symbol and by role rather than by line number, per the
    brief contract; the item body carries the exact lines.

    Labels applied: priority: medium — the assessed default. Held there rather than lower because
    the cost is a future incorrect "fix" to a security-adjacent guard, and not raised because nothing is
    blocked and no behavior is wrong today. Raw marker cleared.

  3. added
    agent-ready
    and removed
    needs-triage
    on Jul 26, 2026
  4. kyle-sexton commented on Jul 26, 2026

    @kyle-sexton
    MemberAuthor

    This was generated by AI during triage.

    Admission gate: carries agent-ready but no work-class: label and no body-recorded class trailer — unclassified → fail-closed human-gated per the work-loop lane's admission table. Routed to human-gated; not dispatched.

  5. added
    needs-human
    and removed
    agent-ready
    on Jul 26, 2026
  6. added 2 commits that reference this issue on Aug 12, 2026
    7b0d366
    8699c30
  7. added a commit that references this issue on Aug 12, 2026
    9549977
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    needs-human

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions