Skip to content

refactor(sources): row-less sources and host-less surfaces name their host - #27290

Merged
OrcaWin merged 2 commits into
mainfrom
OrcaWin/d4-g1-sources
Oct 10, 2026
Merged

OrcaWin merged 2 commits into
mainfrom
OrcaWin/d4-g1-sources

Conversation

@OrcaWin

@OrcaWin OrcaWin commented Oct 10, 2026 •

Copy link
Copy Markdown
Collaborator
Files Added Deleted Net
Test 10 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​213 $\color{#cf222e}{\Huge{\mathbf{−}}}$​142 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​71
Prod 42 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​523 $\color{#cf222e}{\Huge{\mathbf{−}}}$​297 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​226

ELI5

Linear and Jira on the Tasks page, the Claude/Codex account switchers in the status bar, and the settings navigation don't belong to any one project, so they have no owner to follow. Until now they quietly asked the old focus-routing helper which host to use. This PR names that choice explicitly: a row-less source uses its Tasks source when it has one, and otherwise the default host, through one clearly named function. Nothing changes for users.

What Changed

  • Before / after (user): no change. Each surface reads from the same host as before.
  • Mechanism:
    • lib/default-creation-host.ts now holds both approved readers of the "default host" setting, behind one private read:
      • defaultCreationHost for creation flows;
      • defaultScopeHost, new, for row-less sources and settings scopes that start on the default host until a picker overrides them.
    • It also adds RowLessSource (a Tasks source context, an explicit host, or defaultScopeSource(settings)) and rowLessSourceTarget. The ratchet counts defaultScopeHost and rowLessSourceTarget as readers (seeds), so their uses stay visible in the focus-read baseline.
    • The Linear and Jira clients (getLinearRuntimeTarget, getJiraRuntimeTarget and every client that takes RuntimeLinearSettings / RuntimeJiraSettings) take a RowLessSource instead of settings, so raw settings no longer compile. Callers pass sourceContext ?? defaultScopeSource(settings): the Tasks page, the issue drawers, the Linear/Jira store slices and the read scopes.
    • Where an omitted source used to mean "this computer", it still does, now written as an explicit { kind: 'local' }. This covers metadata hooks called without a source, the Linear URL lookup with no context, and the workspace-board sync with no resolver.
    • The status-bar Claude/Codex switchers and useSettingsNavigationMetadata (shared with the palette) have no host picker, so they use defaultScopeHost. The settings host picker's initial default reads through defaultScopeHost too, so there is one reader.
    • Skill discovery builds its target with runtimeTargetForOwnerEnvironment instead of getActiveRuntimeTarget. The owner id still comes from the same single-focused-server rule the skill-install terminal uses, so scan and install keep naming the same host. That rule still reads the setting, and it stays counted.
    • Workspace-board Linear status sync routes each worktree by its owner (runtimeTargetForWorkspaceOwner; no row means this computer), instead of getSettingsForWorktreeRuntimeOwner.
    • The new Linear issue dialog's project list moved into use-new-linear-issue-projects.ts, which keeps the creation-state hook under the line limit.
  • Ratchets: owner-routing 165 → 158; focus-read 1343 → 1339. No file grew.

defaultScopeHost / defaultScopeSource uses (row-less or host-less only): Linear/Jira store slices (connection, status, read scopes), Tasks-page Linear/Jira hooks and dialogs, Linear/Jira issue drawers and editors, ClaudeSwitcherMenu, use-codex-switcher-controller, useSettingsNavigationMetadata, and the settings host scope's initial default.

Why

The design allows exactly two reads of the setting: the creation default, and the initial host of a source or scope picker. These surfaces are the second kind, but they used the generic routing helper, which hid that choice and kept the owner-routing ratchet above zero.

We considered building a Tasks-page host picker now. It needs per-host Linear and Jira connection status, which the store tracks only for the default host today, so it stays a follow-up. The default host is now named at every call site, so that picker only has to replace defaultScopeSource(settings).

Linked Issue

None. This is part of the host-ownership routing stack (D4 G1, leftovers from the forge and terminal areas).

Visual Proof

N/A. There is no UI or behavior change: the same hosts are read through explicit names.

Testing

  • I manually tested these changes locally

  • Automated tests added/updated, or explained why not below

  • default-creation-host.test.ts checks that row-less sources start on the default host and that a task source or explicit host wins.

  • The Linear/Jira client, store-slice, drawer and board-sync tests are updated for explicit sources, with the same expectations for which host is read.

  • Ran: pnpm tc:web, focused pnpm test (369 files; the only failure was the timing-bound palette-match-performance, which is unrelated and fails under machine load), oxlint, oxfmt, check:code-quality:changed, audit:anti-slop, and check:owner-routing-ratchet.

Review

Agent skill upstream boundary

  • Not applicable, or this change copies or mechanically translates no upstream skill-installer source, tests, fixtures, registry entries, path tables, comments, or documentation.

Notes

No wire change; renderer only. SSH: direct-SSH owners still go through this app. Folder workspaces: board sync resolves folder owners through resolveOwner.

Checklist

  • This PR is small and focused
  • I explained what changed and why (ELI5, the user-facing before/after, the mechanism, and why over the alternatives)
  • 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 lint, pnpm typecheck, pnpm test, and pnpm build pass (or CI will cover; local preferred)

Review fix (ratchet accounting)

  • defaultScopeSource is now a counted reader, so its ~48 call sites show in the focus-read baseline. This is the visible list of row-less surfaces that still use the default host.
  • Discovery now also follows a reader's result assigned to a local that is then returned (const id = reader(…); return id …). That keeps the skill-discovery hook and similar wrappers counted. The focus-read baseline grows (1492 on current main) because the definition is wider, not because anything new reads the setting.

@coderabbitai

coderabbitai Bot commented Oct 10, 2026 •

Copy link
Copy Markdown
Contributor

Review in Change Stack →

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration
  • Configuration used: Repository UI
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 0e691d8a-56c9-466a-a6de-117620bbe170

📥 Commits

Reviewing files that changed from the base of the PR and between 4a8a5ab19fa58ddb295b2ecb30d8863947176b28 and 6597a18.


📒 Files selected for processing (1)
  • config/focus-setting-read-baseline.txt

Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 2 remain after this review.



📝 Walkthrough

Walkthrough

The changes add shared helpers for resolving default scope sources and runtime targets. Jira and Linear clients and call sites now pass discriminated sources, with task-source contexts retained when provided. Runtime scope selection also changes for settings, status-bar operations, metadata loading, and worktree status synchronization. Linear project loading moves into a dedicated hook. Tests and routing baselines are updated.


Priority: ➖ Normal

Merge Risk: 🟡 Moderate · up to 6597a

Several issue surfaces can repeat provider requests without a task-source context, creating a material reliability and performance risk. The accompanying ratchet documentation is also incomplete.

Pre-merge checks | Passed 3 | Failed 2

❌ Failed checks (2 warnings)

Check name Status Explanation Resolution
Description check Warning The description clearly explains the refactor, rationale, scope, and validation. However, the required Linked Issue is missing because the description states “None,” and the manual-testing and full va… Add an actual issue link under Linked Issue, or document the applicable maintainer exception. Complete or explicitly explain manual testing and the remaining lint, typecheck, test, and build checks, including the reported performance-test f…
Docstring Coverage Warning Docstring coverage is 10.71% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 56 functions across 50 files. (1 skipped:… Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (3 passed)
Check name Status Explanation
Title check Passed The title clearly identifies the main change: explicit host naming for row-less sources and host-less surfaces.
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 clearly explains the refactor, rationale, scope, and validation. However, the required Linked Issue is missing because the description states “None,” and the manual-testing and full validation checklist remains incomplete.

Resolution

Add an actual issue link under Linked Issue, or document the applicable maintainer exception. Complete or explicitly explain manual testing and the remaining lint, typecheck, test, and build checks, including the reported performance-test failure.


Full details: Docstring Coverage

Explanation

Docstring coverage is 10.71% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 56 functions across 50 files. (1 skipped: 1 unsupported.)


  • Fix all pre-merge checks with AI
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

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

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Actionable comments posted: 1

Caution

Some comments are outside the diff and can’t be posted inline due to GitHub limitations.

⚠️ Outside diff range comments (1)

🟡 Minor · Update the ratchet policy comment for scope defaults. · focus-setting-read-baseline.txt:3-4

config/focus-setting-read-baseline.txt:3-4
📐 Maintainability & Code Quality | 🟡 Minor | ⚡ Quick win

Update the ratchet policy comment for scope defaults.

The new defaultScopeHost seed in config/scripts/check-owner-routing-ratchet.mjs (Line 25) also sanctions default-host reads for row-less source and scope selection. This comment says only creation flows may read the default host through defaultCreationHost. Update it to describe both permitted cases.

This follows the PR objective that defaultScopeHost handles source and scope picker defaults.

Proposed wording
-# Only creation flows with no source row may read
-# the default host, through defaultCreationHost.
+# Creation flows use defaultCreationHost; row-less source and scope selection uses defaultScopeHost.

ℹ️ Review info
⚙️ Run configuration
  • Configuration used: Repository UI
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 9583ec94-b8c1-4bd0-9630-cdf586e671ce
📥 Commits

Reviewing files that changed from the base of the PR and between 2eb6a92 and 1c080a506a06f8e33fa25e1d49772361ee527044.

📒 Files selected for processing (51)
  • config/focus-setting-read-baseline.txt
  • config/owner-routing-baseline.txt
  • config/scripts/check-owner-routing-ratchet.mjs
  • src/renderer/src/components/JiraIssueWorkspace.tsx
  • src/renderer/src/components/LinearIssueTextEditor.tsx
  • src/renderer/src/components/LinearIssueWorkspace.tsx
  • src/renderer/src/components/LinearItemDrawer.tsx
  • src/renderer/src/components/jira-user-picker.tsx
  • src/renderer/src/components/linear-issue-project-selector.tsx
  • src/renderer/src/components/linear-issue-sub-issues.tsx
  • src/renderer/src/components/linear-item-drawer-comment-footer.tsx
  • src/renderer/src/components/linear-item-drawer-edit-controller.tsx
  • src/renderer/src/components/settings/use-settings-store-model.ts
  • src/renderer/src/components/sidebar/use-workspace-board-task-status-sync.ts
  • src/renderer/src/components/sidebar/workspace-board-task-status-sync.test.ts
  • src/renderer/src/components/sidebar/workspace-board-task-status-sync.ts
  • src/renderer/src/components/status-bar/ClaudeSwitcherMenu.tsx
  • src/renderer/src/components/status-bar/use-codex-switcher-controller.ts
  • src/renderer/src/components/task-page-jira-grouping.test.ts
  • src/renderer/src/components/task-page-linear-issue-model.tsx
  • src/renderer/src/components/task-page/jira/IssueAssigneeField.test.tsx
  • src/renderer/src/components/task-page/jira/IssueAssigneeField.tsx
  • src/renderer/src/components/task-page/linear/Filters.tsx
  • src/renderer/src/components/use-new-linear-issue-projects.ts
  • src/renderer/src/components/use-task-page-jira-creation-metadata.ts
  • src/renderer/src/components/use-task-page-jira-issue-creation.ts
  • src/renderer/src/components/use-task-page-jira-list-effects.ts
  • src/renderer/src/components/use-task-page-jira-list-state.ts
  • src/renderer/src/components/use-task-page-linear-board.ts
  • src/renderer/src/components/use-task-page-linear-creation-state.ts
  • src/renderer/src/components/use-task-page-linear-issue-creation.ts
  • src/renderer/src/components/use-task-page-linear-project-creation.ts
  • src/renderer/src/components/use-task-page-provider-metadata.ts
  • src/renderer/src/hooks/use-active-skill-discovery-runtime-target.ts
  • src/renderer/src/hooks/useIssueMetadata.test.tsx
  • src/renderer/src/hooks/useIssueMetadata.ts
  • src/renderer/src/hooks/useSettingsNavigationMetadata.ts
  • src/renderer/src/lib/default-creation-host.test.ts
  • src/renderer/src/lib/default-creation-host.ts
  • src/renderer/src/lib/linear-issue-url-lookup.ts
  • src/renderer/src/runtime/runtime-jira-client.test.ts
  • src/renderer/src/runtime/runtime-jira-target.ts
  • src/renderer/src/runtime/runtime-linear-client.test.ts
  • src/renderer/src/runtime/runtime-linear-client.ts
  • src/renderer/src/store/slices/jira-connection-actions.ts
  • src/renderer/src/store/slices/jira-read-coordination.ts
  • src/renderer/src/store/slices/linear-invalidation.test.ts
  • src/renderer/src/store/slices/linear-scoped-collection-cache.test.ts
  • src/renderer/src/store/slices/linear/linear-slice-connection-actions.ts
  • src/renderer/src/store/slices/linear/linear-slice-scope.ts
  • src/renderer/src/store/slices/linear/linear-slice-status-actions.ts
💤 Files with no reviewable changes (1)
  • config/owner-routing-baseline.txt

Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 3 remain after this review.

@@ -46,7 +47,7 @@ export default function JiraIssueWorkspace({
sourceContext
}: JiraIssueWorkspaceProps): React.JSX.Element {
const settings = useAppStore((s) => s.settings)
const providerSettings = sourceContext ?? settings
const providerSettings = sourceContext ?? defaultScopeSource(settings)

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

Stabilize default-scope sources used by effects. When sourceContext is absent, each render creates a new providerSettings object. Each affected effect depends on that object and updates state. The updates restart requests instead of allowing the current request lifecycle to finish.

  • src/renderer/src/components/JiraIssueWorkspace.tsx#L50-L50: memoize the fallback by settings before the issue-loading effect uses it.
  • src/renderer/src/components/LinearItemDrawer.tsx#L41-L41: memoize the fallback by settings before the drawer fetch effect uses it.
  • src/renderer/src/components/linear-issue-project-selector.tsx#L27-L27: memoize the fallback by settings before the project-search effect uses it.
📍 Affects 3 files
  • src/renderer/src/components/JiraIssueWorkspace.tsx#L50-L50 (this comment)
  • src/renderer/src/components/LinearItemDrawer.tsx#L41-L41
  • src/renderer/src/components/linear-issue-project-selector.tsx#L27-L27

@OrcaWin
OrcaWin force-pushed the OrcaWin/d4-g1-sources branch 3 times, most recently from c6eed4c to 4a8a5ab Compare October 10, 2026 19:07

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Actionable comments posted: 1


ℹ️ Review info
⚙️ Run configuration
  • Configuration used: Repository UI
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 5a913d71-5619-4376-8028-ba36dbaf3419
📥 Commits

Reviewing files that changed from the base of the PR and between 3e9ab7ff66ee230b8205dcca97e161c95788def7 and 4a8a5ab19fa58ddb295b2ecb30d8863947176b28.

📒 Files selected for processing (2)
  • config/focus-setting-read-baseline.txt
  • config/owner-routing-baseline.txt
💤 Files with no reviewable changes (1)
  • config/owner-routing-baseline.txt

Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 3 remain after this review.

@@ -4,10 +4,13 @@
# the default host, through defaultCreationHost. Everything else routes by the owner.

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.

📐 Maintainability & Code Quality | 🟡 Minor | ⚡ Quick win

Update the header to include scope-picker reads.

Line 4 says only creation flows may read the default host through defaultCreationHost. This PR adds defaultScopeHost for initial source and scope picker selection, so the documented rule excludes an intended read. Update it to name both allowed paths. The PR objective describes this new scope-picker behavior.

m4air added 2 commits October 10, 2026 12:15
… host

Linear and Jira clients take a RowLessSource: a task-source context, an
explicit host, or defaultScopeSource(settings) when no Tasks source is
chosen, so raw settings no longer compile. defaultScopeHost joins
defaultCreationHost as the second sanctioned reader of the default-host
setting (both behind one private read, both ratchet seeds), and the status-bar
account switchers, settings navigation and the settings host picker's initial
default use it. Skill discovery routes by the owner id its install terminal
resolves, and the workspace-board Linear sync by the workspace owner.
defaultScopeSource is a sanctioned read of the default host, so its call
sites count. A function that assigns a reader's result to a local and returns
that local is a reader too, which keeps the skill-discovery hook counted.
@OrcaWin
OrcaWin force-pushed the OrcaWin/d4-g1-sources branch from 4a8a5ab to 6597a18 Compare October 10, 2026 19:16
@OrcaWin
OrcaWin merged commit 81867c8 into main Oct 10, 2026
29 checks passed
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