refactor(mothership): one hold field and one retry field on a queued send
Merged
WA
13d ago+152+152+012345678901234567890123456789-105-105-012345678901234567890123456789
Summary
Third step of the chat send-queue consolidation (after #8740 and #8741): one wait field and one retry field on a queued send. No behaviour change.
hold?: 'user' | 'online'replacesretryRequired+heldUntilOnline.usermeans a failed dispatch waits for the user to send or edit it.onlinemeans it waits for the browser to come back online, or the user.retry?: { attempt, notBefore }(SendRetry) replacessendRetries+notBefore, andScheduledRetrygoes away.deferRetrytakes the new shape.- The policy, store and hook use the new fields:
requeuedFieldsreturns{ hold }or{ retry }, plus the chatless surface;- the online release clears only
hold: 'online'; - an edit strips
hold,retryandheldSurface; - the drain skips any hold and waits out
retry.notBefore.
- Saved queues in the older shape are mapped on restore.
retryRequiredbecomeshold: 'user'('online'withheldUntilOnline), andsendRetries+notBeforebecomeretry. Staging builds have persisted the old shape to session storage. - Tidy-ups from #8741's review:
liveQueuePositiondoes one lookup instead of a hop loop, since only a new-chat key moves and only once, andliveQueueKeyderives from it;migratekeeps the first record, so a repeat can't rewrite what was ahead;- the history check drops its no-op forwarding, since it never runs on a new-chat key;
- the dead-key DOM test waits on the queue instead of a fixed sleep.
Type of Change
- Improvement (refactor)
Testing
restores the hold and retry fields of a queue saved in their older shape(store.dom.test.ts) covers user, online, retrying and plain entries.keeps the first move when the same new-chat queue is migrated again(store.test.ts) covers themigratefirst-record guard; it fails without it.- The existing DOM, store and policy tests are updated to the new fields and pass. The full gate and integration tests ran on the CI runner.
Checklist
- Code follows project style guidelines
- Self-reviewed my changes
- Tests added/updated and passing
- No new warnings introduced
- I confirm that I have read and agree to the terms outlined in the Contributor License Agreement (CLA)