Repository navigation
test(relay): drill a memory cell through a database outage, and pin phone renewal - #30666
Merged
Merged
Conversation
…erve mode Step 6 of the relay redesign keys every phone-path change on this switch. The cell reports the effective value in runtime status, and the flag tool refuses phonePath=memory unless the cell is reserve, and a reserve flip that would turn phones over unnamed.
With phonePath=memory in reserve mode, a phone resume is admitted from one device read and the cell's own seat, and takes no activity leases. A refused device closes 4401, a failed read 4503, and only a missing device row falls through to the invite path. A phone whose host has no seat gets one assignment read: 4409 when the row names another cell or the read fails, otherwise 4404.
…from one read A phone resumed on the memory path keeps its connection basis in the cell, not in relay_connection_bases. Its confirm rereads the device row once, renews it only when less than 29 days remain, and always answers a current-version confirm renewed:true with the expiry the database holds. Confirms route by where their basis lives, so a flip between accept and confirm completes either way. Retries answer from a 10-min in-memory result map.
Flipping back by admitMode=db, phonePath=db or a dead-man trip leaves in-flight confirms to finish on their memory basis, writes no phone lease and leaks none, and evacuation still refuses the cell while Postgres records it as reserve.
Memory confirms buffer their audit rows and the cell writes them as one multi-row insert every 5 s or 500 rows, idempotent by a per-event id. The buffer holds at most 5,000 rows and drops a row older than 10 minutes rather than retrying it, counting and logging both kinds of drop.
…line The runtime metrics line gains phone refusals by close code, attach deadlines, accept database errors, resume confirm failures by code, completed accepts by phone path and the resume audit drop total. Every attach-deadline 4404 now logs what the cell knew of the desktop's control (pong age, ping outstanding, control age and round trip), so a half-open control can be told from a slow data dial.
…ason The phone close reason from #30607 now rides the close frame of the 4404 a cell sends when the desktop's data leg misses the attach deadline, so OTA phones can redial the same cell once instead of waiting out the host-offline delay. The failed relay-hello frame is unchanged, and old phones ignore the reason.
…hone renewal A blocked database leaves splices forwarding, closes new resumes 4503 and fails confirms cleanly, lets an in-flight confirm finish on its memory basis after a flip back, and drops audit rows past 10 minutes instead of writing them late. On the phone, a relay-only session lives 31 days under the once-a-day renewal rule, and would not if a not-due confirm answered renewed:false.
…ng writes An explicit phonePath=db left in the switch file would make the flag tool refuse every later write after an image rollback, including a watcher's admitMode=db flip back.
…evice read A failed assignment read for a phone with no seat now logs a rate-limited line before its 4409. A switch that turned off during the device read sends the phone down today's path. resolveResume reuses the one-read lookup, so the expiry and grace rules have one copy.
…s cleanup A renewal write that fails still answers the stored expiry, but now logs a rate-limited line so a persistently failing update is visible before phones age toward re-pairing.
… drop the shutdown flush A failing database no longer takes a 500-row insert per confirm; retries wait for the 5 s timer. The shutdown flush raced the pool closing, so it is gone and the at most 5 s loss is documented. A stopped buffer no longer re-arms its timer.
…e-logs-metrics Carries the PR 3 and PR 4 review logs into the renamed phone-connection log, counts renewal failures in the metrics line, and narrows the confirm-failure count so a lease release after a committed confirm is not counted.
…ll-and-renewal-tests
# Conflicts: # cloud/apps/relay/src/cell-phone-path.blackbox.test.ts
…ll-and-renewal-tests
…firm # Conflicts: # cloud/apps/relay/src/cell-phone-path.blackbox.test.ts # cloud/apps/relay/src/credential-store.ts # cloud/apps/relay/src/host-session-registry.ts # cloud/apps/relay/src/phone-accept-log.ts # cloud/apps/relay/src/test-fixtures/statement-recording-database.ts
…ll-and-renewal-tests
…esume-audit # Conflicts: # cloud/apps/relay/src/cell-phone-path.blackbox.test.ts # cloud/apps/relay/src/credential-store.ts
…ll-and-renewal-tests
…ll-and-renewal-tests
Jinwoo-H
changed the base branch from
relay-step6-attach-timeout-reason
to
main
October 19, 2026 17:16
…-renewal-tests # Conflicts: # cloud/apps/relay/src/host-session-client-accept.test.ts # cloud/apps/relay/src/host-session-registry.ts
8 tasks done
Contributor
✨ Finishing Touches: 💡 1
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
ELI5
Two safety checks for the new phone path (step 6), as tests only:
What Changed
Tests only.
cell-phone-path.blackbox.test.ts, the in-process version of the staging drill E-dep-6). A real reserve-mode cell withphonePath=memory, one desktop and two phones:admitMode=dbduring the outage; once the database returns, the in-flight confirm finishes on its memory basis (one device read), and new resumes take the database path again;resumeAuditDropped), never written late (checked: 2 dropped, 0 written).mobile/src/transport/mobile-relay-renewal-compatibility.test.ts), using the shipped phone code (persistResumeConfirmation,RelayLeaseRotationTimer,mobileRelayCredentialNeedsRotation) against a model of the memory cell's answer:renewed: falsewhen renewal is not due) stops the phone's lease timer after the first confirm, which is why the cell never answers that for a current-version confirm.Why
These pin the two promises the rollout depends on: a database outage costs new connections, not live ones, and the renewal change is invisible to phones already shipped.
Includes #30658 (attach-timeout close reason, reviewed)
Linked Issue
N/A (step 6 of the relay redesign, internal)
Visual Proof
N/A: tests only.
Testing
--maxWorkers=2: 1222 passed. Mobile: the new file passes (2 tests); oxfmt and oxlint clean;pnpm run check:code-quality:changedpassed.Review
Stacked on #30658 (top of the cell stack).
Agent skill upstream boundary
Notes
The mobile test mirrors the cell's renewal rule (30-day expiry, renew when under 29 days left) rather than importing server code into the mobile suite.
Checklist
N/Afor visual proof with reason