mcl-mail#12: a replayed deposit for a letter already held writes nothing #25
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "juno/12-replay-idempotent"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Refs macula-services/mcl-mail#12.
Purpose (defect): a boot of mcl-mail replays the log into the read model without an error for each letter it already holds, so a restart neither retries nor dead-letters every deposit.
This carries Titan's commit
2f09982f(the fix and its red-first test, from the design note in #12 comment 1468) and finishes the package; the branch is merged up to current main60ad880, so the diff against main is those two files only.mailboxes_read_model:upsert_deposited/2reads the document first:{error, not_found}->put/1(create, as before — a letter carried twice and forgotten is recreated so its replayed read facts can land),{ok, _Held}->ok(the deposit was already projected; nothing is written, so no_revconflict and no flag reset).projected/2sits beside the module's ownadvanced/2(carries) andset_flag/2: same read-then-write shape, same two shapes fromget_doc.a_replayed_deposit_for_an_existing_letter_leaves_it_as_it_wasdrivesproject/4withletter_deposited_v1for a stored letter whosearchivedandrepliedflags are set, and assertsfind/2still answers with them.replayed_boot/2lost itscatcharound the deposit so a crash shows as a failure, not a swallow.Proven on msi00 in the pinned image
macula-ci-otp-rocksdb@sha256:57e3929c…(the same digestlint.ymlruns):a_replayed_deposit_for_an_existing_letter_leaves_it_as_it_was/1fails with**error:{badmatch,{error,conflict}}— the probe's failure in #12.MCL_LINT=1 rebar3 lintrc=0,rebar3 eunitall 152 tests passed,rebar3 dialyzerrc=0.projected({ok, _Held}, Doc) -> put(Doc)): 2 failures, the new test by name plusa_restart_does_not_take_away_the_grace_read/1, both{badmatch,{error,conflict}}. Titan'smutants.shform of M1 (replace the whole call withput(Doc)) does not run: it leavesprojected/2unused andwarnings_as_errorsturns that into a compile error, so the mutant was re-expressed on the guard's own clause.{error, not_found}->ok): 6 failures,a_replayed_deposit_for_an_existing_letter_leaves_it_as_it_was/1among them.cmp).Not in this PR: the changelog line for #12, which this repository writes at its release commit.
60ad880into juno/12-replay-idempotent (mcl-mail#12)