Skip to content

test(mobile): RPC recording runner and frozen main goldens (step 1) - #19835

Closed
Jinwoo-H wants to merge 11 commits into
mainfrom
rpc-lane-c-runner
Closed

Jinwoo-H wants to merge 11 commits into
mainfrom
rpc-lane-c-runner

Conversation

@Jinwoo-H

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

Copy link
Copy Markdown
Contributor
Files Added Deleted Net
Test 3 0 0 0
Prod 88 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​19844 0 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​19844

Record the reply shapes a host can send

The recorder froze how nine settings screens react to roughly 26 malformed reply envelopes,
crossed against every field each screen consumes and three boundary kinds. That was 163,925
lines of hash-interned JSON, 84% of the change, pinning accidental behavior on inputs no
desktop produces, and it would have blocked the retrofit it was built to protect: any cleanup
that normalizes malformed-reply handling trips all of it at once.

Each family now runs nine partitions once, with no field cross. The partitions are the shapes
the host dispatcher can actually emit. successResponse always sets result, so a JSON wire
has no explicit-undefined slot; settings.get returns {settings: ...}, so a number, a
string, an array, a bare {} and a boolean are all unreachable; and the inner {ok, error}
envelope the GitHub project mutations carry is only ever missing ok or false. What survives
is a normal result, an absent result, null, an inner refusal with a string or an object
error, an inner envelope missing ok, an outer refusal, method_not_found, and a transport
rejection.

null is not hypothetical. linear.getIssue returns it for a missing issue, regression seed
b2 is a shipped null-result bug, and it is what carries the one named delta these goldens
record.

Goldens: 194,734 lines to 48,240. Recording: 18.9 s to 3.0 s. Net -146,682 lines.

Also removed

  • run-step1-exit.ts, zero callers, shelled out to the same two Vitest files as
    rpc-recording.mts. Its MUTATION_NAMES reader went with it.
  • The module loader's rpc-delivery-ambiguity escape. Instrumented across every scenario,
    mutant and reference run, it was taken once, by the test that existed to take it. Golden
    comparison already fails if a mounted module ever imports the marker.
  • The history-panel exposure moved from a hardcoded branch in the loader into a declarative
    table beside the mutation anchors, so the loader has one source-text mechanism and no
    per-file if.

Kept, with evidence

The schedule goldens. They look like the fulfilled goldens with a different interleaving,
and the interleaving is the point. Mutating the request deadline to / 3 or * 0.9 is caught
by the seven schedules-* and two interruptions-* goldens and by nothing else: no plain
per-operation golden and no matrix golden notices either mutant.

The Node VM in the module loader. Mount adapters load product sources from an arbitrary
root, and the archived pre-fix tree the seed gate runs against is a bare mobile/src plus
src with no package.json and no node_modules. No bundler-resolved import reaches it and
vi.mock cannot introduce it, so the seeds could not be proven against the real defect without
this. Direct import would also swap a 38-module lazy graph for a 338-module eager one behind 20
native mocks, because the task dependency barrel re-exports from react-native and four other
native packages and export * enumerates.

Unchanged: the ~41 plain per-operation goldens, the recorderSha256 and goldenBytes
provenance headers, value pooling, elapsed-time settlement recording, and the three seeds with
their mutants.

Verification

Two consecutive --record runs byte-identical at manifest
669af6c18f33b1cc69fb519daa0619bf5d44ca91b681e7a1034456fa8dad0340. b1/b2/b3 pass against
frozen main and fail against the archived tree. All 11 family mutants killed, each applying
exactly once. Both deadline mutants still fail. Mobile typecheck, oxfmt --check,
check:code-quality:changed at 0 new findings, root oxlint at 0 errors, and the full mobile
suite at 521 files / 4,322 tests.

REPORT-END

Cut summary

An over-engineering pass removed 146,682 lines from this PR. Goldens went from 4.44 MB to 1.10 MB and recording wall time from 18.9 s to 3.0 s. The 13 matrix goldens now record nine reply shapes a host can actually produce, justified against the host dispatcher rather than the client, instead of a cross product against every consumed field. All 61 goldens survive; none was orphaned.

All seven schedules-* goldens were kept against an audit recommendation to delete them, and that turned out to be load-bearing: when either deadline mutant is applied, the nine goldens that catch it are seven schedules plus two interruption files. Not one plain per-operation golden and not one matrix golden detects a deadline change.

The sandboxed module loader was kept after an attempted conversion to plain imports failed. Its irreducible capability is loading product sources from an arbitrary filesystem root: the archived bcba08b3e4 tree has no package.json and no node_modules and sits outside the project graph, so no import specifier or vi.mock can reach it. The regression evidence that b1/b2/b3 fail against the old sources runs only through that path.

Add scripted sender recordings, guarded main goldens, reply matrices, lifecycle schedules, settings caller fixtures, and targeted B-seed mutants.

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

Resolve the golden encoding before merge. The runner itself is in good shape — this is test infrastructure with no product-code changes, strong determinism evidence, and a clean mutant-kill story — but 18 MB of permanent history (one 6.7 MB file) deserves a decision now, before step 4 multiplies it.

Reviewed changes

  • Recording runner — runRecording drives real main hooks/operations through a scripted sendRequest transport, freezing per-checkpoint sender calls, payloads, settlements, projected state, and effects.
  • VM module loader — operation-module-loader transpiles real source with the TypeScript compiler API and evaluates it in a Node VM, sharing the real RpcClientRequestTracker and the delivery-unknown WeakSet identity (special-cased import). It also injects the three B-seed source mutants with an "applied exactly once" assertion.
  • Scripted transport — ScriptedRpcTransport wraps createStableLogicalRpcClient, recording args/payloads and enforcing logical bindings for concurrent same-method calls.
  • Mount adapters — nine settings operations plus inventory/project/linear-detail adapters that mount the actual hooks under react-test-renderer via a Proxy-backed observableModel.
  • 61 goldens — pilot scenarios, reply matrices, sibling/lifecycle/interruption schedules; determinism pinned by two-run byte identity plus the b1/b2/b3 mutant seeds.
  • Write fencing & checker exit — recording requires --record + RPC_FOUNDATION_RECORD=1 + a clean pinned-main baseline; runStep1Exit runs candidate mode and asserts goldens are unchanged.

⚠️ Golden encoding adds ~18 MB of permanent history and compounds in step 4

The 61 goldens weigh ~18 MB, and matrix-settings.task-hydration.json alone is 6.7 MB / 251,664 lines because its 594 checkpoints re-serialize the full sender arguments and effects at every checkpoint rather than storing deltas. The content is correct; the encoding is redundant. Two concrete, separable costs: pretty-printing inflates every file (committed formatting is pure weight, since compareGolden re-serializes both sides via goldenBytes before comparing), and full-snapshot-per-checkpoint duplicates ~1.2 KB of args + ~2.2 KB of effects per checkpoint. I agree with the author's recommendation: drop pretty-printing now (trivial, roughly halves the cost) and delta-encode checkpoints before the directory grows in step 4.

Technical details
# Golden encoding

## Affected sites
- mobile/rpc-foundation/goldens/ — 61 files, ~18 MB; matrix-settings.task-hydration.json is 6.7 MB / 251,664 lines
- mobile/src/test-support/rpc-recording/golden-recording.ts:41-62 — goldenBytes pretty-prints (JSON.stringify indent 2), then oxfmt reformats; committed formatting is never compared directly (compareGolden normalizes both sides)
- mobile/src/test-support/rpc-recording/run-recording.ts:63-74 — every checkpoint captures the full sender array, payloads, settlements, state, and effects

## Required outcome
- Bound the committed golden weight so it does not compound with each migrated domain in step 4.

## Suggested approach
- Drop pretty-printing: write JSON.stringify(golden) + "\n" and skip the oxfmt pass for goldens.
- Delta-encode checkpoints: store diffs against the prior checkpoint for sender/effects/payloads, full snapshots at scenario boundaries; reconstruct on read for comparison.

## Open questions for the human
- Is ~18 MB acceptable as a one-time cost if step 4 adds no further golden weight, or must it be bounded now? (Recommendation: bound it now — git history is permanent.)

