Skip to content

refactor(mobile): the host-scoping rewrite moves out of the terminal's HTML - #22172

Merged
Jinwoo-H merged 1 commit into
mainfrom
ota-fu-style-scoping-home
Sep 22, 2026
Merged

Jinwoo-H merged 1 commit into
mainfrom
ota-fu-style-scoping-home

Conversation

@Jinwoo-H

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

Copy link
Copy Markdown
Contributor
Files Added Deleted Net
Test 4 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​54 $\color{#cf222e}{\Huge{\mathbf{−}}}$​26 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​28
Prod 3 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​2 $\color{#cf222e}{\Huge{\mathbf{−}}}$​2 0

Summary

scopeDocumentStyleToHost moves from mobile/src/terminal/terminal-webview-html/document-style-scoping.ts to mobile/src/style-scoping/document-style-scoping.ts. The rewrite is domain-neutral: the terminal's web document mount and the rich Markdown editor's mount (C2) both read it, and the terminal directory was only its first caller. Pure move (git R100, byte-identical), no re-export shim; both mounts and the page-stylesheet test import from the new home.

The old test file stays in the terminal directory, renamed document-style.test.ts: four of its five cases read the terminal's own sheets (TERMINAL_DOCUMENT_ROOT_STYLE, TERMINAL_DOCUMENT_ELEMENT_STYLE, XTERM_ENGINE_CSS) and the first asserts document-style.ts's split identity, so moving it would have put an import of the generated terminal CSS into a domain-neutral directory, the shape the consumer census exists to forbid. A new style-scoping/document-style-scoping.test.ts holds the caller-free part (the document-level selector reader and the sheet shapes both exports refuse), plus one added case: a declaration block with no selector.

What it touches

  • Session closure pin (config/scripts/mobile-web-app-session-terminal-closure.test.mjs): the pinned path in GAINED_OUTSIDE_THE_DOCUMENT and its docstring. Closure measured with the five generators run first: 4,363 modules / 1,021 local before and after; the diff is one path swapped for another.
  • Generated artifacts: the module is in none of the six bundles (the terminal document bundle's 47 inputs never included it); all six hashes identical before and after.

Verification

Lane: mobile tsc 0, ratchet 0 (811 files, 126 grandfathered), oxfmt 0, mobile oxlint 0, root oxlint 0 (7 files), anti-slop 0, changed-code quality 0 across 7 files, React Doctor 0, config/scripts 252 passed / 2 skipped, targeted 13 files 101 tests exit 0. The lane's own full mobile run exited 1 on three 5 s timeouts under a 12-lane load (green alone).

Lead gate on 0338cbb against 895f2cf (gate-style-scoping-0338cbb740.log): tsc 0, ratchet 0, changed-code quality 0, react-doctor 0, anti-slop 0, root-format 0, max-lines 0, root-oxlint 0 (7 files), config/scripts 252 passed / 2 skipped, mobile 815 passed, machine-paths 0.

…s HTML

`scopeDocumentStyleToHost` and `scopeStyleToHost` are one rewrite of a flat stylesheet, and two
page mounts read it: the terminal's and the rich Markdown editor's. The module lived under
`terminal/terminal-webview-html/`, so the editor reached across the terminal's directory for it.
It moves to `src/style-scoping/`, named for what it does rather than for its first caller, and
both mounts import it from there. No re-export shim: the old path is gone.

Its test does not follow it whole. Four of its five cases read the terminal's own sheets
(`TERMINAL_DOCUMENT_*`, `XTERM_ENGINE_CSS`) and the first asserts `document-style.ts`'s split
identity, which is not about the rewrite at all -- so that file stays in the terminal directory as
`document-style.test.ts`, beside the module it is about. What moves is the part that names no
caller: which selectors read as the document's own, and the sheet shapes both exports refuse.

The page-closure pin names the module by path and is updated in the same commit. The closure is
otherwise unmoved: 4,363 modules and 1,021 local before and after, one path swapped for another.
The five generated artifacts are byte-identical -- none of them bundles this module.

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

coderabbitai Bot commented Sep 22, 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: d2ebe3c0-3ec9-4009-8605-90a430f2799b

📥 Commits

Reviewing files that changed from the base of the PR and between 8568d77 and 0338cbb.

📒 Files selected for processing (7)
  • config/scripts/mobile-web-app-session-terminal-closure.test.mjs
  • mobile/src/components/rich-markdown/page-stylesheet.test.ts
  • mobile/src/components/rich-markdown/rich-markdown-web-document-mount.ts
  • mobile/src/style-scoping/document-style-scoping.test.ts
  • mobile/src/style-scoping/document-style-scoping.ts
  • mobile/src/terminal/terminal-web-document-mount.ts
  • mobile/src/terminal/terminal-webview-html/document-style.test.ts

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


📝 Walkthrough

Walkthrough

The style-scoping helpers and related imports now use src/style-scoping/document-style-scoping. The session closure path list and documentation were updated to match. New tests cover document-level selectors and invalid stylesheet shapes. Existing terminal tests remove duplicated selector and error-case coverage.

Priority: ⬇️ Low

Merge Risk: ⚪ Minimal · up to 0338c

This change centralizes style-scoping helpers for terminal and rich Markdown mounts while preserving behavior and expanding contract coverage. It is mergeable with normal checks.

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Description check ⚠️ Warning The description explains the implementation, rationale, affected files, and verification results. However, it omits most required template sections, including ELI5, Why, Linked Issue with an issue num… Add the missing required template sections. Provide a linked issue after Fixes #, state N/A with a reason for Visual Proof if there is no UI or interaction change, complete the testing and checklist items, and document AI Disclosure, Re…
✅ Passed checks (4 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly describes the primary change: moving the host-scoping rewrite out of the terminal-specific HTML directory.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check. Docstring coverage is scoped to functions touched by this diff. Analyzed 0 functions across 6…
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, rationale, affected files, and verification results. However, it omits most required template sections, including ELI5, Why, Linked Issue with an issue number, Visual Proof or an explicit N/A statement, AI Disclosure, Review, boundary confirmation, Notes, and the checklist.

Resolution

Add the missing required template sections. Provide a linked issue after Fixes #, state N/A with a reason for Visual Proof if there is no UI or interaction change, complete the testing and checklist items, and document AI Disclosure, Review, Agent skill upstream boundary, and Notes. Keep the existing technical summary and verification details.

  • Fix all pre-merge checks with AI
✨ Finishing Touches
📝 Generate docstrings
  • Commit to this branch
  • Create a new PR

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

  • Module move: document-style-scoping.ts moves byte-identically (R100) from mobile/src/terminal/terminal-webview-html/ to a domain-neutral mobile/src/style-scoping/, with no re-export shim. Both page mounts and both tests import the new path.
  • Test split: the terminal test is renamed to document-style.test.ts (R070) and keeps the four terminal-sheet cases; the new style-scoping/document-style-scoping.test.ts holds the caller-free contract (selector reader and the refused sheet shapes through both exports) plus one added no-selector case.
  • Pin update: mobile-web-app-session-terminal-closure.test.mjs re-pins the module path in GAINED_OUTSIDE_THE_DOCUMENT and its docstring; everything else is a filename-only reference that stays valid.

All references to the old path are gone, the new directory is inside mobile's **/*.ts include, the top-level-only consumer census is unaffected, and the split preserves the caller-specific coverage. Verified the moved source exports all four symbols the tests import.

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

@Jinwoo-H
Jinwoo-H merged commit 48bdbb8 into main Sep 22, 2026
33 checks passed
@Jinwoo-H
Jinwoo-H deleted the ota-fu-style-scoping-home branch September 22, 2026 07:44
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