Skip to content

docs: add snapshot update guidance for CLI help text changes - #1529

Merged
max-sixty merged 2 commits into
mainfrom
hourly/review-23097140363
Mar 14, 2026
Merged

max-sixty merged 2 commits into
mainfrom
hourly/review-23097140363

Conversation

@worktrunk-bot

Copy link
Copy Markdown
Collaborator

Summary

  • Add INSTA_UPDATE=always cargo test ... "test_help" guidance to both CLAUDE.md and tests/CLAUDE.md for updating help snapshots after editing after_long_help text
  • Add a note to never manually edit .snap files (they contain ANSI escape sequences)

Evidence

In run 23096056615, the mention bot edited after_long_help in src/cli/mod.rs for PR #1521 but only ran cargo test --lib --bins before pushing. The help_switch_long snapshot test failed in CI, requiring a second commit.

The bot then struggled through 7 approaches to update the snapshot:

  1. cargo insta test --accept (didn't work for file-based snapshots in this context)
  2. Manual inspection of the snapshot file with sed
  3. cat -A to examine raw bytes
  4. Manual Edit of the snapshot file (couldn't reproduce ANSI escapes)
  5. Trying to regenerate help output and compare
  6. UPDATE_SNAPSHOTS=1 (wrong env var name)
  7. INSTA_UPDATE=always (correct — finally worked)

The tests/CLAUDE.md only mentioned cargo insta test --accept for first-time inline snapshot creation. There was no guidance for updating existing file-based snapshots, and CLAUDE.md didn't mention the need to update help snapshots after editing help text.

Test plan

  • Verify the new guidance is clear and actionable
  • Confirm INSTA_UPDATE=always cargo test --test integration "test_help" works as documented

🤖 Generated with Claude Code

The mention bot (run 23096056615) edited `after_long_help` in
`src/cli/mod.rs` but didn't run the help snapshot tests before pushing,
causing a preventable CI failure. It then tried 7 different approaches
to update the snapshot before finding `INSTA_UPDATE=always`.

Add explicit guidance in both CLAUDE.md and tests/CLAUDE.md so bots
know to run `INSTA_UPDATE=always cargo test ... "test_help"` after
editing help text, and to never manually edit .snap files.

Co-Authored-By: Claude Opus 4.6 <[email protected]>
@worktrunk-bot worktrunk-bot added the claude-behavior Issues with Claude CI bot behavior label Mar 14, 2026
Comment thread tests/CLAUDE.md Outdated
use `INSTA_UPDATE=always`:

```bash
INSTA_UPDATE=always cargo test --test integration "test_help"

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

cargo insta test --accept?

we should ensure cargo-insta is intalled in CI

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good call — updated both files to use cargo insta test --accept instead. It's already installed in CI via the claude-setup action and ci.yaml, so no additional setup needed.

@worktrunk-bot

Copy link
Copy Markdown
Collaborator Author

Looks good — clear, well-motivated docs addition. The bot's 7-attempt struggle in the #1521 run is good justification for adding this.

One minor observation: the tests/CLAUDE.md addition repeats the same cargo insta test --accept command already in CLAUDE.md. Since tests/CLAUDE.md is specifically about test infrastructure, you could keep only the "don't manually edit .snap files" guidance there and point to the main CLAUDE.md for the workflow. But the duplication is small and having it in both places reduces the chance of the bot missing it, so fine either way.

@max-sixty
max-sixty enabled auto-merge (squash) March 14, 2026 23:33
@max-sixty
max-sixty merged commit c2e1718 into main Mar 14, 2026
24 checks passed
@max-sixty
max-sixty deleted the hourly/review-23097140363 branch March 14, 2026 23:43
worktrunk-bot added a commit that referenced this pull request Mar 15, 2026
Two behavioral issues observed in the past hour's CI runs:

1. Triple approval on PR #1531 — each of 3 commits triggered a new review
   run, and each re-approved despite the prior approval covering the same
   PR. The trivial-change exit path said "skip steps 2-3" but didn't
   explicitly block step 4 (approval), so the bot re-approved on trivial
   incremental changes.

2. Self-approval attempts on PRs #1521 and #1529 — the bot attempted
   `gh pr review --approve` on its own PRs before discovering GitHub
   rejects self-approvals. The authorship check was buried in step 4
   instead of being caught in pre-flight.

Fixes:
- Add IS_SELF_AUTHORED check to pre-flight (step 1) so the bot knows
  before reaching step 4
- Make trivial-change exit path explicitly skip steps 2, 3, AND 4
- Update step 4 self-authored guidance to reference the pre-flight flag

Co-Authored-By: Claude Opus 4.6 <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

claude-behavior Issues with Claude CI bot behavior

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants