Repository navigation
[Spec #71] Mobile board & stage surface - #103
Conversation
Red-first for #96: exercises deriveMobileWorktreeStage/ buildWorktreeStageDerivationInput against desktop's fixed precedence (open PR -> review, unconsumed merged PR -> shipped, closed PR -> triage, open issue promotes only pre-work bases), the old-host absent-fields case (declared stage only, no fact annotation), and folder-workspace manual regime. Module does not exist yet; fails on import.
…dd mobile stage seam #96 — wire (Rule 1, optional-only): RuntimeWorktreePsSummary gains linkedIssueState (from the GitHub issue cache, keyed the same repoId::issueNumber/repoPath::issueNumber shape as the existing PR lookup) and consumedMergedPRNumbers, folded into both the git-worktree and folder-workspace branches of OrcaRuntime.getWorktreePs(). Absence stays absent (optional-spread idiom, no ?? null/[]). Mobile: extends Worktree (workspace-list-types.ts) with the same three optional facts, and adds mobile-stage-facts.ts — the wire-to-fact adapter plus deriveMobileWorktreeStage(), the single entry point later board/badge/action-sheet units read the effective stage through. Delegates to the shared deriveWorkflowStage engine; no reimplementation, no host-computed effective stage. Folder workspaces pass workspaceKind: 'folder' so the engine's existing manual-regime short-circuit applies untouched (D7).
…dels Pure models for ticket #98's mobile feature board screen: - mobile-stage-labels.ts: Record<WorkflowStage,string> label map (D9) - mobile-stage-board-card.ts: card essentials (name/repo/branch/PR state), gated through deriveMobileWorktreeStage (#96 seam) - mobile-stage-board-columns.ts: generic seven-stage column pre-seed, mirrors desktop buildFeatureBoardColumns; generic seam for #100 ghosts - mobile-stage-action-sheet-model.ts: offered stage actions incl. refused shipped, decided by the shared decideStageWrite guard (no rule copied) - mobile-stage-declaration.ts: worktree.set RPC wrapper with defensive stage_authority_refused handling (D2) Refs #98, #71
Red-first checkpoint: mobile-stage-labels.ts does not exist yet, getMobileWorkspaceLineageRoot/getGroupModeToolbarLabel are not exported yet, MobileGroupMode/WorkspaceViewSettings lack the 'stage' mode, and WorktreeListRow renders no stage badge yet. All new/extended assertions in this commit fail for those reasons (see command output in the unit summary). Refs #97
- mobile-stage-labels.ts: plain-English label map keyed off WorkflowStage (compiler-enforced exhaustiveness), plus the mobile 'No stage' label (D9/D8). - mobile-stage-facts.ts: narrow deriveMobileWorktreeStage's parameter to the minimal WorktreeStageFactsSource shape so any structural subset of Worktree (e.g. a list row item) can call the single entry point directly. - mobile-workspace-lineage.ts: add getMobileWorkspaceLineageRoot, mirroring desktop's getWorkflowStageLaneRoot (#28) — children never carry their own stage for section-membership purposes. - workspace-view-settings.ts: MobileGroupMode gains 'stage', mapped onto desktop's existing PersistedUIState groupBy value 'workflow-stage' (#45). - workspace-list-picker-options.ts: 'Stage' picker option + toolbar label. - workspace-list-sections.ts: 'stage' groupMode buckets by each worktree's ROOT ancestor's effective stage, in WORKFLOW_STAGE_IDS order with an unstaged 'No stage' section first; lineage nesting is unchanged. - WorktreeListRow.tsx: neutral, label-only stage badge (no per-stage color, per STYLEGUIDE) on every staged row, in every existing grouping mode, using the row's own effective stage (never the root's). Refs #97
Ticket #98 — mobile feature board screen: - app/h/[hostId]/board.tsx: thin route, registered in app/h/_layout.tsx's HostStack (title 'Board') - MobileStageBoardPanel.tsx: renders the seven-stage chip strip + swiped, snap-paged full-width columns (D5) over the pure column/card models; tap opens the session (worktree.activate + navigate, matching the existing pattern), long-press opens the stage action sheet (BottomDrawer + ActionSheetContent, delayLongPress 400 + medium haptic — no new sheet primitive) - MobileStageBoardCardRow.tsx: name/repo/branch/PR-state card, PR color via the existing prStateToken() vocabulary - BoardToolbarButton.tsx: shared toolbar entry point (embedded + phone toolbars) into the board — kept as its own component so index.tsx stays under its max-lines ratchet - mobile-stage-board-styles.ts: theme-token styles, no new colors Refs #98, #71
#97) - index.tsx: replace both inline groupMode-label ternary chains (only 4 modes handled, would have mislabeled 'stage' as 'PR') with getGroupModeToolbarLabel; net line count drops, staying under the app/h/*/index.tsx max-lines ratchet. - Split the new 'By stage' buildSections tests into a co-located workspace-list-sections.stage-grouping.test.ts: appending them to workspace-list-sections.test.ts pushed it 21 lines past the default 800-line max-lines budget, and AGENTS.md forbids bumping or disabling that ratchet. oxfmt reformatted the touched import block in workspace-list-sections.ts. Refs #97
# Conflicts: # mobile/src/worktree/mobile-stage-labels.test.ts # mobile/src/worktree/mobile-stage-labels.ts
D4: the pure ghost-candidate derivation (#35) was renderer-local at src/renderer/src/components/feature-board/feature-board-ghost-candidates.ts despite having no renderer imports. Move it to src/shared/feature-board/ghost-candidates.ts (git mv, test moved alongside) so mobile's #100 ghost cards can import the same derivation desktop uses, with no reimplementation and no re-export shim. Desktop behaviour is unchanged; the moved test's assertions are untouched apart from its own import path. Refs #71, #100
…sheet models Red-first tests for #99 (mobile workspace screen: stage row & PR row): - mobile-stage-row-model: stage label + fact-derivation explanation + shipped source annotation, mirroring desktop's explainWorkflowStageDerivation wording and the old-host (declared-stage, no fact claim) degrade case. - mobile-pr-row-model: PR number/state/token from a catalog linkedPR, null when absent. - mobile-session-stage-sheet: session stage row's action sheet built from #98's buildMobileStageActionOptions/runMobileStageAction, proving the round-trip and that selecting shipped performs no write. - mobile-session-pr-row-route: routes the PR row to the existing source-control hub (tab=pr), never a new screen. - mobile-session-workspace-row-fetch: cache-first + single-flight catalog lookup for the session screen's worktree row. - MobileSessionStageRow / MobileSessionPrRow: presentational row components. All new test files fail on missing modules (no implementation yet). Refs #99
…nd rows Implements the failing tests: stage-row explanation copy mirroring desktop's explainWorkflowStageDerivation, PR-row number/state model reusing prStateToken, the session stage sheet built from #98's buildMobileStageActionOptions/runMobileStageAction (no rule re-derived), the PR-row route via panelRouteDescriptor('pr'), a cache-first/single-flight worktree-row fetch, and the two presentational row components. Refs #99
…ack and detail fetch models Red-first for #100: these pure/RPC-wrapper models don't exist yet — the tests fail on module resolution because the behavior described in ticket #100 has not been implemented. mobile-ghost-dismissals.test.ts pins the D3 skew hazard: an old host's UiUpdate schema silently strips featureBoardGhostDismissals via zod .strip(), and dismissMobileGhost must verify by read-back rather than trust the request's own optimistic value. Refs #71, #100
… session screen Adds MobileSessionWorkspaceRows (container) + use-mobile-session-workspace-row (cache-first/single-flight fetch hook) and renders it from the session screen right below the top bar, gated off for synthetic (folder:/floating) routes that have no catalog entry. Renders nothing until the catalog row is known — no guessed stage, no fake PR claim (D6). Also: oxfmt formatting fixes on the two test files touched by an earlier formatting pass (mobile-session-stage-sheet.test.ts, mobile-stage-row-model.test.ts). Refs #99
… issue fetch models
Implements the pure/RPC-wrapper models pinned by the previous red commit:
- mobile-ghost-board-cards.ts: reuses the shared buildFeatureBoardGhostCandidates
(moved to src/shared by the D4 refactor) to place ghost rows in the same
{id, effectiveStage} shape buildMobileStageBoardColumns already accepts (#98).
- mobile-ghost-dismissals.ts: ui.get/ui.set (D3) with mandatory read-back
verification — an old host silently strips featureBoardGhostDismissals via
zod .strip(), so dismissMobileGhost never reports success unless the field
actually round-trips.
- mobile-ghost-issue-fetch.ts / mobile-ghost-issue-detail-fetch.ts: reuse the
existing github.listWorkItems (smart-source search) and github.workItemDetails
(PR sidebar) RPCs mobile already speaks — no new RPC method.
- mobile-ghost-detail-sheet-model.ts / mobile-ghost-labels.ts: plain-English
(D8) content builders for the tap-to-view sheet.
Refs #71, #100
#100) Wires the ghost-card model into the board screen: - use-mobile-ghost-board-state.ts orchestrates fetching each on-board repo's open issues + the host's persisted dismissals, derives ghost rows, and exposes the tap-to-view/dismiss/adopt actions — kept out of MobileStageBoardPanel.tsx so the screen stays a thin renderer (D10). - MobileGhostCardRow.tsx: a dashed-border, ghost-icon card visually distinct from a workspace card (STYLEGUIDE: no new color values), placed in the derivation-assigned column via the same buildMobileStageBoardColumns seam #98 built for this (mobile-stage-board-columns.ts). - MobileStageBoardPanel.tsx: tap opens a BottomDrawer/ActionSheetContent detail sheet (title, body, state) with Adopt/Dismiss; dismiss surfaces a D3 read-back failure honestly via Alert instead of silently succeeding; the poll refreshes dismissals each cycle so a desktop-side dismissal hides the ghost here too. - NewWorktreeModal.tsx: new optional initialGitHubWorkItem prop enters Adopt through the existing create-workspace-from-issue flow (selects the ghost's repo via the resolver's existing initialRepoId param, then seeds the composer through the same handleSmartGitHubItemSelect a Smart-source pick would use) instead of a parallel creation path. Once the workspace is created, the board declares it 'idea' (MOBILE_GHOST_ADOPTION_DECLARED_STAGE), mirroring desktop's buildFeatureBoardGhostGrabInput: creation always declares idea and lets facts govern the effective column. Refs #71, #100
The static-analysis job installs only root dependencies, so in that job react-test-renderer's types are unresolvable and `ReactTestRenderer | null` collapses to an error type, tripping type-aware no-redundant-type-constituents on our added lines. The union is idiomatic in this repo's older mobile tests, but the changed-code gate only scores added lines, so only new files are hit. Refs #71
…ailure Red-first for issue #71 review finding 1: loadMobileSessionWorkspaceRow's null return conflated an RPC failure with a confirmed catalog absence, and useMobileSessionWorkspaceRow's refresh() discarded the previously known row either way. These tests assert refresh() keeps the last-known row on failure and only clears it once the host confirms the worktree is gone.
…ails
loadMobileSessionWorkspaceRow returned null both when worktree.ps failed and
when the worktree was genuinely absent from the catalog. useMobileSessionWorkspaceRow's
refresh() then discarded a good cached/optimistic row on a transient RPC
failure, wiping the session screen's stage/PR rows.
loadMobileSessionWorkspaceRow now returns a discriminated result — { ok: true,
worktree } for a confirmed catalog read (worktree may be null, meaning
confirmed absent) versus { ok: false, message } for an RPC failure. refresh()
keeps the previously known row on ok: false and only replaces/clears it on
ok: true, per issue #71's D6 (absence caused by an error is unknown, never a
confirmed negative).
Refs #71.
…declare Red-first for issue #71 review finding 2: handleAdoptionCreated fires declareMobileWorktreeStage with no error handling. When it fails, the newly adopted workspace ends up with no declared stage and no governing fact, so buildMobileStageBoardCards silently drops it from the board. These tests assert the failure (and a defensive server-side refusal) surfaces an Alert the same way every other stage-write path in this PR does, and that a successful declare stays silent.
handleAdoptionCreated fired declareMobileWorktreeStage with no error handling. When that RPC failed, the newly adopted workspace ended up with no declared stage and no fact to govern it — buildMobileStageBoardCards skips any worktree whose effectiveStage is null, so the workspace silently disappeared from the board. handleAdoptionCreated now awaits the declare and surfaces a failure (or a defensive server-side refusal) with an Alert, matching every other stage-write path in this PR (mobile-stage-declaration.ts, MobileStageBoardPanel.tsx's handleSelectStageOption). Also fixes the test's own refusal-message expectation to assert the shared SHIPPED_STAGE_STEERING_MESSAGE constant rather than a stray hardcoded string. Refs #71.
Readiness: one question for a humanAll of spec #71's work is delivered and every ticket's acceptance criteria are met (see the PR
They are the derived-workspace-name assertions left behind by #88/#92 ( So: this PR cannot make that check green, and I did not edit those tests to force it. I have left the PR in draft rather than marking it ready over a red check. Your call:
One other thing worth a decision, noted in the PR body: the |
#88 made getWorkspaceSourceName carry the linked issue/PR number into the derived name, and #92 updated the desktop expectations but missed mobile — these five assertions have been red on main ever since. Mobile's resolveWorkItemAutoName is a thin delegate to that same shared function, and desktop now expects exactly this shape ('Issue 42 …', 'PR 91 …'), so the behaviour is intended and only the expectations were stale. Refs #71
Correction: the mobile red is fixed here, and no other branch was blocking itMy previous comment said So there was nothing to wait for. Fixed on this branch in
Disregard the "land that branch first" option in my earlier comment. |
…bile-board-stage-surface # Conflicts: # src/shared/feature-board/ghost-candidates.test.ts # src/shared/feature-board/ghost-candidates.ts
Summary
Makes the phone a stage-aware client of a paired host — not a sync peer. The workspace list
gains stage badges and a "By stage" grouping mode; a per-host feature board shows the stage columns
with the host's workspaces as cards, plus ghost cards for inbound GitHub issues; the workspace
screen gains a stage row and a PR row. Effective stage is computed on the phone with the shared
pure derivation engine, from facts the host already publishes plus two new optional wire fields.
Writes ride the existing agent-grade RPC path: the phone declares the six working stages and clear
through
worktree.set;shippedstays desktop-only and surfaces the standard steering message,while still appearing on the board via the merged-PR fact.
Spec & Tickets
Closes #71
Closes #96
Closes #97
Closes #98
Closes #99
Closes #100
Acceptance criteria
#96 — Mobile effective stage: shared derivation + catalog fact fields
linkedIssueState?: WorkflowIssueState,consumedMergedPRNumbers?: number[]onRuntimeWorktreePsSummary(src/shared/runtime-types.ts); optional-spread in bothgetWorktreePsbranches — no opcode, no negotiationmobile/src/worktree/mobile-stage-facts.tsdelegates toderiveWorkflowStagefromsrc/shared/stage-derivation/; host runs no derivationmobile-stage-facts.test.ts— one test per rule, incl. the negative case (implementing+ open issue staysimplementing)toEqual({ stage:'triage', reason:'declared-stage', factId:null })workspaceKind: 'folder'test →reason: 'folder-manual-regime'#97 — Workspace list: stage badges & "By stage" grouping
WorktreeListRow.tsxrenderer, so it is mode-independent;WorktreeListRow.test.ts'stage'inMobileGroupMode;workspace-list-sections.stage-grouping.test.tsderiveMobileWorktreeStage, testedgetMobileWorkspaceLineageRootmirrors desktop's root-ancestor rule (#28);mobile-workspace-lineage.test.ts#98 — Feature board screen: columns, cards, stage action sheet
mobile/app/h/[hostId]/board.tsx+MobileStageBoardPanel.tsx; all 7WORKFLOW_STAGE_IDSpre-seeded so empty columns persist (mobile-stage-board-columns.test.ts)mobile-stage-board-card.test.ts; PR state via the existingpr-state-token.tsvocabularyworktree.activate+ session route;ActionSheetContentwithdelayLongPress={400}mobile-stage-declaration.test.tsassertsworktree.setparams{ worktree:'id:…', workflowStage }expect(declare).not.toHaveBeenCalled(); message imported asSHIPPED_STAGE_STEERING_MESSAGE, never retypedeffectiveStageonly#99 — Workspace screen: stage row & PR row
mobile-stage-row-model.tsbuilds copy fromDerivedWorkflowStage.reason, mirroring desktop'sexplainWorkflowStageDerivationwording; includes shipped-source ("set by merged PR #N" / "set by you")buildMobileStageActionOptions/runMobileStageAction— holds by construction, not by re-derivationmobile-session-pr-row-route.tsroutes to the source-control hub withtab=pr; no new PR screendeclared-stagetest — no fact annotation rendered#100 — Ghost cards: render, adopt from issue, synced dismissals
MobileGhostCardRow.tsx(dashed border + Ghost icon, theme tokens only); rows pass through #98's generic column buildermobile-ghost-detail-sheet-model.ts+BottomDrawer/ActionSheetContent; body via the samegithub.workItemDetailsRPC the PR sidebar usesinitialGitHubWorkItemprop onNewWorktreeModalreusinghandleSmartGitHubItemSelect; declaresideapost-create, matching desktop's grabui.setonfeatureBoardGhostDismissals, which #29 already syncsfetchMobileGhostDismissalsviaui.get, testedui(never the optimistic value) ⇒{kind:'unsupported'}; tested with a client that strips the keyChanges by theme
Wire (Rule 1 only). Two new optional fields on the worktree catalog payload, folded into
both the git-worktree and folder-workspace branches of
getWorktreePs. No new opcode, no capabilitynegotiation. The linked-issue state is read from the host's existing
githubCache.issue;consumed-merge ids come from persisted worktree meta.
Derivation on the phone.
mobile/src/worktree/mobile-stage-facts.tsis the single entry point(
deriveMobileWorktreeStage) every mobile surface reads through; it adapts one catalog row into theshared engine's input. No host-computed
effectiveStagefield, no reimplementation.Workspace list.
'stage'group mode, root-ancestor lane membership, and a neutral label-onlystage badge on the shared row renderer.
Board. A per-host screen with horizontally snap-paged stage columns and a stage chip strip, over
pure column/card/action-sheet models. Ghost cards ride the same generic column builder.
Workspace screen. A stage row (effective stage + fact-governed explanation) and a PR row routing
to the existing source-control PR tab.
Shared code move. The ghost-candidate derivation moved from the renderer into
src/shared/sothe phone and desktop genuinely share it.
Tests changed rather than added
src/shared/feature-board/ghost-candidates.test.ts— relocated fromsrc/renderer/src/components/feature-board/feature-board-ghost-candidates.test.ts. Verifiedbyte-identical apart from its one import line; the implementation file likewise differs only in
its
WorkflowStageimport path. Desktop behaviour unchanged.mobile/src/worktree/workspace-view-settings.test.ts— an existing group-mode round-trip loopgained
'stage', plus a new mapping test. A strict expansion; no existing expected value changed.mobile/src/worktree/workspace-list-sections.test.ts— untouched. The new "By stage" testswent into a separate
workspace-list-sections.stage-grouping.test.tsbecause appending them wouldhave breached the file's
max-linesbudget, and bumping that ratchet is forbidden.Decisions taken while building (Problem → Resolution)
worktree.sethard-codescallerKind: 'agent', and theguard's own comment says mobile human surfaces "stay fail-closed until the board specs land",
which reads as an invitation to lift it here. The spec explicitly says the opposite — writes ride
the existing agent-grade path — so
stage-write-authority.ts,worktree.set,folder-workspace.tsand
mcp-stage-tools.tsare untouched, and the phone refusesshippedclient-side and handles aserver refusal defensively.
ui.get/ui.setalready carryfeatureBoardGhostDismissalsin their schema, so a new method would have been a wire change fornothing. The real hazard is subtler: an old host's zod
.strip()drops the unknown key and stillreturns
ok. Hence read-back verification.src/shared/. The spec says "the same shared derivation as desktop",but the module was renderer-local. Moved (10 call sites updated) rather than duplicated.
duplicate Mobile workspace list: stage badges & "By stage" grouping #97's "By stage" list. Resolved as one full-width stage per swipe-paged column plus a
chip strip — coarse gestures only, all seven stages always present.
agentWaitprecedent: the host's'unknown'PR state maps to no fact; absent consumed-merge ids passundefined, not[]; afailed
ui.getreturnsnullrather than an empty dismissal set.in the list's unstaged section rather than as a phantom column.
Known gaps (deliberate, not defects)
main, thehost derives
specShapeandparentIssueNumberfrom the issue body server-side (Classify spec / ticket / idea ghosts from the issue body so Idea stops mixing spec sub-tickets in #94/[Spec #94] Classify spec / ticket / idea ghosts from the issue body #102) on thesame
github.listWorkItemspath mobile uses, so the phone now inherits sub-ticket exclusion andspec/idea classification for free. What remains uncovered is the older mechanism: mobile still
passes an empty
referencedIssueNumbers, so an issue referenced only as a bare#Ninside a specbody — with no
## Parentheading — can still surface as a ghost on the phone. Documented in themodule.
on the host shows no ghosts on mobile yet, where desktop's project scope could include it.
MobileStageBoardPanel,MobileSessionWorkspaceRows, ghost wiring), matching this repo's existing convention for screencontainers. All decision logic sits in tested pure models.
postinstallnormally produces(
terminal-webview-engine.generated.ts,mermaid-webview-engine.generated.ts). In a freshworktree without an install, run
node scripts/build-terminal-webview-engine.mjsandnode scripts/build-mermaid-webview-engine.mjsfirst.The mobile suite's pre-existing red, now fixed here
mobile/pnpm testhad 5 tests failing on a clean checkout ofmain, and this branch now fixesthem, so the mobile suite is fully green (480 files / 3798 tests, 0 failures).
Cause: #88 made the shared
getWorkspaceSourceNamecarry the linked issue/PR number into thederived name. #92 updated the desktop expectations to the new shape (
'Issue 42 Restore checkout polish','PR 91 …') but missed the mobile ones. Mobile'sresolveWorkItemAutoNameis a thindelegate to that same shared function, so its behaviour was already correct and only these five
assertions were stale:
composer-linked-work-item.test.ts—'fix-the-login-bug'→'issue-3-fix-the-login-bug'source-workspace-create.test.ts—'Bug'→'Issue 7 Bug'workspace-create-params.test.ts—'Fix mobile tasks'→'PR 123 Fix mobile tasks'workspace-create-params.test.ts—'Investigate login'→'Issue 88 Investigate login'workspace-create-params.test.ts—'Port drawer'→'MR 7 Port drawer'These are expectation updates to match intended product behaviour, mirroring #92 for the surface it
missed — no assertion was weakened and no behaviour changed.
Other CI notes
src/main/skills/skill-install-lock.test.ts > publishes a complete candidate atomically when acquisitions overlapand onetests node 24shard (orca-runtime.test.ts, a 30s timeout) eachfailed once during this run and passed on rerun. Both are timing flakes: the first was red on this
PR's empty baseline commit, and the second is in a terminal-worker-resume test this branch does
not touch.
Merged
main(conflict resolution worth reviewing)mainlanded #94 (spec/ticket/idea ghost classification) directly into the ghost-candidates modulethis PR moved to
src/shared/— a move-vs-edit conflict. Resolved by taking main's newercontent at the new shared location and re-fixing its import paths, so every part of #94 is preserved:
specShape,parentIssueNumber,childTicketCount,isSpecShapedIssue, the unconditionalsub-ticket exclusion, and
parseReferencedIssueNumbersdelegating tospec-ticket-shape. Nothing wasresolved toward this branch's side.
Also fixed:
FeatureBoardGhostCard.test.tsx— added onmainafter this branch's move — stillimported the old renderer path, which git could not flag as a conflict.
Verified on the merge result: root and mobile typechecks clean;
mobile/480 files / 3798 tests, 0failures;
src/shared/feature-board+src/renderer/.../feature-board+src/main/runtime414 files/ 4969 tests, 0 failures; changed-code quality 0 new findings across 99 files; root lint exit 0.
Three feature-board files report as unformatted; they are already unformatted on
main, so theywere left untouched rather than swept into this PR.
QA plan
on every staged row; switching Group to Stage sections the list with No stage first,
then Idea → Exploring → Spec → Implementing → Review → Shipped → Triage.
chip strip; counts in the strip match the cards; an empty stage still shows its column.
pick
Implementing→ the card moves to that column and desktop reflects the same stage.the board UI." appears and the card does not move.
manual move.
else; its stage row explains "Open pull request #N keeps the stage at Review."
PR view; a workspace with no linked PR shows no PR claim.
and state show with Adopt and Dismiss.
workspace and the ghost is gone.
dismissed on desktop and on a second machine.
stage row all show the declared stage, nothing claims a fact governs it, and nothing crashes.