Skip to content

Commit 79d8503

Browse files
cardmagicclaude
andcommitted
test: remember a re-sent key once
A parity audit found the same untested branch in both languages. A key can finish twice on one actor: retention removes the message, the enqueue path no longer deduplicates it, and the caller sends it again. The list must move the key to the end rather than repeat it, and nothing proved that. Without the move the new test reads `["first", "second", "first"]`. The changelog and the roadmap did not record that the doctor now catches a half-applied migration. Validation: bundle exec rake (785 runs, 0 failures). Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
1 parent f3c6f84 commit 79d8503

3 files changed

Lines changed: 22 additions & 1 deletion

File tree

‎CHANGELOG.md‎

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,12 @@
3838
`db/migrate`. Seven scripts each carried a hand-copied migration list, and
3939
three of them applied an incomplete schema. A test fails if any script names a
4040
migration class again.
41+
- Report a half-applied migration in `solid_objects doctor`. The column list
42+
omitted `instances.state_revision`, `messages.operation`,
43+
`effects.success_operation`, `effects.failure_operation`, and
44+
`dead_letters.operation`, so an application that skipped a migration read as
45+
healthy and found out from a worker crash. A test fails when the list does not
46+
name a column that a migration after the first adds.
4147

4248
- Retry a dead effect or broadcast. `SolidObjects.dead_letters` keeps its
4349
message meaning and answers `effects` and `broadcasts`, so the kind rides on

‎docs/roadmap.md‎

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,9 @@
5858
cannot reject the subscription or stop its siblings
5959
- Reconciliation read APIs
6060
- Installation doctor, authorization reference, fit guide, and legacy-state
61-
migration cookbook
61+
migration cookbook. The doctor names every column that a migration after the
62+
first adds, so a half-applied migration fails the schema check rather than
63+
reaching a worker. A test holds the list to that rule
6264
- Database server verification: each adapter reports its version against a
6365
tested minimum, MySQL confirms Solid Objects tables use InnoDB, and the
6466
doctor warns rather than refusing to run on an untested server

‎test/integration/result_lookup_test.rb‎

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -294,6 +294,19 @@ def reject_checkout
294294
assert_raises(SolidObjects::MessagePruned) { reference.find_by(idempotency_key: "second") }
295295
end
296296

297+
test "remembers a re-sent key once" do
298+
reference = CartActor.ref("alice")
299+
reference.async(idempotency_key: "first").checkout(order_id: 1)
300+
reference.async(idempotency_key: "second").checkout(order_id: 2)
301+
run_actors
302+
SolidObjects::Message.delete_all
303+
reference.async(idempotency_key: "first").checkout(order_id: 3)
304+
run_actors
305+
306+
assert_equal [ "second", "first" ],
307+
SolidObjects::Instance.sole.completed_idempotency_keys
308+
end
309+
297310
test "remembers nothing for a message that carried no key" do
298311
reference = CartActor.ref("alice")
299312
reference.async.checkout(order_id: 1)

0 commit comments

Comments
 (0)