Skip to content

Remove mobile import cycles while preserving editor and terminal behavior - #25540

Closed
nwparker wants to merge 4 commits into
mainfrom
nwparker/editor-mobile-import-cycle-lint
Closed

nwparker wants to merge 4 commits into
mainfrom
nwparker/editor-mobile-import-cycle-lint

Conversation

@nwparker

@nwparker nwparker commented Oct 5, 2026 •

Copy link
Copy Markdown
Contributor

ELI5

Full lint reports existing mobile import cycles. This rearranges the existing code so lint can pass while mobile editing, terminal selection and connections behave the same.

What Changed

The native and web client providers each keep their own React context in a small leaf module. Terminal cell measurements move into the existing geometry module; selection coordinates move into a leaf used by the overlay. Existing public exports remain available.

Why

Moving the existing function bodies removes the import loops without replacing connection, selection or scheduling logic. Native and web contexts remain separate. No library, dependency, wire format, suppression or lint limit changes.

Linked Issue

Supporting lint cleanup for the editor bug-fix wave and #10161; no separate issue.

Visual Proof

N/A — source moves preserve the rendered behavior and public APIs.

Testing

  • Compared the moved code and provider bodies against the exact base; seven terminal function bodies are byte-identical. Context hooks differ only in the context variable name and retain their original messages.
  • Existing mobile tests: 1,856 passed, three skipped; 210 suites passed and two skipped. Updated the existing bundle census for its new selection leaf and the page-context mock for its new import.
  • The five original lint warnings reproduce on pristine base with matching mobile dependencies. Full lint and changed-code quality pass with those same dependencies after the move.
  • Full desktop/CLI typecheck, mobile typecheck, mobile test-typecheck ratchet and mobile web build pass. Regenerated native terminal and editor bundles before running their existing execution tests; generated files are ignored and are not committed.

Review

Independent source review confirmed the unchanged function bodies, retained exports, separate native/web context identities, web module resolution, and unchanged initialization, callbacks and lifetimes.

Merge risk: very low. No intended negative user-facing trade-off. This was verified through source comparison, existing native-document execution tests and the web build; physical mobile devices were not exercised.

Agent skill upstream boundary

  • Not applicable; no upstream skill-installer source or metadata copied.

Checklist

  • Focused source rearrangement; before/after, mechanism and approach explained.
  • Source comparison and independent review completed.
  • Native/web platform resolution, SSH ownership and public API behavior preserved.
  • Full lint, typechecks, existing tests and relevant bundle builds pass; current-head CI pending.

CI follow-up: The recorder now mounts the existing public client context instead of referencing a private local after transpilation. The web override manifest includes the new context sibling. No editor or mobile production logic changed in this follow-up; it removes 80 net test-support lines. All 1,773 recorder controls pass (3 intentional skips), along with 487 checks in 47 mobile web suites, Chrome/WebKit bundle controls, root/mobile typechecks, full lint and changed-code quality. The generated web build ID matches the prior build.

Additional CI validation: replaced two recorder inline type queries with explicit type-only imports. Standalone React Doctor 0.9.14 now reports no issues against current main; 797 recorder tests across three suites, mobile typecheck and changed quality pass. No runtime or golden changes.

@coderabbitai

coderabbitai Bot commented Oct 5, 2026 •

Copy link
Copy Markdown
Contributor

Review in Change Stack →

Navigate logical layers of code changes, visualize relationships, and explore their blast radius.

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: 8953e296-8a39-4b9e-a3e8-be2d5297c740
📥 Commits

Reviewing files that changed from the base of the PR and between 3d59697 and e6a471c.

📒 Files selected for processing (2)
  • mobile/src/test-support/rpc-recording/adapter-seam.test.ts
  • mobile/src/test-support/rpc-recording/host-client-context-exposure.ts
🚧 Files skipped from review as they are similar to previous changes (2)
  • mobile/src/test-support/rpc-recording/host-client-context-exposure.ts
  • mobile/src/test-support/rpc-recording/adapter-seam.test.ts

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


📝 Walkthrough

Walkthrough

