Skip to content

refactor(client-runtime): share launch reading, child requests and sprint PRs with mobile - #601

Merged
NoahHendrickson merged 2 commits into
customfrom
t3/ios-sprints-shared-logic-1b
Nov 29, 2026
Merged

NoahHendrickson merged 2 commits into
customfrom
t3/ios-sprints-shared-logic-1b

Conversation

@NoahHendrickson

@NoahHendrickson NoahHendrickson commented Nov 29, 2026 •

Copy link
Copy Markdown
Owner

This is step 1b of the iOS sprints spec, following #600. More of the pure sprint logic moves out of apps/web/src/custom/ so the phone can use it. Web behaviour does not change.

Moved into packages/client-runtime/src/fork*.ts. Each module is exported as @t3tools/client-runtime/fork-*:

  • forkThreadLaunches: comes from threadLaunch.logic.ts.
    • ForkThreadLaunch and forkThreadLaunchFromToolItem, which read a launch from its t3_thread_launch call.
    • forkThreadLaunchesEqual and threadLaunchActivityLine.
    • linkedThreadIds, which reads the thread ids a reply's chips name.
    • threadMergeRequestText.
  • forkChildRequests:
    • ForkRequestAnswer, previously in forkThreadHost.ts.
    • pendingRequestFor and childRequestPendingOf, from childRequestControls.ts.
    • childQuestionAnswers, childApprovalAnswers and DECISION_WORDS, from childAnswers.ts, along with their test. These are now typed on OrchestrationV2TurnItem instead of hand-rolled shapes.
    • RequestStatus, which web's childRequestControls.ts now imports.
  • forkSprintPullRequests: the whole of sprintPullRequests.logic.ts. Its test moved with it, using an in-package thread builder. Hermes has no toSorted and the client-runtime lint forbids it, so its two toSorted calls became .sort. Both run on arrays the function itself builds, so nothing else sees the mutation.
  • forkSprintFileEditor: the editor view (sprintFileEditorView, nextSprintFileDraft and SprintFileDraft), split out of forkSprintFiles as the refactor(client-runtime): share sprint and coordinator logic with mobile #600 review asked. The library helpers keep their 1a path, @t3tools/client-runtime/fork-sprint-files.

Stays in web:

  • The timeline placement: placeThreadRowsUnderReplies, forkLaunchedThreads, lastThreadReportIds, withoutHeldLaunches and ForkThreadRow. They are built on web's MessagesTimelineRow and TimelineEntry kinds: work groups, turn and attempt folds, and streaming copy. The mobile feed will place launches over its own rows in spec step 4, and can reuse the launch reading and linkedThreadIds.
  • Every React hook and atom.

What 1a callers see: all 1a export paths and names are unchanged, except that the three editor names now come from fork-sprint-file-editor. No mobile code imports fork-sprint-files yet.

Tests: the pure test blocks for launches, child requests, the PR stage and (from 1a) work reports moved from web's threadLaunch.logic.test.ts next to their modules. The threadRowLiveState block stays in web because it runs through web's threadRowTurnOf. The sprint-free guard now also reads forkThreadLaunches.ts and forkChildRequests.ts.

Also updated: the manifest paths and prose in .fork/customizations.yaml. The untranslated-copy ratchet baseline drops from 972 to 965.

Checks:

  • vp run check:changed passes, and so do node .fork/lint-owned.mjs and node .fork/design-lint.mjs --check.
  • Fork guards plus the threadLaunchCards tests: 1044 pass.
  • client-runtime fork tests: 140 pass.
  • The mobile suite passes 4100 tests.
  • A throwaway mobile file that imported the new modules typechecked.

Reviewed with sol-loop: 2 rounds with GPT-6.1 Sol (gpt-6.1-sol) on high. Sol verdict: approved.


