fix(xmtp_api_d14n): keep commit-log on the retained v3 service after cutover#3889
fix(xmtp_api_d14n): keep commit-log on the retained v3 service after cutover#3889tylerhawkes wants to merge 1 commit into
Conversation
…cutover Commit-log (fork detection) is deliberately not part of d14n's network ordering; the plan is to keep a centralized v3-shaped commit-log service running through and past the cutover. But `MigrationClient` routed `publish_commit_log` / `query_commit_log` through `choose_client`, so the instant a client crossed the cutover its commit-log calls followed reads/writes to xmtpd — whose commit-log methods are deliberate no-ops (publish drops, query returns empty). Fork detection would silently die at the moment of migration. Route commit-log to the v3 client unconditionally, independent of cutover state. Drop `write_with_refresh` for it: the retained service never emits the migration-rejection signal that reroutes writes to xmtpd. Adds a unit test asserting both commit-log calls reach v3 even with `has_migrated = true` — the d14n mock is left bare, so a wrongly-routed call panics (verified: the test fails on the old routing). Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_017AVuJ7VAgen2fFhtJQ6zid
|
Claude finished @tylerhawkes's task —— View job Code Review Complete ✓Review for PR #3889 — 2026-07-22 22:55 UTC SummaryThe fix is correct and well-tested. The commit-log routing change addresses a critical correctness issue with clear implementation and comprehensive test coverage. AnalysisCode Quality: ✓ Excellent
Correctness: ✓ Verified
Test Coverage: ✓ Strong
Performance: No concerns
Security: No concerns
Minor ObservationsNone — the implementation is clean and complete. |
ApprovabilityVerdict: Approved Targeted fix ensuring commit-log operations route to v3 unconditionally during d14n migration (preventing silent fork-detection failure). Author owns all changed files, change is well-documented with explanatory comments, and includes comprehensive test coverage. You can customize Macroscope's approvability policy. Learn more. |
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #3889 +/- ##
==========================================
- Coverage 85.74% 85.66% -0.09%
==========================================
Files 426 426
Lines 68102 68098 -4
==========================================
- Hits 58394 58333 -61
- Misses 9708 9765 +57 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
|
Found 1 test failure on Blacksmith runners: Failure
|
What
Fixes a latent correctness bug in the shipping
MigrationClient: commit-log (fork detection) silently dies the moment a client crosses the v3→d14n cutover.Commit-log is deliberately not part of d14n's network ordering — the plan keeps a centralized v3-shaped commit-log service running through and past the cutover ("basically keep that part of v3 running"). But
MigrationClientroutedpublish_commit_log/query_commit_logthroughchoose_client, so a migrated client's commit-log calls followed its reads/writes to xmtpd — where the commit-log methods are deliberate no-ops (publishdrops,queryreturns empty). Fork detection would go dark at migration with no error.Fix
Route commit-log to the v3 client unconditionally, independent of cutover state — the one surface that must never follow the cutover. Also drop
write_with_refreshfor it: the retained service never emits the migration-rejection signal that reroutes writes to xmtpd.Test
A deterministic unit test: with
has_migrated = true(so every other call routes to xmtpd), both commit-log calls must still hit v3. The d14n mock is left bare, so a wrongly-routed call panics — I verified the test fails on the old routing and passes on the fix.Scope
This is Phase 2 of 3 (Phase 1: #3888). This PR is the routing fix + its unit proof. Lifting the
ci-d14nnot (test(/commit_log/))exclusion so the full commit-log suite runs live through a migration-backed client is deferred — it needs the migration test harness from #3888 to give commit-log a v3 target in the d14n lane, and is better as its own change.Verification
xmtp_api_d14ncompiles; clippy + fmt clean.queries::combined::testspass (13 existing + the new one).🤖 Generated with Claude Code
Note
Fix commit-log routing to always use v3 client after cutover
After migration,
publish_commit_logandquery_commit_logwere still routing throughchoose_client(), which could send commit-log traffic to the wrong backend. Both methods in combined.rs now callv3_clientdirectly, bypassing the migration-aware router entirely. A new test in tests.rs verifies that both calls land on v3 (and not d14n) whenhas_migrated = true.Macroscope summarized c656399.