Skip to content

refactor(mobile): split tasks route into focused modules - #17438

Merged
nwparker merged 7 commits into
stablyai:mainfrom
nwparker:nwparker/refactor-mobile-app-h-hostId-tasks.tsx
Aug 30, 2026
Merged

nwparker merged 7 commits into
stablyai:mainfrom
nwparker:nwparker/refactor-mobile-app-h-hostId-tasks.tsx

Conversation

@nwparker

@nwparker nwparker commented Aug 30, 2026 •

Copy link
Copy Markdown
Contributor

ELI5

The mobile Tasks screen was one enormous file. This keeps the same screen and behavior, but organizes its state, actions, projections, drawers, lists, and styles into small task-focused modules so the route stays easy to navigate and lintable.

What Changed

  • Reduced mobile/app/h/[hostId]/tasks.tsx to a 77-line composition of ordered hooks and the legacy surface.
  • Extracted provider loading, pagination, GitHub Projects, detail actions, workspace creation, Linear actions, picker projections, and connection presentation into named modules under mobile/src/tasks/.
  • Split the rendered surfaces and styles into focused files, preserving existing comments and behavior.
  • Removed the app/h/*/tasks.tsx max-lines override and its ratchet entry.
  • Added source-parity characterization coverage for hook order, execution statements, semantics, render tokens, and styles.

Why

The route exceeded the repository's max-line budget by several orders of magnitude. Focused modules make ownership and review boundaries explicit while preserving the existing hook and render order.

Linked Issue

No issue was provided for this refactor.

Visual Proof

N/A — this is a behavior-preserving module split; the rendered UI is intentionally unchanged. The local Orca emulator was not running for a screenshot capture.

Testing

  • pnpm lint ✅
  • pnpm tc ✅
  • pnpm check:max-lines-ratchet ✅
  • Targeted oxlint over the route and extracted task modules ✅
  • Mobile-only Vitest/typecheck could not run because this worktree does not have the mobile Expo dependencies installed; root typecheck and lint completed successfully.
  • Platforms exercised locally: macOS host; no SSH/Linux/Windows runtime changes.

AI Disclosure

Review

The split keeps execution order explicit through sequential hook stages and preserves relay recovery presentation, provider support, hosted review actions, project/task drawers, and workspace creation paths. No RPC wire contracts, process execution boundaries, SSH semantics, shortcuts, or platform-specific behavior were changed.

Agent skill upstream boundary

  • Not applicable

Notes

Security, cross-platform path/shortcut behavior, SSH/remote semantics, provider compatibility, and performance are unchanged by this structural refactor.

Checklist

  • I explained what changed and why (including ELI5)
  • Before/after screenshots or videos attached for UI changes, or N/A with reason
  • Self-reviewed for correctness, security, and performance
  • Cross-platform, SSH/remote, and path/shortcut impact considered (or N/A)
  • pnpm test and pnpm build pass (not run locally; CI will cover)

Performance Measurement

This is a behavior-preserving module split, not a performance optimization. Source-parity and render-token characterization checks keep the route’s output and execution semantics unchanged; no runtime speedup is claimed (N/A).

User-Facing Trade-offs

None. The Tasks screen, hook order, provider behavior, and rendered styles remain unchanged; only module boundaries move.

@coderabbitai

coderabbitai Bot commented Aug 30, 2026 •

Copy link
Copy Markdown
Contributor

Review Change Stack

Warning

Review limit reached

Next included review available in 14 minutes.

View limit details

Limit details: You’ve used all 10 included reviews currently available.

You've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository.

Learn how review limits work.

Review configuration:

⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro Plus

Run ID: 1468beb7-9a7a-4b0c-8b21-83afebe10ca5

📥 Commits

Reviewing files that changed from the base of the PR and between 9e43f0c and ea6df76.

📒 Files selected for processing (1)
  • mobile/src/tasks/github-project-host-routing-source.test.ts

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro Plus

Run ID: 19a89c6e-a5e2-4606-a753-819c6edddfdf

📥 Commits

Reviewing files that changed from the base of the PR and between c3a9a44 and 9e43f0c.

📒 Files selected for processing (1)
  • mobile/src/tasks/github-project-repo-list-load.test.ts

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


📝 Walkthrough

Walkthrough

The mobile Tasks screen is decomposed into typed provider, project, workspace, and detail models. New hooks manage hydration, loading, projections, persistence, provider actions, review actions, and workspace creation. New renderers provide provider lists, project views, task details, comments, diffs, pickers, drawers, and confirmation dialogs. Shared styles and parity tests support the refactor.

Merge Risk: 🟡 Moderate · up to 9e43f

Although the route was structurally split without an intended behavior change, the current code may still create duplicate workspaces, repeat provider requests or persistence writes, save blank numeric fields as zero, mishandle reviewer identities, and display misleading or malformed messages. These bounded correctness and reliability risks should be fixed or explicitly accepted before merging.

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.52% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 192 functions across 53 files. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly and concisely describes the main change: splitting the mobile Tasks route into focused modules.
Description check ✅ Passed The description is mostly complete and explains the change, rationale, testing, visual proof, and compatibility considerations. The mandatory Linked Issue section is incomplete because it states that …
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.
Full details: Description check

Explanation

The description is mostly complete and explains the change, rationale, testing, visual proof, and compatibility considerations. The mandatory Linked Issue section is incomplete because it states that no issue was provided.

✨ Finishing Touches 💡 1
🛠️ Fix failing CI checks 💡
  • Create stacked PR
  • Commit on current branch

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.

@greptile-apps

greptile-apps Bot commented Aug 30, 2026 •

Copy link
Copy Markdown

Greptile Summary

The PR decomposes the mobile Tasks route into ordered state, loading, action, projection, and presentation modules while retaining the host-scoped task surface.

  • Replaces the monolithic route with sequential hook composition and a legacy surface component.
  • Extracts provider, project, review, workspace-creation, picker, drawer, and style responsibilities.
  • Adds source-parity characterization coverage and removes the obsolete max-lines exceptions.

Confidence Score: 5/5

The PR appears safe to merge.

No blocking failure remains.

Important Files Changed

Filename Overview
mobile/app/h/[hostId]/tasks.tsx Reduced to an explicit ordered composition of extracted task hooks and the legacy presentation surface.
mobile/src/tasks/MobileTasksLegacySurface.tsx Hosts the extracted top-level Tasks rendering surface without an established behavior change.
mobile/src/tasks/use-mobile-tasks-client-settings-actions.tsx Preserves same-render client-change resets so rows and caches from one host are not presented under another.
mobile/src/tasks/use-mobile-tasks-project-loading-actions.tsx Preserves GitHub Project discovery, view loading, table loading, and host-qualified project resolution.
mobile/src/tasks/use-mobile-tasks-project-projection.tsx Projects GitHub Project state while retaining repository-list settlement and active-host filtering.
mobile/src/tasks/mobile-tasks-refactor-parity.test.ts Adds characterization checks for extracted hook, statement, semantic, render-token, and style source parity.
mobile/src/tasks/github-project-host-routing-source.test.ts Updates host-routing characterization coverage to inspect the extracted project modules.
mobile/src/tasks/github-project-repo-list-load.test.ts Updates repository-list loading and host-switch reset coverage for the split module layout.

Flowchart

%%{init: {'theme': 'neutral'}}%%
flowchart TD
  R[Host-scoped Tasks route] --> S[Route and workspace state]
  S --> L[Provider and project loading]
  L --> E[List and detail effects]
  E --> A[Task, review, and workspace actions]
  A --> P[Picker and view projections]
  P --> C[Connection presentation]
  C --> U[MobileTasksLegacySurface]
Loading

Reviews (7): Last reviewed commit: "test(mobile): follow project routing mod..." | Re-trigger Greptile

@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.

Important

The split breaks two existing mobile source-level characterization tests that read mobile/app/h/[hostId]/tasks.tsx as a raw string. After this change that file is 77 lines of imports and hook composition, so every pinned assertion in them fails. Both run in mobile CI (mobile.yml → pnpm test), so this PR is red on its own test lane.

Reviewed changes

  • Route decomposition — mobile/app/h/[hostId]/tasks.tsx reduced from ~15k lines to a 77-line MobileTasksScreen that threads state through 36 ordered useMobileTasks* stages, then hands the final model to MobileTasksLegacySurface.
  • Module extraction — provider loading, pagination, GitHub Project load/select, detail actions, Linear actions, picker/view projections, workspace create/SSH/sparse actions, and connection presentation moved to mobile/src/tasks/; helper barrels live in mobile-tasks-dependencies.ts and mobile-tasks-legacy-foundation.tsx.
  • Lint ratchet cleanup — removed the app/h/*/tasks.tsx max-lines override in mobile/.oxlintrc.json and its config/max-lines-baseline.txt entry.
  • Characterization coverage — added hash-pinned parity tests (mobile-tasks-refactor-parity.test.ts) plus AST-based extraction helpers for hook signatures, execution statements, declarations, semantics, render tokens, and styles.

⚠️ Two existing source-reader tests now assert on content that moved out of tasks.tsx

mobile/src/tasks/github-project-host-routing-source.test.ts and mobile/src/tasks/github-project-repo-list-load.test.ts both readFileSync('../../app/h/[hostId]/tasks.tsx') and pin strings that lived in the monolith. After the split those strings live in modules under mobile/src/tasks/, so the assertions fail:

  • github-project-host-routing-source.test.ts:8-12 — source.matchAll(/['"](github\.project\.[^'"]+)['"]/g) now finds 0 calls, but expect(calls.length).toBeGreaterThan(10) requires >10. Lines 17-35 (toggleProjectGitHubReviewThread, per-method prRepo wiring) and lines 39-40 (listAccessible / host: githubProjectHost(parsed.host)) are likewise absent.
  • github-project-repo-list-load.test.ts:22 — block('const loadTasks = useCallback(', …) returns index -1, so expect(start).toBeGreaterThan(-1) fails before any repo-list/refresh assertions run. Lines 52-56, 64-66, 72-83, 91-92, 99-100, 106-108 also target strings no longer in the route file.

These tests are not touched by the PR and are not covered by the new parity tests (which hash the whole mobile/src/tasks/ family plus the route at an aggregate level, not the string probes these two rely on). They need to be re-pointed at the concrete module files (e.g. use-mobile-tasks-task-list-loading.tsx, use-mobile-tasks-project-loading-actions.tsx, use-mobile-tasks-project-thread-reply-actions.tsx) or otherwise migrated, otherwise the mobile pnpm test lane fails.

Technical details
# Relocate stale source-reader tests after the tasks route split

## Affected sites
- mobile/src/tasks/github-project-host-routing-source.test.ts — reads `../../app/h/[hostId]/tasks.tsx`; probes `github.project.*` host qualification and Project-row PR action wiring that now live in `use-mobile-tasks-project-loading-actions.tsx` and `use-mobile-tasks-project-thread-reply-actions.tsx`.
- mobile/src/tasks/github-project-repo-list-load.test.ts — reads the same route file; probes `loadTasks`, `refreshTasks`, `refreshGitHubProject`, and renderer gating that now live in `use-mobile-tasks-task-list-loading.tsx`, `use-mobile-tasks-list-and-detail-effects.tsx`, and the list surface renderer.

## Required outcome
- Every assertion in both files either reads from a file that still contains the pinned string, or is migrated to the new module where that behavior now lives; both files pass under `pnpm test` in `mobile/`.

## Suggested approach (optional)
- Point each probe at the concrete module file(s) rather than the route; keep the exact-string assertions (they are regression pins for #12966 and Project host routing) but re-point `new URL(...)`.

ℹ️ Nitpicks

  • The parity tests hash current source against opaque constants labelled PRE_REFACTOR_*. They will catch future drift but cannot independently prove the split itself was faithful — a reviewer has no way to re-derive the constants from the pre-refactor monolith. Consider documenting how the constants were generated (e.g. a script or the exact pre-split checkout) so the claim is auditable.
  • useMobileTasksConnectionPresentation and other projection/action stages are plain functions doing Object.assign(model, …) and returning the mutated model. Idiomatic for this pipeline but the model object is mutated in place across stages; fine today, worth a comment if a future stage ever memoizes against model identity.

Pullfrog  | Fix it ➔ | View workflow run | Using DeepSeek Pro (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.

ℹ️ The follow-up commit cleanly repairs the module boundaries; no new issues found in the delta.

Reviewed changes

  • De-duplicated group/sort logic — deleted the mobile-written mobile-github-project-group-sort.ts and re-pointed use-mobile-tasks-project-projection.tsx, mobile-tasks-project-fields.ts, mobile-tasks-options.tsx, and mobile-tasks-view-state-types.ts at the existing shared src/shared/github/project-group-sort.ts / project-types.ts / project-identity.ts instead of maintaining a shadow copy with pinches like GitHubProjectTable as SharedGitHubProjectTable.
  • Re-added a missing re-export — useRelayRecoveryStatus now flows through mobile-tasks-dependencies.ts, matching the import in use-mobile-tasks-route-and-item-state.tsx.
  • Split the too-broad shared type re-exports — BaseRefSearchResult, ProviderCheckSummary, PersistedTrustedOrcaHooks, SparsePreset, and TuiAgent now come from their own shared modules (repo-types, github/pull-request-types, orca-yaml-hook-types, worktree/create-types, tui-agent) rather than the umbrella shared/types.
  • Parity-test re-pin — PRE_REFACTOR_SCREEN_HOOKS / PRE_REFACTOR_STATEMENTS constants and their counts (349→350, 416→417) updated alongside the source change.

ℹ️ Nitpicks

  • This commit re-derives two parity constants (PRE_REFACTOR_SCREEN_HOOKS, PRE_REFACTOR_STATEMENTS) and their counts while leaving the semantics / styles / declarations / render-tree hashes untouched. Since the delta only moved imports and deleted a non-useMobileTasks file (neither of which the hash helpers read), that implies the first commit's parity test was not actually green against its own tree. It reinforces the earlier point that these are snapshot constants carried forward, not an independently verifiable pre-refactor anchor — worth a documented regeneration path so future maintainers don't burn time reconciling the two.

Pullfrog  | Fix it ➔ | View workflow run | Using DeepSeek Pro (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 critical issues in this delta — comment-only change; one nitpick inline.

Reviewed changes

  • Documented two intentional render-phase resets — added a file-level oxlint-disable react-doctor/no-prop-callback-in-render with a -- rationale to use-mobile-tasks-client-settings-actions.tsx (the boundClient !== client client-scoped cache reset) and use-mobile-tasks-workspace-ssh-state.tsx (the render-phase setWorkspaceAgent synchronization).

ℹ️ Nitpicks

  • The disables are file-scoped rather than line-scoped, so they silence no-prop-callback-in-render for the entire file. The render-phase resets live at two specific sites (if (boundClient !== client) { … } and if (workspaceAgentSelection.agent !== workspaceAgent) { … }); a // oxlint-disable-next-line directly above each would keep the rule active for the rest of the file. Both sites already carry separate // Why: comments, so tightening the scope costs nothing.

Pullfrog  | Fix it ➔ | View workflow run | Using DeepSeek Pro (free via Pullfrog for OSS) | 𝕏

@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: 9

🧹 Nitpick comments (7)
mobile/src/tasks/mobile-tasks-project-detail-drawer.tsx (1)

300-315: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick win

Remove the duplicated PULL_REQUEST branch.

The branch at Line 302 sets the same setPendingHostedStateChange payload as the fallback at Line 310. Both pass source: 'project', the same row, and the same nextState. The conditional has no effect and suggests that pull requests take a different path.

♻️ Proposed simplification
                 onPress={() => {
                   const nextState = projectRowItem.content.state === 'CLOSED' ? 'open' : 'closed'
-                  if (projectRowItem.itemType === 'PULL_REQUEST') {
-                    setPendingHostedStateChange({
-                      source: 'project',
-                      row: projectRowItem,
-                      nextState
-                    })
-                    return
-                  }
                   setPendingHostedStateChange({
                     source: 'project',
                     row: projectRowItem,
                     nextState
                   })
                 }}
mobile/src/tasks/mobile-tasks-item-review-sections.tsx (1)

213-277: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick win

Consider extracting the shared changed-files renderer.

This block duplicates the "Changed files" markup in mobile/src/tasks/mobile-tasks-project-review-panels.tsx. Both copies render the same file row, viewed toggle, binary check, GitHubPrFileDiff preview, and unavailable-contents fallback. Only the model field names and the mutation callbacks differ.

A shared renderer that accepts the file list, expandedPrFilePath, prFileContents, prFileCommentDrafts, a disabled flag, and the three handlers would remove the duplication. The current PR targets source parity, so this fits a follow-up change.

mobile/src/tasks/use-mobile-tasks-detail-comment-renderers.tsx (1)

99-106: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick win

Remove the duplicated condition.

Lines 103-105 repeat the exact condition from lines 99-101. No value changes between the two tests, so the inner ternary can never select its null branch. The inner check and its Fragment are dead logic.

Two copies of the same condition can diverge in later edits. Keep one check.

♻️ Proposed simplification
       {SHOW_MOBILE_COMMENT_THREAD_TOOLS &&
       actionItem?.provider === 'github' &&
       detailPayload?.provider === 'github' ? (
         <View style={styles.commentControls}>
-          {SHOW_MOBILE_COMMENT_THREAD_TOOLS &&
-          actionItem?.provider === 'github' &&
-          detailPayload?.provider === 'github' ? (
-            <>
-              {actionItem.source.type === 'pr' && comment.threadId ? (
+          {actionItem.source.type === 'pr' && comment.threadId ? (

Then remove the matching closing </> and ) : null} for the inner ternary.

mobile/src/tasks/use-mobile-tasks-provider-view-projection.tsx (1)

225-236: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick win

Move persistRepoSelection out of the state updater.

setSelectedRepoIds receives an updater that also calls persistRepoSelection. React treats updaters as pure functions and can call them more than once for one dispatch, for example in Strict Mode during development. Each extra call repeats the persistence write. Compute the next selection from the current value and persist it outside the updater.

♻️ Proposed refactor
   const toggleRepoSelection = useCallback(
     (repoId: string) => {
-      setSelectedRepoIds((current) => {
-        const next = new Set(current)
-        if (next.has(repoId)) {
-          next.delete(repoId)
-        } else {
-          next.add(repoId)
-        }
-        const normalized =
-          next.size === 0 || next.size === hostedRepos.length ? new Set<string>() : next
-        persistRepoSelection(normalized, hostedRepos)
-        return normalized
-      })
+      const next = new Set(selectedRepoIds)
+      if (next.has(repoId)) {
+        next.delete(repoId)
+      } else {
+        next.add(repoId)
+      }
+      const normalized =
+        next.size === 0 || next.size === hostedRepos.length ? new Set<string>() : next
+      setSelectedRepoIds(normalized)
+      persistRepoSelection(normalized, hostedRepos)
     },
-    [hostedRepos, persistRepoSelection]
+    [hostedRepos, persistRepoSelection, selectedRepoIds]
   )
mobile/src/tasks/mobile-tasks-item-mapping.ts (1)

188-190: 📐 Maintainability & Code Quality | 🔵 Trivial | 💤 Low value

Remove the no-op ternary in gitHubTaskSubtitle.

Both branches return '#'. The condition has no effect. If the original intent was a different marker for pull requests, that intent is now lost.

♻️ Proposed simplification
 export function gitHubTaskSubtitle(item: GitHubWorkItem): string {
-  return `${item.repoName} ${item.type === 'pr' ? '#' : '#'}${item.number}`
+  return `${item.repoName} #${item.number}`
 }
mobile/src/tasks/use-mobile-tasks-client-settings-actions.tsx (1)

72-73: 📐 Maintainability & Code Quality | 🔵 Trivial | 💤 Low value

Move the ref comment to the effect it describes.

The comment describes the stale-client ref guard, but it sits above resetGitHubItemsState. The ref write happens in the useLayoutEffect at lines 94-99.

mobile/src/tasks/use-mobile-tasks-runtime-hydration.tsx (1)

154-191: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚖️ Poor tradeoff

Consider extracting the repeated task-view reset sequence.

The same ~35 setter calls appear three times in this effect: the disconnect branch (lines 105-149), the pre-hydrate branch (lines 154-191), and the unsupported-capability branch (lines 209-244). A new setter added to one branch can be missed in the others.

A shared resetTaskViewSurfaces callback would remove the duplication. The refactor changes statement order, so the execution-parity test support in mobile-tasks-execution-parity.test-support.ts needs a matching update. Defer this if statement-level parity must hold for this PR.


ℹ️ Review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro Plus

Run ID: e740d65d-a814-4f3a-891a-d065443dfb5d

📥 Commits

Reviewing files that changed from the base of the PR and between 3ab9766 and 33e0265.

📒 Files selected for processing (94)
  • config/max-lines-baseline.txt
  • mobile/.oxlintrc.json
  • mobile/app/h/[hostId]/tasks.tsx
  • mobile/src/tasks/MobileTasksLegacySurface.tsx
  • mobile/src/tasks/MobileTasksPrFileDiff.tsx
  • mobile/src/tasks/mobile-tasks-chrome-styles.ts
  • mobile/src/tasks/mobile-tasks-composer-action-styles.ts
  • mobile/src/tasks/mobile-tasks-create-drawers.tsx
  • mobile/src/tasks/mobile-tasks-dependencies.ts
  • mobile/src/tasks/mobile-tasks-detail-styles.ts
  • mobile/src/tasks/mobile-tasks-diff-comment-styles.ts
  • mobile/src/tasks/mobile-tasks-execution-parity.test-support.ts
  • mobile/src/tasks/mobile-tasks-filter-pickers.tsx
  • mobile/src/tasks/mobile-tasks-github-project-list.tsx
  • mobile/src/tasks/mobile-tasks-github-project-pickers.tsx
  • mobile/src/tasks/mobile-tasks-github-view-controls.tsx
  • mobile/src/tasks/mobile-tasks-hosted-review.ts
  • mobile/src/tasks/mobile-tasks-item-actions.tsx
  • mobile/src/tasks/mobile-tasks-item-comments.tsx
  • mobile/src/tasks/mobile-tasks-item-detail-content.tsx
  • mobile/src/tasks/mobile-tasks-item-detail-drawer.tsx
  • mobile/src/tasks/mobile-tasks-item-field-editors.tsx
  • mobile/src/tasks/mobile-tasks-item-mapping.ts
  • mobile/src/tasks/mobile-tasks-item-review-sections.tsx
  • mobile/src/tasks/mobile-tasks-legacy-foundation.tsx
  • mobile/src/tasks/mobile-tasks-legacy-styles.ts
  • mobile/src/tasks/mobile-tasks-linear-list.tsx
  • mobile/src/tasks/mobile-tasks-linear-view-controls.tsx
  • mobile/src/tasks/mobile-tasks-list-display-pickers.tsx
  • mobile/src/tasks/mobile-tasks-list-styles.ts
  • mobile/src/tasks/mobile-tasks-list-surface.tsx
  • mobile/src/tasks/mobile-tasks-options.tsx
  • mobile/src/tasks/mobile-tasks-project-comments.tsx
  • mobile/src/tasks/mobile-tasks-project-detail-content.tsx
  • mobile/src/tasks/mobile-tasks-project-detail-drawer.tsx
  • mobile/src/tasks/mobile-tasks-project-field-editors.tsx
  • mobile/src/tasks/mobile-tasks-project-fields.ts
  • mobile/src/tasks/mobile-tasks-project-metadata-editors.tsx
  • mobile/src/tasks/mobile-tasks-project-picker-styles.ts
  • mobile/src/tasks/mobile-tasks-project-review-panels.tsx
  • mobile/src/tasks/mobile-tasks-project-workspace-types.ts
  • mobile/src/tasks/mobile-tasks-provider-controls.tsx
  • mobile/src/tasks/mobile-tasks-provider-detail-types.ts
  • mobile/src/tasks/mobile-tasks-provider-item-list.tsx
  • mobile/src/tasks/mobile-tasks-provider-pickers.tsx
  • mobile/src/tasks/mobile-tasks-refactor-parity.test.ts
  • mobile/src/tasks/mobile-tasks-render-parity.test-support.ts
  • mobile/src/tasks/mobile-tasks-repository-presentation.ts
  • mobile/src/tasks/mobile-tasks-reviewer-linear.ts
  • mobile/src/tasks/mobile-tasks-screen-chrome.tsx
  • mobile/src/tasks/mobile-tasks-search-control.tsx
  • mobile/src/tasks/mobile-tasks-source-family.test-support.ts
  • mobile/src/tasks/mobile-tasks-view-state-types.ts
  • mobile/src/tasks/mobile-tasks-workspace-create-drawer.tsx
  • mobile/src/tasks/mobile-tasks-workspace-option-pickers.tsx
  • mobile/src/tasks/mobile-tasks-workspace-review-styles.ts
  • mobile/src/tasks/mobile-tasks-workspace-trust-drawers.tsx
  • mobile/src/tasks/use-mobile-tasks-client-settings-actions.tsx
  • mobile/src/tasks/use-mobile-tasks-connection-presentation.tsx
  • mobile/src/tasks/use-mobile-tasks-detail-comment-renderers.tsx
  • mobile/src/tasks/use-mobile-tasks-github-check-file-actions.tsx
  • mobile/src/tasks/use-mobile-tasks-github-reply-merge-actions.tsx
  • mobile/src/tasks/use-mobile-tasks-gitlab-github-status-actions.tsx
  • mobile/src/tasks/use-mobile-tasks-hosted-comment-review-actions.tsx
  • mobile/src/tasks/use-mobile-tasks-hosted-metadata-actions.tsx
  • mobile/src/tasks/use-mobile-tasks-item-detail-loading.tsx
  • mobile/src/tasks/use-mobile-tasks-item-detail-metadata-effects.tsx
  • mobile/src/tasks/use-mobile-tasks-item-state.tsx
  • mobile/src/tasks/use-mobile-tasks-linear-item-actions.tsx
  • mobile/src/tasks/use-mobile-tasks-list-and-detail-effects.tsx
  • mobile/src/tasks/use-mobile-tasks-picker-projection.tsx
  • mobile/src/tasks/use-mobile-tasks-project-detail-loading.tsx
  • mobile/src/tasks/use-mobile-tasks-project-file-merge-actions.tsx
  • mobile/src/tasks/use-mobile-tasks-project-loading-actions.tsx
  • mobile/src/tasks/use-mobile-tasks-project-metadata-actions.tsx
  • mobile/src/tasks/use-mobile-tasks-project-metadata-loading.tsx
  • mobile/src/tasks/use-mobile-tasks-project-projection.tsx
  • mobile/src/tasks/use-mobile-tasks-project-repository-resolution.tsx
  • mobile/src/tasks/use-mobile-tasks-project-review-check-actions.tsx
  • mobile/src/tasks/use-mobile-tasks-project-thread-reply-actions.tsx
  • mobile/src/tasks/use-mobile-tasks-project-workspace-comment-actions.tsx
  • mobile/src/tasks/use-mobile-tasks-provider-load-actions.tsx
  • mobile/src/tasks/use-mobile-tasks-provider-view-projection.tsx
  • mobile/src/tasks/use-mobile-tasks-route-and-item-state.tsx
  • mobile/src/tasks/use-mobile-tasks-runtime-hydration.tsx
  • mobile/src/tasks/use-mobile-tasks-task-create-actions.tsx
  • mobile/src/tasks/use-mobile-tasks-task-list-loading.tsx
  • mobile/src/tasks/use-mobile-tasks-task-pagination-actions.tsx
  • mobile/src/tasks/use-mobile-tasks-workspace-and-project-state.tsx
  • mobile/src/tasks/use-mobile-tasks-workspace-create-actions.tsx
  • mobile/src/tasks/use-mobile-tasks-workspace-create-projection.tsx
  • mobile/src/tasks/use-mobile-tasks-workspace-source-effects.tsx
  • mobile/src/tasks/use-mobile-tasks-workspace-sparse-actions.tsx
  • mobile/src/tasks/use-mobile-tasks-workspace-ssh-state.tsx
💤 Files with no reviewable changes (2)
  • mobile/.oxlintrc.json
  • config/max-lines-baseline.txt

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

if (!stageName || !definition) {
throw new Error('Unexpected Mobile Tasks route statement')
}
signatures.push(...flattenStageStatements(definition, definitions, new Set([stageName])))

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 | 🟡 Minor | ⚡ Quick win

Retain call-site arguments in flattened parity output.

The flatteners replace a stage or renderer call with its callee body. They discard the call expression and its arguments. If an argument changes from one identifier or callback to another, runtime behavior can change while the hook, statement, and render hashes remain unchanged.

  • mobile/src/tasks/mobile-tasks-execution-parity.test-support.ts#L128-L128: emit the normalized top-level stage invocation before flattening its definition.
  • mobile/src/tasks/mobile-tasks-execution-parity.test-support.ts#L106-L107: emit each nested stage invocation before flattening its definition.
  • mobile/src/tasks/mobile-tasks-render-parity.test-support.ts#L77-L83: emit the renderer invocation, including its arguments, before flattening its returned expression.
📍 Affects 2 files
  • mobile/src/tasks/mobile-tasks-execution-parity.test-support.ts#L128-L128 (this comment)
  • mobile/src/tasks/mobile-tasks-execution-parity.test-support.ts#L106-L107
  • mobile/src/tasks/mobile-tasks-render-parity.test-support.ts#L77-L83

Comment on lines +227 to +230
export function getHostedStateConfirmMessage(pending: PendingHostedStateChange): string {
const target = hostedStateChangeTarget(pending)
return `${hostedStateChangeAction(pending.nextState)} ${target.labelTarget} #${target.number}?`
}

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 | 🟡 Minor | ⚡ Quick win

Suppress the number fragment when the project row has no number.

hostedStateChangeTarget returns number: pending.row.content.number for the project source. GitHubProjectRow.content.number is number | null, and itemType includes DRAFT_ISSUE and REDACTED. For those rows hostedStateChangeTarget still reports labelTarget: 'Issue', so the confirmation dialog renders "Close Issue #null?".

Build the number fragment conditionally.

🐛 Proposed fix for the null number in the confirmation message
 export function getHostedStateConfirmMessage(pending: PendingHostedStateChange): string {
   const target = hostedStateChangeTarget(pending)
-  return `${hostedStateChangeAction(pending.nextState)} ${target.labelTarget} #${target.number}?`
+  const suffix = target.number === null ? '' : ` #${target.number}`
+  return `${hostedStateChangeAction(pending.nextState)} ${target.labelTarget}${suffix}?`
 }
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
export function getHostedStateConfirmMessage(pending: PendingHostedStateChange): string {
const target = hostedStateChangeTarget(pending)
return `${hostedStateChangeAction(pending.nextState)} ${target.labelTarget} #${target.number}?`
}
export function getHostedStateConfirmMessage(pending: PendingHostedStateChange): string {
const target = hostedStateChangeTarget(pending)
const suffix = target.number === null ? '' : ` #${target.number}`
return `${hostedStateChangeAction(pending.nextState)} ${target.labelTarget}${suffix}?`
}

const draftValue = projectFieldDrafts[field.id] ?? ''
const saveTextField = (): void => {
if (field.dataType === 'NUMBER') {
const number = Number(draftValue)

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 | 🟡 Minor | ⚡ Quick win

Handle blank numeric drafts before numeric conversion.

Number('') evaluates to 0. A user can save an empty numeric field and write zero unintentionally. Handle a trimmed empty draft as a clear action or reject it before calling Number().

Proposed fix
         const saveTextField = (): void => {
           if (field.dataType === 'NUMBER') {
+            if (draftValue.trim() === '') {
+              void mutateProjectRowField(projectRowItem, field, null)
+              return
+            }
             const number = Number(draftValue)
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
const number = Number(draftValue)
const saveTextField = (): void => {
if (field.dataType === 'NUMBER') {
if (draftValue.trim() === '') {
void mutateProjectRowField(projectRowItem, field, null)
return
}
const number = Number(draftValue)

Comment on lines +231 to +235
await persistSetupHookTrust(
orcaYamlTrustPrompt.repoId,
orcaYamlTrustPrompt.contentHash,
false
)

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.

🗄️ Data Integrity & Integration | 🟠 Major | ⚡ Quick win

🔎 Supported by static analysis

🏁 Script executed:

printf '%s\n' '--- knowledge files ---'
find /tmp/coderabbit-repo-knowledge/stablyai/orca-89dc44e4 -type f -maxdepth 3 -print 2>/dev/null | sort
printf '%s\n' '--- convention headers ---'
for f in /tmp/coderabbit-repo-knowledge/stablyai/orca-89dc44e4/*/*.md; do
  [ -f "$f" ] && { printf '\n### %s\n' "$f"; head -5 "$f"; }
done
printf '%s\n' '--- target outline ---'
ast-grep outline mobile/src/tasks/mobile-tasks-workspace-trust-drawers.tsx
printf '%s\n' '--- target relevant source ---'
sed -n '1,330p' mobile/src/tasks/mobile-tasks-workspace-trust-drawers.tsx
printf '%s\n' '--- createWorkspace references ---'
rg -n -C 3 'createWorkspace|persistSetupHookTrust' mobile/src

Repository: stablyai/orca

Length of output: 38234


🏁 Script executed:

printf '%s\n' '--- correct knowledge files ---'
find /tmp/coderabbit-repo-knowledge/stablyai-orca-89dc44e4 -maxdepth 3 -type f -print 2>/dev/null | sort
for f in /tmp/coderabbit-repo-knowledge/stablyai-orca-89dc44e4/*/*.md; do
  [ -f "$f" ] && { printf '\n### %s\n' "$f"; head -5 "$f"; }
done
printf '%s\n' '--- workspace create hook ---'
sed -n '1,330p' mobile/src/tasks/use-mobile-tasks-workspace-create-actions.tsx
printf '%s\n' '--- trust persistence binding ---'
sed -n '160,225p' mobile/src/tasks/use-mobile-tasks-client-settings-actions.tsx
sed -n '1,130p' mobile/src/tasks/setup-hook-trust.ts
printf '%s\n' '--- model state definitions and composition ---'
rg -n -C 4 'creatingKey|setCreatingKey|useMobileTasksWorkspaceCreateActions|ConnectionPresentationModel' mobile/src/tasks

Repository: stablyai/orca

Length of output: 50370


🏁 Script executed:

printf '%s\n' '--- worktree.create definitions and idempotency references ---'
rg -n -l 'worktree\.create|WORKTREE_CREATE|idempotenc|dedup' --glob '*.{ts,tsx}' src mobile | head -80
printf '%s\n' '--- focused references ---'
rg -n -C 5 'worktree\.create|idempotenc|dedup' mobile/src/tasks src/main src/shared --glob '*.{ts,tsx}' --glob '*.{ts,js}' | head -500
printf '%s\n' '--- mobile conventions and relevant learning ---'
cat /tmp/coderabbit-repo-knowledge/stablyai-orca-89dc44e4/conventions/mobile.md
cat /tmp/coderabbit-repo-knowledge/stablyai-orca-89dc44e4/learnings/mobile.md

Repository: stablyai/orca

Length of output: 45819


Block repeated trust decisions before workspace creation starts.

When creatingKey is null, the two run actions await persistSetupHookTrust before createWorkspace sets it. All three trust actions remain enabled during that await, so a second tap can start another handler and issue another worktree.create request. Set a synchronous pending guard before the first await and disable every trust action while the flow is active.

Comment on lines +159 to +170
setActionItem((current) =>
current?.provider === 'gitlab' && current.source.id === actionItem.source.id
? {
...current,
source: {
...current.source,
checksSummary,
...hydratedStatus
}
}
: current
)

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.

🩺 Stability & Availability | 🟠 Major | ⚡ Quick win

🔎 Supported by static analysis

🏁 Script executed:

#!/bin/bash
# Inspect git history of the Tasks route for the GitLab hydration block.
git log --oneline -5 -- mobile/app/h/'[hostId]'/tasks.tsx
git show HEAD~1:mobile/app/h/'[hostId]'/tasks.tsx 2>/dev/null | rg -n -C 12 "checksSummary" | head -80

Repository: stablyai/orca

Length of output: 555


🏁 Script executed:

#!/bin/bash
set -e
printf '%s\n' '--- scoped repository knowledge ---'
find /tmp/coderabbit-repo-knowledge/stablyai-orca-89dc44e4 -type f -name '*.md' -print | sort
printf '%s\n' '--- knowledge headers ---'
for f in /tmp/coderabbit-repo-knowledge/stablyai-orca-89dc44e4/*/*.md; do
  [ -f "$f" ] || continue
  printf '\n### %s\n' "$f"
  head -80 "$f"
done
printf '%s\n' '--- target file outline ---'
ast-grep outline mobile/src/tasks/use-mobile-tasks-item-detail-loading.tsx
printf '%s\n' '--- target effect and helper ---'
sed -n '1,290p' mobile/src/tasks/use-mobile-tasks-item-detail-loading.tsx
printf '%s\n' '--- refactor commit parent paths ---'
git show --format= --name-status 5eef1b32d | head -120

Repository: stablyai/orca

Length of output: 50369


🏁 Script executed:

#!/bin/bash
set -e
printf '%s\n' '--- target lines 1-80 ---'
sed -n '1,80p' mobile/src/tasks/use-mobile-tasks-item-detail-loading.tsx
printf '%s\n' '--- target lines 130-275 ---'
sed -n '130,275p' mobile/src/tasks/use-mobile-tasks-item-detail-loading.tsx
printf '%s\n' '--- target symbols ---'
rg -n -C 8 'isGitLabStatusHydrated|workItemDetails|setActionItem|useEffect' mobile/src/tasks mobile/app
printf '%s\n' '--- refactor paths ---'
git diff-tree --no-commit-id --name-status -r 5eef1b32d
printf '%s\n' '--- parent GitLab hydration block ---'
git show '5eef1b32d^:mobile/app/h/[hostId]/tasks.tsx' 2>/dev/null | rg -n -C 18 'checksSummary|workItemDetails|alreadyHydrated' | head -160

Repository: stablyai/orca

Length of output: 50370


🏁 Script executed:

#!/bin/bash
set -e
printf '%s\n' '--- files changed by refactor ---'
git show --format= --name-status --find-renames 5eef1b32d | sed -n '1,120p'
printf '%s\n' '--- parent route existence ---'
git cat-file -e '5eef1b32d^:mobile/app/h/[hostId]/tasks.tsx' && echo exists || echo missing
printf '%s\n' '--- predecessor GitLab-related lines ---'
git show '5eef1b32d^:mobile/app/h/[hostId]/tasks.tsx' 2>/dev/null |
  awk '
    /provider === '\''gitlab'\''|provider: '\''gitlab'\''|workItemDetails|checksSummary|setActionItem/ {
      start=NR-12
      if (start < 1) start=1
      stop=NR+22
      print "--- candidate at line " NR " ---"
      for (i=start; i<=stop; i++) lines[i]=1
    }
    { text[NR]=$0 }
    END {
      for (i=1; i<=NR; i++) if (lines[i]) print i ":" text[i]
    }' | head -240
printf '%s\n' '--- relevant setter declarations ---'
rg -n -m 20 -C 4 'setActionItem|useState.*actionItem|actionItem.*useState' mobile/src/tasks mobile/app/h

Repository: stablyai/orca

Length of output: 44998


🏁 Script executed:

#!/bin/bash
set -e
printf '%s\n' '--- current detail-loading branch boundaries ---'
sed -n '45,175p' mobile/src/tasks/use-mobile-tasks-item-detail-loading.tsx
printf '%s\n' '--- predecessor relevant lines ---'
python3 - <<'PY'
import subprocess
path = 'mobile/app/h/[hostId]/tasks.tsx'
text = subprocess.check_output(['git', 'show', f'5eef1b32d^:{path}'], text=True)
lines = text.splitlines()
needles = ('workItemDetails', 'checksSummary', 'alreadyHydrated')
hits = [i for i, line in enumerate(lines) if any(n in line for n in needles)]
for i in hits:
    print(f'--- lines {max(1, i-12+1)}-{min(len(lines), i+22+1)} ---')
    for j in range(max(0, i-12), min(len(lines), i+23)):
        print(f'{j+1}:{lines[j]}')
PY

Repository: stablyai/orca

Length of output: 22125


Guard GitLab hydration against effect re-triggering.

The pre-refactor route contains the same unconditional update, so this extraction preserves the bug. When gitlab.workItemDetails succeeds, setActionItem returns a new object. Because actionItem is an effect dependency, the effect can re-run continuously, reset loading state, and resend the request. Return current when the hydrated values are unchanged.

Comment on lines +33 to +46
const reviewers = logins ?? splitReviewerList(projectReviewersDraft)
if (reviewers.length === 0 || !row.content.number) {
return
}
setProjectMutating(true)
setProjectRowDetailError('')
try {
const response = await client.sendRequest(
'github.requestPRReviewers',
{
repo: `id:${repo.id}`,
prNumber: row.content.number,
prRepo: projectRowGitHubRepository(row, activeGitHubProjectHost),
reviewers

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 | 🟡 Minor | ⚡ Quick win

🔎 Supported by static analysis

🏁 Script executed:

#!/bin/bash
# Description: Inspect splitReviewerList to confirm whether it strips a leading '@'.
set -euo pipefail

fd -t f 'mobile-tasks-reviewer-linear.ts' | xargs -r rg -n -A 15 'export function splitReviewerList'
rg -n -C 3 'splitReviewerList' --type=ts --type=tsx || rg -n -C 3 'splitReviewerList'

Repository: stablyai/orca

Length of output: 361


🏁 Script executed:

#!/bin/bash
set -euo pipefail

printf '%s\n' '--- repository conventions ---'
find /tmp/coderabbit-repo-knowledge/stablyai-orca-89dc44e4 -maxdepth 2 -type f -name '*.md' -print \
  | while read -r f; do
      case "$f" in
        *repository-conventions*|*mobile*|*review*|*/learnings/*|*/architecture/*)
          printf '\n### %s\n' "$f"
          head -80 "$f"
          ;;
      esac
    done

printf '%s\n' '--- changed function and helper ---'
sed -n '1,100p' mobile/src/tasks/use-mobile-tasks-project-review-check-actions.tsx
printf '%s\n' '--- splitReviewerList definition ---'
sed -n '185,215p' "$(fd -t f 'mobile-tasks-reviewer-linear.ts' | head -1)"
printf '%s\n' '--- requestPRReviewers bindings ---'
rg -n -C 5 'requestPRReviewers|reviewRequests|projectReviewersDraft' mobile/src

Repository: stablyai/orca

Length of output: 50369


Strip the leading @ before sending reviewers to github.requestPRReviewers. splitReviewerList only splits and trims entries, so @login reaches the RPC unchanged while the optimistic state stores login.

Comment on lines +41 to +44
if (!kind || !row.content.number || !row.content.url) {
setError('Add the project item repository to Orca before creating a workspace.')
return
}

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 | 🟡 Minor | ⚡ Quick win

Correct the error message for unsupported project rows.

This branch runs when the row has no issue or pull-request type, or when number or url is missing. Draft and redacted rows reach it. The missing-repository case is handled separately at lines 45-53 through setProjectRepoNotInOrca. The current message tells the user to add a repository, which does not resolve this condition.

🐛 Proposed message fix
       if (!kind || !row.content.number || !row.content.url) {
-        setError('Add the project item repository to Orca before creating a workspace.')
+        setError('This project item cannot start a workspace. Draft and redacted rows are not supported.')
         return
       }
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
if (!kind || !row.content.number || !row.content.url) {
setError('Add the project item repository to Orca before creating a workspace.')
return
}
if (!kind || !row.content.number || !row.content.url) {
setError('This project item cannot start a workspace. Draft and redacted rows are not supported.')
return
}

Comment on lines +153 to +170
for (const result of results) {
if (result.sources) {
sourcesByRepoId[result.repoId] = result.sources
}
if (result.sourceError) {
sourceErrors.push(result.sourceError)
}
if (result.sourceFallback) {
sourceFallbacks.push(result.sourceFallback)
}
}

return {
items: results
.flatMap((result) => result.items)
.sort((a, b) => taskTime(b.updatedAt) - taskTime(a.updatedAt))
.slice(0, CROSS_REPO_DISPLAY_LIMIT),
failedCount: results.filter((result) => result.error).length,

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 | 🟡 Minor | ⚡ Quick win

🔎 Supported by static analysis

🏁 Script executed:

#!/bin/bash
# Locate mapWithConcurrency and confirm its generic return type.
rg -n -C 12 'export (async )?function mapWithConcurrency' mobile src

Repository: stablyai/orca

Length of output: 3076


🏁 Script executed:

#!/bin/bash
set -e
printf '%s\n' '--- repository conventions and learnings ---'
find /tmp/coderabbit-repo-knowledge/stablyai-orca-89dc44e4 -maxdepth 2 -type f -name '*.md' -print
printf '%s\n' '--- target file outline ---'
ast-grep outline mobile/src/tasks/use-mobile-tasks-provider-load-actions.tsx
printf '%s\n' '--- target implementation ---'
sed -n '90,185p' mobile/src/tasks/use-mobile-tasks-provider-load-actions.tsx
printf '%s\n' '--- relevant type and helper definitions ---'
sed -n '1,80p' mobile/src/tasks/mobile-tasks-item-mapping.ts
sed -n '273,305p' mobile/src/tasks/mobile-tasks-item-mapping.ts

Repository: stablyai/orca

Length of output: 9873


🏁 Script executed:

#!/bin/bash
set -e
printf '%s\n' '--- target imports and surrounding declarations ---'
sed -n '1,55p' mobile/src/tasks/use-mobile-tasks-provider-load-actions.tsx
printf '%s\n' '--- mobile repository conventions ---'
cat /tmp/coderabbit-repo-knowledge/stablyai-orca-89dc44e4/conventions/mobile.md
printf '%s\n' '--- mobile package/typecheck declarations ---'
rg -n -C 4 '"(typecheck|check:types|tsc)"|typescript|tsconfig' mobile/package.json package.json mobile --glob 'package.json' --glob 'tsconfig*.json'

Repository: stablyai/orca

Length of output: 10157


Narrow the mapWithConcurrency result union before property access.

The callback returns success and failure shapes with different properties. The loop accesses branch-specific properties without narrowing, so strict mobile TypeScript checking can report missing-property errors. Add optional properties to both shapes or narrow the union.

@nwparker
nwparker merged commit 81b4d88 into stablyai:main Aug 30, 2026
28 checks passed
Jinwoo-H added a commit that referenced this pull request Sep 17, 2026
…omain (step 7) (#21169)

* refactor(mobile): checked reply readers for the tasks item and list domain (step 7)

Thirty-eight unchecked reply readers across four tasks files become checked zod
readers, so a malformed host reply surfaces as one `RpcIncompatibleReplyError`
naming the method instead of a downstream `TypeError`, a rendered `undefined`,
or a sheet left ready over garbage. Deliberately a behaviour change on malformed
replies only; nothing on the wire moves.

  mobile-task-item-state-operations.ts    17
  mobile-task-item-detail-operations.ts    8
  mobile-task-item-comment-operations.ts   7
  mobile-task-list-operations.ts           6

Two rules decide every schema, and both are stated in
task-provider-entity-reply-schema.ts:

1. A member is required only where a tasks consumer reads it with no guard.
   Everything reached through `?.`, `??` or a `typeof` test stays optional,
   because a reply without it rendered the same fallback then and now.
2. No member is required that the site's own recorded `normal` reply lacks. The
   corpus is the only evidence of what a host really sends at each site, and
   requiring a member absent from that control would turn a good reply into an
   incompatible one.

Rule 2 holds two schemas at the container: `github.prFileContents`, whose
recorded reply is `{ oldContent, newContent, truncated }` where
`getPRFileContents` returns `{ original, modified, ... }`, and `gitlab.todos`,
whose recorded row is not a `GitLabTodo` and whose `normal` partition therefore
records main crashing in `actionName.replace`. Both still gain their container,
which is what names a reply that is not an object or not a list. Correcting
those two scenarios is the follow-up that unlocks narrowing the rows.

Nine writes share one envelope reader and five comment writes share another:
`ok === false` and `error` are one host convention across them, and no input
would make two of them want different answers. The acceptance, the name and the
recorded family stay per operation. Three readers are reused rather than
re-declared — the session domain's boolean confirmation for `setPRFileViewed`
and `resolveReviewThread`, and its salvaged-member combinators throughout.

Three call-site shape tests the reader now answers for are deleted: both
`Array.isArray(payload)` guards on the checks read and the
`typeof count === 'number'` fallback on the item count. `GitHubPRFileContents`
is widened to optional members, which is what the reader can promise, and
`buildGitHubPrFileDiffPreview` takes the widened sides — `splitContentLines`
already treated a falsy side as no content, so no runtime behaviour moves.

The tasks source-parity hashes are refreshed: hook, statement, declaration and
render-token counts are unchanged, the render-token hash does not move at all,
and `semantics` is a pure deletion of ten lines.

Inventory: 137 unchecked readers over 30 files becomes 99 over 26.

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

* test(mobile): repin the RPC recording corpus and re-record the tasks reply deltas

`baseline` moves to 9133c02, the commit that made the tasks item and list
readers checked, and the whole corpus is re-recorded from it. The repin rewrites
the `baseline` header of every golden; the body moves are the disclosed
behaviour change and nothing else.

What moved, and why: a malformed reply at one of the thirty-eight migrated read
sites used to reach the consumer as the declared type and fail downstream — a
property read on `null`, `.map` on a string, a rendered `undefined`. It now
stops at the operation boundary as one `RpcIncompatibleReplyError` naming the
method, which each call site's existing `catch` shows where it showed the
`TypeError` before. Every move is confined to a malformed reply partition of a
`tasks.*` or `linear.issue-detail` family; no `normal` partition moves, and no
family outside the tasks domain moves at all.

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

* test(mobile): anchor the tasks reply readers' null-collapse mutant

One registered mutant for the class the session domain shipped twice before a
review caught it: the assignable-user row's explicit `avatarUrl: null` collapsed
into absence. `tk-item-detail-metadata` records that null in visible state, so
the pilot suite kills it; it also fails the unit pin beside the schema and both
of that family's matrix goldens, including their `normal` partitions.

Three by-hand experiments back the other two claims the corpus should hold.
Applied to the product source, run, reverted:

- Loosening a required member the consumer reads with no guard —
  `linearIssueSchema`'s `title` to a salvaged optional — fails the unit pin
  `one Linear issue: refuses a reply missing a member createLinearTask reads
  with no guard`, and `tsc` rejects it, because the loosened output is no longer
  a `LinearMobileIssue`. No golden moves: the reply matrix varies the envelope a
  host sends, never the shape of a row inside a result, so a row requirement is
  unreachable from the corpus and the unit pin is the only thing holding it.
- Loosening a *container* requirement is reachable: making
  `linearAccountStatusSchema` `.nullable()` fails one matrix golden,
  `tasks.provider-load: reply partitions at linear.status#1`, on the
  `result-null` partition, as well as its unit pin.
- Swapping one checked reader back to unchecked —
  `githubPullRequestChecksRead` to `rpcUncheckedPayloadReader` — fails two
  matrix goldens, `tasks.item-review-github` and
  `tasks.project-row-review-checks`, both at `github.prChecks#1`.

Nothing under `mutants/` is pinned by a golden header, so this moves no
recording.

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

* test(mobile): correct the gitlab.todos fixture to a real GitLabTodo row

The `tk-list-gitlab-todos` reply sent `[{ id, targetType, target: { … } }]`, a shape `listTodos`
never produces: the host returns `GitLabTodo[]`, whose row carries `actionName`, `targetTitle`,
`targetUrl`, `projectPath` and `updatedAt` flat. Main crashed on it —
`Cannot read properties of undefined (reading 'replace')` from `createGitLabTodoTask`, with the
list rendering as an empty inbox and a raw TypeError on screen.

That crash was being read as evidence: a reader could not narrow this row without "refusing the
site's only success control", when the control was never a success. The fixture is the defect, so
the fixture is what moves.

The row is now a real `GitLabTodo` (src/shared/gitlab-types.ts:219) and main renders it: one item
titled "A GitLab todo", subtitle `group/project #4`, status `review requested`.

Recorded from the pinned main tree, not from this branch, so the corrected fixture's main
projection exists as a golden before any reader touches it: a detached worktree at
`4b876758d3158a8eb6b798055d8db7c58d1cd4a9` with this branch's manifest laid over it and its
`baseline` set to that commit, per the recorder README's detached-pin recipe. Control: all 756
other goldens reproduced the base corpus byte for byte; only these two moved. Both keep
`baseline: 4b87675`, which is the tree that produced them.

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

* refactor(mobile): check the GitLab to-do row and drop its cast

With the fixture corrected, the row is readable, so the reader reads it. `gitlabTodoSchema`
requires the five members the screen reaches with no guard — `id`, `actionName` (read as
`actionName.replace`), `targetUrl` (what tapping the row opens, and the title's fallback),
`projectPath` (the subtitle and the repository badge's key and label) and `updatedAt` — and leaves
every guarded member optional: `targetTitle` behind `targetTitle || targetUrl`, `targetType` and
`targetIid` behind the two tests in `gitLabTodoTargetRef`, and `authorUsername` and `state`, which
this screen carries but never reads.

The list salvages: one unreadable to-do drops and the rest of the inbox still renders, which is
what the rest of this domain does with a row it cannot place. Nullish still reads as the empty
inbox the call site already read.

`GitLabTodo` in mobile-tasks-provider-detail-types.ts now says what the reader proves rather than
what the host declares, which is what lets the `as GitLabTodo[]` assertion at the call site go. It
was the last cast in this domain's consumers, and it was re-typing rows nothing had checked — the
phantom-field shape this series exists to remove.

Parity: the same three hashes the step-7 commit moved move once more, for the deleted cast and the
widened row type. Counts are unchanged and `semantics` does not move.

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

* test(mobile): repin the corpus after the to-do fixture and row check

Repins `baseline` to the commit that checked the GitLab to-do row and re-records all 758 goldens,
so the whole corpus is pinned to one tree again: the two `gitlab.todos` goldens were still pinned
to main's, which is the tree that produced their before-picture.

The disclosed move is the `normal` partition of `tasks.task-list-gitlab-todos`. That is the fixture
correction showing through, not a reader change: with a real `GitLabTodo` on the wire the list
renders one item where it used to render a TypeError. Every other body move in this refresh is a
malformed-reply partition, as before.

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

* test(mobile): correct the github.prFileContents fixture to the host's shape

The recorded `normal` reply at both `github.prFileContents` sites was
`{oldContent, newContent, truncated}`, which `getPRFileContents` never returns:
it answers `{original, modified, originalIsBinary, modifiedIsBinary,
originalTooLarge, modifiedTooLarge}` (src/main/github/pull-request-file-contents
.ts:121-128), with the two too-large flags set only where a side was skipped for
size (:54). Both sites' `normal` partitions therefore proved nothing about the
success path, and `githubPullRequestFileContentsSchema` cited that fiction as
the reason it could require nothing. Same defect class as the `gitlab.todos`
fixture corrected in 32bd65c, found by round-1 review.

Before-picture recorded against main's own product tree, not this branch's: a
detached worktree at `4b876758d3`, this branch's `pilot-scenarios.json` copied
in with `baseline` set to that commit, per the recorder README's detached-pin
recipe. Control: 744 of the 758 goldens reproduce the base corpus byte for byte;
the 12 copied here are the two affected families, and the remaining two are the
already-corrected to-do pair, which reproduced 32bd65c's bytes exactly.

The 12 carry `baseline: 4b87675`, the tree that produced them. The next
commit's reader change and the repin that follows it re-record them.

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

* test(mobile): record main's reaction rendering for both providers

No scenario in the corpus carried a comment reaction, so nothing in the 758
goldens could see what a reader does to one. Round-1 review found the
consequence: this branch closed `reactions[].content` to a mobile vocabulary
(`thumbs_up`) that no producer sends, and the corpus stayed green because the
member was never on the wire.

Two scenarios, one per provider, each a second scenario in an existing family so
no matrix base and no existing golden moves. The GitHub one carries
`GitHubReactionContent` as the host sends it — `'+1'` and `'heart'`
(src/shared/github/comment-types.ts:3-17, normalised from GraphQL at
src/main/github/comment-reactions.ts:19-27). The GitLab one carries
`GitLabReaction`, which is `{ name, count }` with no `content` at all
(src/shared/gitlab-types.ts:60-72).

Recorded against main's product tree at `4b876758d3` through the detached-pin
worktree, so the `normal` partition now pins what main renders rather than what
this branch renders. Control: all 758 existing goldens reproduce the previous
pin recording byte for byte; the only difference is these two added files.

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

* fix(mobile): forward a comment reaction instead of matching mobile's vocabulary

`DETAIL_REACTION_CONTENT` was `thumbs_up | thumbs_down | ...`, a vocabulary no
producer of this list sends. GitHub answers `github.workItemDetails` with
`PRComment[]` whose reactions are `GitHubReactionContent` — `'+1'`, `'-1'`,
`laugh`, ... (src/shared/github/comment-types.ts:3-17), normalised from GraphQL
at src/main/github/comment-reactions.ts:19-27 — and GitLab answers with
`GitLabReaction`, `{ name, count }` with no `content` member
(src/shared/gitlab-types.ts:60-72). The closed arm set dropped every real
reaction row on both providers, which is a good-reply path this PR must not
change.

`content` is forwarded now, salvaged the way every other guarded member here is;
`count` stays required, because the `count > 0` filter at
mobile-tasks-item-comments.tsx:145 is the one unguarded read. `DetailComment`'s
eight phantom arms go with it: mobile's declared type was written from memory,
not from the wire, and widening the type is the fix rather than narrowing what
the host may send.

`COMMENT_REACTION_EMOJI` was keyed by that same phantom vocabulary, so it
resolves no glyph for a real reaction and the chip renders without one. That is
a pre-existing defect and it stays exactly as it is: the map is typed
`Record<string, string>` and the lookup takes `?? ''`, which resolves to the
same `undefined` main resolved for both providers. The two scenarios recorded in
68a3db2 pin that rendering, so a future arm set cannot drop the rows unseen.

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

* docs(mobile): stop citing the file-contents fiction as the reason nothing is required

The schema comment and its unit pin both named `{ oldContent, newContent,
truncated }` as "the recorded reply", which d26aeec corrected. The rule that
keeps every member optional is unchanged and is now stated from the reads
instead: the call site files the payload under the file path and reads nothing
off it, the review panels reach each flag through `?.`, and `splitContentLines`
takes `string | undefined` behind a falsy guard. The pins move to the host's own
shape, plus the too-large pair a skipped side carries and the empty object that
shows no member is required.

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

* refactor(mobile): import MERGEABLE_STATE instead of redeclaring it

`task-item-detail-reply-schema.ts` declared its own copy of `['MERGEABLE',
'CONFLICTING', 'UNKNOWN']` while already importing four member helpers from
`../session/github-pr-entity-reply-schema`, which exports that arm set and uses
it in the identical expression three times. Two copies of one wire arm set is
one place to fix when a provider gains a fourth state.

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

* refactor(mobile): inline the alias-only bindings the deleted casts left behind

Each of the eight was `const result = x as { ok?: boolean; error?: string }`.
With the cast gone the line is a rename of a binding that already has a name,
and every one of them is followed immediately by the same `ok === false` check.
Reading `created.ok` / `updated.ok` / `written.ok` / `replyResult.ok` directly
leaves one name per value.

The parity constants move with it and with the reaction change before it. The
comment there names both: ten string literals leave `semantics` with the phantom
reaction vocabulary and one arrives with the `?? ''` fallback, and the alias
deletions move the hook and statement hashes. No `rpc:` or `jsx:` signature
moves, the render-token hash does not move, and the hook, statement and
declaration counts are unchanged at 350, 417 and 194.

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

* test(mobile): register the container-requirement mutant the matrix kills

`f1b695f161` proved by hand that making `linearAccountStatusSchema` `.nullable()`
fails the `result-null` partition of `tasks.provider-load`'s matrix, and left it
unregistered. Registering it in `pilot-mutants.test.ts` is not available: that
suite drives the manifest scenario as written, and `tk-provider-load` scripts a
fulfilled `linear.status`, which a nullable container accepts exactly as the
required one does. The mutation only has somewhere to diverge under a partition
the pilot never reaches.

`family-mutants.test.ts` drives one named variant of a family's matrix instead,
against that variant's own slice of the golden, and each entry names both the
partition that kills the mutation and one that cannot see it — so the entry
records where the coverage is rather than that some golden went red. The
comparison is the whole recorded variant, the way the family suite compares:
under a last-state projection this mutant survives, because the divergence is in
the settlement and both paths reach the same final screen state.

Nothing under `mutants/` is pinned by a golden header, so this moves no
recording.

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

* test(mobile): repin the corpus after the round-1 review fixes

`baseline` moves to 542c1c3, the last fenced commit, and the whole corpus is
re-recorded against it. The two fixture corrections and the two added reaction
scenarios were recorded at main's pin first, so this run is what carries them
onto the branch's own reader.

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

* refactor(mobile): keep the Linear create arm's own binding out of the inlining

The alias inlining swept one line further than the finding it answers: the
Linear arm's `const result = linearIssueCreate.interpret(reply)` is a
declaration with a name, not an alias for one, and renaming it put a
pre-existing `createLinearTask(...) as Extract<TaskItem, …>` assertion from
#17438 inside this branch's changed lines, where the changed-code casting gate
attributes it to this PR. Reverted to `result`; the eight bindings the review
listed stay inlined.

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

* refactor(mobile): let each module build its own Linear team reader

`linearTeamListReader` was exported from the detail-operations module only so the
list-operations module could import it, which adds an operations-to-operations
import edge that buys nothing: `rpcResultVariant` is a pure factory, so two calls
with the same schema produce two functionally identical readers. What keeps the
composer's picker and the saved-selection reconciler agreeing about a team row is
that both build from `linearTeamsSchema`, which is already exported.

Deleting the export also puts the composer-policy JSDoc back on
`linearComposerTeamListRead`. JSDoc binds to the next declaration, so the block
explaining why this method carries two operations with different acceptance
policies had drifted onto the reader, leaving the operation it is about
undocumented.

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

* test(mobile): repin the corpus to the last round-1 commit

`baseline` moves to 75c568c and all 760 goldens are re-recorded against it.
Nothing but the `baseline` header moves: the two product commits since the
previous repin — the Linear create arm's binding restored and the team reader
built per module — change no observation in any recording, which is what a pure
refactor should look like here.

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

* chore(mobile): repin the RPC recording corpus to the main merge

The merge of origin/main moved both lockfiles, which the recorder fences,
so --record refused until the pin named a commit whose fenced tree matches
this one. Repinned to the merge commit and re-recorded: 760 goldens, header
only, `baseline` and `lockfileSha256`. No observation moved.

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

* docs(mobile): point the reply-schema citations at the lines they name

The alias inlining and the detail-loader rewrite moved fifteen of the consumer
lines these comments cite, and the comments are the evidence for requiring a
member only where the consumer reads it unguarded. Every citation re-checked by
opening it; the host-side ones were already right.

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

* docs(mobile): stop repeating the file-contents fiction on the type

The corrected fixture carries four of the six members at both call sites, so
"the recorded reply carries none of these" is false. The reason is the one the
schema already gives: no reader reaches a member without `?.` or
splitContentLines' falsy guard.

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

* fix(mobile): forward a file's viewed state instead of closing it

No scenario reply carries a file row, so no golden can observe either of this
schema's two arm sets. `viewerViewedState` is read only by two `=== 'VIEWED'`
tests, so it is forwarded and an arm this build predates reaches them as itself.

`status` stays closed: its only consumer sends it straight back as a
`github.prFileContents` param, which the host validates against the same seven
arms (github-pull-request-params.ts:62). Forwarding could not reach the wire
without a cast, and the host would refuse the arm on its own params, so the
drop to absent that becomes `?? 'modified'` is the compatible read.

Parity: one declaration and three arm literals, no executable change.

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

* docs(mobile): say that a Linear state-update refusal is ignored, as on main

`require-result-or-throw-message` throws only on an outer refusal, and
`linear.updateIssue` refuses in band as `{ ok: false, error }` on a
successful envelope, so the refusal reaches no `catch`. Main read the
same payload unchecked and discarded it, so nothing here changes.

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

* test(mobile): repin the RPC recording corpus to the origin/main merge

Main's #20069 re-recorded ten session create-terminal goldens and moved
twenty-one files under src/shared, both inside the recorder's fence, so
`--record` refused until the pin caught up. The re-record moves one key,
`baseline`, in all 760 goldens and nothing else; the ten taken from main
reproduce byte-for-byte apart from that pin.

Claude-Session: https://claude.ai/code/session_01JNnE9qzUZMMnqpZWCqM3nb
ivanvykopal pushed a commit to ivanvykopal/orca that referenced this pull request Sep 20, 2026
…omain (step 7) (stablyai#21169)

* refactor(mobile): checked reply readers for the tasks item and list domain (step 7)

Thirty-eight unchecked reply readers across four tasks files become checked zod
readers, so a malformed host reply surfaces as one `RpcIncompatibleReplyError`
naming the method instead of a downstream `TypeError`, a rendered `undefined`,
or a sheet left ready over garbage. Deliberately a behaviour change on malformed
replies only; nothing on the wire moves.

  mobile-task-item-state-operations.ts    17
  mobile-task-item-detail-operations.ts    8
  mobile-task-item-comment-operations.ts   7
  mobile-task-list-operations.ts           6

Two rules decide every schema, and both are stated in
task-provider-entity-reply-schema.ts:

1. A member is required only where a tasks consumer reads it with no guard.
   Everything reached through `?.`, `??` or a `typeof` test stays optional,
   because a reply without it rendered the same fallback then and now.
2. No member is required that the site's own recorded `normal` reply lacks. The
   corpus is the only evidence of what a host really sends at each site, and
   requiring a member absent from that control would turn a good reply into an
   incompatible one.

Rule 2 holds two schemas at the container: `github.prFileContents`, whose
recorded reply is `{ oldContent, newContent, truncated }` where
`getPRFileContents` returns `{ original, modified, ... }`, and `gitlab.todos`,
whose recorded row is not a `GitLabTodo` and whose `normal` partition therefore
records main crashing in `actionName.replace`. Both still gain their container,
which is what names a reply that is not an object or not a list. Correcting
those two scenarios is the follow-up that unlocks narrowing the rows.

Nine writes share one envelope reader and five comment writes share another:
`ok === false` and `error` are one host convention across them, and no input
would make two of them want different answers. The acceptance, the name and the
recorded family stay per operation. Three readers are reused rather than
re-declared — the session domain's boolean confirmation for `setPRFileViewed`
and `resolveReviewThread`, and its salvaged-member combinators throughout.

Three call-site shape tests the reader now answers for are deleted: both
`Array.isArray(payload)` guards on the checks read and the
`typeof count === 'number'` fallback on the item count. `GitHubPRFileContents`
is widened to optional members, which is what the reader can promise, and
`buildGitHubPrFileDiffPreview` takes the widened sides — `splitContentLines`
already treated a falsy side as no content, so no runtime behaviour moves.

The tasks source-parity hashes are refreshed: hook, statement, declaration and
render-token counts are unchanged, the render-token hash does not move at all,
and `semantics` is a pure deletion of ten lines.

Inventory: 137 unchecked readers over 30 files becomes 99 over 26.

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

* test(mobile): repin the RPC recording corpus and re-record the tasks reply deltas

`baseline` moves to 9133c02, the commit that made the tasks item and list
readers checked, and the whole corpus is re-recorded from it. The repin rewrites
the `baseline` header of every golden; the body moves are the disclosed
behaviour change and nothing else.

What moved, and why: a malformed reply at one of the thirty-eight migrated read
sites used to reach the consumer as the declared type and fail downstream — a
property read on `null`, `.map` on a string, a rendered `undefined`. It now
stops at the operation boundary as one `RpcIncompatibleReplyError` naming the
method, which each call site's existing `catch` shows where it showed the
`TypeError` before. Every move is confined to a malformed reply partition of a
`tasks.*` or `linear.issue-detail` family; no `normal` partition moves, and no
family outside the tasks domain moves at all.

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

* test(mobile): anchor the tasks reply readers' null-collapse mutant

One registered mutant for the class the session domain shipped twice before a
review caught it: the assignable-user row's explicit `avatarUrl: null` collapsed
into absence. `tk-item-detail-metadata` records that null in visible state, so
the pilot suite kills it; it also fails the unit pin beside the schema and both
of that family's matrix goldens, including their `normal` partitions.

Three by-hand experiments back the other two claims the corpus should hold.
Applied to the product source, run, reverted:

- Loosening a required member the consumer reads with no guard —
  `linearIssueSchema`'s `title` to a salvaged optional — fails the unit pin
  `one Linear issue: refuses a reply missing a member createLinearTask reads
  with no guard`, and `tsc` rejects it, because the loosened output is no longer
  a `LinearMobileIssue`. No golden moves: the reply matrix varies the envelope a
  host sends, never the shape of a row inside a result, so a row requirement is
  unreachable from the corpus and the unit pin is the only thing holding it.
- Loosening a *container* requirement is reachable: making
  `linearAccountStatusSchema` `.nullable()` fails one matrix golden,
  `tasks.provider-load: reply partitions at linear.status#1`, on the
  `result-null` partition, as well as its unit pin.
- Swapping one checked reader back to unchecked —
  `githubPullRequestChecksRead` to `rpcUncheckedPayloadReader` — fails two
  matrix goldens, `tasks.item-review-github` and
  `tasks.project-row-review-checks`, both at `github.prChecks#1`.

Nothing under `mutants/` is pinned by a golden header, so this moves no
recording.

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

* test(mobile): correct the gitlab.todos fixture to a real GitLabTodo row

The `tk-list-gitlab-todos` reply sent `[{ id, targetType, target: { … } }]`, a shape `listTodos`
never produces: the host returns `GitLabTodo[]`, whose row carries `actionName`, `targetTitle`,
`targetUrl`, `projectPath` and `updatedAt` flat. Main crashed on it —
`Cannot read properties of undefined (reading 'replace')` from `createGitLabTodoTask`, with the
list rendering as an empty inbox and a raw TypeError on screen.

That crash was being read as evidence: a reader could not narrow this row without "refusing the
site's only success control", when the control was never a success. The fixture is the defect, so
the fixture is what moves.

The row is now a real `GitLabTodo` (src/shared/gitlab-types.ts:219) and main renders it: one item
titled "A GitLab todo", subtitle `group/project stablyai#4`, status `review requested`.

Recorded from the pinned main tree, not from this branch, so the corrected fixture's main
projection exists as a golden before any reader touches it: a detached worktree at
`4b876758d3158a8eb6b798055d8db7c58d1cd4a9` with this branch's manifest laid over it and its
`baseline` set to that commit, per the recorder README's detached-pin recipe. Control: all 756
other goldens reproduced the base corpus byte for byte; only these two moved. Both keep
`baseline: 4b87675`, which is the tree that produced them.

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

* refactor(mobile): check the GitLab to-do row and drop its cast

With the fixture corrected, the row is readable, so the reader reads it. `gitlabTodoSchema`
requires the five members the screen reaches with no guard — `id`, `actionName` (read as
`actionName.replace`), `targetUrl` (what tapping the row opens, and the title's fallback),
`projectPath` (the subtitle and the repository badge's key and label) and `updatedAt` — and leaves
every guarded member optional: `targetTitle` behind `targetTitle || targetUrl`, `targetType` and
`targetIid` behind the two tests in `gitLabTodoTargetRef`, and `authorUsername` and `state`, which
this screen carries but never reads.

The list salvages: one unreadable to-do drops and the rest of the inbox still renders, which is
what the rest of this domain does with a row it cannot place. Nullish still reads as the empty
inbox the call site already read.

`GitLabTodo` in mobile-tasks-provider-detail-types.ts now says what the reader proves rather than
what the host declares, which is what lets the `as GitLabTodo[]` assertion at the call site go. It
was the last cast in this domain's consumers, and it was re-typing rows nothing had checked — the
phantom-field shape this series exists to remove.

Parity: the same three hashes the step-7 commit moved move once more, for the deleted cast and the
widened row type. Counts are unchanged and `semantics` does not move.

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

* test(mobile): repin the corpus after the to-do fixture and row check

Repins `baseline` to the commit that checked the GitLab to-do row and re-records all 758 goldens,
so the whole corpus is pinned to one tree again: the two `gitlab.todos` goldens were still pinned
to main's, which is the tree that produced their before-picture.

The disclosed move is the `normal` partition of `tasks.task-list-gitlab-todos`. That is the fixture
correction showing through, not a reader change: with a real `GitLabTodo` on the wire the list
renders one item where it used to render a TypeError. Every other body move in this refresh is a
malformed-reply partition, as before.

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

* test(mobile): correct the github.prFileContents fixture to the host's shape

The recorded `normal` reply at both `github.prFileContents` sites was
`{oldContent, newContent, truncated}`, which `getPRFileContents` never returns:
it answers `{original, modified, originalIsBinary, modifiedIsBinary,
originalTooLarge, modifiedTooLarge}` (src/main/github/pull-request-file-contents
.ts:121-128), with the two too-large flags set only where a side was skipped for
size (:54). Both sites' `normal` partitions therefore proved nothing about the
success path, and `githubPullRequestFileContentsSchema` cited that fiction as
the reason it could require nothing. Same defect class as the `gitlab.todos`
fixture corrected in 32bd65c, found by round-1 review.

Before-picture recorded against main's own product tree, not this branch's: a
detached worktree at `4b876758d3`, this branch's `pilot-scenarios.json` copied
in with `baseline` set to that commit, per the recorder README's detached-pin
recipe. Control: 744 of the 758 goldens reproduce the base corpus byte for byte;
the 12 copied here are the two affected families, and the remaining two are the
already-corrected to-do pair, which reproduced 32bd65c's bytes exactly.

The 12 carry `baseline: 4b87675`, the tree that produced them. The next
commit's reader change and the repin that follows it re-record them.

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

* test(mobile): record main's reaction rendering for both providers

No scenario in the corpus carried a comment reaction, so nothing in the 758
goldens could see what a reader does to one. Round-1 review found the
consequence: this branch closed `reactions[].content` to a mobile vocabulary
(`thumbs_up`) that no producer sends, and the corpus stayed green because the
member was never on the wire.

Two scenarios, one per provider, each a second scenario in an existing family so
no matrix base and no existing golden moves. The GitHub one carries
`GitHubReactionContent` as the host sends it — `'+1'` and `'heart'`
(src/shared/github/comment-types.ts:3-17, normalised from GraphQL at
src/main/github/comment-reactions.ts:19-27). The GitLab one carries
`GitLabReaction`, which is `{ name, count }` with no `content` at all
(src/shared/gitlab-types.ts:60-72).

Recorded against main's product tree at `4b876758d3` through the detached-pin
worktree, so the `normal` partition now pins what main renders rather than what
this branch renders. Control: all 758 existing goldens reproduce the previous
pin recording byte for byte; the only difference is these two added files.

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

* fix(mobile): forward a comment reaction instead of matching mobile's vocabulary

`DETAIL_REACTION_CONTENT` was `thumbs_up | thumbs_down | ...`, a vocabulary no
producer of this list sends. GitHub answers `github.workItemDetails` with
`PRComment[]` whose reactions are `GitHubReactionContent` — `'+1'`, `'-1'`,
`laugh`, ... (src/shared/github/comment-types.ts:3-17), normalised from GraphQL
at src/main/github/comment-reactions.ts:19-27 — and GitLab answers with
`GitLabReaction`, `{ name, count }` with no `content` member
(src/shared/gitlab-types.ts:60-72). The closed arm set dropped every real
reaction row on both providers, which is a good-reply path this PR must not
change.

`content` is forwarded now, salvaged the way every other guarded member here is;
`count` stays required, because the `count > 0` filter at
mobile-tasks-item-comments.tsx:145 is the one unguarded read. `DetailComment`'s
eight phantom arms go with it: mobile's declared type was written from memory,
not from the wire, and widening the type is the fix rather than narrowing what
the host may send.

`COMMENT_REACTION_EMOJI` was keyed by that same phantom vocabulary, so it
resolves no glyph for a real reaction and the chip renders without one. That is
a pre-existing defect and it stays exactly as it is: the map is typed
`Record<string, string>` and the lookup takes `?? ''`, which resolves to the
same `undefined` main resolved for both providers. The two scenarios recorded in
68a3db2 pin that rendering, so a future arm set cannot drop the rows unseen.

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

* docs(mobile): stop citing the file-contents fiction as the reason nothing is required

The schema comment and its unit pin both named `{ oldContent, newContent,
truncated }` as "the recorded reply", which d26aeec corrected. The rule that
keeps every member optional is unchanged and is now stated from the reads
instead: the call site files the payload under the file path and reads nothing
off it, the review panels reach each flag through `?.`, and `splitContentLines`
takes `string | undefined` behind a falsy guard. The pins move to the host's own
shape, plus the too-large pair a skipped side carries and the empty object that
shows no member is required.

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

* refactor(mobile): import MERGEABLE_STATE instead of redeclaring it

`task-item-detail-reply-schema.ts` declared its own copy of `['MERGEABLE',
'CONFLICTING', 'UNKNOWN']` while already importing four member helpers from
`../session/github-pr-entity-reply-schema`, which exports that arm set and uses
it in the identical expression three times. Two copies of one wire arm set is
one place to fix when a provider gains a fourth state.

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

* refactor(mobile): inline the alias-only bindings the deleted casts left behind

Each of the eight was `const result = x as { ok?: boolean; error?: string }`.
With the cast gone the line is a rename of a binding that already has a name,
and every one of them is followed immediately by the same `ok === false` check.
Reading `created.ok` / `updated.ok` / `written.ok` / `replyResult.ok` directly
leaves one name per value.

The parity constants move with it and with the reaction change before it. The
comment there names both: ten string literals leave `semantics` with the phantom
reaction vocabulary and one arrives with the `?? ''` fallback, and the alias
deletions move the hook and statement hashes. No `rpc:` or `jsx:` signature
moves, the render-token hash does not move, and the hook, statement and
declaration counts are unchanged at 350, 417 and 194.

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

* test(mobile): register the container-requirement mutant the matrix kills

`f1b695f161` proved by hand that making `linearAccountStatusSchema` `.nullable()`
fails the `result-null` partition of `tasks.provider-load`'s matrix, and left it
unregistered. Registering it in `pilot-mutants.test.ts` is not available: that
suite drives the manifest scenario as written, and `tk-provider-load` scripts a
fulfilled `linear.status`, which a nullable container accepts exactly as the
required one does. The mutation only has somewhere to diverge under a partition
the pilot never reaches.

`family-mutants.test.ts` drives one named variant of a family's matrix instead,
against that variant's own slice of the golden, and each entry names both the
partition that kills the mutation and one that cannot see it — so the entry
records where the coverage is rather than that some golden went red. The
comparison is the whole recorded variant, the way the family suite compares:
under a last-state projection this mutant survives, because the divergence is in
the settlement and both paths reach the same final screen state.

Nothing under `mutants/` is pinned by a golden header, so this moves no
recording.

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

* test(mobile): repin the corpus after the round-1 review fixes

`baseline` moves to 542c1c3, the last fenced commit, and the whole corpus is
re-recorded against it. The two fixture corrections and the two added reaction
scenarios were recorded at main's pin first, so this run is what carries them
onto the branch's own reader.

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

* refactor(mobile): keep the Linear create arm's own binding out of the inlining

The alias inlining swept one line further than the finding it answers: the
Linear arm's `const result = linearIssueCreate.interpret(reply)` is a
declaration with a name, not an alias for one, and renaming it put a
pre-existing `createLinearTask(...) as Extract<TaskItem, …>` assertion from
stablyai#17438 inside this branch's changed lines, where the changed-code casting gate
attributes it to this PR. Reverted to `result`; the eight bindings the review
listed stay inlined.

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

* refactor(mobile): let each module build its own Linear team reader

`linearTeamListReader` was exported from the detail-operations module only so the
list-operations module could import it, which adds an operations-to-operations
import edge that buys nothing: `rpcResultVariant` is a pure factory, so two calls
with the same schema produce two functionally identical readers. What keeps the
composer's picker and the saved-selection reconciler agreeing about a team row is
that both build from `linearTeamsSchema`, which is already exported.

Deleting the export also puts the composer-policy JSDoc back on
`linearComposerTeamListRead`. JSDoc binds to the next declaration, so the block
explaining why this method carries two operations with different acceptance
policies had drifted onto the reader, leaving the operation it is about
undocumented.

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

* test(mobile): repin the corpus to the last round-1 commit

`baseline` moves to 75c568c and all 760 goldens are re-recorded against it.
Nothing but the `baseline` header moves: the two product commits since the
previous repin — the Linear create arm's binding restored and the team reader
built per module — change no observation in any recording, which is what a pure
refactor should look like here.

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

* chore(mobile): repin the RPC recording corpus to the main merge

The merge of origin/main moved both lockfiles, which the recorder fences,
so --record refused until the pin named a commit whose fenced tree matches
this one. Repinned to the merge commit and re-recorded: 760 goldens, header
only, `baseline` and `lockfileSha256`. No observation moved.

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

* docs(mobile): point the reply-schema citations at the lines they name

The alias inlining and the detail-loader rewrite moved fifteen of the consumer
lines these comments cite, and the comments are the evidence for requiring a
member only where the consumer reads it unguarded. Every citation re-checked by
opening it; the host-side ones were already right.

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

* docs(mobile): stop repeating the file-contents fiction on the type

The corrected fixture carries four of the six members at both call sites, so
"the recorded reply carries none of these" is false. The reason is the one the
schema already gives: no reader reaches a member without `?.` or
splitContentLines' falsy guard.

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

* fix(mobile): forward a file's viewed state instead of closing it

No scenario reply carries a file row, so no golden can observe either of this
schema's two arm sets. `viewerViewedState` is read only by two `=== 'VIEWED'`
tests, so it is forwarded and an arm this build predates reaches them as itself.

`status` stays closed: its only consumer sends it straight back as a
`github.prFileContents` param, which the host validates against the same seven
arms (github-pull-request-params.ts:62). Forwarding could not reach the wire
without a cast, and the host would refuse the arm on its own params, so the
drop to absent that becomes `?? 'modified'` is the compatible read.

Parity: one declaration and three arm literals, no executable change.

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

* docs(mobile): say that a Linear state-update refusal is ignored, as on main

`require-result-or-throw-message` throws only on an outer refusal, and
`linear.updateIssue` refuses in band as `{ ok: false, error }` on a
successful envelope, so the refusal reaches no `catch`. Main read the
same payload unchecked and discarded it, so nothing here changes.

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

* test(mobile): repin the RPC recording corpus to the origin/main merge

Main's stablyai#20069 re-recorded ten session create-terminal goldens and moved
twenty-one files under src/shared, both inside the recorder's fence, so
`--record` refused until the pin caught up. The re-record moves one key,
`baseline`, in all 760 goldens and nothing else; the ten taken from main
reproduce byte-for-byte apart from that pin.

Claude-Session: https://claude.ai/code/session_01JNnE9qzUZMMnqpZWCqM3nb
enrick-dev pushed a commit to enrick-dev/orca that referenced this pull request Oct 15, 2026
)

* refactor(mobile): split tasks route into focused modules

* fix(mobile): repair tasks refactor module boundaries

* chore(mobile): document intentional render resets

* fix(mobile): remove stale lint suppressions from tasks split

* test(mobile): keep parity checks stable with doctor suppressions

* test(mobile): follow tasks module split

* test(mobile): follow project routing module split
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