🤖 Signed: Claude Opus 5.5 (claude-opus-5-5) via Claude Code
🤖 Reviewer: GPT-6.1 Sol (gpt-6.1-sol) via Codex, two review rounds with no findings

🤖 Generated with Claude Code

…rint PRs with mobile

Step 1b of the iOS sprints spec. Move the row-agnostic launch reading
(forkThreadLaunches), the child request reads (forkChildRequests), the sprint PR
list (forkSprintPullRequests) and the sprint file editor view
(forkSprintFileEditor, split from forkSprintFiles) into client-runtime. Web
keeps its timeline placement and hooks and imports these; no behaviour change.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@github-actions github-actions Bot added size:XL vouch:trusted Author is trusted by repo permissions or the VOUCHED list. labels Nov 29, 2026

@NoahHendrickson NoahHendrickson left a comment

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

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

Code quality review of cf176a62bf.

The move itself is clean. Code moves verbatim, web keeps only the timeline placement and the hooks, the .sort calls only touch arrays the function builds itself, no file crosses 1k lines, and the fork-sprint- prefix guard from #600 already covers the two new sprint modules. One thing stops this from being a real boundary, though. The shared modules' tests mostly stayed in web. The PR moves childAnswers.test.ts with its code, but it leaves every other test of the moved logic behind. So the phone's shared logic is only tested by the web suite, and the client-runtime "107 pass" figure does not cover forkThreadLaunches or forkSprintPullRequests at all. Details are inline.

  1. Move the pure tests with their code (threadLaunch.logic.test.ts). These blocks test client-runtime functions and import nothing from web: forkThreadLaunchFromToolItem, threadLaunchActivityLine, threadMergeRequestText, pendingRequestFor and childRequestPendingOf. They belong in forkThreadLaunches.test.ts and forkChildRequests.test.ts. That would also take about 150 lines out of a 956-line web test file whose job is now timeline placement. (The threadPullRequestStage / threadRowLiveState blocks have the same problem but date from #600. Worth taking in the same pass.)
  2. sprintPullRequests.logic.test.ts is now named after a file that no longer exists. The stated reason for keeping it in web is that it uses a web fixture, but it only calls makeThreadFixture for an id and then overwrites updatedAt, source.tags and pullRequests with an as never cast. forkBotDigestLinks.test.ts already builds EnvironmentThreadShells inside the package, so this can become forkSprintPullRequests.test.ts next to its module.
  3. Contract types now that the code sits next to them (forkChildRequests.ts). AnsweredQuestionItem and the inline approval shape are hand-rolled copies of the user_input_request / approval_request members of OrchestrationV2TurnItem. isQuestionItem asserts the whole shape after checking only type. Moved code was left as it was, which is fair, but client-runtime is where Extract<OrchestrationV2TurnItem, { type: "user_input_request" }> is the natural type, and the only caller passes real projection items. That would remove both local types and the type guard that claims more than it checks.

Small: ForkThreadRequestCard.tsx imports @t3tools/client-runtime/fork-child-requests twice, so merge those into one import. RequestStatus is now declared in both childRequestControls.ts and forkChildRequests.ts, so export it once from the shared module.

Not approving. Items 1 and 2 decide whether this is a real shared boundary, and both are mechanical moves.


🤖 Signed: Claude Opus 5.5 (claude-opus-5-5) via Claude Code

@NoahHendrickson NoahHendrickson left a comment

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

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

Code review of commit cf176a62bf38ef94c30d1ea23a7de40e68ed50bd against base 56d3924fea.

I found no correctness issues. I compared each moved block with the code it replaced:

  • forkThreadLaunches.ts matches the removed parts of threadLaunch.logic.ts.
  • forkChildRequests.ts matches the removed parts of childAnswers.ts, childRequestControls.ts and forkThreadHost.ts.
  • forkSprintFileEditor.ts matches what was split out of forkSprintFiles.ts.

The moves are line-for-line, apart from new export keywords and import paths. Other things I checked:

  • The two toSorted → .sort changes are safe. One sorts the fresh array that .filter(...) returns, and the other sorts the local rows. Neither array is visible to anyone else, and the stable sort that the stage-order comment relies on still holds.
  • Hermes support. findLast is not flagged by no-hermes-unsupported-apis, and client-runtime already uses it elsewhere.
  • Leftover imports. Nothing still imports the removed exports from their old web paths.
  • The manifest files and verify lists now point at the new paths.

Two small notes are inline:

  1. Guard coverage (nit). The sprint-free guard in forkSprints.test.ts (around line 418) checks threadLaunch.logic.ts and the thread cards. The launch-reading code that used to sit in that file now lives in forkThreadLaunches.ts, which the guard doesn't read. Code inside client-runtime would also import ./forkSprint….ts by relative path, and the guard's @t3tools/client-runtime/fork-sprint- check can't see that. If thread cards are meant to stay sprint-free, consider adding forkThreadLaunches.ts and forkChildRequests.ts to that loop, with a /forkSprint/ check.
  2. Duplicate import (nit). ForkThreadRequestCard.tsx imports from fork-child-requests on two separate lines.

CI was still pending when I reviewed, so I didn't re-run tests locally.


🤖 Reviewed by Claude Opus 5.5 (claude-opus-5-5) via Claude Code

@github-actions

github-actions Bot commented Nov 29, 2026 •

Copy link
Copy Markdown

Thread transfer impact

✅ Thread transfer remains within every enforced ceiling.

ℹ️ The exact PR base did not have a successful artifact. Baseline uses the latest successful main measurement shown below.

Provider Metric Main baseline This PR Impact PR ceiling
Codex Total thread wire 5.0 KiB 5.0 KiB 0 B (0.0%) 6.8 KiB ✅
Codex Thread snapshot wire 3.8 KiB 3.8 KiB 0 B (0.0%) 4.9 KiB ✅
Codex Live turn WebSocket wire 1.2 KiB 1.2 KiB 0 B (0.0%) 2.0 KiB ✅
Codex Live turn WebSocket decoded 21.5 KiB 21.5 KiB 0 B (0.0%) 24.4 KiB ✅
Codex Live turn messages 1 1 0 (0.0%) 8 ✅
Claude Total thread wire 5.0 KiB 5.0 KiB 0 B (0.0%) 6.8 KiB ✅
Claude Thread snapshot wire 3.8 KiB 3.8 KiB 0 B (0.0%) 4.9 KiB ✅
Claude Live turn WebSocket wire 1.2 KiB 1.2 KiB 0 B (0.0%) 2.0 KiB ✅
Claude Live turn WebSocket decoded 21.9 KiB 21.9 KiB 0 B (0.0%) 24.4 KiB ✅
Claude Live turn messages 1 1 0 (0.0%) 8 ✅

Other scenarios

All 64 scenario measurements match main.

All 64 scenario measurements
Provider Scenario Metric Main baseline This PR Impact PR ceiling
Codex short turn resume WebSocket decoded 10.5 KiB 10.5 KiB 0 B (0.0%) 12.7 KiB ✅
Codex short turn resume WebSocket messages 2 2 0 (0.0%) 2 ✅
Codex long turn running, cold open HTTP decoded 281.7 KiB 281.7 KiB 0 B (0.0%) 302.7 KiB ✅
Codex long turn running, cold open rows 75 75 0 (0.0%) 75 ✅
Codex long turn running, history page HTTP decoded 92.4 KiB 92.4 KiB 0 B (0.0%) 107.4 KiB ✅
Codex long turn running, history page rows 75 75 0 (0.0%) 75 ✅
Codex long turn finished, cold open HTTP decoded 381.5 KiB 381.5 KiB 0 B (0.0%) 410.2 KiB ✅
Codex long turn finished, cold open rows 151 151 0 (0.0%) 151 ✅
Codex long turn finished, socket cold open WebSocket decoded 381.6 KiB 381.6 KiB 0 B (0.0%) 410.2 KiB ✅
Codex long turn finished, socket cold open WebSocket messages 2 2 0 (0.0%) 2 ✅
Codex long turn finished, socket cold open rows 151 151 0 (0.0%) 151 ✅
Codex long turn finished, work page HTTP decoded 186.2 KiB 186.2 KiB 0 B (0.0%) 200.2 KiB ✅
Codex long turn finished, work page rows 150 150 0 (0.0%) 150 ✅
Codex idle thread resume WebSocket decoded 65 B 65 B 0 B (0.0%) 200 B ✅
Codex idle thread resume WebSocket messages 1 1 0 (0.0%) 1 ✅
Codex fleet shell snapshot HTTP decoded 42.4 KiB 42.4 KiB 0 B (0.0%) 53.7 KiB ✅
Codex fleet shell snapshot rows 27 27 0 (0.0%) 27 ✅
Codex fleet shell subscribe WebSocket decoded 65 B 65 B 0 B (0.0%) 200 B ✅
Codex fleet shell subscribe WebSocket messages 1 1 0 (0.0%) 1 ✅
Codex fleet shell resume check HTTP decoded 18 B 18 B 0 B (0.0%) 100 B ✅
Codex fleet shell resume check rows 0 0 0 0 ✅
Codex stale shell reload HTTP decoded 42.4 KiB 42.4 KiB 0 B (0.0%) 53.7 KiB ✅
Codex stale shell reload rows 27 27 0 (0.0%) 27 ✅
Codex stale shell resume WebSocket decoded 140 B 140 B 0 B (0.0%) 400 B ✅
Codex stale shell resume WebSocket messages 2 2 0 (0.0%) 2 ✅
Codex stale todo list cold open HTTP decoded 72.4 KiB 72.4 KiB 0 B (0.0%) 83.0 KiB ✅
Codex stale todo list cold open rows 75 75 0 (0.0%) 75 ✅
Codex stale todo list cold open nodes 2 2 0 (0.0%) 4 ✅
Codex stale todo list cold open subagents 2 2 0 (0.0%) 4 ✅
Codex stale todo list cold open plans 1 1 0 (0.0%) 2 ✅
Codex stale todo list cold open providerTurns 1 1 0 (0.0%) 2 ✅
Codex stale todo list cold open checkpoints 1 1 0 (0.0%) 2 ✅
Claude short turn resume WebSocket decoded 10.6 KiB 10.6 KiB 0 B (0.0%) 12.7 KiB ✅
Claude short turn resume WebSocket messages 2 2 0 (0.0%) 2 ✅
Claude long turn running, cold open HTTP decoded 283.3 KiB 283.3 KiB 0 B (0.0%) 302.7 KiB ✅
Claude long turn running, cold open rows 75 75 0 (0.0%) 75 ✅
Claude long turn running, history page HTTP decoded 93.4 KiB 93.4 KiB 0 B (0.0%) 107.4 KiB ✅
Claude long turn running, history page rows 75 75 0 (0.0%) 75 ✅
Claude long turn finished, cold open HTTP decoded 384.2 KiB 384.2 KiB 0 B (0.0%) 410.2 KiB ✅
Claude long turn finished, cold open rows 151 151 0 (0.0%) 151 ✅
Claude long turn finished, socket cold open WebSocket decoded 384.3 KiB 384.3 KiB 0 B (0.0%) 410.2 KiB ✅
Claude long turn finished, socket cold open WebSocket messages 2 2 0 (0.0%) 2 ✅
Claude long turn finished, socket cold open rows 151 151 0 (0.0%) 151 ✅
Claude long turn finished, work page HTTP decoded 188.1 KiB 188.1 KiB 0 B (0.0%) 200.2 KiB ✅
Claude long turn finished, work page rows 150 150 0 (0.0%) 150 ✅
Claude idle thread resume WebSocket decoded 66 B 66 B 0 B (0.0%) 200 B ✅
Claude idle thread resume WebSocket messages 1 1 0 (0.0%) 1 ✅
Claude fleet shell snapshot HTTP decoded 43.0 KiB 43.0 KiB 0 B (0.0%) 53.7 KiB ✅
Claude fleet shell snapshot rows 27 27 0 (0.0%) 27 ✅
Claude fleet shell subscribe WebSocket decoded 66 B 66 B 0 B (0.0%) 200 B ✅
Claude fleet shell subscribe WebSocket messages 1 1 0 (0.0%) 1 ✅
Claude fleet shell resume check HTTP decoded 18 B 18 B 0 B (0.0%) 100 B ✅
Claude fleet shell resume check rows 0 0 0 0 ✅
Claude stale shell reload HTTP decoded 43.0 KiB 43.0 KiB 0 B (0.0%) 53.7 KiB ✅
Claude stale shell reload rows 27 27 0 (0.0%) 27 ✅
Claude stale shell resume WebSocket decoded 140 B 140 B 0 B (0.0%) 400 B ✅
Claude stale shell resume WebSocket messages 2 2 0 (0.0%) 2 ✅
Claude stale todo list cold open HTTP decoded 73.4 KiB 73.4 KiB 0 B (0.0%) 83.0 KiB ✅
Claude stale todo list cold open rows 75 75 0 (0.0%) 75 ✅
Claude stale todo list cold open nodes 2 2 0 (0.0%) 4 ✅
Claude stale todo list cold open subagents 2 2 0 (0.0%) 4 ✅
Claude stale todo list cold open plans 1 1 0 (0.0%) 2 ✅
Claude stale todo list cold open providerTurns 1 1 0 (0.0%) 2 ✅
Claude stale todo list cold open checkpoints 1 1 0 (0.0%) 2 ✅

Baseline: ffc58d3 · PR result: f8dba52 · Source CI: success

Scenario and decoded snapshot size

10 historical turns, 5 command tools per turn, 878.9 KiB retained MCP result per historical turn, and a 1.05 MiB retained result in the measured turn.

  • Codex decoded thread snapshot: 108.5 KiB
  • Claude decoded thread snapshot: 108.8 KiB

Updated in place by a trusted workflow. PR artifacts are strictly validated and never executed.

… package

Move the pure launch, child-request, PR-stage, work-report and sprint PR tests
next to their client-runtime modules; type the child answer readers on
OrchestrationV2TurnItem; share RequestStatus; extend the sprint-free guard to
the shared launch and request files.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@NoahHendrickson

Copy link
Copy Markdown
Owner Author

Both reviews are addressed in f8dba52, and each inline thread has a reply.

  • The pure tests moved next to their modules, along with the sprint PR test, which now uses an in-package builder. client-runtime now runs 140 fork tests, up from 107.
  • The answer readers are typed on OrchestrationV2TurnItem, and RequestStatus is declared once.
  • The duplicate import is merged, and the sprint-free guard now covers the shared launch and request files.
  • The untranslated-copy ratchet baseline drops from 972 to 965, since the moved tests' fixture strings no longer count against web.

Checks: vp run check:changed, lint-owned and design-lint pass. The fork guards plus the threadLaunchCards tests pass (1044), and the mobile suite passes (4100). Sol round 2 (GPT-6.1 Sol, high) approved with no findings.

🤖 Claude Opus 5.5 (claude-opus-5-5) via Claude Code

@NoahHendrickson
NoahHendrickson merged commit 4f8a6f0 into custom Nov 29, 2026
33 checks passed
@NoahHendrickson
NoahHendrickson deleted the t3/ios-sprints-shared-logic-1b branch November 29, 2026 19:37
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

size:XL vouch:trusted Author is trusted by repo permissions or the VOUCHED list.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants