Skip to content

fix(guard): surface CRAFT_GUARD_ALLOW_DEV_EDIT in guard-bypass-marker confirms - #310

Merged
Data-Wise merged 2 commits into
devfrom
feature/issue-309-branch-guard-docs
Jul 25, 2026
Merged

fix(guard): surface CRAFT_GUARD_ALLOW_DEV_EDIT in guard-bypass-marker confirms#310
Data-Wise merged 2 commits into
devfrom
feature/issue-309-branch-guard-docs

Conversation

@Data-Wise

Copy link
Copy Markdown
Owner

Summary

Closes #309. The [CONFIRM] flow docs describe ("Claude writes .claude/allow-once") is
circular for the one case where the approved action is creating/editing that marker itself —
every tool path (Write/Edit/Bash) intercepts it with its own [CONFIRM]
(write_guard_bypass/edit_guard_bypass/bash_guard_bypass), and the one thing that actually
resolves it non-interactively — issue #281's CRAFT_GUARD_ALLOW_DEV_EDIT env var — appeared in
neither reference doc (REFCARD-BRANCH-GUARD.md, branch-guard-smart-mode.md) nor any runtime
_confirm() suggestion string.

Test plan

All tiers run in-tree (~/.git-worktrees/craft/feature-issue-309), hook synced to
~/.claude/hooks/ via install-guards.sh first (same as CI):

  • tests/test_branch_guard.sh: 146/146 passed — includes 6 new tests pinning the env-var hint
    present in all 3 marker-specific confirms, absent from write_new_code.
  • tests/test_branch_guard_e2e.sh: 30/31 — e2e_perf_50_invocations fails identically on
    unmodified dev (wall-clock timing budget, pre-existing, reproduced to confirm baseline).
  • tests/test_branch_guard_dogfood.py + test_integration_branch_guard.py: 28/28 passed.
  • Full suite (python3 -m pytest tests/): 2615 passed / 0 failed / 49 skipped / 1 xfailed
    (unrelated, tracked) / 1 xpassed (known perf microbenchmark flake, unrelated).
  • scripts/docs-staleness-check.sh: GREEN, 0 issues.

🤖 Generated with Claude Code

… confirms (#309)

The "Claude writes .claude/allow-once" one-shot flow documented in
REFCARD-BRANCH-GUARD.md and branch-guard-smart-mode.md is circular for the
one case where the approved action IS creating/editing that marker itself —
every tool path (Write/Edit/Bash) intercepts it with its own [CONFIRM], and
the one thing that actually resolves it non-interactively (issue #281's
CRAFT_GUARD_ALLOW_DEV_EDIT env var) appeared in neither reference doc nor
any runtime suggestion.

Adds the env-var hint to the three guard-bypass-marker confirms only
(edit_guard_bypass/write_guard_bypass/bash_guard_bypass) — not to
write_new_code, where allow-once genuinely works as documented and the
hint would be noise. Reconciles both reference docs with a caveat pointing
to skills/dev/git/SKILL.md Operation 10, which already had this right.
…ounter

Code review of PR #310 caught: the negative test guarding against
CRAFT_GUARD_ALLOW_DEV_EDIT leaking into write_new_code's suggestions was
reading stderr from a 2nd-encounter call, which renders "brief" verbosity —
suggestions are omitted there regardless of content, so the assertion
passed vacuously and would not have caught the very regression it was
named for.

Fixed to capture a single 1st-encounter ("full" verbosity, where Suggest:
lines actually render) stderr and assert both the positive ("New code
files" present) and negative (env var absent) conditions against it.

Verified by planting the regression (temporarily adding the env-var hint
to write_new_code's suggestions) and confirming the test now fails, then
reverting and confirming it passes clean.
@Data-Wise
Data-Wise merged commit 472e362 into dev Jul 25, 2026
6 checks passed
@Data-Wise
Data-Wise deleted the feature/issue-309-branch-guard-docs branch July 25, 2026 16:37
Data-Wise added a commit that referenced this pull request Jul 25, 2026
Both PRs merged to dev this session: #310 (branch-guard bypass-marker
confirm messages, closes #309) and #311 (version-grep bug class sweep,
closes the recurrence risk flagged after v4.3.0). Both worktrees removed,
local + remote branches deleted.
Data-Wise added a commit that referenced this pull request Jul 25, 2026
Full docs/website audit: docs-staleness-check.sh (nav/counts/coverage/
cross-doc freshness), validate-counts.sh, broken-link tests, mkdocs build
--strict, and live-site version check all GREEN — no drift found there.

The one real gap: both CHANGELOG.md and docs/CHANGELOG.md jumped straight
from the header to [4.3.0], with no record of the two PRs merged to dev
since that release (#310, #311). Added a mirrored [Unreleased] section to
both files.
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