Repository navigation
refactor(client-runtime): share launch reading, child requests and sprint PRs with mobile - #601
Conversation
…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>
NoahHendrickson
left a comment
There was a problem hiding this comment.
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.
- 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,pendingRequestForandchildRequestPendingOf. They belong inforkThreadLaunches.test.tsandforkChildRequests.test.ts. That would also take about 150 lines out of a 956-line web test file whose job is now timeline placement. (ThethreadPullRequestStage/threadRowLiveStateblocks have the same problem but date from #600. Worth taking in the same pass.) sprintPullRequests.logic.test.tsis 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 callsmakeThreadFixturefor an id and then overwritesupdatedAt,source.tagsandpullRequestswith anas nevercast.forkBotDigestLinks.test.tsalready buildsEnvironmentThreadShells inside the package, so this can becomeforkSprintPullRequests.test.tsnext to its module.- Contract types now that the code sits next to them (
forkChildRequests.ts).AnsweredQuestionItemand the inline approval shape are hand-rolled copies of theuser_input_request/approval_requestmembers ofOrchestrationV2TurnItem.isQuestionItemasserts the whole shape after checking onlytype. Moved code was left as it was, which is fair, but client-runtime is whereExtract<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
left a comment
There was a problem hiding this comment.
Code review of commit cf176a62bf38ef94c30d1ea23a7de40e68ed50bd against base 56d3924fea.
I found no correctness issues. I compared each moved block with the code it replaced:
forkThreadLaunches.tsmatches the removed parts ofthreadLaunch.logic.ts.forkChildRequests.tsmatches the removed parts ofchildAnswers.ts,childRequestControls.tsandforkThreadHost.ts.forkSprintFileEditor.tsmatches what was split out offorkSprintFiles.ts.
The moves are line-for-line, apart from new export keywords and import paths. Other things I checked:
- The two
toSorted→.sortchanges are safe. One sorts the fresh array that.filter(...)returns, and the other sorts the localrows. Neither array is visible to anyone else, and the stable sort that the stage-order comment relies on still holds. - Hermes support.
findLastis not flagged byno-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
filesandverifylists now point at the new paths.
Two small notes are inline:
- Guard coverage (nit). The sprint-free guard in
forkSprints.test.ts(around line 418) checksthreadLaunch.logic.tsand the thread cards. The launch-reading code that used to sit in that file now lives inforkThreadLaunches.ts, which the guard doesn't read. Code inside client-runtime would also import./forkSprint….tsby 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 addingforkThreadLaunches.tsandforkChildRequests.tsto that loop, with a/forkSprint/check. - Duplicate import (nit).
ForkThreadRequestCard.tsximports fromfork-child-requestson 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
Thread transfer impact✅ Thread transfer remains within every enforced ceiling.
Other scenariosAll 64 scenario measurements match All 64 scenario measurements
Baseline: Scenario and decoded snapshot size10 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.
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>
|
Both reviews are addressed in f8dba52, and each inline thread has a reply.
Checks: 🤖 Claude Opus 5.5 ( |
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 fromthreadLaunch.logic.ts.ForkThreadLaunchandforkThreadLaunchFromToolItem, which read a launch from itst3_thread_launchcall.forkThreadLaunchesEqualandthreadLaunchActivityLine.linkedThreadIds, which reads the thread ids a reply's chips name.threadMergeRequestText.forkChildRequests:ForkRequestAnswer, previously inforkThreadHost.ts.pendingRequestForandchildRequestPendingOf, fromchildRequestControls.ts.childQuestionAnswers,childApprovalAnswersandDECISION_WORDS, fromchildAnswers.ts, along with their test. These are now typed onOrchestrationV2TurnIteminstead of hand-rolled shapes.RequestStatus, which web'schildRequestControls.tsnow imports.forkSprintPullRequests: the whole ofsprintPullRequests.logic.ts. Its test moved with it, using an in-package thread builder. Hermes has notoSortedand the client-runtime lint forbids it, so its twotoSortedcalls became.sort. Both run on arrays the function itself builds, so nothing else sees the mutation.forkSprintFileEditor: the editor view (sprintFileEditorView,nextSprintFileDraftandSprintFileDraft), split out offorkSprintFilesas 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:
placeThreadRowsUnderReplies,forkLaunchedThreads,lastThreadReportIds,withoutHeldLaunchesandForkThreadRow. They are built on web'sMessagesTimelineRowandTimelineEntrykinds: 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 andlinkedThreadIds.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 importsfork-sprint-filesyet.Tests: the pure test blocks for launches, child requests, the PR stage and (from 1a) work reports moved from web's
threadLaunch.logic.test.tsnext to their modules. ThethreadRowLiveStateblock stays in web because it runs through web'sthreadRowTurnOf. The sprint-free guard now also readsforkThreadLaunches.tsandforkChildRequests.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:changedpasses, and so donode .fork/lint-owned.mjsandnode .fork/design-lint.mjs --check.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