The terminal document code centralizes cell geometry helpers and moves selection-range helpers into a dedicated module. The transport code defines native and web RPC client contexts in separate modules, and recording adapters and tests use the public context. The renderer hook-confirmation helper is renamed to confirmHook.

Priority: ⬇️ Low

Merge Risk: ⚪ Minimal · up to e6a47

This change reorganizes mobile modules to remove import cycles, and the reported validation is passing. No merge-blocking risk was identified. Current-head CI was reported as pending.

Security Architecture Review

Security architecture risk: 🔵 Low · up to 3d596

The inspected changes preserve existing security boundaries and behavior, and no new attack path was established. Incomplete runtime integration and reachability coverage limit confidence in the newly exposed shared interfaces.

Retained concerns
No architecture-level concerns identified.

Security review details

Security Blast Radius

  • inferred — The inspected effects concern in-process access to existing native host clients, the page's injected bridge client, and document-local terminal selection. The new exports do not establish an attacker-controlled path to additional hosts or credentials; dynamic and external consumers remain outside verified reachability coverage.

Trust Boundaries and Controls

  • observed — Native and web contexts remain separate. The web provider retains shell-owned connection authority, exposes a placeholder client identity rather than a credential, and does not provide native reconnect capability. Native host hooks retain acquisition identity, host binding and release-on-cleanup behavior.

Resilience and Maintainability Implications

  • inferred — Recording support replaces appended exposure of a private provider local with loading the public context. Its evaluation-capable loader and registry predate this PR, and inspected callers remain under recording test support. The new seam test asserts provider-and-hook identity, but its execution was not independently verified.
🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 35.71% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 28 functions across 25 files. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 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 summarizes the main change: removing mobile import cycles while preserving editor and terminal behavior.
Description check ✅ Passed The description covers the required sections with clear change details, rationale, issue reference, visual-proof status, testing, review, and checklist information. It is mostly complete and explains …
  • Fix all pre-merge checks with AI
✨ Finishing Touches 💡 1
📝 Generate docstrings 💡
  • Commit to this branch
  • Create a new PR
  • Autopilot · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

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

❤️ Share

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

@pullfrog pullfrog Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

✅ No new issues found.

Reviewed changes

No prior Pullfrog review existed on this PR, so this run reviewed the full change set end to end. The incremental range (3d59697..e6a471c) is a test-support type-import cleanup only.

  • Extracted terminal cell geometry into a leaf: cell-geometry.ts now owns getMeasuredCellHeight, getCellWidth, getTotalScale, getCellHeight, with fit-scale.ts and viewport-transform.ts re-exporting so existing importers are untouched.
  • Moved selection coordinate math into a new leaf selection-cell-range.ts (selRange, isStartFirst, applyXtermSelection, TerminalSelectionRange), re-exported by selection-range.ts, breaking the overlay↔range cycle.
  • Split the RPC client React context into platform leaves rpc-client-react-context.ts / .web.ts; client-context(.web).tsx consume and re-export, and host-client-hooks.ts imports the leaf. Native and web keep separate context identities.
  • Listed the new web sibling in web-overrides.json.
  • Reworked recorder test-support to mount the public context instead of exposing the module-private Ctx local, deleting the exposure table and per-adapter exposes entries.
  • Renamed the renderer's local confirm helper to confirmHook to clear the localization-coverage false positive.

Verified: the web bundle's resolveExtensions (.web.* first) makes host-client-hooks resolve to the same .web leaf client-context.web.tsx provides, so page screens still read their provider; the native path uses the matching native leaf. Moved bodies are byte-identical and re-exports preserve the public API. All checks at e6a471c pass (static analysis and typecheck, mobile web app bundle, Mobile Checks, verify).

Pullfrog  | View workflow run | Using deepseek-v4.1-flash (free via Pullfrog for OSS) | 𝕏

@nwparker

nwparker commented Nov 1, 2026

Copy link
Copy Markdown
Contributor Author

Closing as obsolete. Main no longer has these mobile import cycles: oxlint --config config/oxlint-code-quality-native-plugins.json mobile --deny-warnings (which includes import/no-cycle) passes on main, and the branch now conflicts. The two PRs that depended on it (#25621, #25554) were retargeted to main and merged.

@nwparker nwparker closed this Nov 1, 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