Skip to content

feat(rpc): generate a shared params catalog from the host registry, gated on parse parity - #19961

Merged
Jinwoo-H merged 14 commits into
mainfrom
rpc-step2a-params
Sep 11, 2026
Merged

Jinwoo-H merged 14 commits into
mainfrom
rpc-step2a-params

Conversation

@Jinwoo-H

@Jinwoo-H Jinwoo-H commented Sep 11, 2026 •

Copy link
Copy Markdown
Contributor
Files Added Deleted Net
Test 2 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​184 0 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​184
Prod 174 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​8036 $\color{#cf222e}{\Huge{\mathbf{−}}}$​5874 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​2162

Summary

Mobile has no typed knowledge of what any RPC method's params look like — it passes a method string and an object and hopes. The desktop host already binds a zod schema to every method through defineMethod. This makes that binding a generated, shared source of truth.

Step 2a of the mobile RPC contract plan. Params only — no readers, no result types, no descriptors, no acceptance policies, no call-site migration, and no change to the live send path.

Scale correction

The plan said 117 methods. ALL_RPC_METHODS actually has 610. Everything here is at real scale and was done by codemod, not by hand. Estimates downstream of the 117 figure — step 4 in particular, already flagged as a placeholder — should be re-derived.

What landed

  • Generator config/scripts/generate-rpc-params-catalog.mjs (~190 lines). esbuild-bundles the host registry with the contract modules, maps method → params export by object identity, and pipes output through oxfmt so bytes are stable. Wired into pnpm lint and CI.
  • Catalog src/shared/rpc-contract/rpc-params-catalog.generated.ts: 607 entries (41 params: null, 566 schema-backed, 457 distinct schemas, 20 name collisions auto-aliased). Three methods are explicitly excluded because their schemas need node:path or runtime orchestration modules.
  • 82 shared modules extracted, 625 statements / ~4,970 lines moved out of 82 method files. Method files keep their handlers and runtime imports. The duplicate RepoSelector is consolidated to one definition.

Parse parity is the real exit

src/main/runtime/rpc/rpc-params-parse-parity.test.ts runs every catalogued schema through the dispatcher's compiled safeParse and through the same module graph re-imported against mobile's pinned zod, over a corpus of omitted / absent / undefined / null / wrong-type / transformed / defaulted / unknown-key per field.

22,772 probes, zero differences between zod 4.5.4 and 4.4.3. The version skew that motivated this gate does not currently produce one, and ACCEPTED_DELTAS is empty.

Mobile imports are type-only, enforced

mobile/src/rpc-params-contract-type-only-boundary.test.ts rejects import, bare import '…', export … from, require() and dynamic import() of contract modules, with inline self-tests for each shape.

This is load-bearing rather than stylistic: requiredString is z.unknown().transform(...), so a client-side parse would coerce a non-string to '' instead of rejecting it — silently changing the bytes on the wire. mobile/src/transport/rpc-params-contract.ts is a pure type re-export that emits no Metro module while pulling all 83 contract modules into mobile's typecheck, which also proves the host schemas compile under zod 4.4.3.

Send-side input type: settled, not half-built

z.input is unusable as the plan anticipated — requiredString is z.unknown().transform(...), so its inferred input admits non-strings and loses optional/default semantics. Rather than invent a derivation, this adds a round-trip assertion: every accepted parse re-parses to itself across all 22,772 probes, which makes RpcParams<M> = z.output a sound send-side type. No input-type machinery was built.

Each gate was proven to fail

Gate Induced failure
Drift hand-set 'repo.hooks': null → --check prints "is out of date", exit 1
Parse parity swapped the client-side repo.hooks schema → 12 differences, test failed
Type-only boundary added a mobile value import → failed naming the offending edge

Review note

188 files across src/main and src/shared. Almost all of it is mechanical movement plus generated output, but the blast radius is real and larger than the earlier steps in this plan — worth reviewing as a move, not as new logic.

Eleven fully-emptied modules were left as one-line re-exports rather than churning ~30 importers including tests. Deliberate, and easy to collapse later.

…ract

Codemod-extracted, not hand-listed: every zod value reachable from a defineMethod
`params:` now lives in a shared module a client can type against, while the method
files keep their handlers and runtime imports. Methods that bound an inline schema
get a named export so the registry can be read back by name.

Claude-Session: https://claude.ai/code/session_01JNnE9qzUZMMnqpZWCqM3nb
The generator bundles the host registry together with the shared schema modules and
maps each method to its params export by object identity, so a renamed or rebound
schema shows up as catalog drift instead of a silent mismatch. `--check` exits
non-zero on any regenerated byte difference and runs in `pnpm lint` and PR CI.

Claude-Session: https://claude.ai/code/session_01JNnE9qzUZMMnqpZWCqM3nb
Runs every catalogued schema through the dispatcher's compiled safeParse path and
through the same schema resolved against mobile's pinned zod, over a corpus of
omitted/absent/undefined/null/wrong-type/transformed/defaulted/unknown-key inputs.
Any accept, reject, throw or parsed-value difference fails unless recorded as a
named delta.

Claude-Session: https://claude.ai/code/session_01JNnE9qzUZMMnqpZWCqM3nb
requiredString is z.unknown().transform(...): parsing params client-side would coerce
a non-string to '' instead of rejecting it, rewriting the bytes on the wire. The AST
check rejects every import shape that would emit a runtime require.

Claude-Session: https://claude.ai/code/session_01JNnE9qzUZMMnqpZWCqM3nb
Why: RpcParams<M> exposes z.output as the send-side type. That is only sound if a
parsed value parses back to itself, since z.input of these schemas is unknown.

Claude-Session: https://claude.ai/code/session_01JNnE9qzUZMMnqpZWCqM3nb
A pure type re-export, so it emits no module into the Metro graph while pulling all
83 contract modules into `pnpm --dir mobile typecheck` — which is what proves the
host's schemas compile against mobile's pinned zod.

Claude-Session: https://claude.ai/code/session_01JNnE9qzUZMMnqpZWCqM3nb
@greptile-apps

greptile-apps Bot commented Sep 11, 2026 •

Copy link
Copy Markdown

Too many files changed for review (176 files, 100 file limit).

Bypass the limit by tagging @greptile-apps to review.

@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

Two cross-environment defects in the new generator break pnpm lint on Windows and on a clean checkout. Both are quick, well-precedented fixes; details inline.

Reviewed changes

  • Params catalog generator — new config/scripts/generate-rpc-params-catalog.mjs esbuild-bundles the host RPC registry, maps each method to its bound params schema by object identity, and emits a byte-stable catalog via oxfmt; wired into pnpm lint and CI with a --check drift gate.
  • Generated catalog — rpc-params-catalog.generated.ts (607 entries) plus RpcParams<M> / RpcMethodName types and an explicit RPC_METHODS_WITHOUT_SHARED_PARAMS list for the three schemas that reach into src/main.
  • Shared schema extraction — 82 zod params modules moved from method files into src/shared/rpc-contract/*-params.ts; method files keep handlers and import the schemas, schemas.ts and git-exec-options.ts become re-exports, and the duplicate RepoSelector is consolidated.
  • Two gates — a parse-parity test (22,772 probes, host zod 4.5.4 vs mobile zod 4.4.3, plus a re-parse/idempotency round-trip) and a mobile type-only boundary test that rejects any value import of the contract modules.

ℹ️ Parse-parity gate does not pin move fidelity

The parity test compares the new host schema against the same schema re-imported under mobile's zod. It proves version-skew parity, but not that the ~4,970 moved lines are behaviorally identical to the schemas they replaced — host and client both bind the moved schema, so a codemod slip (a changed .min(), a dropped .strict(), a reordered .transform()) would alter the wire contract invisibly to every gate in this PR. No golden/snapshot pins pre-move behavior.

Technical details
# Parse-parity gate does not pin move fidelity

## Affected sites
- `src/main/runtime/rpc/rpc-params-parse-parity.test.ts` — re-imports `rpc-params-catalog.generated.ts` (the moved schemas), never the pre-move schema source.

## Required outcome
- Nothing blocking: the move is deliberately mechanical and the author flagged "review as a move." If desired, a one-shot golden snapshot (per-method accept/reject/output over a fixed corpus, captured from `main` before the move) would make a future re-move auditable, but this is optional given the scale and the manual review.

## Open questions for the human
- Is "review as a move" backed by any diff-side check (e.g. codemod + `git diff --color-moved`), or purely eyeballed? Worth a sentence in the PR so a future reviewer knows the fidelity argument's basis.

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

@coderabbitai

coderabbitai Bot commented Sep 11, 2026 •

Copy link
Copy Markdown
Contributor

Review Change StackReview 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: a44d5513-61f7-4526-83bb-dfc397bdaa32

📥 Commits

Reviewing files that changed from the base of the PR and between 45f83a7 and d96f8d2.

📒 Files selected for processing (2)
  • src/shared/rpc-contract/client-ui-params.ts
  • src/shared/rpc-contract/repo-update-params.ts

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


📝 Walkthrough

Walkthrough

The change centralizes RPC parameter schemas in shared Zod contract modules. Runtime RPC methods now import or re-export these contracts instead of defining local schemas. A generator creates and verifies the generated RPC parameter catalog. CI and lint run the verification command. Mobile code exposes catalog types through type-only exports and tests the import boundary. Shared OXC CLI resolution supports formatter and linter invocation.

Priority: ➖ Normal

Merge Risk: 🟡 Moderate · up to d96f8

The parity gate may miss schema behavior changes, malformed Base64 input may reach file writes, and catalog generation may drift unpredictably. These should be resolved before merge.

🚥 Pre-merge checks | ✅ 3 | ❌ 2

❌ Failed checks (2 warnings)

Check name Status Explanation Resolution
Description check ⚠️ Warning The description gives substantial technical detail and testing evidence, but it omits required template information, including a linked issue, explicit Visual Proof with N/A and a reason, the Testin… Update the description to include every required template section. Add a real linked issue after Fixes #. Add ## Visual Proof with N/A and a brief reason if there is no UI or interaction change. Add ## Testing with manual-test statu…
Docstring Coverage ⚠️ Warning Docstring coverage is 40.91% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 22 functions across 55 files. 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 and concisely describes the main change: generating a shared RPC params catalog from the host registry with parse-parity gating.
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 gives substantial technical detail and testing evidence, but it omits required template information, including a linked issue, explicit Visual Proof with N/A and a reason, the Testing section and checklist status, AI Disclosure, Review, Agent skill upstream boundary, Notes, and the main checklist.

Resolution

Update the description to include every required template section. Add a real linked issue after Fixes #. Add ## Visual Proof with N/A and a brief reason if there is no UI or interaction change. Add ## Testing with manual-test status, automated-test details, and tested platforms. Complete or explicitly mark ## AI Disclosure, ## Review, ## Agent skill upstream boundary, ## Notes, and ## Checklist.

  • Fix all pre-merge checks with AI
✨ Finishing Touches 💡 1
📝 Generate docstrings 💡
  • 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.

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

🧹 Nitpick comments (2)
src/shared/rpc-contract/worktree-params.ts (1)

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

Use string literal issue codes for Zod 4.

Zod 4 deprecates ZodIssueCode in favor of raw string literals. Replace the five new z.ZodIssueCode.custom usages in these worktree refinements with code: 'custom'.

src/shared/rpc-contract/terminal-orphan-params.ts (1)

14-15: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick win

Use the shared pane-layout limits for orphan group layouts.

MAX_PANE_LAYOUT_DEPTH and MAX_PANE_LAYOUT_NODES are exported, and both validators walk the same recursive split/leaf tree. Use the shared constants so the two layout validators cannot diverge when a limit changes.

♻️ Proposed shared-cap reuse
-import { TerminalPaneLayoutNodeSchema } from './session-tabs-schemas-params'
+import {
+  MAX_PANE_LAYOUT_DEPTH,
+  MAX_PANE_LAYOUT_NODES,
+  TerminalPaneLayoutNodeSchema
+} from './session-tabs-schemas-params'
-      current.depth > 64 ||
-      ++count > 1_024 ||
+      current.depth > MAX_PANE_LAYOUT_DEPTH ||
+      ++count > MAX_PANE_LAYOUT_NODES ||

ℹ️ Review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Advanced

Run ID: 7d0429ce-c6ce-429c-9c1f-d3025fdd051b

📥 Commits

Reviewing files that changed from the base of the PR and between fb9ba4b and 8e1c414.

⛔ Files ignored due to path filters (1)
  • src/shared/rpc-contract/rpc-params-catalog.generated.ts is excluded by !**/*.generated.*
📒 Files selected for processing (172)
  • .github/workflows/pr.yml
  • .oxlintrc.json
  • config/scripts/generate-rpc-params-catalog.mjs
  • mobile/src/rpc-params-contract-type-only-boundary.test.ts
  • mobile/src/transport/rpc-params-contract.ts
  • package.json
  • src/main/git/command-runner/git-exec-options.ts
  • src/main/runtime/rpc/methods/accounts.ts
  • src/main/runtime/rpc/methods/agent-hooks.ts
  • src/main/runtime/rpc/methods/agent-session.ts
  • src/main/runtime/rpc/methods/ai-vault.ts
  • src/main/runtime/rpc/methods/artifacts.ts
  • src/main/runtime/rpc/methods/automation-schemas.ts
  • src/main/runtime/rpc/methods/browser-core.ts
  • src/main/runtime/rpc/methods/browser-extras.ts
  • src/main/runtime/rpc/methods/browser-schemas.ts
  • src/main/runtime/rpc/methods/browser-screencast.ts
  • src/main/runtime/rpc/methods/browser-tab-create-schema.ts
  • src/main/runtime/rpc/methods/client-events.ts
  • src/main/runtime/rpc/methods/client-settings-schemas.ts
  • src/main/runtime/rpc/methods/client-ui-schemas.ts
  • src/main/runtime/rpc/methods/client-ui-workspace-filter-fields.ts
  • src/main/runtime/rpc/methods/clipboard.ts
  • src/main/runtime/rpc/methods/computer-schemas.ts
  • src/main/runtime/rpc/methods/computer.ts
  • src/main/runtime/rpc/methods/emulator.ts
  • src/main/runtime/rpc/methods/files-mutation-methods.ts
  • src/main/runtime/rpc/methods/files-target-schemas.ts
  • src/main/runtime/rpc/methods/files-terminal-artifact-methods.ts
  • src/main/runtime/rpc/methods/files.ts
  • src/main/runtime/rpc/methods/folder-workspace.ts
  • src/main/runtime/rpc/methods/git-admission-tier-schema.ts
  • src/main/runtime/rpc/methods/git-params.ts
  • src/main/runtime/rpc/methods/github-issue-methods.ts
  • src/main/runtime/rpc/methods/github-issue-update-schema.ts
  • src/main/runtime/rpc/methods/github-project-methods.ts
  • src/main/runtime/rpc/methods/github-pull-request-methods.ts
  • src/main/runtime/rpc/methods/github-pull-request-update-methods.ts
  • src/main/runtime/rpc/methods/github-repo-target-schemas.ts
  • src/main/runtime/rpc/methods/github-repo-work-item-methods.ts
  • src/main/runtime/rpc/methods/gitlab.ts
  • src/main/runtime/rpc/methods/hosted-review.ts
  • src/main/runtime/rpc/methods/jira.ts
  • src/main/runtime/rpc/methods/linear-agent-access.ts
  • src/main/runtime/rpc/methods/linear-issue-attribute-filter-schema.ts
  • src/main/runtime/rpc/methods/linear-issue-list-method.ts
  • src/main/runtime/rpc/methods/linear-project-create.ts
  • src/main/runtime/rpc/methods/linear.ts
  • src/main/runtime/rpc/methods/native-chat.ts
  • src/main/runtime/rpc/methods/notifications.ts
  • src/main/runtime/rpc/methods/orchestration/federation/federation-control.ts
  • src/main/runtime/rpc/methods/orchestration/federation/federation-relay.ts
  • src/main/runtime/rpc/methods/orchestration/federation/federation-start-schema.ts
  • src/main/runtime/rpc/methods/orchestration/gates/gates.ts
  • src/main/runtime/rpc/methods/orchestration/runs/mutation-request-show.ts
  • src/main/runtime/rpc/methods/orchestration/runs/runs.ts
  • src/main/runtime/rpc/methods/orchestration/schemas.ts
  • src/main/runtime/rpc/methods/orchestration/worker/worker-control.ts
  • src/main/runtime/rpc/methods/orchestration/worker/worker-release-schemas.ts
  • src/main/runtime/rpc/methods/orchestration/worker/worker-release.ts
  • src/main/runtime/rpc/methods/orchestration/worker/worker-start-schema.ts
  • src/main/runtime/rpc/methods/orchestration/worker/worker-stop.ts
  • src/main/runtime/rpc/methods/plugins.ts
  • src/main/runtime/rpc/methods/preflight.ts
  • src/main/runtime/rpc/methods/project-runtime-rpc-methods.ts
  • src/main/runtime/rpc/methods/repo-update-schema.ts
  • src/main/runtime/rpc/methods/repo.ts
  • src/main/runtime/rpc/methods/runtime-client-capabilities.ts
  • src/main/runtime/rpc/methods/session-tabs-schemas.ts
  • src/main/runtime/rpc/methods/session-tabs.ts
  • src/main/runtime/rpc/methods/skills.ts
  • src/main/runtime/rpc/methods/speech.ts
  • src/main/runtime/rpc/methods/ssh.ts
  • src/main/runtime/rpc/methods/structured-agent-session-schemas.ts
  • src/main/runtime/rpc/methods/task-resume-state-schema.ts
  • src/main/runtime/rpc/methods/terminal-orphan.ts
  • src/main/runtime/rpc/methods/terminal-quick-command-rpc-schema.ts
  • src/main/runtime/rpc/methods/terminal/stream-schemas.ts
  • src/main/runtime/rpc/methods/terminal/terminal-viewport-methods.ts
  • src/main/runtime/rpc/methods/terminal/unary-schemas.ts
  • src/main/runtime/rpc/methods/terminal/viewport-schemas.ts
  • src/main/runtime/rpc/methods/ui-update-value-tolerance.ts
  • src/main/runtime/rpc/methods/updater.ts
  • src/main/runtime/rpc/methods/workspace-cleanup-ui-schema.ts
  • src/main/runtime/rpc/methods/workspace-ports.ts
  • src/main/runtime/rpc/methods/worktree-create-schemas.ts
  • src/main/runtime/rpc/methods/worktree-schemas.ts
  • src/main/runtime/rpc/methods/worktree-visibility-defaults-schema.ts
  • src/main/runtime/rpc/rpc-params-parse-parity.test.ts
  • src/main/runtime/rpc/schemas.ts
  • src/shared/rpc-contract/accounts-params.ts
  • src/shared/rpc-contract/agent-hooks-params.ts
  • src/shared/rpc-contract/agent-session-params.ts
  • src/shared/rpc-contract/ai-vault-params.ts
  • src/shared/rpc-contract/artifacts-params.ts
  • src/shared/rpc-contract/automation-params.ts
  • src/shared/rpc-contract/browser-core-params.ts
  • src/shared/rpc-contract/browser-extras-params.ts
  • src/shared/rpc-contract/browser-params.ts
  • src/shared/rpc-contract/browser-screencast-params.ts
  • src/shared/rpc-contract/browser-tab-create-params.ts
  • src/shared/rpc-contract/client-events-params.ts
  • src/shared/rpc-contract/client-settings-params.ts
  • src/shared/rpc-contract/client-ui-params.ts
  • src/shared/rpc-contract/client-ui-workspace-filter-fields-params.ts
  • src/shared/rpc-contract/clipboard-params.ts
  • src/shared/rpc-contract/computer-params.ts
  • src/shared/rpc-contract/computer-schemas-params.ts
  • src/shared/rpc-contract/emulator-params.ts
  • src/shared/rpc-contract/files-mutation-params.ts
  • src/shared/rpc-contract/files-params.ts
  • src/shared/rpc-contract/files-target-params.ts
  • src/shared/rpc-contract/files-terminal-artifact-params.ts
  • src/shared/rpc-contract/folder-workspace-params.ts
  • src/shared/rpc-contract/git-admission-tier-params.ts
  • src/shared/rpc-contract/git-params.ts
  • src/shared/rpc-contract/github-issue-params.ts
  • src/shared/rpc-contract/github-issue-update-params.ts
  • src/shared/rpc-contract/github-project-params.ts
  • src/shared/rpc-contract/github-pull-request-params.ts
  • src/shared/rpc-contract/github-pull-request-update-params.ts
  • src/shared/rpc-contract/github-repo-target-params.ts
  • src/shared/rpc-contract/github-repo-work-item-params.ts
  • src/shared/rpc-contract/gitlab-params.ts
  • src/shared/rpc-contract/hosted-review-params.ts
  • src/shared/rpc-contract/jira-params.ts
  • src/shared/rpc-contract/linear-agent-access-params.ts
  • src/shared/rpc-contract/linear-issue-attribute-filter-params.ts
  • src/shared/rpc-contract/linear-issue-list-params.ts
  • src/shared/rpc-contract/linear-params.ts
  • src/shared/rpc-contract/linear-project-create-params.ts
  • src/shared/rpc-contract/native-chat-params.ts
  • src/shared/rpc-contract/notifications-params.ts
  • src/shared/rpc-contract/orchestration-federation-control-params.ts
  • src/shared/rpc-contract/orchestration-federation-relay-params.ts
  • src/shared/rpc-contract/orchestration-federation-start-params.ts
  • src/shared/rpc-contract/orchestration-gates-params.ts
  • src/shared/rpc-contract/orchestration-params.ts
  • src/shared/rpc-contract/orchestration-runs-mutation-request-show-params.ts
  • src/shared/rpc-contract/orchestration-runs-params.ts
  • src/shared/rpc-contract/orchestration-worker-control-params.ts
  • src/shared/rpc-contract/orchestration-worker-release-params.ts
  • src/shared/rpc-contract/orchestration-worker-release-schemas-params.ts
  • src/shared/rpc-contract/orchestration-worker-start-params.ts
  • src/shared/rpc-contract/orchestration-worker-stop-params.ts
  • src/shared/rpc-contract/plugins-params.ts
  • src/shared/rpc-contract/preflight-params.ts
  • src/shared/rpc-contract/project-runtime-params.ts
  • src/shared/rpc-contract/repo-params.ts
  • src/shared/rpc-contract/repo-update-params.ts
  • src/shared/rpc-contract/rpc-param-primitives.ts
  • src/shared/rpc-contract/runtime-client-capabilities-params.ts
  • src/shared/rpc-contract/session-tabs-params.ts
  • src/shared/rpc-contract/session-tabs-schemas-params.ts
  • src/shared/rpc-contract/skills-params.ts
  • src/shared/rpc-contract/speech-params.ts
  • src/shared/rpc-contract/ssh-params.ts
  • src/shared/rpc-contract/structured-agent-session-params.ts
  • src/shared/rpc-contract/task-resume-state-params.ts
  • src/shared/rpc-contract/terminal-orphan-params.ts
  • src/shared/rpc-contract/terminal-quick-command-params.ts
  • src/shared/rpc-contract/terminal-stream-params.ts
  • src/shared/rpc-contract/terminal-unary-params.ts
  • src/shared/rpc-contract/terminal-viewport-methods-params.ts
  • src/shared/rpc-contract/terminal-viewport-schemas-params.ts
  • src/shared/rpc-contract/ui-update-value-tolerance-params.ts
  • src/shared/rpc-contract/updater-params.ts
  • src/shared/rpc-contract/workspace-cleanup-ui-params.ts
  • src/shared/rpc-contract/workspace-ports-params.ts
  • src/shared/rpc-contract/worktree-create-params.ts
  • src/shared/rpc-contract/worktree-params.ts
  • src/shared/rpc-contract/worktree-visibility-defaults-params.ts

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

Comment on lines +61 to +68
export const TaskProviderIdentity = z
.custom<SharedTaskProviderIdentity>(
(value) =>
value !== null &&
typeof value === 'object' &&
'provider' in value &&
['github', 'gitlab', 'linear', 'jira'].includes(String(value.provider))
)

@coderabbitai coderabbitai Bot Sep 11, 2026 •

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:

#!/bin/bash
set -euo pipefail

ast-grep outline src/shared/task-source-context.ts \
  --items all \
  --match 'TaskProviderIdentity' \
  --view expanded

rg -n -C 16 \
  '\b(type|interface)\s+TaskProviderIdentity\b|\bTaskProviderIdentity\b' \
  src/shared/task-source-context.ts src

Repository: stablyai/orca

Length of output: 34600


Validate provider-specific fields in TaskProviderIdentity.

The schema accepts { provider: 'github' } even though GitHub identities require owner and repo; similar required fields exist for GitLab. This incomplete value can cross the RPC boundary as SharedTaskProviderIdentity. Use provider-specific object schemas.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Correct that { provider: 'github' } passes without owner/repo — the z.custom guard only checks the discriminant. Unchanged from main (automation-schemas.ts:57), identical apart from export, so same call as the base64 one: out of scope for a move-only PR, worth its own.

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.

@Jinwoo-H, acknowledged. The validation gap predates this PR and the relocation does not expand its behavior.

A separate change should replace the discriminant-only z.custom guard with provider-specific schemas. Would you like me to open a follow-up issue for that work?

You are interacting with an AI system.

Mobile's only entry to the params contract is a pure `export type`, and
rpc-params-contract-type-only-boundary.test.ts rejects a value import — so mobile
never parses these schemas. The gate proved parity for a parse the design forbids,
never ran in CI, and 88% of its probes set one field while omitting required
siblings, so both sides rejected them for the wrong reason. What a type-only
consumer needs is that the types resolve under mobile's zod, which
`pnpm --dir mobile typecheck` already proves over all 83 contract modules.

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

Two ways `pnpm lint` died before the catalog gate could run. It scratched in out/,
which is gitignored and absent on a clean checkout, so mkdtempSync threw ENOENT; it
is now created on demand. And it spawned node_modules/.bin/oxfmt, a .cmd shim on
Windows that Node >= 20 refuses without shell:true — the same EINVAL that once took
the oxlint gates down. resolveOxcCliInvocation generalises the fix oxlint already
had: read the bin entry from the package manifest and run it under process.execPath.

Claude-Session: https://claude.ai/code/session_01JNnE9qzUZMMnqpZWCqM3nb
verify:rpc-params-catalog compares it byte-for-byte, so a CRLF checkout fails the
gate — the same reason en-runtime-required.json and bundled-skill-guides.ts are
pinned here.

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

@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 parse-parity gate was dropped, but the PR's headline and its RpcParams<M> = z.output rationale still describe it as load-bearing.

Reviewed changes

  • Fixed the two cross-environment generator defects — scratchDir() now mkdirSyncs the gitignored out/ before mkdtempSync (the fresh-clone ENOENT), and formatted() runs oxfmt through a new resolveOxcCliInvocation helper under process.execPath instead of the Windows .cmd shim (the EINVAL).
  • Generalized the oxc shim resolution — extracted resolveOxcCliInvocation into its own module; oxlint-cli-invocation.mjs now delegates to it, with a focused test covering the no-shim / no-shell spawn and the missing-bin error.
  • Pinned the generated catalog to LF — .gitattributes marks rpc-params-catalog.generated.ts linguist-generated + eol=lf, so the byte-for-byte drift gate survives a CRLF checkout.
  • Removed the host/mobile parse-parity test — deleted rpc-params-parse-parity.test.ts (191 lines) on the grounds that mobile imports the contract type-only and never parses these schemas.

⚠️ Description and z.output soundness no longer match what landed

The deleted test carried two distinct things: the zod 4.5.4-vs-4.4.3 version-skew comparison, and the round-trip/idempotency assertion ("every accepted parse re-parses to itself") that the description cites as the proof making RpcParams<M> = z.output "a sound send-side type." Dropping the version-skew comparison is clearly right — mobile/src/transport/rpc-params-contract.ts is a pure export type, the boundary test rejects any value import, so mobile never parses these schemas and the skew is moot. But the round-trip assertion was the only thing backing the z.output decision documented in the generated catalog and in the "Send-side input type" section, and it is now gone with no replacement. The title ("gated on parse parity"), the "Parse parity is the real exit" section, the "two gates" enumeration, and the "Each gate was proven to fail" table all still describe a test this delta deleted, so the merge record is misleading.

Technical details
# Reconcile the description (and the z.output soundness claim) with the dropped gate

## Affected sites
- PR #19961 title and description — still claim "gated on parse parity", 22,772 probes, "two gates", and a proven-fail table for the deleted test.
- `src/shared/rpc-contract/rpc-params-catalog.generated.ts:1161` — the `RpcParams<M> = z.output` comment explains why `z.input` is unusable but no longer records how `z.output`'s send-side soundness is established.

## Required outcome
- Update the title/description so they reflect what actually landed (a type-only params contract, drift-gated, with no parse-parity gate).
- Either restore a bounded round-trip/idempotency assertion to keep the `z.output`-is-sound claim honest, or explicitly mark that soundness as unproven and deferred to the step-4 call-site migration (where `RpcParams<M>` first gets used to construct send values).

## Open questions for the human
- Is the round-trip soundness of `z.output` expected to be re-proven when call sites migrate in step 4, or is it acceptable to leave it asserted-by-comment until then?

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

Conflict in client-ui-schemas.ts: main (#19966) added
dismissedUnexpectedSignoutVersion to UiUpdateFields while this branch moved
UiUpdateFields to src/shared/rpc-contract/client-ui-params.ts. Kept the
re-export and re-applied main's field at the schema's new home, so the
signed-out-user prompt keeps its persisted dismissal field.

Claude-Session: https://claude.ai/code/session_01JNnE9qzUZMMnqpZWCqM3nb
createRepoUpdateSchema annotated its return as
z.ZodObject<T & { updates: z.ZodObject<z.ZodRawShape> }> and cast to match, so
z.output widened `updates` to Record<string, unknown>. That was harmless while
nothing read the type; this branch makes the catalog the params contract, so
RpcParams<'repo.update'> shipped as an open record and typed callers lost all
24 update fields. Inferring the return type restores them.

Type-only: the annotation and cast are erased, so the schema object and every
parse outcome are unchanged.

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

@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 new issues found.

Reviewed changes

  • Merged origin/main — the single new commit is a merge of main into the branch. The net delta against the prior review is the propagation of one new persisted-UI field, dismissedUnexpectedSignoutVersion: NullableString.optional(), into the moved UiUpdateFields schema in src/shared/rpc-contract/client-ui-params.ts, matching the field main added to the pre-move client-ui-schemas.ts. The propagation is exact (same NullableString type, same position next to dismissedUpdateVersion), so the method-file re-export and the shared source of truth stay in lockstep and the drift gate remains satisfied.

Pullfrog  | 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 new issues found.

Reviewed changes

  • Kept repo.update's named fields in its params type — createRepoUpdateSchema dropped its explicit z.ZodObject<T & { updates: z.ZodObject<z.ZodRawShape> }> return annotation (and the matching as cast) in src/shared/rpc-contract/repo-update-params.ts, letting TypeScript infer the precise shape. The prior annotation widened updates to an open record and erased all 24 named fields from RpcParams<'repo.update'>; the inferred type restores them.

ℹ️ Type fidelity of RpcParams<M> is not pinned by any gate

This commit fixes a real regression — a widening annotation silently collapsed RpcParams<'repo.update'> to an open record — but nothing in CI would have caught it: the drift gate only compares schema object identity, the type-only boundary test only rejects value imports, and no test asserts the shape a catalogued schema produces. The fix was found by hand. Worth a sentence in the PR on whether a type-level assertion (e.g. a satisfies-style check that RpcParams<'repo.update'>['updates'] still names its fields) belongs here or is deferred until step 4 gives the type a real consumer.

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

@Jinwoo-H
Jinwoo-H merged commit c84007c into main Sep 11, 2026
39 checks passed
@Jinwoo-H
Jinwoo-H deleted the rpc-step2a-params branch September 11, 2026 04:18
sj900211 added a commit to sj900211/orcinus that referenced this pull request Sep 13, 2026
The nightly orcinus-sync radar flagged a conflict every night since it was
armed on 2026-09-07 (6 red runs). Resolved locally as the radar instructs and
merged with a merge commit (never squash).

Conflicts (5) and resolutions:
- src/main/runtime/rpc/methods/client-ui-schemas.ts: upstream moved the
  schemas to src/shared/rpc-contract/client-ui-params.ts (stablyai#19961). Took
  upstream and re-added the fork's 'sftp' entry in STATIC_RIGHT_SIDEBAR_TABS.
- tab-bar-surface.tsx: kept the fork's editorOnly wrapper (satellite D10)
  around upstream's <TabBarStaticCreateMenu/> component.
- tab-drag-pointer-sensor.ts: upstream's `ended` guard first, then the
  fork's last-pointer recording in handleEnd.
- useIpcEvents-lifecycle.test.ts: upstream's runtimeEnvironments.onStatusChanged
  rename plus the fork's satelliteWindow.* events.
- worktree-activation.ts: fork's ActivateOtherWindowGuardOpts intersected with
  upstream's WorktreeActivationOptions / WorktreeActivationSurfaceSelection.

Follow-ups so the fork gates pass on the merged tree:
- src/shared/constants.ts: dropped the redundant `satelliteWindowSessions: []`
  default (the field is optional and every reader normalizes); the file is
  back within the max-lines budget and byte-identical to upstream.
- worktree-activation-surface-caller-wiring.test.ts: registered the fork's
  seam file folder-workspace-initial-terminal.ts in the census.

Gates on the merged tree: oxlint 0, typecheck 0, verify-orcinus-identity OK,
fork contract tests + tests covering the conflict files green (25 files).

Co-Authored-By: Claude Fable 5.1 <[email protected]>
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