Repository navigation
fix(mobile): keep retired names on an RPC error and route the host's created name (STA-4479, STA-4480) - #14926
brennanb2025 wants to merge 1 commit into
Conversation
…created name (STA-4479, STA-4480)
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Repository UI Review profile: CHILL Plan: Pro Plus Run ID: 📒 Files selected for processing (4)
Included review availability: Your plan includes up to 10 reviews per rolling hour; 5 remain after this review. 📝 WalkthroughWalkthroughWorktree creation now returns the host-provided non-empty Merge Risk: ⚪ Minimal · up to The change preserves retired-name suggestions across RPC errors and uses the host-created name for new workspaces; no actionable merge-blocking risk remains after the reported checks pass. 🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches📝 Generate docstrings
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 |
Review — verdict: CLEAN, approve. No blocking findings at
|
Fixes STA-4479 (P2) and STA-4480 (P2). Both regressions from #14350, both on mobile's
generated-name suggestion surface. Neither can leak history — the host still refuses reuse — so this
branches from
mainrather than the host-side stack (#14917 → #14919 → #14924); it shares no fileswith it.
STA-4479 — an RPC error blanked the retired-name cache
RpcClient.sendRequestresolves with{ ok: false, error }for a host-side failure; it onlyrejects on transport failures. The hook read
response.resultunconditionally, so an error envelopeproduced
undefined→readRetiredNameRegistryForReporeturned an empty registry (not null) →retiredNamesAfterRefreshstored it and overwrote the previous good answer. The.catchnever sawit.
Empty means "nothing is retired", which is the one direction
retired-name-cache.tsexists toprevent — its own doc says mobile "blanked the list on any error, which un-retires names". The
transport-level fix landed then; the envelope-level one did not.
Now the envelope decides:
response.ok ? read(response.result) : null, andnullalready means"hold the previous answer" in the shared cache rules.
Test-harness correction, called out because it changes existing tests: the hook's test client
resolved bare
{ result }objects with nookfield, which the transport never delivers. That fakeis exactly what let this bug hide. The harness now emits real
RpcSuccess/RpcFailureenvelopes.STA-4480 — mobile routed the name it proposed, not the one the host created
createWorktreeWithNameRetryreturned{ worktreeId, name: candidateName }. The host advances pasta retired cwd on its own, so the created workspace can carry a later candidate than the one sent —
and
onCreated(result.worktreeId, result.name)then titles the new workspace wrongly until thelive-name hook corrects it.
It now prefers
result.worktree.displayName, falling back to the proposal when a host answerswithout one. No wire change:
displayNameis an existing required field onWorktree; the fallbackcovers a malformed or unexpected envelope rather than a version skew.
Tests
RED against unfixed production code (
git checkout origin/main -- <both files>, tests kept — notethe 17 pre-existing tests still pass against the corrected harness, so only the two new assertions
fail):
GREEN: full mobile suite, 3524 passed / 3 skipped across 448 files.
tsc -p mobile/tsconfig.jsonexit 0, oxlint exit 0.
Not covered
Mobile emulator QA was not run for this change; both defects are asserted at the unit level only.
🤖 Generated with Claude Code