test(e2e): prove offline messages redeliver on session start, durably (RIG-3532) - #1225
test(e2e): prove offline messages redeliver on session start, durably (RIG-3532)#1225rigel-mintaka wants to merge 1 commit into
Conversation
|
Merging to
After your PR is submitted to the merge queue, this comment will be automatically updated with its status. If the PR fails, failure details will also be posted here |
|
Compass engineering docs preview: https://compass-comms-rig3532-offlin.compass-eng-docs.pages.dev Deployed from |
… (RIG-3532)
RIG-3473 T5. The offline-redelivery design records had no positive e2e
coverage: the start-sweep appeared only as a hazard other legs acked around
(legfive_test.go). `TestCommsOfflineRedeliveryOnSessionStart` makes the
redelivery the asserted behavior.
The frozen record's prescribed mechanism does not match the code, so this
test takes a different shape on two axes. Both were verified against the
tree; a follow-up amends the record's T5 section.
**The durable surface is `UndeliveredMessages`, not `owed_mentions`.** The
record names `CountOwedMentions`/`ClearOwedMention`, but `owed_mentions` rows
are written only by `RecordOwedMention`, whose callsites require the message
to `@`-mention the agent AND the agent to be outside the channel's sweep set.
`InSweepSet` is satisfied by `cm.channel_id = aa.home_channel_id`, so a
home-channel post never records a row — `CountOwedMentions` would read 0 both
before and after the sweep, and the test would be green while asserting
nothing. `UndeliveredMessages` is what the sweep itself consumes
(`drainStarts` -> `sweepSession`), so it is the surface that actually moves.
**"Offline" has to be a despawn, not a never-started agent.** The record's
"post to a provisioned-but-not-started agent, then StartSession" is
unreachable: the post wakes the agent and fresh-starts it, because `fanOut`
finds no live session, calls `wake`, and `freshStart` resolves the placement
`Provision` already recorded — and the waker is wired in the real assembly
the fixture runs (`sinks.go` `SetAgentWaker`). `StartSession` would then be a
second, racing start. Posting after `RemoveWorkspace` deletes the placement
makes the wake a benign no-placement no-op, so the message stays owed.
The assertion is durable rather than on the live tail, which is the point of
the task: the sweep is enqueued inside `Resume` and drained asynchronously,
so a tail opened after `Resume` returns can miss the redelivery. That is the
RIG-3044 flake shape. Event-gated throughout, no sleeps and no retries.
A pre-condition check asserts the message IS owed before the resume, so the
"no longer owed" post-condition cannot pass vacuously.
Verified: PASS in 60.45s. Mutation-tested against production — disabling
`sweepSession` in `drainStarts` reddens it at the redelivery assertion
("delivery cursor did not advance past message ... within 15s"); production
restored byte-identical.
Co-authored-by: Matt Wilkinson <matt@rigel.build>
…(RIG-3532) The frozen coverage record (RIG-3473) prescribes a T5 mechanism the code falsifies on two independent axes. Both were verified against the tree before T5 was implemented (#1225); this amends the record so the next reader is not misled, and records WHY the shipped test differs rather than rewriting the task as if it had always said this. 1. `CountOwedMentions`/`ClearOwedMention` are the wrong durable surface: a home-channel post never writes an `owed_mentions` row, because `RecordOwedMention` requires an @-mention AND an out-of-sweep-set agent, and `InSweepSet` is satisfied by the home-channel disjunct. A test asserting on that count is green while proving nothing. The surface the sweep actually consumes is `UndeliveredMessages`. 2. Posting to a provisioned-but-not-started agent cannot leave a message owed: the post wakes the agent and fresh-starts it against the placement `Provision` recorded, and the waker is wired in the assembly the e2e fixture runs. Offline has to be a despawn boundary. The durable-not-live-tail requirement the record states is unaffected and is why the shipped test reads the store. Co-authored-by: Matt Wilkinson <matt@rigel.build>
59f770e to
272e1ef
Compare
Verification
Why this differs from the frozen recordThe record's T5 section prescribes a mechanism the code falsifies on two independent axes. Both were verified before implementation; #1227 amends the record. Matt approved proceeding on the correction. The record's durable surface is the wrong one. It names The record's scenario is unreachable. "Post to a provisioned-but-not-started agent, then The point of the taskThe assertion is durable rather than on the live session tail — which is what the record gets right and why it flagged the hazard. The sweep is enqueued inside |
This PR is part of a stack containing 2 PRs:
mainRIG-3473 T5. The offline-redelivery design records had no positive e2e
coverage: the start-sweep appeared only as a hazard other legs acked around
(legfive_test.go).
TestCommsOfflineRedeliveryOnSessionStartmakes theredelivery the asserted behavior.
The frozen record's prescribed mechanism does not match the code, so this
test takes a different shape on two axes. Both were verified against the
tree; a follow-up amends the record's T5 section.
The durable surface is
UndeliveredMessages, notowed_mentions. Therecord names
CountOwedMentions/ClearOwedMention, butowed_mentionsrowsare written only by
RecordOwedMention, whose callsites require the messageto
@-mention the agent AND the agent to be outside the channel's sweep set.InSweepSetis satisfied bycm.channel_id = aa.home_channel_id, so ahome-channel post never records a row —
CountOwedMentionswould read 0 bothbefore and after the sweep, and the test would be green while asserting
nothing.
UndeliveredMessagesis what the sweep itself consumes(
drainStarts->sweepSession), so it is the surface that actually moves."Offline" has to be a despawn, not a never-started agent. The record's
"post to a provisioned-but-not-started agent, then StartSession" is
unreachable: the post wakes the agent and fresh-starts it, because
fanOutfinds no live session, calls
wake, andfreshStartresolves the placementProvisionalready recorded — and the waker is wired in the real assemblythe fixture runs (
sinks.goSetAgentWaker).StartSessionwould then be asecond, racing start. Posting after
RemoveWorkspacedeletes the placementmakes the wake a benign no-placement no-op, so the message stays owed.
The assertion is durable rather than on the live tail, which is the point of
the task: the sweep is enqueued inside
Resumeand drained asynchronously,so a tail opened after
Resumereturns can miss the redelivery. That is theRIG-3044 flake shape. Event-gated throughout, no sleeps and no retries.
A pre-condition check asserts the message IS owed before the resume, so the
"no longer owed" post-condition cannot pass vacuously.
Verified: PASS in 60.45s. Mutation-tested against production — disabling
sweepSessionindrainStartsreddens it at the redelivery assertion("delivery cursor did not advance past message ... within 15s"); production
restored byte-identical.
Co-authored-by: Matt Wilkinson matt@rigel.build