Repository navigation
ci: add contract snapshot verification and drift reporting - #901
Merged
thegreatfeez merged 2 commits intoOct 18, 2026
Merged
Conversation
|
@abimbolaalabi is attempting to deploy a commit to the thegreatfeez's projects Team on Vercel. A member of the Team first needs to authorize it. |
|
@abimbolaalabi Great news! 🎉 Based on an automated assessment of this PR, the linked Wave issue(s) no longer count against your application limits. You can now already apply to more issues while waiting for a review of this PR. Keep up the great work! 🚀 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Comprehensive Implementation Summary: Snapshot Verification (#815)
📌 Issue Overview
Issue Reference:
#815 / CI/CD & DevOps — Automated snapshot verificationTitle: Add automated snapshot verification and diff reporting in CI
Goal: Make CI detect when committed Soroban test snapshots under
contracts/accord/test_snapshots/drift from a fresh test run, report a readable diff, document the update procedure, and keep the check from blocking PRs because of an existing stale baseline.🏗️ Architecture & Core Design Decisions
1. Advisory CI mode, strict local mode
SNAPSHOT_VERIFY_WARN_ONLY=1: drift is reported as a warning and the full patch is uploaded as an artifact. This satisfies the issue's "fail or warn" requirement without forcing every PR to refresh the already-stale deterministic baseline.1on drift, so contributors catch stale snapshots before opening a PR.2. Deterministic snapshots only
Envdropped during a test. Property tests generate new random inputs on every run, so their snapshots can never match across runs.non_snapshot_env()(EnvTestConfig { capture_snapshot_at_drop: false }) and used it in all five property-test functions.3. Complete, readable drift reporting
target/snapshot-verification/status.txtandsnapshots.patch; untracked snapshots are included in the patch viagit diff --no-index.contract-snapshot-verificationartifact and appends the changed-file list to the run summary.4. Cross-platform stability
.gitattributeswithcontracts/accord/test_snapshots/** text eol=lf.--ignore-cr-at-eol, so Windowscore.autocrlfconversion is not mistaken for drift.5. No fighting the merge process
📁 File-by-File Detailed Breakdown
1.
.github/workflows/contract.yml(Modified)Contract Snapshot Verificationjob.scripts/verify-snapshots.shwith advisory mode enabled.target/snapshot-verificationas a 30-day artifact.2.
scripts/verify-snapshots.sh(New)cargo test -p accord --lib --no-fail-fast.1on drift in strict mode; warns and exits0inSNAPSHOT_VERIFY_WARN_ONLY=1mode.3.
contracts/accord/src/test.rs(Modified)non_snapshot_env().Env::default()withnon_snapshot_env()in all five proptest functions:approval_count_never_exceeds_owner_counttotal_weight_matches_all_current_owner_weightsapproval_weight_always_equals_sum_of_approved_weightsactive_count_never_exceeds_maxrole_members_index_matches_per_address_roles4.
.gitattributes(New)5.
.gitignore(Modified)6.
CONTRIBUTING.md(Modified)UPDATE_EXPECTguidance with the actual snapshot workflow.7.
docs/CI.md(Modified)8.
contracts/accord/test_snapshots/test/(Deleted)✅ Verification & CI Results
bash -n scripts/verify-snapshots.shbash scripts/verify-snapshots.sh multi_transfer_successSNAPSHOT_VERIFY_WARN_ONLY=1 bash scripts/verify-snapshots.sh multi_transfer_success::warning::and wrote the patch?status anddiff --no-indexcontent in patchbash scripts/verify-snapshots.sh bench_baseline_helpers_roundtripSnapshot verification passedcargo test -p accord --lib --no-fail-fastmain(resource-limit/budget tests, RBAC expectation, missing error-table entry, benchmark regression)The regular Contract CI job continues to own test failures. This PR's new job is intentionally advisory so it can surface the existing stale deterministic snapshots without blocking merges; the uploaded artifact contains the full diff.
mainfor 20 tests unrelated to snapshot verification (resource limits,RecoveryActivemissing fromdocs/CONTRACT_API.md, RBAC expectation mismatch, benchmark regression).cargo fmt --check -p accordreports existing formatting diffs inbench.rs,lib.rs, andtest.rs; the code added in this PR is formatted.Closes #815