ℹ️ Nitpicks

  • schedule-driver.ts:4 exports REQUIRED_SCHEDULES but nothing imports it — looks like a roadmap/spec constant that was never wired to an assertion. Remove it or enforce it in a follow-up.

Note: 1 inline comment(s) dropped because they did not anchor to lines inside the PR diff:

  • mobile/src/test-support/rpc-recording/family-recordings.test.ts:183 (RIGHT) — file has no textual diff (binary, pure rename, or mode change)

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

@pullfrog

pullfrog Bot commented Sep 10, 2026

Copy link
Copy Markdown
Contributor

One minor nit that couldn't be anchored inline (the diff tooling reports this file as having no textual hunks):

mobile/src/test-support/rpc-recording/family-recordings.test.ts:183 — certify(\lifecycle-${id}`, …, false)passes a trailingfalse, but certify(id, scenarios)only takes two parameters. It's a no-op that slipped typecheck only because mobile'stsconfig.jsonexcludes**/*.test.ts`. Remove the stray argument.

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

@coderabbitai

coderabbitai Bot commented Sep 10, 2026 •

Copy link
Copy Markdown
Contributor

Review Change StackReview Change Stack

Note

Reviews paused

It looks like this branch is under active development. To avoid overwhelming you with review comments due to an influx of new commits, CodeRabbit has automatically paused this review. You can configure this behavior by changing the reviews.auto_review.auto_pause_after_reviewed_commits setting.

Use the following commands to manage reviews:

  • @coderabbitai resume to resume automatic reviews.
  • @coderabbitai review to trigger a single review.

Use the checkboxes below for quick actions:

  • ▶️ Resume reviews
  • 🔍 Trigger review

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: 49656da4-2d61-40e7-9bfa-4ecf3cacf32c

📥 Commits

Reviewing files that changed from the base of the PR and between 869e8de and ba045e6.

📒 Files selected for processing (68)
  • mobile/rpc-foundation/goldens/b1.json
  • mobile/rpc-foundation/goldens/b2.json
  • mobile/rpc-foundation/goldens/b3.json
  • mobile/rpc-foundation/goldens/interruptions-inventory-lifecycle.json
  • mobile/rpc-foundation/goldens/interruptions-settings-bot-overrides-fulfilled.json
  • mobile/rpc-foundation/goldens/inventory-lifecycle.json
  • mobile/rpc-foundation/goldens/lifecycle-b3.json
  • mobile/rpc-foundation/goldens/lifecycle-inventory-lifecycle.json
  • mobile/rpc-foundation/goldens/lifecycle-settings-bot-overrides-fulfilled.json
  • mobile/rpc-foundation/goldens/lifecycle-settings-task-hydration-fulfilled.json
  • mobile/rpc-foundation/goldens/lifecycle-settings-workspace-context-fulfilled.json
  • mobile/rpc-foundation/goldens/matrix-legacy-inventory.json
  • mobile/rpc-foundation/goldens/matrix-linear-detail-barrier.json
  • mobile/rpc-foundation/goldens/matrix-project-explicit-false.json
  • mobile/rpc-foundation/goldens/matrix-settings-agent-read.json
  • mobile/rpc-foundation/goldens/matrix-settings-best-effort.json
  • mobile/rpc-foundation/goldens/matrix-settings.bot-overrides.json
  • mobile/rpc-foundation/goldens/matrix-settings.home-providers.json
  • mobile/rpc-foundation/goldens/matrix-settings.repo-metadata.json
  • mobile/rpc-foundation/goldens/matrix-settings.resume-metadata.json
  • mobile/rpc-foundation/goldens/matrix-settings.task-hydration.json
  • mobile/rpc-foundation/goldens/matrix-settings.task-workspace.json
  • mobile/rpc-foundation/goldens/matrix-settings.workspace-context.json
  • mobile/rpc-foundation/goldens/matrix-settings.workspace-submit.json
  • mobile/rpc-foundation/goldens/schedules-b3.json
  • mobile/rpc-foundation/goldens/schedules-settings-home-providers-fulfilled.json
  • mobile/rpc-foundation/goldens/schedules-settings-new-tab-ssh.json
  • mobile/rpc-foundation/goldens/schedules-settings-repo-metadata-fulfilled.json
  • mobile/rpc-foundation/goldens/schedules-settings-resume-metadata-fulfilled.json
  • mobile/rpc-foundation/goldens/schedules-settings-task-hydration-fulfilled.json
  • mobile/rpc-foundation/goldens/schedules-settings-workspace-context-fulfilled.json
  • mobile/rpc-foundation/goldens/settings-bot-overrides-fulfilled.json
  • mobile/rpc-foundation/goldens/settings-bot-overrides-refused.json
  • mobile/rpc-foundation/goldens/settings-bot-overrides-transport-error.json
  • mobile/rpc-foundation/goldens/settings-home-coalesced.json
  • mobile/rpc-foundation/goldens/settings-home-providers-fulfilled.json
  • mobile/rpc-foundation/goldens/settings-home-providers-refused.json
  • mobile/rpc-foundation/goldens/settings-home-providers-transport-error.json
  • mobile/rpc-foundation/goldens/settings-new-tab-refused.json
  • mobile/rpc-foundation/goldens/settings-new-tab-ssh.json
  • mobile/rpc-foundation/goldens/settings-new-tab-transport-error.json
  • mobile/rpc-foundation/goldens/settings-repo-cache-expiry.json
  • mobile/rpc-foundation/goldens/settings-repo-metadata-fulfilled.json
  • mobile/rpc-foundation/goldens/settings-repo-metadata-refused.json
  • mobile/rpc-foundation/goldens/settings-repo-metadata-transport-error.json
  • mobile/rpc-foundation/goldens/settings-resume-metadata-fulfilled.json
  • mobile/rpc-foundation/goldens/settings-resume-metadata-refused.json
  • mobile/rpc-foundation/goldens/settings-resume-metadata-transport-error.json
  • mobile/rpc-foundation/goldens/settings-task-hydration-fulfilled.json
  • mobile/rpc-foundation/goldens/settings-task-hydration-refused.json
  • mobile/rpc-foundation/goldens/settings-task-hydration-transport-error.json
  • mobile/rpc-foundation/goldens/settings-task-workspace-fulfilled.json
  • mobile/rpc-foundation/goldens/settings-task-workspace-refused.json
  • mobile/rpc-foundation/goldens/settings-task-workspace-transport-error.json
  • mobile/rpc-foundation/goldens/settings-task-write.json
  • mobile/rpc-foundation/goldens/settings-workspace-context-fulfilled.json
  • mobile/rpc-foundation/goldens/settings-workspace-context-refused.json
  • mobile/rpc-foundation/goldens/settings-workspace-context-transport-error.json
  • mobile/rpc-foundation/goldens/settings-workspace-submit-fulfilled.json
  • mobile/rpc-foundation/goldens/settings-workspace-submit-refused.json
  • mobile/rpc-foundation/goldens/settings-workspace-submit-transport-error.json
  • mobile/scripts/rpc-recording.mts
  • mobile/src/test-support/rpc-recording/README.md
  • mobile/src/test-support/rpc-recording/family-recordings.test.ts
  • mobile/src/test-support/rpc-recording/operation-module-loader.ts
  • mobile/src/test-support/rpc-recording/operation-mutations.ts
  • mobile/src/test-support/rpc-recording/recording-runner.test.ts
  • mobile/src/test-support/rpc-recording/reply-matrix.ts
💤 Files with no reviewable changes (10)
  • mobile/rpc-foundation/goldens/matrix-settings.task-workspace.json
  • mobile/rpc-foundation/goldens/matrix-settings.bot-overrides.json
  • mobile/rpc-foundation/goldens/matrix-settings.workspace-submit.json
  • mobile/rpc-foundation/goldens/matrix-legacy-inventory.json
  • mobile/rpc-foundation/goldens/matrix-linear-detail-barrier.json
  • mobile/rpc-foundation/goldens/matrix-settings.home-providers.json
  • mobile/rpc-foundation/goldens/matrix-settings.resume-metadata.json
  • mobile/rpc-foundation/goldens/matrix-settings.workspace-context.json
  • mobile/rpc-foundation/goldens/matrix-settings-agent-read.json
  • mobile/rpc-foundation/goldens/matrix-settings.repo-metadata.json
🚧 Files skipped from review as they are similar to previous changes (38)
  • mobile/scripts/rpc-recording.mts
  • mobile/rpc-foundation/goldens/settings-home-providers-transport-error.json
  • mobile/rpc-foundation/goldens/b2.json
  • mobile/rpc-foundation/goldens/interruptions-settings-bot-overrides-fulfilled.json
  • mobile/rpc-foundation/goldens/schedules-settings-repo-metadata-fulfilled.json
  • mobile/rpc-foundation/goldens/settings-task-workspace-transport-error.json
  • mobile/rpc-foundation/goldens/settings-home-providers-fulfilled.json
  • mobile/rpc-foundation/goldens/settings-resume-metadata-fulfilled.json
  • mobile/rpc-foundation/goldens/settings-repo-cache-expiry.json
  • mobile/rpc-foundation/goldens/schedules-b3.json
  • mobile/rpc-foundation/goldens/settings-home-providers-refused.json
  • mobile/rpc-foundation/goldens/settings-new-tab-transport-error.json
  • mobile/rpc-foundation/goldens/settings-bot-overrides-transport-error.json
  • mobile/rpc-foundation/goldens/b3.json
  • mobile/rpc-foundation/goldens/lifecycle-b3.json
  • mobile/rpc-foundation/goldens/settings-home-coalesced.json
  • mobile/rpc-foundation/goldens/settings-repo-metadata-fulfilled.json
  • mobile/rpc-foundation/goldens/settings-resume-metadata-refused.json
  • mobile/rpc-foundation/goldens/settings-workspace-context-refused.json
  • mobile/rpc-foundation/goldens/interruptions-inventory-lifecycle.json
  • mobile/rpc-foundation/goldens/settings-new-tab-refused.json
  • mobile/rpc-foundation/goldens/b1.json
  • mobile/rpc-foundation/goldens/schedules-settings-resume-metadata-fulfilled.json
  • mobile/rpc-foundation/goldens/settings-repo-metadata-refused.json
  • mobile/rpc-foundation/goldens/schedules-settings-new-tab-ssh.json
  • mobile/rpc-foundation/goldens/settings-new-tab-ssh.json
  • mobile/rpc-foundation/goldens/settings-resume-metadata-transport-error.json
  • mobile/rpc-foundation/goldens/settings-workspace-submit-transport-error.json
  • mobile/rpc-foundation/goldens/lifecycle-settings-bot-overrides-fulfilled.json
  • mobile/rpc-foundation/goldens/settings-repo-metadata-transport-error.json
  • mobile/rpc-foundation/goldens/lifecycle-inventory-lifecycle.json
  • mobile/src/test-support/rpc-recording/README.md
  • mobile/rpc-foundation/goldens/settings-task-workspace-refused.json
  • mobile/rpc-foundation/goldens/settings-workspace-submit-refused.json
  • mobile/rpc-foundation/goldens/settings-task-hydration-refused.json
  • mobile/rpc-foundation/goldens/schedules-settings-workspace-context-fulfilled.json
  • mobile/rpc-foundation/goldens/settings-workspace-context-fulfilled.json
  • mobile/rpc-foundation/goldens/schedules-settings-home-providers-fulfilled.json

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


📝 Walkthrough

Walkthrough

Adds a deterministic mobile RPC recording framework with virtual time, scripted transport, hook adapters, scenario manifests, mutation checks, and golden-value pooling. Adds pilot scenarios and coverage mappings for inventory, Linear, project, and settings operations. Regenerates or adds versioned golden recordings with recorder hashes, timestamped settlements, deduplicated observations, and schedule outcomes. Updates recording tests, documentation, and the recording command.

Merge Risk: 🟡 Moderate · up to ba045

The new test foundation can report incomplete or misleading certification because some required schedules cannot be generated and certain configuration can bypass recording runs. These issues should be resolved before relying on the goldens.

🚥 Pre-merge checks | ✅ 3 | ❌ 2

❌ Failed checks (2 warnings)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 13.46% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 52 functions across 25 files. (60 skipped… Write docstrings for the functions missing them to satisfy the coverage threshold.
Description check ⚠️ Warning The description provides detailed scope, rationale, changes, and verification results, but it does not follow the required template. It omits the required section headings, linked issue, visual-proof … Restructure the description using the repository template. Add an ELI5 section, What Changed, Why, a valid Linked Issue such as Fixes #123``, Visual Proof with N/A and a reason, Testing with checked or explained items, AI Disclosure, Revi…
✅ Passed checks (3 passed)
Check name Status Explanation
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.
Title check ✅ Passed The title clearly identifies the test-focused mobile RPC recording runner and frozen goldens introduced by this pull request.
Full details: Docstring Coverage

Explanation

Docstring coverage is 13.46% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 52 functions across 25 files. (60 skipped: 60 unsupported.)

Full details: Description check

Explanation

The description provides detailed scope, rationale, changes, and verification results, but it does not follow the required template. It omits the required section headings, linked issue, visual-proof statement, checklist items, AI disclosure, review notes, and agent-skill boundary confirmation.

Resolution

Restructure the description using the repository template. Add an ELI5 section, What Changed, Why, a valid Linked Issue such as Fixes #123``, Visual Proof with N/A and a reason, Testing with checked or explained items, AI Disclosure, Review, Agent skill upstream boundary, Notes, and the completed Checklist.

✨ Finishing Touches 💡 2
📝 Generate docstrings 💡
  • Create stacked PR
  • Commit on current branch
🛠️ 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.

@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 (3)
mobile/src/test-support/rpc-recording/golden-recording.ts (1)

42-42: 🚀 Performance & Scalability | 🔵 Trivial | ⚡ Quick win

Write compact golden JSON.

goldenBytes adds indentation, and writeGolden formats the result again. The PR reports 17 MB of generated goldens.

Use compact JSON with a final newline. Remove the formatter when formatted output is not required.

Proposed change
-import { format } from 'oxfmt'
 export function goldenBytes(golden: GoldenRecording): string {
-  return `${JSON.stringify(golden, null, 2)}\n`
+  return `${JSON.stringify(golden)}\n`
 }
-  const result = await format(path, goldenBytes(golden), { printWidth: 100, trailingComma: 'none' })
-  if (result.errors.length) {
-    throw new Error('Cannot format golden')
-  }
-  writeFileSync(path, result.code)
+  writeFileSync(path, goldenBytes(golden))

Also applies to: 57-61

mobile/src/test-support/rpc-recording/schedule-driver.ts (1)

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

Remove the unused REQUIRED_SCHEDULES constant. No tracked code consumes it, and several entries do not match the names produced by the schedule generators. The mismatch does not currently break coverage because no coverage gate uses this constant.

mobile/src/test-support/rpc-recording/run-step1-exit.ts (1)

75-77: 🩺 Stability & Availability | 🔵 Trivial | ⚡ Quick win

Report the timeout distinctly.

runProcess resolves with timedOut: true and a null exit code when the 120 s budget expires, per src/shared/child-process/run-process.ts. This branch then reports Step 1 failed (null), which does not identify the timeout. The PR records 61 goldens across two suites, so exceeding 120 s on slower machines is plausible.

♻️ Proposed change
   if (result.code !== 0) {
+    if (result.timedOut) {
+      throw new Error(`Step 1 timed out after 120s:\n${result.stdout}\n${result.stderr}`)
+    }
     throw new Error(`Step 1 failed (${result.code}):\n${result.stdout}\n${result.stderr}`)
   }

ℹ️ Review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Advanced

Run ID: e4f71330-bfc1-43e7-b428-ad747dc1eef6

📥 Commits

Reviewing files that changed from the base of the PR and between aac38d6 and 909fadb.

📒 Files selected for processing (85)
  • mobile/rpc-foundation/goldens/b1.json
  • mobile/rpc-foundation/goldens/b2.json
  • mobile/rpc-foundation/goldens/b3.json
  • mobile/rpc-foundation/goldens/interruptions-inventory-lifecycle.json
  • mobile/rpc-foundation/goldens/interruptions-settings-bot-overrides-fulfilled.json
  • mobile/rpc-foundation/goldens/inventory-lifecycle.json
  • mobile/rpc-foundation/goldens/lifecycle-b3.json
  • mobile/rpc-foundation/goldens/lifecycle-inventory-lifecycle.json
  • mobile/rpc-foundation/goldens/lifecycle-settings-bot-overrides-fulfilled.json
  • mobile/rpc-foundation/goldens/lifecycle-settings-task-hydration-fulfilled.json
  • mobile/rpc-foundation/goldens/lifecycle-settings-workspace-context-fulfilled.json
  • mobile/rpc-foundation/goldens/matrix-legacy-inventory.json
  • mobile/rpc-foundation/goldens/matrix-linear-detail-barrier.json
  • mobile/rpc-foundation/goldens/matrix-project-explicit-false.json
  • mobile/rpc-foundation/goldens/matrix-settings-agent-read.json
  • mobile/rpc-foundation/goldens/matrix-settings-best-effort.json
  • mobile/rpc-foundation/goldens/matrix-settings.bot-overrides.json
  • mobile/rpc-foundation/goldens/matrix-settings.home-providers.json
  • mobile/rpc-foundation/goldens/matrix-settings.repo-metadata.json
  • mobile/rpc-foundation/goldens/matrix-settings.resume-metadata.json
  • mobile/rpc-foundation/goldens/matrix-settings.task-hydration.json
  • mobile/rpc-foundation/goldens/matrix-settings.task-workspace.json
  • mobile/rpc-foundation/goldens/matrix-settings.workspace-context.json
  • mobile/rpc-foundation/goldens/matrix-settings.workspace-submit.json
  • mobile/rpc-foundation/goldens/schedules-b3.json
  • mobile/rpc-foundation/goldens/schedules-settings-home-providers-fulfilled.json
  • mobile/rpc-foundation/goldens/schedules-settings-new-tab-ssh.json
  • mobile/rpc-foundation/goldens/schedules-settings-repo-metadata-fulfilled.json
  • mobile/rpc-foundation/goldens/schedules-settings-resume-metadata-fulfilled.json
  • mobile/rpc-foundation/goldens/schedules-settings-task-hydration-fulfilled.json
  • mobile/rpc-foundation/goldens/schedules-settings-workspace-context-fulfilled.json
  • mobile/rpc-foundation/goldens/settings-bot-overrides-fulfilled.json
  • mobile/rpc-foundation/goldens/settings-bot-overrides-refused.json
  • mobile/rpc-foundation/goldens/settings-bot-overrides-transport-error.json
  • mobile/rpc-foundation/goldens/settings-home-coalesced.json
  • mobile/rpc-foundation/goldens/settings-home-providers-fulfilled.json
  • mobile/rpc-foundation/goldens/settings-home-providers-refused.json
  • mobile/rpc-foundation/goldens/settings-home-providers-transport-error.json
  • mobile/rpc-foundation/goldens/settings-new-tab-refused.json
  • mobile/rpc-foundation/goldens/settings-new-tab-ssh.json
  • mobile/rpc-foundation/goldens/settings-new-tab-transport-error.json
  • mobile/rpc-foundation/goldens/settings-repo-cache-expiry.json
  • mobile/rpc-foundation/goldens/settings-repo-metadata-fulfilled.json
  • mobile/rpc-foundation/goldens/settings-repo-metadata-refused.json
  • mobile/rpc-foundation/goldens/settings-repo-metadata-transport-error.json
  • mobile/rpc-foundation/goldens/settings-resume-metadata-fulfilled.json
  • mobile/rpc-foundation/goldens/settings-resume-metadata-refused.json
  • mobile/rpc-foundation/goldens/settings-resume-metadata-transport-error.json
  • mobile/rpc-foundation/goldens/settings-task-hydration-fulfilled.json
  • mobile/rpc-foundation/goldens/settings-task-hydration-refused.json
  • mobile/rpc-foundation/goldens/settings-task-hydration-transport-error.json
  • mobile/rpc-foundation/goldens/settings-task-workspace-fulfilled.json
  • mobile/rpc-foundation/goldens/settings-task-workspace-refused.json
  • mobile/rpc-foundation/goldens/settings-task-workspace-transport-error.json
  • mobile/rpc-foundation/goldens/settings-task-write.json
  • mobile/rpc-foundation/goldens/settings-workspace-context-fulfilled.json
  • mobile/rpc-foundation/goldens/settings-workspace-context-refused.json
  • mobile/rpc-foundation/goldens/settings-workspace-context-transport-error.json
  • mobile/rpc-foundation/goldens/settings-workspace-submit-fulfilled.json
  • mobile/rpc-foundation/goldens/settings-workspace-submit-refused.json
  • mobile/rpc-foundation/goldens/settings-workspace-submit-transport-error.json
  • mobile/rpc-foundation/pilot-scenarios.json
  • mobile/rpc-foundation/settings-recording-coverage.json
  • mobile/scripts/rpc-recording.mts
  • mobile/src/test-support/rpc-recording/README.md
  • mobile/src/test-support/rpc-recording/family-recordings.test.ts
  • mobile/src/test-support/rpc-recording/golden-recording.ts
  • mobile/src/test-support/rpc-recording/hook-mount.ts
  • mobile/src/test-support/rpc-recording/observable-model.ts
  • mobile/src/test-support/rpc-recording/operation-module-loader.ts
  • mobile/src/test-support/rpc-recording/pilot-mount-adapters.ts
  • mobile/src/test-support/rpc-recording/pilot-recordings.test.ts
  • mobile/src/test-support/rpc-recording/recording-runner.test.ts
  • mobile/src/test-support/rpc-recording/recording-scenario.ts
  • mobile/src/test-support/rpc-recording/recording-values.ts
  • mobile/src/test-support/rpc-recording/reply-matrix.ts
  • mobile/src/test-support/rpc-recording/run-recording.ts
  • mobile/src/test-support/rpc-recording/run-step1-exit.ts
  • mobile/src/test-support/rpc-recording/scenario-input.ts
  • mobile/src/test-support/rpc-recording/schedule-driver.ts
  • mobile/src/test-support/rpc-recording/scripted-rpc-transport.ts
  • mobile/src/test-support/rpc-recording/settings-mount-adapters.ts
  • mobile/src/test-support/rpc-recording/unhandled-recording.ts
  • mobile/src/test-support/rpc-recording/vitest-recording-scheduler.ts
  • mobile/src/test-support/rpc-recording/workspace-settings-mounts.ts

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

"version": 1,
"family": "legacy-inventory",
"sites": ["mobile/src/session/use-mobile-native-chat-file-search.ts"],
"schedules": ["a-b-a", "stale-inflight-cleanup"],

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

🔎 Supported by static analysis

🏁 Script executed:

#!/bin/bash
# Description: Compare declared schedules per scenario against emitted schedule goldens.
set -euo pipefail

echo '--- declared schedules per scenario ---'
jq -r '.scenarios[] | "\(.id)\t\(.schedules | join(","))"' mobile/rpc-foundation/pilot-scenarios.json

echo '--- schedules-* goldens present ---'
fd -t f 'schedules-.*\.json' mobile/rpc-foundation/goldens

echo '--- schedule driver handling of declared names ---'
fd -t f 'schedule-driver.ts|reply-matrix.ts|run-recording.ts' mobile/src/test-support/rpc-recording \
  --exec rg -n -C6 'schedules|schedule'

Repository: stablyai/orca

Length of output: 6200


🏁 Script executed:

#!/bin/bash
set -euo pipefail

echo '--- schedule expansion implementation ---'
sed -n '1,150p' mobile/src/test-support/rpc-recording/schedule-driver.ts

echo '--- scenario and golden generation references ---'
rg -n -C5 'schedules|goldens|lifecycleSchedules|interruptionSchedules|schedule' \
  mobile/src mobile/rpc-foundation --glob '*.ts' --glob '*.json' --glob '*.md' \
  | head -n 400

echo '--- relevant scenario definitions ---'
sed -n '1,80p' mobile/rpc-foundation/pilot-scenarios.json
sed -n '150,260p' mobile/rpc-foundation/pilot-scenarios.json

Repository: stablyai/orca

Length of output: 38232


🏁 Script executed:

#!/bin/bash
set -euo pipefail

echo '--- all files that write or compare RPC goldens ---'
rg -n -C5 'write.*golden|golden|pilot-scenarios|runRecording|lifecycleSchedules|interruptionSchedules' \
  mobile --glob '*.ts' --glob '*.js' --glob '*.json' --glob '*.md' \
  | head -n 500

echo '--- golden inventory with scenario identifiers ---'
python3 - <<'PY'
import json
from pathlib import Path
p = Path('mobile/rpc-foundation/pilot-scenarios.json')
data = json.loads(p.read_text())
for s in data['scenarios']:
    print(s['id'], s.get('schedules', []))
PY
for f in mobile/rpc-foundation/goldens/schedules-*.json; do
  printf '%s: ' "$f"
  jq -r '.scenario // .id // "no scenario field"' "$f"
done

Repository: stablyai/orca

Length of output: 40026


🏁 Script executed:

#!/bin/bash
set -euo pipefail

sed -n '72,190p' mobile/src/test-support/rpc-recording/family-recordings.test.ts

echo '--- schedule-related scenario validation ---'
rg -n -C8 'REQUIRED_SCHEDULES|scenario\.schedules|schedules\.|schedule' \
  mobile/src/test-support/rpc-recording --glob '*.ts' \
  | head -n 300

echo '--- README schedule contract ---'
sed -n '35,75p' mobile/src/test-support/rpc-recording/README.md

Repository: stablyai/orca

Length of output: 30188


Validate declared schedules against generated schedule scenarios

RecordingScenario.schedules is never read. family-recordings.test.ts hard-codes the scenarios passed to siblingSchedules, lifecycleSchedules, and interruptionSchedules, so declarations such as b1’s a-b-a and stale-inflight-cleanup do not generate or validate goldens. Add validation that each declared schedule maps to a generated scenario and golden, or remove the declarations.

Comment on lines +2016 to +2020
{
"complete": "settings.get#2",
"params": {
"$undefined": true
},

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: Check whether the coalescing golden records one or two settings.get requests.
set -euo pipefail

fd -t f 'settings-home-coalesced.json' mobile/rpc-foundation/goldens --exec sh -c '
  echo "--- request names per checkpoint in $1 ---"
  jq -r ".recording.checkpoints[] | \"\(.id): \" + ([.observation.sender[].name] | join(\", \"))" "$1"
' sh {}

echo '--- how the transport asserts unmatched scripted completions ---'
fd -t f 'scripted-rpc-transport.ts|run-recording.ts' mobile/src/test-support/rpc-recording \
  --exec rg -n -C5 'unmatched|not found|Unknown request|pending'

Repository: stablyai/orca

Length of output: 1227


🏁 Script executed:

#!/bin/bash
set -euo pipefail
echo '--- scenario actions ---'
sed -n '1948,2072p' mobile/rpc-foundation/pilot-scenarios.json
echo '--- golden checkpoints and request observations ---'
jq '.recording.checkpoints[] | {id, sender: [.observation.sender[].name]}' mobile/rpc-foundation/goldens/settings-home-coalesced.json

Repository: stablyai/orca

Length of output: 3945


Rename the scenario to reflect the recorded behavior.

The recording contains settings.get#1 and settings.get#2 after the two load actions. The loads do not coalesce.


async function certify(id: string, scenarios: RecordingScenario[]) {
let first = ''
for (let run = 0; run < Number(process.env.RPC_FOUNDATION_DETERMINISM_RUNS ?? 2); run++) {

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

Validate RPC_FOUNDATION_DETERMINISM_RUNS before the recording command launches Vitest. runStep1Exit validates its numeric option, but mobile/scripts/rpc-recording.mts forwards the inherited environment without validation. A malformed value becomes NaN, so both loops execute zero times. Their test callbacks then resolve without recording or checking a golden, and Vitest can report success if the unrelated tests pass. Parse and validate the count in a shared helper, require an integer of at least 2, and use it in both loops.

'settings-task-hydration-fulfilled',
'settings-repo-metadata-fulfilled'
]) {
const base = input.scenarios.find((scenario) => scenario.id === id)!

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

Validate missing schedule IDs before collection.

readScenarios checks only the manifest shape and duplicate IDs. runStep1Exit checks only b1, b2, and b3, so a supported manifest can omit another hardcoded schedule ID. The lookup then returns undefined, and base.steps can throw during Vitest collection. Reject the manifest with an error naming the missing ID, or skip that schedule explicitly.

Comment on lines +76 to +83
const boundSteps = steps.flatMap((step): ScenarioStep[] =>
'complete' in step
? [
{ bind: `lifecycle-${step.complete}`, request: step.complete, params: step.params },
{ ...step, complete: `lifecycle-${step.complete}` }
]
: [step]
)

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 | 🟠 Major | ⚡ Quick win

🔎 Supported by static analysis

🏁 Script executed:

#!/bin/bash
# Inspect the bind and complete resolution rules in the scripted transport.
fd -t f 'scripted-rpc-transport.ts' mobile | xargs -r ast-grep outline --items all
fd -t f 'scripted-rpc-transport.ts' mobile | xargs -r rg -n -C6 '\bbind\s*\(|logical binding|params mismatch'

Repository: stablyai/orca

Length of output: 2670


🏁 Script executed:

#!/bin/bash
sed -n '1,155p' mobile/src/test-support/rpc-recording/scripted-rpc-transport.ts
printf '\n--- lifecycle schedule generation ---\n'
sed -n '55,90p' mobile/src/test-support/rpc-recording/schedule-driver.ts
printf '\n--- bind call contract ---\n'
sed -n '55,78p' mobile/src/test-support/rpc-recording/recording-runner.test.ts

Repository: stablyai/orca

Length of output: 8128


Use the physical request identifier for lifecycle bindings.

ScriptedRpcTransport.bind looks up name directly in this.bindings. Lifecycle schedules pass a bare method name, such as settings.getSettings, while sendRequest stores bindings under physical names such as settings.getSettings#1. The bind therefore throws Invalid request binding, and the lifecycle schedule cannot run. Pass the matching physical request identifier to bind.

Golden format version 2 stores each distinct observation field value once in
a `values` map keyed by a 12-hex sha256 of its sorted-key JSON, and a
checkpoint references five hashes. Output stays pretty-printed; the reader
rejects any other format version, resolves hashes back to values, and reports
the scenario, checkpoint, field and JSON path on a mismatch.

Generated variants now declare where their distinguishing input lands, so
checkpoints observed before that point are recorded once in a `.prelude`
scenario instead of once per reply partition. Reply matrices, interruption
schedules and lifecycle schedules share the primitive, which asserts each
variant's pre-divergence prefix matches the base. Equal-but-differently-reached
checkpoints are untouched.

17.71 MB / 3,599 checkpoints / 58.4% intra-file duplicates becomes
4.21 MB / 1,961 checkpoints / 23.6%, with every file's set of distinct
observations 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. The new commit resolves the golden-encoding size concern from the prior review via value pooling and pre-divergence checkpoint hoisting, and clears the dangling certify argument nitpick.

Reviewed changes

  • Value pooling (golden-value-pool.ts, format v2) — distinct observation field values are interned into a sha256-keyed values map (12-hex key with explicit collision detection); checkpoints store five field hashes. readGolden refuses any other goldenFormatVersion and resolves hashes back to values.
  • Detailed comparison — compareGolden now diffs header fields, checkpoint ids, and each observation field via sorted-key canonical JSON, reporting scenario, checkpoint id, field, JSON path, and both resolved values instead of a bare byte mismatch.
  • Prelude hoisting (prelude-checkpoints.ts) — reply matrices, interruption schedules, and lifecycle schedules record their shared prefix once in a <base>.prelude scenario and start each variant at its own divergence, asserting the pre-divergence prefix matches the base.
  • Schedule driver rework — bindCompletions is extracted; lifecycleSchedules/interruptionSchedules return DivergingScenario[], and the family recordings test now passes a bound base and drops the dangling third certify argument.
  • Golden weight — goldens drop from ~18 MB to ~4.2 MB (matrix-settings.task-hydration.json from 6.7 MB to ~1 MB), while staying pretty-printed for reviewability.

The hoisting and interning logic both check out: divergence indices are computed against the correct (bound vs unbound) step space per caller, hash collisions abort at record time, and the deterministic hash-ordered pool plus explicit collision checks keep recordings stable. The family-recordings.test.ts:183 dangling-argument issue is fixed.

Pullfrog  | 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: 3


ℹ️ Review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Advanced

Run ID: 86a9bb92-7a88-4cbb-aad3-952d87f8808c

📥 Commits

Reviewing files that changed from the base of the PR and between 909fadb and 31dd744.

📒 Files selected for processing (71)
  • mobile/rpc-foundation/goldens/b1.json
  • mobile/rpc-foundation/goldens/b2.json
  • mobile/rpc-foundation/goldens/b3.json
  • mobile/rpc-foundation/goldens/interruptions-inventory-lifecycle.json
  • mobile/rpc-foundation/goldens/interruptions-settings-bot-overrides-fulfilled.json
  • mobile/rpc-foundation/goldens/inventory-lifecycle.json
  • mobile/rpc-foundation/goldens/lifecycle-b3.json
  • mobile/rpc-foundation/goldens/lifecycle-inventory-lifecycle.json
  • mobile/rpc-foundation/goldens/lifecycle-settings-bot-overrides-fulfilled.json
  • mobile/rpc-foundation/goldens/lifecycle-settings-task-hydration-fulfilled.json
  • mobile/rpc-foundation/goldens/lifecycle-settings-workspace-context-fulfilled.json
  • mobile/rpc-foundation/goldens/matrix-legacy-inventory.json
  • mobile/rpc-foundation/goldens/matrix-linear-detail-barrier.json
  • mobile/rpc-foundation/goldens/matrix-project-explicit-false.json
  • mobile/rpc-foundation/goldens/matrix-settings-agent-read.json
  • mobile/rpc-foundation/goldens/matrix-settings-best-effort.json
  • mobile/rpc-foundation/goldens/matrix-settings.bot-overrides.json
  • mobile/rpc-foundation/goldens/matrix-settings.home-providers.json
  • mobile/rpc-foundation/goldens/matrix-settings.repo-metadata.json
  • mobile/rpc-foundation/goldens/matrix-settings.resume-metadata.json
  • mobile/rpc-foundation/goldens/matrix-settings.task-hydration.json
  • mobile/rpc-foundation/goldens/matrix-settings.task-workspace.json
  • mobile/rpc-foundation/goldens/matrix-settings.workspace-context.json
  • mobile/rpc-foundation/goldens/matrix-settings.workspace-submit.json
  • mobile/rpc-foundation/goldens/schedules-b3.json
  • mobile/rpc-foundation/goldens/schedules-settings-home-providers-fulfilled.json
  • mobile/rpc-foundation/goldens/schedules-settings-new-tab-ssh.json
  • mobile/rpc-foundation/goldens/schedules-settings-repo-metadata-fulfilled.json
  • mobile/rpc-foundation/goldens/schedules-settings-resume-metadata-fulfilled.json
  • mobile/rpc-foundation/goldens/schedules-settings-task-hydration-fulfilled.json
  • mobile/rpc-foundation/goldens/schedules-settings-workspace-context-fulfilled.json
  • mobile/rpc-foundation/goldens/settings-bot-overrides-fulfilled.json
  • mobile/rpc-foundation/goldens/settings-bot-overrides-refused.json
  • mobile/rpc-foundation/goldens/settings-bot-overrides-transport-error.json
  • mobile/rpc-foundation/goldens/settings-home-coalesced.json
  • mobile/rpc-foundation/goldens/settings-home-providers-fulfilled.json
  • mobile/rpc-foundation/goldens/settings-home-providers-refused.json
  • mobile/rpc-foundation/goldens/settings-home-providers-transport-error.json
  • mobile/rpc-foundation/goldens/settings-new-tab-refused.json
  • mobile/rpc-foundation/goldens/settings-new-tab-ssh.json
  • mobile/rpc-foundation/goldens/settings-new-tab-transport-error.json
  • mobile/rpc-foundation/goldens/settings-repo-cache-expiry.json
  • mobile/rpc-foundation/goldens/settings-repo-metadata-fulfilled.json
  • mobile/rpc-foundation/goldens/settings-repo-metadata-refused.json
  • mobile/rpc-foundation/goldens/settings-repo-metadata-transport-error.json
  • mobile/rpc-foundation/goldens/settings-resume-metadata-fulfilled.json
  • mobile/rpc-foundation/goldens/settings-resume-metadata-refused.json
  • mobile/rpc-foundation/goldens/settings-resume-metadata-transport-error.json
  • mobile/rpc-foundation/goldens/settings-task-hydration-fulfilled.json
  • mobile/rpc-foundation/goldens/settings-task-hydration-refused.json
  • mobile/rpc-foundation/goldens/settings-task-hydration-transport-error.json
  • mobile/rpc-foundation/goldens/settings-task-workspace-fulfilled.json
  • mobile/rpc-foundation/goldens/settings-task-workspace-refused.json
  • mobile/rpc-foundation/goldens/settings-task-workspace-transport-error.json
  • mobile/rpc-foundation/goldens/settings-task-write.json
  • mobile/rpc-foundation/goldens/settings-workspace-context-fulfilled.json
  • mobile/rpc-foundation/goldens/settings-workspace-context-refused.json
  • mobile/rpc-foundation/goldens/settings-workspace-context-transport-error.json
  • mobile/rpc-foundation/goldens/settings-workspace-submit-fulfilled.json
  • mobile/rpc-foundation/goldens/settings-workspace-submit-refused.json
  • mobile/rpc-foundation/goldens/settings-workspace-submit-transport-error.json
  • mobile/src/test-support/rpc-recording/README.md
  • mobile/src/test-support/rpc-recording/family-recordings.test.ts
  • mobile/src/test-support/rpc-recording/golden-recording.ts
  • mobile/src/test-support/rpc-recording/golden-value-pool.ts
  • mobile/src/test-support/rpc-recording/pilot-recordings.test.ts
  • mobile/src/test-support/rpc-recording/prelude-checkpoints.ts
  • mobile/src/test-support/rpc-recording/recording-runner.test.ts
  • mobile/src/test-support/rpc-recording/recording-scenario.ts
  • mobile/src/test-support/rpc-recording/reply-matrix.ts
  • mobile/src/test-support/rpc-recording/schedule-driver.ts
💤 Files with no reviewable changes (9)
  • mobile/rpc-foundation/goldens/lifecycle-settings-task-hydration-fulfilled.json
  • mobile/rpc-foundation/goldens/lifecycle-inventory-lifecycle.json
  • mobile/rpc-foundation/goldens/lifecycle-b3.json
  • mobile/rpc-foundation/goldens/schedules-settings-workspace-context-fulfilled.json
  • mobile/rpc-foundation/goldens/schedules-settings-resume-metadata-fulfilled.json
  • mobile/rpc-foundation/goldens/schedules-settings-repo-metadata-fulfilled.json
  • mobile/rpc-foundation/goldens/lifecycle-settings-workspace-context-fulfilled.json
  • mobile/rpc-foundation/goldens/matrix-project-explicit-false.json
  • mobile/rpc-foundation/goldens/matrix-settings-best-effort.json
🚧 Files skipped from review as they are similar to previous changes (5)
  • mobile/rpc-foundation/goldens/settings-workspace-context-refused.json
  • mobile/rpc-foundation/goldens/settings-task-workspace-refused.json
  • mobile/src/test-support/rpc-recording/pilot-recordings.test.ts
  • mobile/rpc-foundation/goldens/settings-task-hydration-refused.json
  • mobile/src/test-support/rpc-recording/README.md

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

Comment on lines +115 to +117
const index = expectedIds.findIndex((id, at) => id !== actualIds[at])
throw new Error(
`Recording differs: ${scenario} checkpoint list (${expectedIds.length} expected, ${actualIds.length} actual)\n first divergence at index ${index}: expected ${JSON.stringify(expectedIds[index])}, actual ${JSON.stringify(actualIds[index])}`

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

Report the exact path for added or missing entries.

If expectedIds is a prefix of actualIds, findIndex returns -1. The error then reports divergence at index -1.

firstDifference also returns the parent path when an array has a missing element or an object has a missing key. Compute the common-prefix index and append the missing array index or object key to the returned path. Add tests for surplus and shortfall on both sides.

Also applies to: 157-158, 173-175

const observation = {} as Observation
for (const field of OBSERVATION_FIELDS) {
const hash = checkpoint.observation[field]
if (!(hash in values)) {

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

Require an own pool entry for each hash.

hash in values accepts inherited properties such as __proto__. A malformed golden can therefore reference a value that is absent from the pool. resolveRecording can then reconstruct an invalid observation instead of rejecting the golden.

Use Object.hasOwn(values, hash).

Proposed fix
-        if (!(hash in values)) {
+        if (!Object.hasOwn(values, hash)) {
📝 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 (!(hash in values)) {
if (!Object.hasOwn(values, hash)) {

Comment on lines +8 to +10
return JSON.stringify(steps, (_key, value: unknown) =>
value === undefined ? '$undefined' : value
)

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

Use a collision-free prefix comparison.

The replacer maps both undefined and the literal string "$undefined" to the same JSON value. Such prefixes compare as equal even when their parameters differ. The helper can then hoist checkpoints after an actual divergence.

Use a structural equality check that distinguishes missing properties, undefined, and strings.

…every family

The goldens carried no temporal information, so a request deadline could be cut
to a third and all 61 files stayed byte-identical. Every threshold is now
straddled by two advances with a checkpoint between them: the 30 s request
deadline in both schedule drivers, the 120 ms search debounce in b1, and the 60 s
repo-metadata cache TTL. Shortening any of them moves an observation.

The record fence pinned product sources but excluded the whole recorder, so
--record could rewrite every golden from a modified runner and report the
baseline intact. Goldens now pin recorderSha256 over every non-markdown file in
the runner plus pilot-scenarios.json, and the fence exemption shrinks to the one
directory that digest covers.

Mutation evidence covered 3 of 13 mounted operations. There is now one anchored
mutant per adapter family, covering 11 operations and 51 of the 61 goldens; the
two omitted are the pure async loaders whose entire output is their settlement.
Anchors are asserted to match exactly one site, which caught the acceptance
mutant silently half-applying against three identical guards.

The archived-tree assertion pins each seed's visible state instead of merely
differing from main, and error observations carry code and cause when present.

Claude-Session: https://claude.ai/code/session_01JNnE9qzUZMMnqpZWCqM3nb
The previous commit made the reviewer's divide-by-three deadline mutant fail by
placing checkpoints on each side of the 30 s deadline. That is a patch: a timing
change that does not cross a hand-placed boundary stays invisible. Those
scenario edits are reverted, and pilot-scenarios.json and schedule-driver.ts are
byte-identical to what they were before them.

The real defect was that the projection had no temporal dimension, so every
settlement now carries startedAt and settledAt in virtual milliseconds on the
pinned fake clock. Any transition the product schedules for itself is recorded
at the time it actually fires, so a deadline or debounce change of any size, in
either direction, moves a recorded number.

A checkpoint's own clock is not recorded. It is always the sum of the scripted
advances, so it is a function of the scenario rather than of the code under
test; run-recording.ts asserts that equality at every checkpoint instead, which
costs no bytes and fails loudly if it ever drifts.

projectionVersion is 2 and all 61 goldens are re-recorded. With the added
timestamps stripped, the distinct-observation set is identical to the previous
recording, so the change is purely additive.

Claude-Session: https://claude.ai/code/session_01JNnE9qzUZMMnqpZWCqM3nb
Recorded settlement times cover thresholds the product schedules for itself, but
not one it only consults when something else makes it act. The repo-metadata TTL
is the single such case: with probes only at 0 s and 60 s, a 20 s TTL and a 60 s
TTL are both expired at 60 s and record identically, so a 3x cache-lifetime
regression was invisible.

settings-repo-cache-expiry now probes the cache at 59 s as well. This is
coverage, not a substitute for recorded time: it bounds how small a TTL
reduction is visible rather than making the reduction itself observable, and the
README says so.

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 critical issues — one minor cross-platform note inline.

Reviewed changes

  • Settlement timestamps — projectionVersion bumped to 2; every settlement now records startedAt/settledAt on the pinned virtual clock, so a changed request deadline or debounce moves a recorded number instead of depending on where a checkpoint happens to sit. run-recording.ts asserts the checkpoint clock equals the sum of scripted advance steps.
  • Recorder provenance — a new recorderSha256 header hashes every non-markdown recorder source plus pilot-scenarios.json, so compareGolden now fails on any recorder edit and forces a deliberate re-record. The write fence narrowed from :!mobile/src/test-support to :!mobile/src/test-support/rpc-recording.
  • Mutant coverage — the three inline B-seed mutants moved into operation-mutations.ts and expanded to one anchor per adapter family (12 total), each asserted to match exactly one source site. captureError now records a thrown error's code and a depth-bounded cause chain.
  • Reference pinning — the archived bcba08b3e4 corroboration now pins per-seed visible state instead of a bare "differs from main" assertion, and is gated on RPC_FOUNDATION_REFERENCE_ROOT.

Note: 1 inline comment(s) dropped because they did not anchor to lines inside the PR diff:

  • mobile/src/test-support/rpc-recording/recorder-digest.ts:38 (RIGHT) — file has no textual diff (binary, pure rename, or mode change)

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

@pullfrog

pullfrog Bot commented Sep 10, 2026

Copy link
Copy Markdown
Contributor

One minor cross-platform note that wouldn't anchor as an inline comment (the .ts files under mobile/src/test-support/rpc-recording/ have no textual diff in this PR's diff view):

recorderSha256 hashes raw on-disk bytes, so a CRLF checkout — Windows' default core.autocrlf=true — produces a different digest than the committed mac/Linux value and fails compareGolden in candidate mode for Windows contributors. A Windows re-record would likewise commit CRLF-specific hashes that then break macOS/Linux CI. lockfileSha256 (over mobile/pnpm-lock.yaml) has the same latent gap. Unlike the other byte-hashed trees in .gitattributes (/resources/plugins, /config/relay-assets, the shell-wrapper snapshots), none of these paths carry an eol=lf pin.

Suggested fix: either normalize line endings before hashing (readFileSync(..., 'utf8').replace(/\r\n/g, '\n')) in recorder-digest.ts:38 / golden-recording.ts:52, or pin text eol=lf for mobile/src/test-support/rpc-recording/**, mobile/rpc-foundation/pilot-scenarios.json, and mobile/pnpm-lock.yaml in .gitattributes. Defer-able, but worth doing before a Windows contributor re-records.

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

…oduct

The reply matrix froze ~26 malformed envelopes crossed against every consumed
field and three boundary kinds, which is 163,925 lines of JSON pinning accidents
on inputs no desktop produces. `successResponse` always sets `result`, so a JSON
wire has no explicit-undefined slot, and no mounted handler returns a number, a
string, an array, a bare `{}` or a boolean: `settings.get` returns
`{settings: ...}`, and the seed methods return an object or nothing.

Each family now runs nine witnessed partitions once, with no field cross: a
normal result, an absent result, `null`, an inner `{ok: false}` envelope with a
string or an object error, an inner envelope missing `ok`, an outer refusal,
`method_not_found`, and a transport rejection. `null` stays because
`linear.getIssue` returns it for a missing issue and b2 is a shipped null-result
bug; it is also what carries the one named delta these goldens record.

`run-step1-exit.ts` had zero callers and shelled out to the same two Vitest
files as `rpc-recording.mts`, so it and its README paragraph go, along with
`MUTATION_NAMES`, which only it read.

In the module loader, the `rpc-delivery-ambiguity` escape is measured dead: over
every scenario, mutant and reference run it was taken once, by the test that
existed to take it. Golden comparison already fails loudly if a mounted module
ever imports the marker, so both go. The history-panel exposure moves into a
declarative table beside the mutation anchors, leaving the loader with one
source-text mechanism and no per-file branch.

The VM stays. Mount adapters load product sources from an arbitrary `root`, and
the archived bcba08b tree is bare `mobile/src` and `src` with no package.json
and no node_modules, so no bundler-resolved import can reach it and the seed
rejection gate cannot run without it. Direct import also swaps a 38-module lazy
graph for a 338-module eager one behind 20 native mocks, because
`mobile-tasks-dependencies.ts` re-exports from `react-native` and four other
native packages and `export *` enumerates.

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 reply-matrix and TTL changes are sound, but removing the rpc-delivery-ambiguity escape leans on a safety net that does not actually exist — see below.

Reviewed changes

  • Reply-matrix simplification — replyPartitions(normal) now records the nine reply shapes a host dispatcher can actually emit, dropping the cross-product against consumed fields and the unreachable undefined/number/string/array/boolean/{} results. I verified successResponse (src/main/runtime/rpc/errors.ts:27) always sets result, so the "no explicit-undefined slot" justification holds.
  • Loader cleanup — the hardcoded MobileAgentSessionHistoryPanel.tsx exposure became the declarative OPERATION_EXPOSURES table, and the rpc-delivery-ambiguity special-case was deleted.
  • run-step1-exit.ts removal — the candidate checker and its MUTATION_NAMES reader are gone (zero remaining references).
  • Repo-metadata TTL probe — settings-repo-cache-expiry now probes at 59 s (cache-warm) before the 60 s expiry, so a 20 s vs 60 s Date.now() TTL records differently.

⚠️ Removing the rpc-delivery-ambiguity escape is not covered by the safety net the PR describes

The PR body says the escape "was taken once, by the test that existed to take it" and that "golden comparison already fails if a mounted module ever imports the marker." The first claim is credible, but the second is not: nothing in the comparison path detects a mounted module importing the marker. runRecording records each settlement through captureError, which uses the real isRpcDeliveryUnknown from recording-values.ts, while a mounted operation that imported the marker would get a VM-compiled copy with its own module-level WeakSet (rpc-delivery-ambiguity.ts:4) — so its isRpcDeliveryUnknown(error) returns false for errors the scripted transport marked delivery-unknown. The golden would silently record the divergent behavior as if it were correct, with no failure. This is not just theoretical: use-new-workspace-create-submit.ts value-imports createBlankWorkspace → createWorktreeWithNameRetry → isRpcDeliveryUnknown. That path is dormant today only because the mount pins getWorktreeCreateCutoverSupport: () => false, which disables idempotency and throws before isRpcDeliveryUnknown is ever invoked. A step-4 scenario that enables idempotency (or any operation that consults delivery-ambiguity) would record a false golden.

Technical details
# Restore or replace the rpc-delivery-ambiguity singleton guard

## Affected sites
- mobile/src/test-support/rpc-recording/operation-module-loader.ts:85 — `load()` no longer special-cases `rpc-delivery-ambiguity.ts`; a mounted module that reaches it now gets a VM-compiled copy with a fresh `WeakSet`.
- mobile/src/test-support/rpc-recording/recording-values.ts:1,58 — `captureError` uses the real `isRpcDeliveryUnknown`, so the settlement and the mounted operation can disagree without anything failing.
- mobile/src/tasks/worktree-create-retry.ts:3,137 — real `isRpcDeliveryUnknown` value import, reachable from the mounted `use-new-workspace-create-submit.ts` via `blank-workspace-create.ts`.

## Required outcome
- A mounted operation that consults or marks delivery-ambiguity must share the real marker identity with the scripted transport, or the recording must fail loudly rather than silently encode divergent behavior.

## Suggested approach
- Restore the three-line escape (return the real `rpc-delivery-ambiguity` module when the loader is asked to compile it), which is correct and removes the false justification; or add a record-time assertion that throws if any mounted module ever loads the marker.

## Open questions for the human
- Is delivery-ambiguity handling expected to enter the mounted surface in step 4 (worktree-create with idempotency, chat send/stop)? If yes, the guard is needed before then.

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

…racle

Every golden pinned `lockfileSha256`, so any dependency bump on main failed all
61 comparisons on the merge commit while the traces were identical. A dependency
that changes behaviour changes the trace itself; one that does not must not fail
a candidate. `platform` already had this exemption — `lockfileSha256` joins it.

Recording still refuses to run unless the lockfile matches the pinned baseline,
so goldens are still produced under frozen conditions.

Verified against main's lockfile: 85 passed, previously 61 failed. The declared
mutation set still reports every mutant killed.

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 lockfileSha256 provenance change is clean and well-tested, with no new issues in this commit. The rpc-delivery-ambiguity concern raised in the prior review remains unresolved, though, and this commit does not touch that path — so the PR is not yet mergeable.

Reviewed changes

  • lockfileSha256 demoted to provenance — compareGolden now overrides lockfileSha256 (alongside platform) from the candidate before comparing, so a behavior-neutral dependency bump no longer fails candidate mode; the goldenBytes byte-equality check still catches any bump that genuinely changes the recorded trace. baseline and recorderSha256 remain pinned.
  • Regression test — a new case pins that a bumped lockfile hash passes while a changed baseline still throws header baseline.
  • Re-recorded headers and docs — all 61 goldens re-generated with the updated recorderSha256 (header-only; no recording content changed), and the README golden-schema prose now describes platform and lockfileSha256 as uncompared provenance.

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

Add three scenarios, preserve existing traces, remove unreachable archived checks, and document observed mutation kills and remaining adapter limitations.

Claude-Session: https://claude.ai/code/session_01JNnE9qzUZMMnqpZWCqM3nb
The audit file was mostly a point-in-time record of mutation runs that had already
happened, in an artifacts directory, where it would go stale on the next scenario
change. The durable part is which holes are still open and why they cannot be
reached, which belongs beside the runner it describes.

Markdown is outside recorderSha256, so no re-record; 88 passed | 3 skipped.

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

No new issues in this delta, but the previously raised blocking concern remains fully open: removing the rpc-delivery-ambiguity singleton escape from operation-module-loader.ts still leaves a path where a mounted operation that imports the delivery-unknown marker gets a VM-compiled copy with its own WeakSet and silently records a false golden. These commits do not touch the loader, so the PR is still not mergeable on that point.

Reviewed changes

  • Added inventory-repeat-query — new scenario and golden recording query normalization (" ALPHA " → "alpha"), a cache-served repeat emitting no new request, a stale in-flight reply being ignored after a newer query, and a cached repeat cancelling a pending delta debounce.
  • Added settings-repo-metadata-single-host — records that two repos sharing one SSH host skip the ssh.listTargetSummaries label lookup.
  • Added settings-bot-overrides-refresh-refused — records that a refused settings.get on reset retains the existing PR-bot overrides.
  • Scoped the archived-tree reference test — rejects bcba08b3e4 is now registered only for the three seeds with pinned reference states instead of an always-skipped test for the other nine mutants.
  • Documented known-open holes — README now lists two adapter-unreachable mutations (repo-metadata cross-module cache write, bot-overrides client-identity guard) and flags archived-tree corroboration as unproven in CI.
  • Re-pinned recorderSha256 across all goldens since pilot-scenarios.json feeds recorder provenance.

The new scenarios are all genuine coverage: each drives real mount actions through the existing adapters (query/reset/load), and each golden asserts a projection that changes if the underlying behavior regresses. The schedules label remains descriptive only and is never read to drive the recording.

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

@Jinwoo-H

Copy link
Copy Markdown
Contributor Author

Superseded by #20521, which consolidated the recording runner and goldens and has merged.

@Jinwoo-H Jinwoo-H closed this Sep 14, 2026
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