Skip to content

fix(lint): replace Reflect.get with typed property access in mounting substitutes - #20874

Merged
brennanb2025 merged 2 commits into
mainfrom
brennanb2025/fix-native-mounting-reflect-get
Sep 15, 2026
Merged

brennanb2025 merged 2 commits into
mainfrom
brennanb2025/fix-native-mounting-reflect-get

Conversation

@brennanb2025

@brennanb2025 brennanb2025 commented Sep 15, 2026 •

Copy link
Copy Markdown
Contributor
Files Added Deleted Net
Test 0 0 0 0
Prod 510 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​515 $\color{#cf222e}{\Huge{\mathbf{−}}}$​512 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​3

main's tip currently fails pnpm run audit:anti-slop (the static analysis CI gate), blocking every open PR:

mobile/src/test-support/rpc-recording/native-mounting-substitutes.ts:45:14: error anti-slop(no-reflect-get): Replace `Reflect.get` with typed property access. Parse dynamic input into a named domain type before reading it.

The Proxy get trap's key is string | symbol, while the target is Record<string, unknown> — Reflect.get was used to read both key shapes without a cast. This replaces it by branching on typeof key: typed bracket access (target[key]) for the string case, and a symbol-indexed cast ((target as Record<symbol, unknown>)[key]) for the symbol case. Both are ordinary property reads with identical semantics to Reflect.get(target, key) for this plain-object target, so behavior (including the __esModule and unsubstituted-member throw checks) is unchanged.

Verified: pnpm run audit:anti-slop exits 0, pnpm tc clean, mobile typecheck clean, oxfmt --check clean, and the file's consumer test suites (native-mounting-substitutes.test.ts, recording-runner.test.ts, adapter-seam.test.ts, adapter-load-deferral.test.ts — 30 tests) pass.

…ounting substitutes

main's tip fails `pnpm run audit:anti-slop` (the `static analysis` CI gate) on
`no-reflect-get` in mobile/src/test-support/rpc-recording/native-mounting-substitutes.ts,
blocking every open PR. The Proxy get trap's key is `string | symbol`; branch on that to
keep typed bracket access for strings and a symbol-indexed cast for symbols, preserving the
existing throw-on-unsubstituted-member behavior exactly.
@coderabbitai

coderabbitai Bot commented Sep 15, 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: 729bc3ca-e34c-4149-a213-e0a720365127

📥 Commits

Reviewing files that changed from the base of the PR and between 2eb9320 and 2a6c0b6.

📒 Files selected for processing (1)
  • mobile/src/test-support/rpc-recording/native-mounting-substitutes.ts

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


📝 Walkthrough

Walkthrough

The partialNativeModule get trap now handles string and symbol keys separately. String keys allow __esModule, validate target membership, throw an Unsubstituted native member error when missing, and return the target value. Symbol keys return the target property directly without Reflect.get.

Priority: ⬇️ Low

Merge Risk: ⚪ Minimal · up to 2a6c0

This refactor preserves native-module property reads and introduces no supported merge-blocking risk.

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Description check ⚠️ Warning The description explains the implementation, reason, behavior preservation, and verification results. However, it does not follow most required template sections, including ELI5, What Changed, Why, Li… Update the description to include all required template sections. Add the linked issue under Fixes #, state N/A with a reason for Visual Proof, document testing and platform coverage, complete the required checklist, and include the rem…
✅ Passed checks (4 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly identifies the primary change: replacing Reflect.get with typed property access in the mounting substitutes.
Docstring Coverage ✅ Passed Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 1 functions across 1 files.
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 explains the implementation, reason, behavior preservation, and verification results. However, it does not follow most required template sections, including ELI5, What Changed, Why, Linked Issue, Visual Proof, Testing checkboxes, Review, Notes, and Checklist.

Resolution

Update the description to include all required template sections. Add the linked issue under Fixes #, state N/A with a reason for Visual Proof, document testing and platform coverage, complete the required checklist, and include the remaining applicable sections.

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

@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 as cast this PR adds reintroduces a blocking CI failure in a different gate than the one it fixes: pnpm run check:code-quality:changed reports typescript(consistent-type-assertions) on added line 48, so the Enforce changed-code quality step fails. The anti-slop fix itself is correct; only the assertion needs to go.

Reviewed changes

  • Reflect.get replaced in the partialNativeModule Proxy trap — the get trap now branches on typeof key, reading target[key] for string keys and (target as Record<symbol, unknown>)[key] for symbol keys, while preserving the __esModule bypass and the unsubstituted-member throw. Runtime behavior against these plain-object targets is equivalent to Reflect.get.

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

Comment on lines +42 to +48
if (typeof key === 'string') {
if (key !== '__esModule' && !(key in target)) {
throw new Error(`Unsubstituted native member: ${module}.${key}`)
}
return target[key]
}
return Reflect.get(target, key)
return (target as Record<symbol, unknown>)[key]

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.

This cast fails a different blocking gate than the one the PR fixes. The casting code quality scan in pnpm run check:code-quality:changed (which enforces assertionStyle: never) flags this added line, so the Enforce changed-code quality step at .github/workflows/pr.yml:164 exits 1 — verified locally, one finding on line 48. Dropping the assertion keeps behavior: these targets are plain object literals with no symbol properties, so the symbol read already resolved to undefined under Reflect.get, and an early undefined return preserves that while leaving the __esModule/unsubstituted-member checks intact.

Technical details
# Remove the type assertion on the symbol read

## Affected sites
- `mobile/src/test-support/rpc-recording/native-mounting-substitutes.ts:48` — `(target as Record<symbol, unknown>)[key]`

## Evidence
- `node config/scripts/check-changed-code-quality.mjs origin/main` → `casting code quality: 1 new finding(s)` … `line 48 … Do not use any type assertions.`
- The same gate also runs `config/oxlint-code-quality-casting.json`, whose `typescript/consistent-type-assertions` is `["error", { "assertionStyle": "never" }]`.

## Required outcome
- The symbol branch reads the target without a type assertion so `check:code-quality:changed` passes, while `anti-slop(no-reflect-get)` stays satisfied.

## Suggested approach
- Option A (inline suggestion): return `undefined` for `typeof key === 'symbol'`. Equivalent here because the targets carry no symbol members.
- Option B: widen the `members` parameter to `Record<PropertyKey, unknown>` and restore the single-condition body ending in `return target[key]`; this preserves symbol reads exactly.
- Both were verified to pass `tsc --strict`, `config/oxlint-code-quality-casting.json`, and `audit:anti-slop`.
Suggested change
if (typeof key === 'string') {
if (key !== '__esModule' && !(key in target)) {
throw new Error(`Unsubstituted native member: ${module}.${key}`)
}
return target[key]
}
return Reflect.get(target, key)
return (target as Record<symbol, unknown>)[key]
if (typeof key === 'symbol') {
return undefined
}
if (key !== '__esModule' && !(key in target)) {
throw new Error(`Unsubstituted native member: ${module}.${key}`)
}
return target[key]

native-mounting-substitutes.ts changed bytes, so recorderSha256 (which
pins every non-adapter file under this directory into every golden's
header) moved. Re-recorded all 509 goldens; only recorderSha256 differs
in any of them, confirming the checkpoint content is unchanged.
@greptile-apps

greptile-apps Bot commented Sep 15, 2026

Copy link
Copy Markdown

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

@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 in the golden re-record itself — one sequencing note below.

Reviewed changes

The only change since the prior pullfrog review at 2a6c0b6 is one commit that re-records the golden headers after the recorder source edit shifted their pinned digest.

  • Re-recorded all 509 rpc-foundation goldens — every golden's recorderSha256 moves from fc1f0b1f… to e044443e…, and nothing else in any file changes (no scenarioSha256, adapterSha256, or recorded observation). I recomputed the digest from the checked-out source and it matches e044443e…, so the re-record is internally consistent.

ℹ️ The re-record is pinned to a source that will shift again

recorderSha256 digests the raw bytes of every pinned file under mobile/src/test-support/rpc-recording, and native-mounting-substitutes.ts is one of them. This commit re-records all 509 goldens against the source as it stands, but that source still carries the assertion the previous review flagged, so whichever fix lands for it edits a pinned file and shifts recorderSha256 a second time — forcing a second full re-record and a fresh 509-file conflict surface. Landing the assertion fix first, then re-recording once, avoids the extra churn.

Technical details
# Order the golden re-record after the source stops changing

## Affected sites
- `mobile/rpc-foundation/goldens/*.json` (509 files) — every header is pinned to `e044443e…`, the `recorderSha256` of the current source.
- `mobile/src/test-support/rpc-recording/native-mounting-substitutes.ts:48` — the assertion; removing or suppressing it rewrites the file, which re-digests every golden.

## Evidence
- `recorderSha256` (`mobile/src/test-support/rpc-recording/recorder-digest.ts:55`) digests every non-markdown file under `RECORDER_DIRECTORY` except `adapters/` and `mutants/`, and `native-mounting-substitutes.ts` is included.
- Recomputing the digest from the checked-out source yields `e044443e01f282566a5e0eff110d0861d2a1047ca8d8696a2e7ff914f51957f3`, matching the re-recorded headers.
- `golden-header-digest.test.ts:248` ("re-digests every golden when an engine file changes") asserts this all-goldens movement.

## Required outcome
- One re-record, against a source that no longer needs a follow-up edit.

## Open questions for the human
- Intentional to land the golden churn ahead of the assertion fix, or should the fix land first?

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

@brennanb2025

Copy link
Copy Markdown
Contributor Author

Review verdict: correct, verified, mergeable

Behavioral correctness of the get trap rewrite — proven, not asserted:

Reflect.get(target, key) with no third receiver argument and target[key] both invoke the identical [[Get]] internal method with receiver = target. This holds for every key kind the trap can see: plain string keys, symbol keys (Symbol.toStringTag, Symbol.iterator, Symbol.asyncIterator, util.inspect.custom), __esModule, inherited/prototype-chain properties, and accessor (getter) properties — getters included, because the internal method is the same one either way.

This is a materially different (and correct) approach vs. the sibling fix in 62c5037cc3, which used Object.getOwnPropertyDescriptor + 'value' in descriptor — that pattern silently returns undefined for accessor properties instead of invoking the getter, since a getter descriptor has no value key. This PR's bracket-access rewrite has no such hole: it doesn't special-case getters away, it just delegates to [[Get]] exactly like the original did.

Throw semantics for Unsubstituted native member: ${module}.${key} are unchanged for the identical key set (only reached for typeof key === 'string', key !== '__esModule' && !(key in target)).

Empirical confirmation: regenerated all 509 golden recordings against the fixed source and diffed every one against the pre-fix originals — the only line that changed in any of the 509 files is the recorderSha256 header field. Zero content/behavioral differences in any recorded checkpoint or observation. This directly confirms the spec-level reasoning above with runtime evidence across the full recording surface, not just the file under review.

Root cause of the CI failure this PR hit: recorderSha256 (in recorder-digest.ts) hashes every non-.md, non-adapters/, non-mutants/ file under mobile/src/test-support/rpc-recording, including native-mounting-substitutes.ts, and that hash is pinned into every golden's header. Editing the fixture file — even a behavior-preserving edit — shifts this hash for all 509 goldens at once, and compareGolden throws on the first mismatched header field (recorderSha256 comes before checkpoint content in the compared field order). This is documented, intended behavior (see the README and the doc comment on recorderSha256), not a regression the lint fix introduced. Re-recording all 509 goldens is the correct, deliberate response.

Scope: confirmed via diff against the true merge-base (62c5037cc3) that the PR's total footprint is exactly 510 files: the 1-file, +6/-3 source fix, plus 509 one-line (recorderSha256 only) golden updates added in this review pass. No drive-by changes, no inline lint disables, no config weakening, no as any/as unknown as laundering.

Verification performed at PR head (7fd6365):

  • pnpm run audit:anti-slop — exit 0
  • pnpm tc — exit 0
  • The 4 consumer test suites (found via rg partialNativeModule) — 30/30 passed
  • Full mobile test suite — 587 files, 5350 passed, 6 skipped
  • oxfmt --check — clean, 510 files
  • Mobile CI verify job (the one that originally failed with 235 test failures, run 35021187865 / job 104556967828) — now pass, 4m42s

Remaining gaps (not defects, just noting): the pullfrog check on the PR is still pending at the time of this comment — it's a third-party review bot, not a repo-native required gate, and isn't part of audit:anti-slop/tc/test verification.

Merge verdict: clean to merge.

@brennanb2025
brennanb2025 merged commit 6c03bb6 into main Sep 15, 2026
22 checks passed
Jinwoo-H added a commit that referenced this pull request Sep 15, 2026
…'s engine digest

#20874 re-digested `recorderSha256` on all 509 goldens, so the six goldens mounted
through the worktree catalog adapter had to be recorded again from the pin rather
than merged. Bodies and `adapterSha256` are unchanged from the pre-merge recording.

Claude-Session: https://claude.ai/code/session_01JNnE9qzUZMMnqpZWCqM3nb
Jinwoo-H added a commit that referenced this pull request Sep 15, 2026
… RPC recorder (#20873)

* test(rpc-recording): record the real worktree catalog snapshot result

`worktree.catalog-snapshot`'s action returned `WorktreeCatalogSnapshotClient.fetch`'s
raw result. That value nests the live `RpcClient` under `pending.client`, so
`captureValue` threw `Unsupported observation: function`: both goldens baked an
`unhandled-rejection` effect and left the action's settlement `pending`, proving
nothing about what the fetch returns.

Project the result through `projectObservable` on the settlement path, the same
way `state()` already shows it and the same way #20667 fixed
`transport.pairing-race`. Rejections still propagate unchanged, so the two
transport-rejection matrix partitions keep their recorded errors.

The matrix golden now discriminates all eleven reply partitions: a full
admission, six invalid ones, three `request_failed` codes and two rejections.
`recorderSha256` does not move; `adapterSha256` moves on the six goldens mounted
through this adapter module, four of which have no other change.

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

* test(rpc-recording): fail the suite when a golden records a recorder failure

A projection refusal settles as data, not as a failed run: `captureValue` throws
inside the action, the recorder captures it as an `unhandled-rejection` effect,
and `--record` writes a green golden whose action never settled. The class has
landed twice — `transport.pairing-race` in #20667 and `worktree.catalog-snapshot`
in the previous commit — and reverting either one plus a re-record would go green
with the broken golden back.

Read every golden and fail on an `unhandled-rejection` effect or on either of
`captureValue`'s refusal texts in any observation field. A positive control in the
same case asserts both detectors fire, so the absence claim is load-bearing rather
than vacuous.

Not a recording driver, so `recorderSha256` excludes it and no golden moves.

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

* test(rpc-recording): ban only the recorder's own refusals, not product bugs

The gate also failed on any effect named `unhandled-rejection`, which bans a real
observation: detached-rejection capture exists to pin a main bug in a golden, and
`unhandled-recording.test.ts` pins the capture precisely because no golden carries
one today. Banning the name would make recording a genuine product failure a test
failure.

Drop that detector. `refusalText` alone catches all seven checkpoints of the
worktree-catalog regression, because the refusal is the message of the captured
error rather than the effect's name. The positive control now seeds that shape —
the refusal inside a recorded error under `effects` — so the surviving detector is
still proven to fire. Vacuity guards on golden and checkpoint counts are unchanged.

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

* test(rpc-recording): re-record the worktree catalog goldens over main's engine digest

#20874 re-digested `recorderSha256` on all 509 goldens, so the six goldens mounted
through the worktree catalog adapter had to be recorded again from the pin rather
than merged. Bodies and `adapterSha256` are unchanged from the pre-merge recording.

Claude-Session: https://claude.ai/code/session_01JNnE9qzUZMMnqpZWCqM3nb
Jinwoo-H added a commit that referenced this pull request Sep 15, 2026
main adopted anti-slop's `no-reflect-get` in #20874 and fixed the copy that lived
in `native-mounting-substitutes.ts`. This branch moved both traps into
`native-module-traps.ts`, so the rule lands here instead and the static-analysis
gate is red without the same narrowing.

Claude-Session: https://claude.ai/code/session_01JNnE9qzUZMMnqpZWCqM3nb
Jinwoo-H added a commit that referenced this pull request Sep 15, 2026
Takes main's typed property access in the native traps (#20874) and main's
`baseline` repin to e7206f6 (#20895); pre-existing goldens take main's side
and are re-recorded in the next commit.

Claude-Session: https://claude.ai/code/session_01JNnE9qzUZMMnqpZWCqM3nb
Jinwoo-H added a commit that referenced this pull request Sep 15, 2026
…tate in the RPC recorder (#20884)

* test(mobile): mount screens, declared device stores and declared OS state in the RPC recorder

Three recorder capabilities, each with a test, plus four holdout sites recorded against main's
product code to prove them. No product source changes.

- JSX compiles through the automatic runtime, which is what product sources use; the classic
  `React.createElement` emit threw `React is not defined` on the first render of every screen.
- An unlisted package answers `__esModule` as undefined, so a default import loads and the refusal
  defers to the first real member read instead of killing the module at load.
- The substitutes table gains the inert view packages a screen needs, split into
  `screen-native-substitutes.ts` behind the same rule: only what a screen reads is listed.
- A scenario may declare `deviceStore` and `deviceState.notificationTray`. Reads resolve the
  declaration or null and never a write; writes are recorded as effects. Undeclared is unchanged.
- `screenMount` mounts a component with a crash boundary, so a reply partition that takes a screen
  down is a recording rather than a suite failure.

Every pre-existing golden re-records byte-identical except `recorderSha256`, recorded from a
detached worktree at the pinned baseline.

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

* test(mobile): declare the crash boundary's state type instead of asserting it

The changed-code casting gate counts `null as string | null` as a type assertion. Re-records every
golden from the pinned baseline, because the edit moves `recorderSha256`.

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

* test(mobile): refuse an unlisted native package by the member a mount reads

Both emitted interop helpers short-circuit on `__esModule`, so answering `true`
hands the refusing trap back unwrapped to `__importDefault` and `__importStar`.
All three import forms now load the importer and throw the named refusal at the
first member read, instead of a namespace import silently yielding `undefined`
and failing later at the call.

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

* test(mobile): run a task deferred past interactions instead of dropping it

An inert `runAfterInteractions` swallows whatever send the screen deferred, and
the recording then claims the screen sends nothing. It runs the task on a
microtask and returns the RN-shaped handle, so a cancel before the task runs
still prevents it. `Alert.alert` stays inert.

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

* test(mobile): re-record every golden for the two recorder engine changes

Only `recorderSha256` moves, from c58067de to a59b30e7. Recorded from a detached
worktree at the pinned baseline c6a7216 with this branch's recorder and
scenario file overlaid, so no golden body is a claim about migrated source.

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

* test(mobile): stop exporting three recorder symbols with no importer

`projectScreenTree`, `DeviceEffect` and `DeclaredNotification` are only used by
the file that declares them.

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

* test(mobile): re-record every golden for the dropped exports

Only `recorderSha256` moves, from a59b30e7 to 4df43aef. Recorded from a detached
worktree at the pinned baseline c6a7216 with this branch's recorder and
scenario file overlaid.

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

* test(mobile): list only the native members a recording is known to read

Instrumenting `partialNativeModule` across all 522 recordings found 68 declared
members and 23 read. The unread ones are gone: the whole react-native-svg,
react-native-reanimated and react-native-gesture-handler entries, two expo-router
hooks, and twelve react-native members including `InteractionManager` and
`Alert`. A member listed before a recording reads it turns a refusal that would
have forced a decision into a silent stand-in, which is how an inert scheduler
swallows a deferred send. Wave 3 re-adds each one with the recording that reads
it.

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

* test(mobile): order each effect against the sends with a send count

Sender and effects are two independent lists, so a send reordered ahead of a
device write moved neither. Scheduling the codex journal write on a timer instead
of awaiting it left all 520 goldens byte-identical; with `sent` it moves two.

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

* test(mobile): report a boundary crash through the effect sink

A hook mount projects the hook's own value and never a crash, so an adapter that
never reads `crash()` recorded a screen that quietly stopped rendering. The
boundary now reports to the effect sink as well, which forces a cleanup
checkpoint and puts the crash in the golden with no adapter cooperation. Two
reply-matrix goldens gain the effect. Also folds the two near-identical tree
walkers into one `walk(tree, visit)`.

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

* test(mobile): state the __esModule interop rule once

It was restated at four sites with four different answers. The canonical
paragraph is in `native-module-traps.ts`; the loader and the declared tray point
at it in a line. The loader comment also said the refusal names the member the
product read, which for a default import is `.default` instead.

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

* test(mobile): re-record for the send ordinal, the crash effect and the pruned table

`recorderSha256` moves on all 520. Of the 509 pre-existing goldens, 260 are
header-only and 249 gain `sent` on their effects and nothing else; two of this
branch's own reply-matrix goldens also gain a `screen.crash` effect. Recorded
from a detached worktree at the pinned baseline c6a7216.

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

* fix(lint): drop Reflect.get from the native traps

main adopted anti-slop's `no-reflect-get` in #20874 and fixed the copy that lived
in `native-mounting-substitutes.ts`. This branch moved both traps into
`native-module-traps.ts`, so the rule lands here instead and the static-analysis
gate is red without the same narrowing.

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

* test(mobile): re-record for the Reflect.get narrowing

`recorderSha256` only, 8ca81bc6 to 0ddc0dc4. No golden body moves, which is the
claim the narrowing makes: the trap reads the same member it always did.

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

* test(mobile): re-record every golden at main's new baseline pin

One record from a detached worktree at `e7206f62a8` — main's pin since #20895 —
with this branch's `rpc-recording/`, `pilot-scenarios.json` and
`scripts/rpc-recording.mts` laid over it, so the goldens are recorded against
main's product tree rather than a branch that edits the engine.

All 520 goldens now share one `recorderSha256`
(`0ddc0dc472e2efbe58004c6dfaf5360e368fed321e40dfe15c11a9ad1817dea4`) and one
`baseline`. Against main, 262 move on the header alone and 247 also gain the
`sent` ordinal on an effect, which is the whole of the body change; the nine
goldens #20895 re-digested carry a byte-identical body, and the six the new
worktree catalog adapter (#20873) recorded keep main's observation.

Claude-Session: https://claude.ai/code/session_01JNnE9qzUZMMnqpZWCqM3nb
brennanb2025 added a commit that referenced this pull request Sep 15, 2026
Picks up #20874 (6c03bb6), which removes the Reflect.get this branch was
carrying as an inherited anti-slop error. The file arrives from main untouched -
its blob here is now main's 6a85b39 - and audit:anti-slop reports zero
findings for the first time on this branch.

Twelve settings goldens conflicted, the same set as before and for the same
reason: main moved recorderSha256 while this branch owns adapterSha256, so
neither side's header describes the merged tree. Resolved by re-recording from
the merged sources so both digests derive from what is actually there.

Unlike the previous merge, the BODIES changed too, and that is correct rather
than a regression: main rewrote the recording harness and run-recording.ts now
projects a `sent` counter on every effect. The re-recorded bodies gain only
`sent` lines - pure additions, no deletions, no modifications - matching the
~629 goldens that took main's side cleanly. The header delta is baseline
(main repinned it) and recorderSha256; adapterSha256 is unchanged because this
branch already held the right one. The golden set is unchanged in both
directions at 641.
ivanvykopal pushed a commit to ivanvykopal/orca that referenced this pull request Sep 20, 2026
… substitutes (stablyai#20874)

* fix(lint): replace Reflect.get with typed property access in native mounting substitutes

main's tip fails `pnpm run audit:anti-slop` (the `static analysis` CI gate) on
`no-reflect-get` in mobile/src/test-support/rpc-recording/native-mounting-substitutes.ts,
blocking every open PR. The Proxy get trap's key is `string | symbol`; branch on that to
keep typed bracket access for strings and a symbol-indexed cast for symbols, preserving the
existing throw-on-unsubstituted-member behavior exactly.

* test(rpc-recording): re-record goldens for the recorderSha256 shift

native-mounting-substitutes.ts changed bytes, so recorderSha256 (which
pins every non-adapter file under this directory into every golden's
header) moved. Re-recorded all 509 goldens; only recorderSha256 differs
in any of them, confirming the checkpoint content is unchanged.
ivanvykopal pushed a commit to ivanvykopal/orca that referenced this pull request Sep 20, 2026
… RPC recorder (stablyai#20873)

* test(rpc-recording): record the real worktree catalog snapshot result

`worktree.catalog-snapshot`'s action returned `WorktreeCatalogSnapshotClient.fetch`'s
raw result. That value nests the live `RpcClient` under `pending.client`, so
`captureValue` threw `Unsupported observation: function`: both goldens baked an
`unhandled-rejection` effect and left the action's settlement `pending`, proving
nothing about what the fetch returns.

Project the result through `projectObservable` on the settlement path, the same
way `state()` already shows it and the same way stablyai#20667 fixed
`transport.pairing-race`. Rejections still propagate unchanged, so the two
transport-rejection matrix partitions keep their recorded errors.

The matrix golden now discriminates all eleven reply partitions: a full
admission, six invalid ones, three `request_failed` codes and two rejections.
`recorderSha256` does not move; `adapterSha256` moves on the six goldens mounted
through this adapter module, four of which have no other change.

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

* test(rpc-recording): fail the suite when a golden records a recorder failure

A projection refusal settles as data, not as a failed run: `captureValue` throws
inside the action, the recorder captures it as an `unhandled-rejection` effect,
and `--record` writes a green golden whose action never settled. The class has
landed twice — `transport.pairing-race` in stablyai#20667 and `worktree.catalog-snapshot`
in the previous commit — and reverting either one plus a re-record would go green
with the broken golden back.

Read every golden and fail on an `unhandled-rejection` effect or on either of
`captureValue`'s refusal texts in any observation field. A positive control in the
same case asserts both detectors fire, so the absence claim is load-bearing rather
than vacuous.

Not a recording driver, so `recorderSha256` excludes it and no golden moves.

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

* test(rpc-recording): ban only the recorder's own refusals, not product bugs

The gate also failed on any effect named `unhandled-rejection`, which bans a real
observation: detached-rejection capture exists to pin a main bug in a golden, and
`unhandled-recording.test.ts` pins the capture precisely because no golden carries
one today. Banning the name would make recording a genuine product failure a test
failure.

Drop that detector. `refusalText` alone catches all seven checkpoints of the
worktree-catalog regression, because the refusal is the message of the captured
error rather than the effect's name. The positive control now seeds that shape —
the refusal inside a recorded error under `effects` — so the surviving detector is
still proven to fire. Vacuity guards on golden and checkpoint counts are unchanged.

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

* test(rpc-recording): re-record the worktree catalog goldens over main's engine digest

stablyai#20874 re-digested `recorderSha256` on all 509 goldens, so the six goldens mounted
through the worktree catalog adapter had to be recorded again from the pin rather
than merged. Bodies and `adapterSha256` are unchanged from the pre-merge recording.

Claude-Session: https://claude.ai/code/session_01JNnE9qzUZMMnqpZWCqM3nb
ivanvykopal pushed a commit to ivanvykopal/orca that referenced this pull request Sep 20, 2026
…tate in the RPC recorder (stablyai#20884)

* test(mobile): mount screens, declared device stores and declared OS state in the RPC recorder

Three recorder capabilities, each with a test, plus four holdout sites recorded against main's
product code to prove them. No product source changes.

- JSX compiles through the automatic runtime, which is what product sources use; the classic
  `React.createElement` emit threw `React is not defined` on the first render of every screen.
- An unlisted package answers `__esModule` as undefined, so a default import loads and the refusal
  defers to the first real member read instead of killing the module at load.
- The substitutes table gains the inert view packages a screen needs, split into
  `screen-native-substitutes.ts` behind the same rule: only what a screen reads is listed.
- A scenario may declare `deviceStore` and `deviceState.notificationTray`. Reads resolve the
  declaration or null and never a write; writes are recorded as effects. Undeclared is unchanged.
- `screenMount` mounts a component with a crash boundary, so a reply partition that takes a screen
  down is a recording rather than a suite failure.

Every pre-existing golden re-records byte-identical except `recorderSha256`, recorded from a
detached worktree at the pinned baseline.

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

* test(mobile): declare the crash boundary's state type instead of asserting it

The changed-code casting gate counts `null as string | null` as a type assertion. Re-records every
golden from the pinned baseline, because the edit moves `recorderSha256`.

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

* test(mobile): refuse an unlisted native package by the member a mount reads

Both emitted interop helpers short-circuit on `__esModule`, so answering `true`
hands the refusing trap back unwrapped to `__importDefault` and `__importStar`.
All three import forms now load the importer and throw the named refusal at the
first member read, instead of a namespace import silently yielding `undefined`
and failing later at the call.

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

* test(mobile): run a task deferred past interactions instead of dropping it

An inert `runAfterInteractions` swallows whatever send the screen deferred, and
the recording then claims the screen sends nothing. It runs the task on a
microtask and returns the RN-shaped handle, so a cancel before the task runs
still prevents it. `Alert.alert` stays inert.

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

* test(mobile): re-record every golden for the two recorder engine changes

Only `recorderSha256` moves, from c58067de to a59b30e7. Recorded from a detached
worktree at the pinned baseline c6a7216 with this branch's recorder and
scenario file overlaid, so no golden body is a claim about migrated source.

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

* test(mobile): stop exporting three recorder symbols with no importer

`projectScreenTree`, `DeviceEffect` and `DeclaredNotification` are only used by
the file that declares them.

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

* test(mobile): re-record every golden for the dropped exports

Only `recorderSha256` moves, from a59b30e7 to 4df43aef. Recorded from a detached
worktree at the pinned baseline c6a7216 with this branch's recorder and
scenario file overlaid.

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

* test(mobile): list only the native members a recording is known to read

Instrumenting `partialNativeModule` across all 522 recordings found 68 declared
members and 23 read. The unread ones are gone: the whole react-native-svg,
react-native-reanimated and react-native-gesture-handler entries, two expo-router
hooks, and twelve react-native members including `InteractionManager` and
`Alert`. A member listed before a recording reads it turns a refusal that would
have forced a decision into a silent stand-in, which is how an inert scheduler
swallows a deferred send. Wave 3 re-adds each one with the recording that reads
it.

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

* test(mobile): order each effect against the sends with a send count

Sender and effects are two independent lists, so a send reordered ahead of a
device write moved neither. Scheduling the codex journal write on a timer instead
of awaiting it left all 520 goldens byte-identical; with `sent` it moves two.

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

* test(mobile): report a boundary crash through the effect sink

A hook mount projects the hook's own value and never a crash, so an adapter that
never reads `crash()` recorded a screen that quietly stopped rendering. The
boundary now reports to the effect sink as well, which forces a cleanup
checkpoint and puts the crash in the golden with no adapter cooperation. Two
reply-matrix goldens gain the effect. Also folds the two near-identical tree
walkers into one `walk(tree, visit)`.

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

* test(mobile): state the __esModule interop rule once

It was restated at four sites with four different answers. The canonical
paragraph is in `native-module-traps.ts`; the loader and the declared tray point
at it in a line. The loader comment also said the refusal names the member the
product read, which for a default import is `.default` instead.

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

* test(mobile): re-record for the send ordinal, the crash effect and the pruned table

`recorderSha256` moves on all 520. Of the 509 pre-existing goldens, 260 are
header-only and 249 gain `sent` on their effects and nothing else; two of this
branch's own reply-matrix goldens also gain a `screen.crash` effect. Recorded
from a detached worktree at the pinned baseline c6a7216.

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

* fix(lint): drop Reflect.get from the native traps

main adopted anti-slop's `no-reflect-get` in stablyai#20874 and fixed the copy that lived
in `native-mounting-substitutes.ts`. This branch moved both traps into
`native-module-traps.ts`, so the rule lands here instead and the static-analysis
gate is red without the same narrowing.

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

* test(mobile): re-record for the Reflect.get narrowing

`recorderSha256` only, 8ca81bc6 to 0ddc0dc4. No golden body moves, which is the
claim the narrowing makes: the trap reads the same member it always did.

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

* test(mobile): re-record every golden at main's new baseline pin

One record from a detached worktree at `e7206f62a8` — main's pin since stablyai#20895 —
with this branch's `rpc-recording/`, `pilot-scenarios.json` and
`scripts/rpc-recording.mts` laid over it, so the goldens are recorded against
main's product tree rather than a branch that edits the engine.

All 520 goldens now share one `recorderSha256`
(`0ddc0dc472e2efbe58004c6dfaf5360e368fed321e40dfe15c11a9ad1817dea4`) and one
`baseline`. Against main, 262 move on the header alone and 247 also gain the
`sent` ordinal on an effect, which is the whole of the body change; the nine
goldens stablyai#20895 re-digested carry a byte-identical body, and the six the new
worktree catalog adapter (stablyai#20873) recorded keep main's observation.

Claude-Session: https://claude.ai/code/session_01JNnE9qzUZMMnqpZWCqM3nb
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