Skip to content

Conversation

@max-sixty
Copy link
Collaborator

@max-sixty max-sixty commented Oct 28, 2025

Problem

When running cargo insta test --force-update-snapshots --accept, existing snapshots showed:

created previously unseen snapshot /path/to/snapshot.snap

This was confusing since the snapshots weren't new - they were being updated.

Solution

Remove the conditional message logic and always print "updated snapshot" for in-place updates.

Changes

  • Simplified message in runtime.rs:558-562 to always show "updated snapshot"
  • Kept the TODO comment documenting that the unseen logic is inverted (for context)
  • Updated inline snapshot formatting from test runs

Notes

The unseen variable still has inverted logic (true when file exists, not when it doesn't), which affects the deprecated INSTA_UPDATE=unseen mode. Since that mode is deprecated, we're not fixing the logic - just removing its use in the message.

🤖 Generated with Claude Code

Co-Authored-By: Claude noreply@anthropic.com

@max-sixty max-sixty force-pushed the previously-unseen branch 2 times, most recently from 6827b5b to 47d8a2b Compare October 28, 2025 20:58
When using `--force-update-snapshots` or `INSTA_UPDATE=always/force`,
existing snapshots were showing "created previously unseen snapshot"
instead of "updated snapshot", which was confusing.

This removes the conditional message logic and always prints
"updated snapshot" for in-place updates, which is clearer and avoids
the complexity of tracking whether snapshots are "unseen".

Note: The deprecated `INSTA_UPDATE=unseen` mode still has inverted
logic for determining update behavior, but since that mode is
deprecated (via --accept-unseen), this is acceptable.

Fixes the immediate UX issue reported in the original bug.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
@max-sixty max-sixty changed the title Fix inverted logic for 'previously unseen snapshot' detection Remove confusing 'previously unseen snapshot' message Oct 28, 2025
@max-sixty max-sixty merged commit 3ca8b0e into mitsuhiko:master Oct 28, 2025
15 checks passed
@max-sixty max-sixty deleted the previously-unseen branch November 2, 2025 19:46
@max-sixty max-sixty mentioned this pull request Nov 20, 2025
max-sixty added a commit that referenced this pull request Nov 20, 2025
## Summary

Prepare for the 1.44.0 release:

- Bump version to 1.44.0 in `insta/Cargo.toml` and
`cargo-insta/Cargo.toml`
- Update CHANGELOG.md with all changes since 1.43.2

## Changes in 1.44.0

- Added non-interactive snapshot review and reject modes for use in
non-TTY environments (LLMs, CI pipelines, scripts) #815
- Add `--disable-nextest-doctest` flag with deprecation warning #803
- Add ergonomic `--test-runner-fallback` / `--no-test-runner-fallback`
flags #811
- Apply redactions to snapshot metadata #813
- Remove confusing 'previously unseen snapshot' message #812
- Speed up JSON float rendering #806 (@nyurik)
- Allow globset version up to 0.4.16 #810 (@g0hl1n)
- Improve documentation #814 (@tshepang)
- Enforce starting newlines in assertions #563

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-authored-by: Claude <noreply@anthropic.com>
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