Repository navigation
fix(migration-keeper): only MigrationNotInitialized means no snapshot - #1176
Conversation
|
@liutingqiu is attempting to deploy a commit to the Collins' projects Team on Vercel. A member of the Team first needs to authorize it. |
|
@liutingqiu 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! 🚀 |
|
Verified locally on this branch before asking for review. Full workspace suite, The regression test added here is Diff is 34 lines in Repro: |
4c2592b to
c9ea0af
Compare
|
The Commit Messages failure was only the 77-character subject line; I shortened it and left the code unchanged. The new workflow runs are waiting for maintainer approval (action_required), so CI cannot re-run yet. Could you approve the runs and take a look when you have a moment? Happy to adjust anything else. |
|
@collinsezedike The only failing check on this PR is Vercel's |
collinsezedike
left a comment
There was a problem hiding this comment.
Thanks for the fix, @liutingqiu. This is a solid contribution. If you'd like to pick up another open issue, there are several available in the tracker.
|
@liutingqiu thank you again for getting this over the line. If you are enjoying working on Meridian, starring the repository helps more contributors find the project and is much appreciated. |
|
Thanks for the kind words and for reviewing the PR. I’ve enjoyed contributing to Meridian, and I’ll star the repository to help others discover the project. |
Closes #1131
What was wrong
migration-keeper.tsclassified a snapshot read failure withsnapshotReadFailed = isTransientKeeperError(err). Any non-transient, non-MigrationNotInitializedfailure — a decode/parse error, contract-not-found, a definitive simulation error, an HTTP 400/404 — therefore leftsnapshotReadFailedfalse, sohasMatchingSnapshotstayed false and the keeper firedbegin_migration. That resets an already cooldown-elapsed snapshot'sledger_seqback to now, the exact harm the surrounding comment says must be avoided.Fix
Only a confirmed
MigrationNotInitializedmeans "this vault has no snapshot yet". Everything else is a read failure and is reported as retryable:s snapshotReadFailed = !isMigrationNotInitializedError(err);isMigrationNotInitializedErrormatches the three shapes that error arrives in: the contract identifier (MigrationNotInitialized), the reasontx.tsmaps it to (Start a migration before calling migrate), and the raw contract code (Error(Contract, #19)— #19 inVAULT_CONTRACT_ERROR_MESSAGES). The comment now states that this deliberately does not defer toisTransientKeeperError: a non-transient but unrecognised read error is still not proof of absence.Tests
migration-keeper.test.tsgains a case whereget_migration_snapshotthrows a definitive, non-transient error (contract not found: HTTP 404) and asserts:sendTransactionwas never called (nobegin_migration)The existing transient-timeout test still passes, and so do the genuine-
MigrationNotInitializedcases that must fall through tobegin_migration.Verification
The new test fails on the pre-fix commit (it observed a
begin_migrationsubmission) and passes after it.