Repository navigation
fix(lint): merge duplicate type imports in the mobile RPC recorder adapters - #20895
Conversation
…apters The native code-quality audit rejects a module imported twice in one file, so main's static-analysis job is red for every open PR.
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Repository UI Review profile: CHILL Plan: Advanced Run ID: 📒 Files selected for processing (2)
Included review availability: Your plan provides up to 10 included reviews per hour; 7 remain after this review. 📝 WalkthroughWalkthroughThe changes consolidate type-only imports from Priority: ⬇️ Low Merge Risk: ⚪ Minimal · up to This PR only reorganizes type-only imports and leaves runtime behavior unchanged, so no merge-blocking risk remains. 🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
Full details: Description checkExplanation The description explains the code change, motivation, golden-file impact, and local verification. However, it does not follow the required template and omits the required Linked Issue, Visual Proof with an N/A explanation, AI Disclosure, Review, Agent skill upstream boundary, Notes, and Checklist sections. Resolution Update the description to include every required template section. Add a linked issue in the
✨ Finishing Touches📝 Generate docstrings
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. Comment |
There was a problem hiding this comment.
✅ No new issues found.
Reviewed changes
- Merged duplicate type imports —
agent-history-mount-adapters.tsandpush-registration-mount-adapters.tseach collapse two../operation-module-loaderimports into a singleimport typestatement, clearing theaudit:code-quality:nativeduplicate-import failure.
Both files reference the loader import only in type positions (ReturnType<typeof operationModuleLoader>), so the type-only form is correct and consistent with the other adapters in rpc-recording/adapters/. This is a mechanical import merge with no behavioral surface.
DeepSeek Flash (free via Pullfrog for OSS) | 𝕏
…uplicate-type-imports
The duplicate-import fix changed two mount adapters, so the nine goldens that pin them by adapterSha256 needed re-recording. The recorder fence requires the pinned baseline to match the product tree, so the baseline moves to current main, which rewrites that header in all 509 goldens. Every recording body is identical, which also shows the commits between the two baselines changed no observed behavior.
|
Too many files changed for review (512 files, 100 file limit). |
#20895 edited two mount adapters and re-recorded all 509 goldens to shift adapterSha256, while this branch re-recorded the same goldens to shift recorderSha256. Nine goldens conflicted on adjacent header lines; they were resolved to main's side and every golden was then re-recorded from the merged tree with scripts/rpc-recording.mts, so main's adapterSha256 values survive. Against origin/main the only golden field this branch changes is recorderSha256. adapterSha256 and baseline are unchanged on every golden.
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
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
…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
…apters (stablyai#20895) * fix(lint): merge duplicate type imports in the mobile RPC recorder adapters The native code-quality audit rejects a module imported twice in one file, so main's static-analysis job is red for every open PR. * test(mobile): re-record RPC goldens against the merged adapters The duplicate-import fix changed two mount adapters, so the nine goldens that pin them by adapterSha256 needed re-recording. The recorder fence requires the pinned baseline to match the product tree, so the baseline moves to current main, which rewrites that header in all 509 goldens. Every recording body is identical, which also shows the commits between the two baselines changed no observed behavior.
…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

Main's static-analysis job fails on
audit:code-quality:nativebecause two files added in #20702 import../operation-module-loadertwice. Merging each pair into oneimport typeclears the gate. No behavior change.Because the mount adapters are pinned into their goldens by
adapterSha256, the nine goldens that mount them were re-recorded. The recorder fence requires the pinned baseline to match the product tree, sobaselineinpilot-scenarios.jsonmoves to current main, which rewrites that one header line in all 509 goldens. The diff undermobile/rpc-foundation/goldensis header-only: 509baselinelines and 9adapterSha256lines, no recording content. 511 replays pass locally.Verified locally:
pnpm run audit:code-quality:nativeexits 0.