Skip to content

Delete 261 orphaned test snapshots, guard against new ones - #442

Merged
godamongstmen897 merged 1 commit into
mainfrom
chore/prune-orphan-snapshots
Sep 2, 2026
Merged

Delete 261 orphaned test snapshots, guard against new ones#442
godamongstmen897 merged 1 commit into
mainfrom
chore/prune-orphan-snapshots

Conversation

@godamongstmen897

Copy link
Copy Markdown
Contributor

test_snapshots/ held 895 files; 262 had no test function behind them. They accumulated as tests were renamed or removed — most left by 8716d10, which cut test.rs from 143 test functions to 86 while claiming to add 29.

Checked before deleting

An orphan can mean two different things: a test was renamed (harmless), or a test was deleted (lost coverage). Every orphan group here maps to an area that still has substantial live tests:

orphan group orphans live tests in that area
escrow_interest_yield 21 81
tax_withholding_deductions 17 20
admin_override_* 32 118
cancel_escrow_event 14 83
dispute_arbitration_split 11 72

The genuinely lost ones were the 16 handled in #441. These are stale artifacts.

Result

Deleted 261 — the 262nd reconnected to a test restored in #441. A full test run afterwards regenerated none of them, confirming no live test owns them. 633 snapshots remain, 0 orphaned.

Guard

Added scripts/check-orphan-snapshots.py and a CI step ahead of the format check. An orphan alone is clutter; a pile of them is where a silently deleted test hides.

Verified it actually fails rather than only passing on a clean tree:

$ python3 scripts/check-orphan-snapshots.py
test_snapshots: 1 orphaned snapshot(s)

  .../test_this_does_not_exist.1.json
      no `fn test_this_does_not_exist` in contracts/milestone-escrow/src/**/*.rs
exit=1

708 tests pass, clippy clean under -D warnings, fmt clean.

🤖 Generated with Claude Code

test_snapshots/ held 895 files; 262 had no test function behind them.
They accumulated as tests were renamed or removed -- most of them left by
8716d10, which cut test.rs from 143 test functions to 86 while its message
claimed to add 29 tests.

Before deleting, checked that none of them pointed at coverage that is
actually missing: every orphan group maps to an area with substantial live
tests (escrow_interest_yield 81, admin_override 118, cancel_escrow 83,
dispute 72, and so on). The genuinely lost ones were the 16 handled in
#441; these are stale artifacts of renames and reorganisation.

Deleted 261 -- the 262nd reconnected to a test restored in #441. After
deletion a full test run regenerated none of them, which confirms no live
test owns them. 633 snapshots remain, 0 orphaned.

Added scripts/check-orphan-snapshots.py and a CI step ahead of the format
check. An orphan on its own is harmless clutter; a pile of them is where a
silently deleted test hides. Verified the script actually fails (exit 1)
on a planted orphan rather than only passing on a clean tree.

708 tests pass, clippy clean under -D warnings, fmt clean.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Copilot AI lite review requested due to automatic review settings September 2, 2026 15:00
@godamongstmen897
godamongstmen897 merged commit 16793ae into main Sep 2, 2026
2 checks passed

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🔵 Needs a closer look

The new orphan-snapshot checker currently treats any Rust fn as a “test function,” which can miss true orphans and should be restricted to #[test] functions to match the script’s stated intent.

Pull request overview

This PR cleans up the Soroban snapshot corpus by removing orphaned test_snapshots/ JSON files (snapshots with no corresponding live test function), and adds an automated guard to prevent new orphans from accumulating unnoticed.

Changes:

  • Add a Python script to detect committed snapshots whose test function name no longer exists in contracts/milestone-escrow/src/**/*.rs.
  • Wire the orphan-snapshot check into CI ahead of formatting/linting.
  • Delete a large set of orphaned snapshot JSON files under contracts/milestone-escrow/test_snapshots/.
File summaries
File Description
scripts/check-orphan-snapshots.py New checker script that fails CI if snapshot files are not backed by a live test function name.
.github/workflows/ci.yml Adds a CI step to run the orphan snapshot checker.
contracts/milestone-escrow/test_snapshots/**/*.json Removes orphaned committed snapshot artifacts to reduce noise and prevent masking silently deleted tests.
Review details
  • Files reviewed: 19/264 changed files
  • Comments generated: 0
  • Review effort level: Lite

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

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.

2 participants