Skip to content

refactor(mobile): put the branch-compare leg on the lifecycle owner, with a currency probe (step 5) - #21299

Merged
Jinwoo-H merged 9 commits into
mainfrom
step5-next-sites
Sep 17, 2026
Merged

Jinwoo-H merged 9 commits into
mainfrom
step5-next-sites

Conversation

@Jinwoo-H

@Jinwoo-H Jinwoo-H commented Sep 17, 2026 •

Copy link
Copy Markdown
Contributor
Files Added Deleted Net
Test 3 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​382 0 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​382
Prod 4 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​174 $\color{#cf222e}{\Huge{\mathbf{−}}}$​90 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​84

What this is

Step 5 of the mobile RPC contract foundation on its next site after the pilot (#20914): the source-control branch-compare leg moves off hand-rolled generation refs onto GenerationScopedRequestOwner. Pure refactor: no wire change, zero goldens moved.

The other site the plan named, the terminal list, is reported rather than forced: MobileTerminalInventoryRequest shares one execute run across joiners, upgrades an in-flight allowEmptyLoaded flag, and exposes the joiner's startedAt for the certified-sweep cadence; the owner has no expression for any of the three, and its loader-write fence rejects the body's ref writes. That matches the pilot's own next-sites note. Making it fit means widening the owner with joiner-visible request state, which is a design ticket, not this PR.

The migration

isCurrentLoad() was a closure over three refs (branchCompareGenerationRef, currentBranchCompareIdentityRef, mountedRef) that each of four exit points had to remember to call. The first two are deleted. An attempt now calls reset() and then load(), so only the newest holds a live lease and a reply publishes only through commit. The three mid-flight decision points that used to write state (no base ref, refused capability, unreadable reply) are a returned BranchCompareOutcome, so the loader body writes nothing and the screen is written in one place. (The pilot's loader-write source fence does include this hook and parses the inline arrow passed to load; it finds nothing because the body delegates one level to readBranchCompareOutcome, so the no-write property of that function is held by construction and by the tests, not by the fence.) mountedRef stays: a detached route has no screen to publish to, which is a fact about the view, not about which reply is current.

Two design points: reset() before every load is what keeps the wire identical (a compare is a refresh, so neither the cache nor in-flight coalescing applies; without it a second attempt would join the first's request and publish a base ref the user had left). And the identity retire sits in the render-phase adjust-on-prop-change block rather than relying on the scope, because the next load starts only after the fresh git.status returns, leaving a window where an in-flight compare could publish the old worktree's commits.

One schedule differs, disclosed

Round 1 built the before/after table for eight schedules: normal load, refresh while in flight, identity change while in flight, unmount while in flight, superseded between base-ref resolution and the compare send, refused capability, unreadable reply, no base ref. Same requests and same published state on all of them, five pinned byte-for-byte by unmoved goldens. The one exception is an A-to-B-to-A identity flap while a base-ref lookup is out: main wrote its identity ref back to A, so the stale attempt's currency check went true again and it sent its compare; the render-phase reset() is monotonic, so this branch drops that attempt and the second A attempt starts its own load. One fewer request on that flap, no stuck state, and no golden drives it.

The owner grew a currency probe

Main checked currency between resolving the base ref and sending the compare. A loader inside the owner had no way to ask, so the first cut sent one extra git.branchCompare for a superseded attempt, which is a wire change. Fixed at the owner boundary: load's fn now receives RequestCurrency = { readonly isCurrent: () => boolean }, one probe per physical request built from the lease's own state (joiners share it as they share the reply), answering the same comparison commit makes. No generation number and no lease brand are exposed, and the compile fence pins that a probe cannot be passed to commit and that its generation is unreadable. The loader checks it after the base-ref round trip and before the compare, exactly where main checked, and returns null (which load already reads as no value). A superseded attempt now sends nothing.

Tests

  • lifecycle-owner.test.ts: three probe schedules (flips under a reset mid-flight; flips when a load enters an unseen scope; a loader that stops on it publishes nothing while the live attempt commits).
  • use-mobile-source-control-loaders.test.ts (new; the hook had none): two schedules for what the migration rests on, plus request-count parity for the superseded-mid-base-ref case: zero git.branchCompare for the superseded attempt, exactly one for the live one.
  • Mutations: deleting the site's probe check fails the parity case; an always-true isCurrent() fails the four probe cases and, since the detach schedule landed, the fifth (lead reproduced the four before that schedule existed).

Gates (on 43583f95b9)

Mobile tsc 0 · full mobile vitest run 632 files, 6227 passed, 6 skipped · recording suites with mutants 22 files, 965 passed, 3 skipped · zero goldens moved · oxfmt --check and oxlint clean on the five changed files · check-changed-code-quality 0 findings in every category. The race mutant's before text still matches the commit block once; no re-anchor.

Review

Round 1 (adversarial, before/after table rebuilt from main's isCurrentLoad() code): ship as-is. Probe confirmed read-only (closure returning a boolean, no publish path, no generation reachable; both compile-fence directives fire for the stated reason). The reset()-before-load claim holds (deleting it fails both overlap cases; the compare never read the cache on main). Render-phase reset: round 2 corrected round 1's premise here. expo-router wraps every screen in React.Suspense and calls React.startTransition, so a discarded render can advance the identity guard while dropping both setState calls and leave the old worktree's ready compare on screen. Main has the identical exposure through its identical render-phase identity-ref write, so this is not a regression and not a blocker; it is a pre-existing hazard worth its own ticket. Four low items folded: a compile-fence comment that claimed the probe carries a generation; the detach reset() was correct but unpinned (now a schedule); worktreeId dropped from the scope because statusIdentityKey already embeds it; the compare protocol split out of the loaders hook into its own module.

Round 2 (fresh reviewer): ship as-is. Rebuilt the before/after table from main's isCurrentLoad() independently; identical on every schedule except the disclosed flap, and named two equivalences (the early-return guard narrowing to mountedRef is safe because the only caller sits behind isCurrentLoad() with no intervening await; the empty-refusal message parity is pinned by matrix-git.changes-load-git.branchcompare-1). All five mutations confirmed by reading; both compile-fence directives fire for their stated reason; the split is byte-identical bodies. Two low items folded: the "joiners share it" wording (joiners never see a probe; they await the same promise), and the split module's parameter narrowed from RpcClient to the sender type per rpc-operation-sender.ts.

…step 5)

The compare kept three hand-rolled guards for one reply, combined in an
`isCurrentLoad()` the four exit points each had to remember to call:
`branchCompareGenerationRef` (latest-wins), `currentBranchCompareIdentityRef`
(the route identity, written in render) and `mountedRef`.

The owner replaces the first two. An attempt now `reset()`s and then `load`s, so
the newest attempt is the only one holding a live lease, and the reply is
published only through `commit(lease, value)`. What retires a compare is named
at the call site: this host, this route identity, this workspace.

A compare is a refresh, so neither of the owner's other two mechanisms applies
here and the `reset()` before each `load` is what says so: nothing it holds is
reusable, and no attempt may share its predecessor's reply. Dropping that line
makes the second attempt join the first's request and publish a base ref the
user already navigated away from.

The identity retire moves into the render-phase adjust-on-prop-change block,
where the identity ref was written. Leaving it to the next load's scope is not
the same thing: that load only starts once the fresh `git.status` returns, and
an in-flight compare would publish the old worktree's commits first.

`mountedRef` stays. A detached route has no screen to publish to, which is a
fact about the view, not about which reply is current.

The three decision points that used to write state mid-flight — no base ref, a
refused capability, an unreadable reply — are a returned `BranchCompareOutcome`
now, so the loader body writes nothing and the screen is written in one place.
That also puts this file under the loader-write source fence.

No golden moves: the recording suites reproduce byte for byte.

Claude-Session: https://claude.ai/code/session_01JNnE9qzUZMMnqpZWCqM3nb
…reads it

The pilot's wording named two scope consumers; the compare leg has only `load`.
What the scope still adds over the render-phase retire is the structural half: a
scope the owner has not seen retires on its own.

Claude-Session: https://claude.ai/code/session_01JNnE9qzUZMMnqpZWCqM3nb
A loader that spans two round trips had no way to ask whether its scope
had moved, so a superseded attempt sent its second request and was only
refused at commit. The probe answers exactly the question commit asks and
carries nothing to publish with, so the owner's publish fence is unchanged:
a loader that stops on it returns null, which the owner already reads as
no value.

Claude-Session: https://claude.ai/code/session_01JNnE9qzUZMMnqpZWCqM3nb
Restores request-count parity with main for the one path the migration
changed: an attempt superseded while it resolved its base ref used to stop
before sending git.branchCompare, and under the owner it sent one and was
refused at commit. It now stops on the owner's currency probe between the
two legs, so the screen is unchanged and so is the request count.

Claude-Session: https://claude.ai/code/session_01JNnE9qzUZMMnqpZWCqM3nb
@coderabbitai

coderabbitai Bot commented Sep 17, 2026 •

Copy link
Copy Markdown
Contributor

Review Change StackReview Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Advanced

Run ID: e2fefb0a-80e6-4b81-88ed-aee17f4021bb

📥 Commits

Reviewing files that changed from the base of the PR and between b4eb13c and 336d69a.

📒 Files selected for processing (2)
  • mobile/src/source-control/mobile-branch-compare-outcome.ts
  • mobile/src/transport/generation-scoped-request-owner.ts
🚧 Files skipped from review as they are similar to previous changes (1)
  • mobile/src/transport/generation-scoped-request-owner.ts

Included review availability: Your plan provides up to 10 included reviews per hour; 4 remain after this review.


📝 Walkthrough

Walkthrough

The change adds a read-only RequestCurrency probe to GenerationScopedRequestOwner. The mobile branch-compare loader uses the probe to stop superseded work before sending comparisons and uses shared outcome handling to update state. Request scope now uses the client and status identity. Tests cover concurrent compares, supersession during base-ref lookup, route detachment, route identity changes, and probe lifecycle behavior.

Priority: ⬇️ Low

Merge Risk: 🟡 Moderate · up to 336d6

A concurrent route update can leave source-control status or branch comparison stale or stuck because an abandoned render cancels the committed route's load. This should be fixed before merge.

🚥 Pre-merge checks | ✅ 3 | ❌ 2

❌ Failed checks (2 warnings)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 40.00% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 15 functions across 7 files. Write docstrings for the functions missing them to satisfy the coverage threshold.
Description check ⚠️ Warning The description gives detailed migration rationale, implementation details, testing evidence, and review notes. However, it does not follow the repository template completely: it omits explicit ELI5, … Add the missing template sections. Include the linked issue explicitly, state N/A with a reason for Visual Proof if there is no UI or interaction change, complete the applicable Testing and Checklist items, address AI Disclosure, Agent sk…
✅ Passed checks (3 passed)
Check name Status Explanation
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
Title check ✅ Passed The title clearly identifies the mobile branch-compare refactor and the addition of a currency probe. It is specific and related to the primary change.
Full details: Description check

Explanation

The description gives detailed migration rationale, implementation details, testing evidence, and review notes. However, it does not follow the repository template completely: it omits explicit ELI5, Linked Issue, Visual Proof, AI Disclosure, Agent skill upstream boundary, Notes, and Checklist sections. It also does not clearly state whether UI proof is not applicable.

Resolution

Add the missing template sections. Include the linked issue explicitly, state N/A with a reason for Visual Proof if there is no UI or interaction change, complete the applicable Testing and Checklist items, address AI Disclosure, Agent skill upstream boundary, and Notes, and retain the existing technical details under the matching headings.

  • Fix all pre-merge checks with AI
✨ Finishing Touches 💡 1
📝 Generate docstrings 💡
  • Commit to this branch
  • Create a new PR

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1


ℹ️ Review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Advanced

Run ID: bc9a3f62-1140-4db4-992e-0ebe69d967b9

📥 Commits

Reviewing files that changed from the base of the PR and between eabfbaa and 43583f9.

📒 Files selected for processing (5)
  • mobile/src/source-control/use-mobile-source-control-loaders.test.ts
  • mobile/src/source-control/use-mobile-source-control-loaders.ts
  • mobile/src/transport/generation-scoped-lease-compile-fence.ts
  • mobile/src/transport/generation-scoped-request-owner.ts
  • mobile/src/transport/lifecycle-owner.test.ts

Included review availability: Your plan provides up to 10 included reviews per hour; 1 remains after this review.

lastResetIdentityRef.current = statusIdentityKey
// Retire here rather than leaving it to the next load's scope: that load only starts once the
// fresh status returns, and an in-flight compare would publish the old worktree's commits first.
branchCompare.reset()

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🎯 Functional Correctness | 🟠 Major | ⚡ Quick win

🔎 Supported by static analysis

🏁 Script executed:

sed -n '1,245p' mobile/src/source-control/use-mobile-source-control-loaders.ts
sed -n '1,230p' mobile/src/transport/generation-scoped-request-owner.ts
rg -n -C 3 'loadBranchCompare|statusIdentityKey|branchCompareState|setRootRef' mobile/src/source-control/use-mobile-source-control-loaders.ts

Repository: stablyai/orca

Length of output: 23460


🏁 Script executed:

sed -n '230,350p' mobile/src/source-control/use-mobile-source-control-loaders.ts
rg -n -C 6 'useMobileSourceControlLoaders|loadStatus\(' mobile/src --glob '*.ts' --glob '*.tsx'

Repository: stablyai/orca

Length of output: 28664


🏁 Script executed:

rg -n -C 8 'useMobileSourceControlLoaders|loadStatus\(' mobile/src

Repository: stablyai/orca

Length of output: 30988


Move the identity-change reset out of render.

branchCompare is a persistent GenerationScopedRequestOwner. An abandoned render can call reset(), increment its generation, and clear the in-flight request for the still-committed identity. When that request resolves, commit() refuses its lease. The abandoned render starts no replacement useEffect load, so the screen can retain stale compare data or remain loading.

Move the identity-change reset block to a useLayoutEffect keyed by statusIdentityKey. The reset will occur only after the new identity commits and before the existing passive loadStatus effect starts, while preserving stale-result protection.

Stripping the directive gives TS2339, a member that does not exist, not a
privacy error: the probe has no generation to keep private.

Claude-Session: https://claude.ai/code/session_01JNnE9qzUZMMnqpZWCqM3nb
The detach reset() was the only thing retiring an attempt after the route
went away, and deleting it left the suite green. This schedule detaches
mid base-ref lookup and asserts nothing reaches git.branchCompare; without
the reset() it fails with one request sent.

Claude-Session: https://claude.ai/code/session_01JNnE9qzUZMMnqpZWCqM3nb
statusIdentityKey is `${hostId}\0${worktreeId}`, so listing worktreeId
beside it read as a third fence when it fences nothing new.

Claude-Session: https://claude.ai/code/session_01JNnE9qzUZMMnqpZWCqM3nb
The outcome union, the attempt and the screen mapping are the compare
leg's own protocol, not the hook's: nothing in them reaches React. Moved
verbatim to mobile-branch-compare-outcome.ts with a unit pin for the
mapping, which only the hook's schedules covered before. The hook drops
from 283 to 230 lines against a 300 limit.

Claude-Session: https://claude.ai/code/session_01JNnE9qzUZMMnqpZWCqM3nb

@pullfrog pullfrog Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

✅ No new issues found.

Reviewed changes

  • Branch-compare leg moved onto the lifecycle owner — use-mobile-source-control-loaders.ts now loads through GenerationScopedRequestOwner; the hand-rolled branchCompareGenerationRef / currentBranchCompareIdentityRef / isCurrentLoad() closure is deleted.
  • One write point for the screen — readBranchCompareOutcome returns a total BranchCompareOutcome | null (null = superseded) and nextBranchCompareState projects it, so the loader body writes nothing and publication is single-sited past branchCompare.commit.
  • Owner gains a read-only currency probe — load's fn receives RequestCurrency, built once per physical request from the lease's own state; the compile fence pins that the probe cannot publish and its generation is unreadable.
  • New coverage — hook schedules for newest-wins, supersede-mid-base-ref request parity, and identity-move refusal, plus three probe schedules in lifecycle-owner.test.ts. The race mutant anchor in operation-mutations.ts:23 still matches the unchanged commit block.
  • Verification this run — both changed test files pass (17 tests); the recording mutant suites pass (84 passed, 3 skipped, b1: kills race green).

ℹ️ The render-phase retire also fires on an identity round trip, where main published

No action requested — this is a deliberate consequence of the owner's A→B→A retire, and it self-heals. It only means the PR's "wire identical" claim is not exact in this one window: on a reused route that goes A→B→A while A's base-ref round trip is still out, main left branchCompareGenerationRef untouched and rewrote the identity ref back to A, so A's in-flight compare published; the new render-phase reset() retires it, sending one fewer git.branchCompare and leaving the compare list idle until the fresh A status load resolves. That load always runs (the identity-change effect re-fires), so the end state is the same.

Technical details
# Identity round trip A → B → A retires an in-flight compare that main published

## Affected sites
- `mobile/src/source-control/use-mobile-source-control-loaders.ts:152` — render-phase `branchCompare.reset()` bumps the owner generation on every identity change.
- `mobile/src/source-control/use-mobile-source-control-loaders.ts:65` — the probe stops the attempt once that generation moved.
- `mobile/src/transport/generation-scoped-request-owner.ts:129-132` — `reset()` bumps even when the scope returns to where it started, by design.

## Why the divergence exists
`loadBranchCompare` only runs from `loadStatus`'s success path, and B's status load is skipped by `isCurrentLoad()` once the route is back on A, so no attempt ever enters B's scope. Main's `isCurrentLoad()` for A's attempt still matched (`branchCompareGenerationRef` was never bumped by a render; `currentBranchCompareIdentityRef` was rewritten to A unconditionally), so it published. The owner cannot match that: the render-phase reset retired it and `commit`/the probe answer the same generation question.

## Required outcome
None — the retire is intentional and the fresh A load always runs, so the compare list refills. Surfaced only so the "wire identical" wording can be read precisely.

## Open questions for the human (optional)
- If exact wire parity in this window matters, a one-line note in the PR description would cover it; otherwise no code change is needed.

Pullfrog  | View workflow run | Using DeepSeek Flash (free via Pullfrog for OSS) | 𝕏

@pullfrog pullfrog Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

✅ No new issues found.

Reviewed changes (since the prior pullfrog review at 43583f95b9)

  • Compare protocol split into its own React-free module — mobile-branch-compare-outcome.ts now holds BranchCompareOutcome, readBranchCompareOutcome and nextBranchCompareState; the hook imports them and no longer imports refusedRpcMessageOrFallback, gitBranchCompareRead, resolveMobileBranchCompareBaseRef or the reply type directly. Imports are clean (no duplicates, no unused).
  • Owner scope reduced to [client, statusIdentityKey] — safe: the only production caller builds statusIdentityKey = ${hostId}\0${worktreeId} (use-mobile-source-control-state.ts:79), so the workspace is still in the key, and the hook already treats that key as the identity for its render-phase reset and status guard.
  • New detach schedule — use-mobile-source-control-loaders.test.ts now pins that an attempt the route detached under sends no compare, which is exactly what the detach reset() (not the mount latch) provides; without it the probe would stay current and the compare would go out.
  • New pure-mapping tests — mobile-branch-compare-outcome.test.ts covers ready-over-any-prior, preserve-ready only when asked, and unavailable-vs-failed.
  • Fence comment corrected — the probe exposes no generation at all, and the compile fence's @ts-expect-error now says so.
  • PR description updated — the A→B→A flap from the prior review is now disclosed under "One schedule differs, disclosed", and the loader-write fence's scope limitation is stated. No further action needed on either.

Verification this run — vitest run on the changed test files at b4eb13c3ac (21 passed); the recording mutant suites (84 passed, 3 skipped, b1: kills race green); oxlint on the changed files (0 warnings, 0 errors).

Pullfrog  | View workflow run | Using DeepSeek Flash (free via Pullfrog for OSS) | 𝕏

…ender

A joiner never receives the probe: its fn is never invoked, it awaits the
originating request's promise, and retire() clears inFlight so none can
join across a generation bump. The compare attempt takes the operation
sender the convention names rather than a whole RpcClient, which it only
ever used as that.

Claude-Session: https://claude.ai/code/session_01JNnE9qzUZMMnqpZWCqM3nb
@Jinwoo-H
Jinwoo-H merged commit 4927439 into main Sep 17, 2026
23 checks passed
@Jinwoo-H
Jinwoo-H deleted the step5-next-sites branch September 17, 2026 22:39
ivanvykopal pushed a commit to ivanvykopal/orca that referenced this pull request Sep 20, 2026
…with a currency probe (step 5) (stablyai#21299)

* refactor(mobile): put the branch-compare leg on the lifecycle owner (step 5)

The compare kept three hand-rolled guards for one reply, combined in an
`isCurrentLoad()` the four exit points each had to remember to call:
`branchCompareGenerationRef` (latest-wins), `currentBranchCompareIdentityRef`
(the route identity, written in render) and `mountedRef`.

The owner replaces the first two. An attempt now `reset()`s and then `load`s, so
the newest attempt is the only one holding a live lease, and the reply is
published only through `commit(lease, value)`. What retires a compare is named
at the call site: this host, this route identity, this workspace.

A compare is a refresh, so neither of the owner's other two mechanisms applies
here and the `reset()` before each `load` is what says so: nothing it holds is
reusable, and no attempt may share its predecessor's reply. Dropping that line
makes the second attempt join the first's request and publish a base ref the
user already navigated away from.

The identity retire moves into the render-phase adjust-on-prop-change block,
where the identity ref was written. Leaving it to the next load's scope is not
the same thing: that load only starts once the fresh `git.status` returns, and
an in-flight compare would publish the old worktree's commits first.

`mountedRef` stays. A detached route has no screen to publish to, which is a
fact about the view, not about which reply is current.

The three decision points that used to write state mid-flight — no base ref, a
refused capability, an unreadable reply — are a returned `BranchCompareOutcome`
now, so the loader body writes nothing and the screen is written in one place.
That also puts this file under the loader-write source fence.

No golden moves: the recording suites reproduce byte for byte.

Claude-Session: https://claude.ai/code/session_01JNnE9qzUZMMnqpZWCqM3nb

* docs(mobile): correct the compare scope comment to the one call that reads it

The pilot's wording named two scope consumers; the compare leg has only `load`.
What the scope still adds over the render-phase retire is the structural half: a
scope the owner has not seen retires on its own.

Claude-Session: https://claude.ai/code/session_01JNnE9qzUZMMnqpZWCqM3nb

* feat(mobile): give the lifecycle owner's loader a currency probe

A loader that spans two round trips had no way to ask whether its scope
had moved, so a superseded attempt sent its second request and was only
refused at commit. The probe answers exactly the question commit asks and
carries nothing to publish with, so the owner's publish fence is unchanged:
a loader that stops on it returns null, which the owner already reads as
no value.

Claude-Session: https://claude.ai/code/session_01JNnE9qzUZMMnqpZWCqM3nb

* fix(mobile): keep a superseded branch compare off the wire

Restores request-count parity with main for the one path the migration
changed: an attempt superseded while it resolved its base ref used to stop
before sending git.branchCompare, and under the owner it sent one and was
refused at commit. It now stops on the owner's currency probe between the
two legs, so the screen is unchanged and so is the request count.

Claude-Session: https://claude.ai/code/session_01JNnE9qzUZMMnqpZWCqM3nb

* docs(mobile): say what the probe's missing generation actually is

Stripping the directive gives TS2339, a member that does not exist, not a
privacy error: the probe has no generation to keep private.

Claude-Session: https://claude.ai/code/session_01JNnE9qzUZMMnqpZWCqM3nb

* test(mobile): pin that a detached route sends no compare

The detach reset() was the only thing retiring an attempt after the route
went away, and deleting it left the suite green. This schedule detaches
mid base-ref lookup and asserts nothing reaches git.branchCompare; without
the reset() it fails with one request sent.

Claude-Session: https://claude.ai/code/session_01JNnE9qzUZMMnqpZWCqM3nb

* refactor(mobile): drop the scope member the identity key already carries

statusIdentityKey is `${hostId}\0${worktreeId}`, so listing worktreeId
beside it read as a third fence when it fences nothing new.

Claude-Session: https://claude.ai/code/session_01JNnE9qzUZMMnqpZWCqM3nb

* refactor(mobile): split the compare protocol out of the loaders hook

The outcome union, the attempt and the screen mapping are the compare
leg's own protocol, not the hook's: nothing in them reaches React. Moved
verbatim to mobile-branch-compare-outcome.ts with a unit pin for the
mapping, which only the hook's schedules covered before. The hook drops
from 283 to 230 lines against a 300 limit.

Claude-Session: https://claude.ai/code/session_01JNnE9qzUZMMnqpZWCqM3nb

* refactor(mobile): correct the joiner comment and narrow the compare sender

A joiner never receives the probe: its fn is never invoked, it awaits the
originating request's promise, and retire() clears inFlight so none can
join across a generation bump. The compare attempt takes the operation
sender the convention names rather than a whole RpcClient, which it only
ever used as that.

Claude-Session: https://claude.ai/code/session_01JNnE9qzUZMMnqpZWCqM3nb
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant