Skip to content

feat(mobile): the rich Markdown editor mounts on the page (OTA phase C, C7.10 C2) - #22099

Merged
Jinwoo-H merged 20 commits into
mainfrom
ota-c7-10-c2-editor-mount
Sep 22, 2026
Merged

Jinwoo-H merged 20 commits into
mainfrom
ota-c7-10-c2-editor-mount

Conversation

@Jinwoo-H

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

Copy link
Copy Markdown
Contributor
Files Added Deleted Net
Test 9 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​1619 $\color{#cf222e}{\Huge{\mathbf{−}}}$​62 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​1557
Prod 13 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​898 $\color{#cf222e}{\Huge{\mathbf{−}}}$​174 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​724

C7.10 item C: the rich Markdown editor mounts on the page

C7.6 gave the page a plain Markdown field and recorded the toolbar and the rendered view as a degradation. Ruling 26 makes that debt rather than done: the page now mounts the editor document itself. rich-markdown-web-document-mount.ts is the editor's half of what terminal-web-document-mount.ts does for the terminal: the sheet held under the host's class, the markup planted in the host, one factory call, a dispose that gives the host back. The component over it renders the same fifteen-command toolbar and uses the same controller the phone uses, so MarkdownReader cannot tell which sibling it has.

Seams the page answers differently

  • postToHost reaches the component directly and never window.ReactNativeWebView, which on the page is the shell's bridge.
  • promptForUrl is TextInputModal. window.prompt was measured to return null in both shells, so Link and Image silently did nothing on the phone.
  • No inset source, so onKeyboardInsetChange is never called: the screen's keyboard-occlusion.web.ts measures the same viewport with the same formula.
  • root is the mount's host element, because the markup's id is page-wide and a stack transition can keep two session screens mounted.

Two defects fixed

The surface computed to 14 px. iOS zooms on focus of any editable under that and never zooms back, and the keyboard seam then reads scale ≠ 1 as "no keyboard" for the rest of the session. The size now comes from the text-input seam, so the phone keeps 14 and the page gets 16 from one binding. The TextInput census could not see a contenteditable sized by a CSS string, so mobile-web-app-editable-host-font-size.mjs starts from the markup instead.

The caret did not survive the URL dialog: the modal focuses its own field, and execCommand on a document that does not hold the selection inserts nothing. The document now remembers the caret before it waits and restores it after, and the component answers from the drawer's onAfterClose; WebKit would not take focus back while the field still held it.

Numbers

Session route modules 4,333 to 4,359, local 991 to 1,017 on a merge of main at 197550c952, +26, all local (the editor's own 26; markdown-table-rows.ts is on both sides since #22114, and the freebuff icon from #18790 is on both sides since #22119); reproduced by the lead, zero removed. Bundle 8,028,418 to 8,056,166 bytes, 85.1% to 85.4% of the 9 MiB ceiling. Scripts unchanged at 67 against a fence of 76. No new grants: externalLink was already declared.

Known engine limit

WebKit's insertUnorderedList nests the <ul> inside the <p>, so a bullet list does not survive a markdown round trip there. The phone's WebView is the same engine, so this is pre-existing rather than introduced here; filed for its own fix.

Correction to the design note

The editor has one live consumer, MarkdownReader in MobileSessionActiveContent, not two; src/session/MobileMarkdownReader.tsx has no consumer at all. The root seam is still needed for the stack-transition case, and the render check drives two editors at once.

Round 1 (CodeRabbit on 556e7284e4, four findings, all accepted red-first)

  • The census counts every editable tag and reads its optional id from that tag, so an anonymous host beside a named one is no longer invisible.
  • An editable that declares no size is reported unresolved rather than passed, because the inherited value comes from a rule the walk cannot read.
  • The rule search is the markup's own directory, not its subtree, so a nested sheet cannot answer for the sibling the host actually gets.
  • A selector descending from :root is refused like one descending from body, instead of being rewritten into a rule that matches nothing.

Record note: 7552033979 carries the first three; dda48c4b84 carries the fourth but its message describes the second (staging error, left as is since history is never rewritten).

Round 2 (pullfrog + CodeRabbit on dda48c4b84, both accepted red-first)

  • The census validates the effective font-size, not the first declaration: CSS takes the last of equal importance and !important outranks the rest; the !important flag is stripped from the value (2 failed / 9 passed before).
  • The render check reads the floor from the seam (textInputFontSizeFloor(mobileDir)) and asserts at-or-above it; two controls show both sides move together and a 14px regression reds both engines.
  • The census reads every rule in the sheet that sizes the host, not the first: exact #id rules cascade by source order (last of equal importance, !important first), and a subject selector of higher specificity that still targets the host is reported as unresolved rather than ranked. No specificity arithmetic; the sibling walk still stops at the first sheet that opens the exact selector, so a sibling sheet carrying only a main#editor rule and no exact rule is out of view (left as is; a document's sheet and markup are one module).

Verification

config/scripts/mobile-web-app-rich-markdown-render.test.mjs: 16 cases, 8 per engine, under the shipped CSP. All fifteen commands, the 16 px floor, the sheet reaching nothing outside the host, the bridge object untouched, Link and Image inserting with the image painting, one change per checkbox tap, a link tap reaching the host, a remount leaving the listener and scheduler snapshots unmoved, and two editors holding their own content.

Commits

sha change red before
8422339227 root seam: the document reads its surface under its host 4 failed / 1 control
660f9704a3 scopeDocumentStyleToHost: :root/*/html/body move onto the host 6/6 on the absent export
7751b83a9f, 7cc183de83 the fifteen commands become one shared toolbar; ratchet fix
a2dba1e41a the mount module and MobileRichMarkdownEditor.web.tsx 9 on the absent module; 4 failed / 6 against the plain field
00770bb2aa 16 px floor via the text-input seam; editable-host census named document-style.ts:36 (14 px)
f7652bc72e the caret survives the URL dialog 2 failed / 7 passed
a8631ba71b the render check (16/16 both engines)
05d09441c3 closure repin 4,360 / 1,018
3f2d7673f0 merge of origin/main (73b726c64f)
556e7284e4 lint fix
a89f7c6c08 merge of origin/main (55378fce5b); closure pin conflict resolved by measurement, 4,358 / 1,016
7552033979 fix: census counts every editable tag, treats an omitted size as unresolved, searches siblings only (round 1, findings 1–3) 1 failed each
dda48c4b84 fix: a :root descendant selector is refused, not rewritten to match nothing (round 1, finding 4; message names finding 2) 1 failed / 6 passed
c945fc106b fix: the census reads the effective font size, last declaration and !important first (round 2) 2 failed / 9 passed
94e8b1f1fb test: the render check reads the floor from the seam (round 2) controls both ways
b3d9f317b2 merge of origin/main (15472cd4c6), no mobile or config changes
1a9ce5b2a0 merge of origin/main (059ee59a48); closure pin conflict resolved by measurement, 4,359 / 1,017
5eb1e449b3 merge of origin/main (197550c952, the #22119 freebuff repin); pin conflict resolved by keeping the measurement, main's paragraph placed first; closure unchanged at 4,359 / 1,017
5667d51435 fix: the census reads every rule that sizes the host — exact #id rules cascade in source order, any other subject rule that sizes the host (main#editor, a comma list holding one) makes it unresolved; id boundary so #editor never matches #editor-notes (round 3, CodeRabbit) later 14px: [] vs ['…:2']; main#editor: [] vs ['…:5']; comma list same; source-order and ::before/descendant controls green both ways

Gates

Lane gates all exit 0 on 556e7284e4. Lead gate against 73b726c64f: all lint gates 0; config/scripts 251 files passed; mobile 807 files passed; no machine paths.
Lead gate on dda48c4b84 against 55378fce5b: all lint gates 0; config/scripts 251 files passed; mobile 808 files passed; no machine paths.
Lead gate on 5eb1e449b3 against 197550c952: artifacts rebuilt, tsc 0, ratchet 0, all lint gates 0; config/scripts 251 files passed (2,319 tests); mobile 808 files passed (8,994 tests); no machine paths.
Lead gate on 5667d51435 against 197550c952: tsc 0, ratchet 0, all lint gates 0; config/scripts 251 files passed (2,325 tests); mobile 808 files passed; no machine paths.

The markup gives the editable surface an id, and inside the WebView that is
unambiguous because the document is the page. On the page it is not: a stack
transition keeps the outgoing session screen mounted while the incoming one
starts, so two hosts carry `#editor` at once and a page-wide `getElementById`
hands both documents the first one. The seventh seam is the root, exactly as it
is the terminal's ninth (ruling 24): the WebView names none of them and gets the
whole page, the page names the element its mount planted the markup in.

Red first, `vitest run src/components/rich-markdown/document-host-root.test.ts`
against the page-wide read: 4 failed, 1 passed — content written into the second
host landed in the first, both documents serialized the first surface, an edit in
the second reported through the first document's host, and stopping the first
took the listeners off the surface the second was still using. The one that
passed is the control: a document with no root still reads the whole page, which
is what the WebView gets.

Claude-Session: https://claude.ai/code/session_01JNnE9qzUZMMnqpZWCqM3nb
The editor's sheet says `:root`, `*`, `html` and `body` because inside the
WebView it owns the page. Appended to the head of a React Native Web application
all four restyle every screen the shell can show, so the page mount may inject
only what it owns — ruling 19's rule for `window.onerror`, applied to CSS.

The terminal's half of the scoper drops those rules and repaints through a seam,
because the colour `html, body` was setting belongs to the application. The
editor has no such seam and needs none: its host element *is* that editor's page,
so `scopeDocumentStyleToHost` moves the document's own rules onto the host — the
variables every other rule reads, the surface colour, the font, the box model —
and everything else hangs under it. A selector that merely starts at the document
(`body p`) throws rather than being rewritten into something it did not say.

Red first, `vitest run src/components/rich-markdown/page-stylesheet.test.ts`:
6 failed, 0 passed, all on the absent export.

Claude-Session: https://claude.ai/code/session_01JNnE9qzUZMMnqpZWCqM3nb
…ces render

The row of controls is not the WebView's: a press becomes an injected
`runCommand` there and a call on the page, and neither difference belongs in the
toolbar. Extracted so the page's editor does not declare fifteen rows of its own
that would drift from the phone's.

`MobileRichMarkdownToolbar.test.tsx` adds the fence a second copy would have
needed: the row names every command in the contract, exactly once. Verified red
by dropping `codeBlock` from the row — "names every command in the contract,
once" failed on the 14-member list before the case went back. The native
component's own test and the web fallbacks file stay green unchanged, which is
what says the extraction moved nothing.

Claude-Session: https://claude.ai/code/session_01JNnE9qzUZMMnqpZWCqM3nb
`check-tests-typecheck-ratchet.mjs` reported the new file as newly failing
`tsc -p tsconfig.test.json`: the `ScrollView` mock's spread did not match any
`createElement` overload, and comparing a node's `ElementType` against the string
`'Pressable'` is a no-overlap comparison. Host strings for the mock and
`String(node.type)` for the read, rather than a cast. Ratchet back to OK at 800
files.

Claude-Session: https://claude.ai/code/session_01JNnE9qzUZMMnqpZWCqM3nb
`react-native-webview` renders nothing in a browser, so C7.6 gave the page a
plain Markdown field and recorded the toolbar and the rendered view as a
degradation. Ruling 26 makes that debt rather than done: the page mounts the
document itself. `rich-markdown-web-document-mount.ts` is the editor's half of
what `terminal-web-document-mount.ts` does for the terminal — the sheet held
under the host's class, the markup planted in the host, one factory call, and a
dispose that gives the host back. `MobileRichMarkdownEditor.web.tsx` is the
component over it, with the same fifteen-command toolbar and the same controller
the phone uses, so `MarkdownReader` cannot tell which sibling it has.

Three seams are the page's rather than the window's. Messages reach
`handleMessage` directly and never `window.ReactNativeWebView`, which on the page
is the shell's bridge. The URL for Link and Image comes from `TextInputModal`:
`window.prompt` was measured to return null in both shells, so those two commands
silently did nothing. And no inset source is supplied, so `onKeyboardInsetChange`
is never called — the screen's `keyboard-occlusion.web.ts` measures the same
viewport with the same formula, and a report here would lift its bar twice.

Red first, two runs. `rich-markdown-web-document-mount.test.ts`: 9 failed on the
absent module, and its listener case is the one that holds ruling 21 — a second
mount reports its own edits and the first mount's detached surface reports
nothing, with an event dispatched on it to say so. The four new cases in
`mobile-webview-editor-web-fallbacks.test.tsx`, run against the plain field still
in the tree: 4 failed, 6 passed — no toolbar, no URL modal, and the `TextInput`
the page is meant to have lost.

Claude-Session: https://claude.ai/code/session_01JNnE9qzUZMMnqpZWCqM3nb
…census that can see it

`#editor` computed to 14 px, measured in both engines. iOS zooms the page on
focus of any editable under 16 px and does not zoom back, and
`keyboard-occlusion.web.ts` answers 0 for the rest of the session at a scale
other than 1 — the exact failure the floor exists for, on the page's only
full-screen writing surface. The size now comes from the text-input seam, which
is also where the two hosts part: the phone keeps the app's body size because a
WebView has no page to zoom, the page gets the raise, and one binding moves both
if the floor ever does.

The `TextInput` census could not have caught it. `modulesDeclaringTextInput`
matches JSX tags and `style` props, and this is a `contenteditable` in a markup
string sized by a rule in a stylesheet. `mobile-web-app-editable-host-font-size.mjs`
starts from the markup instead: it finds every editable host a closure declares,
follows its id to the rule beside it, and reads the size the same way — a literal
at or above the floor, or the seam's own export imported from the seam's module.
An editable with no id, or one no sibling sheet styles, is reported unresolved
rather than passed.

Red first. The rule's own file reported
`src/components/rich-markdown/document-style.ts:36` as the offender before the
fix (4 failed, 3 passed on the first run, the other three being the brace scanner
and the line-start anchor the fixtures found). The closure case in
`mobile-web-app-session-terminal-closure.test.mjs` now names the editor as the
one editable in the session route's closure and its offender list is empty:
1 passed, 4 skipped under `-t editables`.

Claude-Session: https://claude.ai/code/session_01JNnE9qzUZMMnqpZWCqM3nb
…age insert

Measured in the render check, on both engines: the Link and Image commands opened
the modal, took the URL, and inserted nothing. The dialog is what takes the
caret — the modal focuses its own field — and `execCommand` on a document that
does not hold the selection does nothing at all. So the page had swapped one
silent failure for another: `window.prompt` returning null on the phone, and a
command with no selection on the page.

Two halves. The document remembers its caret before it waits and puts it back
after (`restoreRememberedSelection`, unconditional where `restoreSelectionOrEnd`
needs a flag, because the wait itself is the blur); if the host replaced the
content while the dialog was open, the remembered range is gone from the document
and the caret goes to the end instead. And the component answers the promise from
the drawer's `onAfterClose` rather than from the submit, because WebKit would not
take the focus back while the field still held it — with the answer released on
submit, chromium inserted and WebKit did not.

`TextInputModal` forwards `onAfterClose` for that, which is the one thing it did
not already pass through to `BottomDrawer`.

Red first, `editor-selection.test.ts` against the previous `editor-commands.ts`:
2 failed, 7 passed — the caret was left in the dialog's field, and a replaced
document did not fall back to the end. The render check's Link/Image case went
from failing on both engines to inserting on both, with the inserted image's
`naturalWidth` above zero under the shipped policy.

Claude-Session: https://claude.ai/code/session_01JNnE9qzUZMMnqpZWCqM3nb
…the shipped header

`config/scripts/mobile-web-app-rich-markdown-render.test.mjs`: the real component,
mounted by the real React, driven through its toolbar in chromium and webkit under
the policy read out of the shell's own Kotlin source. Sixteen cases, eight per
engine.

What it measures rather than asserts: all fifteen commands change the document,
each with the precondition that what it produces was not there first; the surface
computes to the 16 px floor and the document's own `--editor-surface` variable is
set on the host and nowhere on the root element; `ready` and `change` cross the
seam while `window.ReactNativeWebView` — defined by the rig so its absence is a
reading — is never touched; Link and Image are answered by the modal, and the
inserted image paints with a non-zero `naturalWidth`; one change per checkbox tap
and one per inline code; a link tap reaches the host instead of navigating; a
remount leaves the listener snapshot and the scheduler exactly where one whole
cycle left them (rulings 20 and 21); and two editors on one page hold their own
content and report their own edits.

Four harness facts the first runs found, each now in a comment: the entry needs
four of `MOBILE_WEB_APP_SHIMS` (`isFabric` threw `global is not defined` and every
case failed at `data-ready`); `.web.jsx` in `resolveExtensions` or
`react-native-svg` resolves its Fabric components; a `SafeAreaProvider`, which the
route's navigator supplies and a bare mount does not; and the document's markup,
not its text, as the oracle for a content reset — `### body text here` and `body
text here` read the same, so a text wait passed on the document it was replacing.

One finding, reported not fixed: WebKit's `insertUnorderedList` nests the `<ul>`
inside the `<p>` it was given and the serializer walks back out with the same
text, so a bullet list does not survive a round trip there. The phone's WebView is
the same engine, so this is not something the page introduces; the case names the
command's own element and the reset is numbered per command to work around it.

Run 5 of 5: 16 passed, 0 failed, 0 errors, exit 0, 6.58s.

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

Both sides measured with `mobileWebAppRouteClosure(SESSION_ROUTE)` at base
`9267423f22`, all five postinstall generators run first, the before side a scratch
worktree detached at that sha:

  modules        4333 -> 4360   (+27)
  local modules   991 -> 1018   (+27)

All 27 are local and none is vendored, which is the point: the editor is the app's
own code, not a library. The document's 24 modules under `src/components/rich-markdown/`
were reachable from nothing on the page while it rendered a plain field, and the
other three are the mount, the shared toolbar, and the controller with its
keyboard-inset module. Nothing leaves, because the web sibling replaces its own
native file and that file was never in this closure. Named by diffing the two
`local` lists, not inferred from the total.

`document-style-scoping.ts` is on both sides: the terminal's mount already brings
it, so the editor's second export costs no module.

The generation, measured the same way on both sides: 8,028,418 -> 8,056,166 bytes
(+27,748) across 109 assets against the 9 MiB ceiling, 85.1% -> 85.4%. The script
count does not move (67 against the 76 the chunk fence allows for 15 routes) and
neither does the entry's static closure (1,612,052 bytes against 3 MiB) — this is
code the route already reached for, not a new chunk boundary.

The grant census needs nothing: `openExternalLink` is the editor's only seam with a
grant behind it, and the session route already declares `externalLink` for six
other openers. `mobile-web-app-page-grant-call-sites.test.mjs` passes unchanged.

Closure, webview-consumer and grant censuses together: 28 passed, 0 failed, exit 0.

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

`check-changed-code-quality.mjs` failed with one finding: the mount effect's
`react-hooks/exhaustive-deps` disable reports no problem under that config, so the
directive itself is the finding. The reason it carried is worth keeping and now
reads as a plain comment — the effect mounts once, with `promptForUrl` taken from
the closure, because re-running it would throw away a live document and the caret
in it.

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

coderabbitai Bot commented Sep 21, 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: 855ba43f-c97f-4b3f-89e6-68e213f4d6bf

📥 Commits

Reviewing files that changed from the base of the PR and between 5eb1e44 and 5667d51.

📒 Files selected for processing (2)
  • config/scripts/mobile-web-app-editable-host-font-size.mjs
  • config/scripts/mobile-web-app-editable-host-font-size.test.mjs
🚧 Files skipped from review as they are similar to previous changes (2)
  • config/scripts/mobile-web-app-editable-host-font-size.test.mjs
  • config/scripts/mobile-web-app-editable-host-font-size.mjs

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


📝 Walkthrough

Walkthrough

The web editor now mounts the shared rich Markdown document in a host element with scoped styles and lifecycle cleanup. URL prompts preserve the editor selection. Native and web surfaces use a shared 15-command toolbar. The editor style uses the text-input font-size seam. New tests cover document isolation, style scoping, toolbar behavior, browser rendering, and editable-host font-size validation. The session closure measurement increases from 4,333 to 4,359 modules.

Priority: ➖ Normal

Merge Risk: 🔵 Low · up to 5667d

The PR adds a page-mounted editor and expands editable-host validation, but the validation census may still miss some hosts or accept unverified font sizes. The impact is bounded to compliance coverage, so the change is mergeable with owner awareness.

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Description check ⚠️ Warning The description gives detailed technical context, testing results, known limitations, and bundle measurements. However, it does not follow the required template and omits required sections such as ELI… Rewrite the description using the repository template. Add all required section headings and content. Include a linked issue using a Fixes entry, attach before-and-after visual proof or write N/A with a reason, document manual and automated…
✅ Passed checks (4 passed)
Check name Status Explanation
Docstring Coverage ✅ Passed Docstring coverage is 83.33% which is sufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 48 functions across 22 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.
Title check ✅ Passed The title clearly identifies the main change: mounting the rich Markdown editor on the mobile web page. The OTA phase and C7.10 reference provide useful context.
Full details: Description check

Explanation

The description gives detailed technical context, testing results, known limitations, and bundle measurements. However, it does not follow the required template and omits required sections such as ELI5, What Changed, Why, Linked Issue with a Fixes entry, Visual Proof, AI Disclosure, Review, Agent skill upstream boundary, Notes, and the Checklist.

Resolution

Rewrite the description using the repository template. Add all required section headings and content. Include a linked issue using a Fixes entry, attach before-and-after visual proof or write N/A with a reason, document manual and automated testing, complete the AI Disclosure and Agent skill upstream boundary sections, address the Notes items, and complete the Checklist.

  • 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.

@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: 4


ℹ️ Review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Advanced

Run ID: b6edc042-a15a-4df6-b28d-5e5490bf65e4

📥 Commits

Reviewing files that changed from the base of the PR and between da982a4 and 556e728.

📒 Files selected for processing (22)
  • config/scripts/mobile-web-app-editable-host-font-size.mjs
  • config/scripts/mobile-web-app-editable-host-font-size.test.mjs
  • config/scripts/mobile-web-app-rich-markdown-render.test.mjs
  • config/scripts/mobile-web-app-session-terminal-closure.test.mjs
  • mobile/src/components/MobileRichMarkdownEditor.tsx
  • mobile/src/components/MobileRichMarkdownEditor.web.tsx
  • mobile/src/components/MobileRichMarkdownToolbar.test.tsx
  • mobile/src/components/MobileRichMarkdownToolbar.tsx
  • mobile/src/components/TextInputModal.tsx
  • mobile/src/components/mobile-webview-editor-web-fallbacks.test.tsx
  • mobile/src/components/rich-markdown/document-host-root.test.ts
  • mobile/src/components/rich-markdown/document-host-seams.ts
  • mobile/src/components/rich-markdown/document-scope.ts
  • mobile/src/components/rich-markdown/document-style.ts
  • mobile/src/components/rich-markdown/editor-commands.ts
  • mobile/src/components/rich-markdown/editor-selection.test.ts
  • mobile/src/components/rich-markdown/editor-selection.ts
  • mobile/src/components/rich-markdown/editor-surface.ts
  • mobile/src/components/rich-markdown/page-stylesheet.test.ts
  • mobile/src/components/rich-markdown/rich-markdown-web-document-mount.test.ts
  • mobile/src/components/rich-markdown/rich-markdown-web-document-mount.ts
  • mobile/src/terminal/terminal-webview-html/document-style-scoping.ts

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

Comment on lines +48 to +50
const ids = [...source.matchAll(EDITABLE_MARKUP)].map((match) => match[1] ?? match[2] ?? null)
if (ids.length === 0) {
found.push({ file, id: null })

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:

rg -n 'contenteditable="true"' mobile/src
rg -n 'editableHostsIn|unresolvedEditableHostStyles|editableHostFontSizeOffenders' config/scripts

Repository: stablyai/orca

Length of output: 3669


🏁 Script executed:

#!/bin/bash
set -e
printf '%s\n' '--- validator implementation ---'
sed -n '1,215p' config/scripts/mobile-web-app-editable-host-font-size.mjs
printf '%s\n' '--- editable-host tests ---'
sed -n '1,155p' config/scripts/mobile-web-app-editable-host-font-size.test.mjs
printf '%s\n' '--- session-terminal closure test ---'
sed -n '300,370p' config/scripts/mobile-web-app-session-terminal-closure.test.mjs
printf '%s\n' '--- closure definitions/usages ---'
rg -n -C 3 'EDITOR_CLOSURE|closure:|closure\b|editableHostFontSizeOffenders|unresolvedEditableHostStyles' config/scripts mobile/src --glob '*.mjs' --glob '*.ts'

Repository: stablyai/orca

Length of output: 45509


🏁 Script executed:

#!/bin/bash
set -e
printf '%s\n' '--- validator implementation ---'
sed -n '1,65p' config/scripts/mobile-web-app-editable-host-font-size.mjs
sed -n '125,195p' config/scripts/mobile-web-app-editable-host-font-size.mjs
printf '%s\n' '--- editable-host tests ---'
sed -n '1,145p' config/scripts/mobile-web-app-editable-host-font-size.test.mjs
printf '%s\n' '--- relevant closure files ---'
fd -i 'closure' config/scripts -t f
printf '%s\n' '--- editable markup in config scripts ---'
rg -n -C 4 'contenteditable|editableHostsIn|editableHostFontSizeOffenders|unresolvedEditableHostStyles' config/scripts --glob '*.mjs'

Repository: stablyai/orca

Length of output: 32375


Count each editable host before extracting its optional id.

EDITABLE_MARKUP matches only editable tags that have an id. A mixed file can therefore omit its no-id host, so the unresolved-host and offender checks do not validate it. The current validated editor closure has only one named host, so this is a localized false-negative gap in the regression check.

Parse each contenteditable="true" tag first, extract its optional id, and add a fixture with one named host and one no-id host.

Comment on lines +109 to +110
// No size of its own, so it inherits, and the floor is about the size an editable declares.
return { text: null, onSeam: 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:

sed -n '1,210p' config/scripts/mobile-web-app-editable-host-font-size.mjs
sed -n '105,145p' config/scripts/mobile-web-app-editable-host-font-size.test.mjs
rg -n 'font-size|TEXT_INPUT_FONT_SIZE|textInputFontSizeFloor' mobile/src config/scripts/mobile-web-app-session-terminal-closure.test.mjs | head -120

Repository: stablyai/orca

Length of output: 17898


🏁 Script executed:

set -o pipefail
printf '%s\n' '--- consumers and definitions ---'
rg -n -C 5 'unresolvedEditableHostStyles|editableHostFontSizeOffenders|editableHostSizes|onSeam|contenteditable="true"' config/scripts mobile/src --glob '*.mjs' --glob '*.js' --glob '*.ts' --glob '*.tsx' | head -260
printf '%s\n' '--- validator tests and fixture helper ---'
sed -n '1,180p' config/scripts/mobile-web-app-editable-host-font-size.test.mjs
printf '%s\n' '--- likely page/root style declarations ---'
rg -n -C 3 'html\s*\{|body\s*\{|:root\s*\{|font-size\s*:|document-style|styleSheet|stylesheet' mobile/src config/scripts --glob '*.ts' --glob '*.tsx' --glob '*.mjs' | head -320

Repository: stablyai/orca

Length of output: 41909


🏁 Script executed:

set -o pipefail
printf '%s\n' '--- route-closure consumer ---'
sed -n '300,355p' config/scripts/mobile-web-app-session-terminal-closure.test.mjs
rg -n -C 8 'editableHostFontSizeOffenders|unresolvedEditableHostStyles' config/scripts --glob '*.mjs' --glob '*.js'
printf '%s\n' '--- real editor markup/style ---'
cat -n mobile/src/components/rich-markdown/document-markup.ts
sed -n '1,90p' mobile/src/components/rich-markdown/document-style.ts
printf '%s\n' '--- page/root style and mount candidates ---'
rg -n -C 6 'document\.body|document\.documentElement|`#root`|font-size|RICH_MARKDOWN_EDITOR_MARKUP|documentStyle|document-style' mobile/src --glob '*.ts' --glob '*.tsx' | head -260

Repository: stablyai/orca

Length of output: 41652


🏁 Script executed:

set -o pipefail
printf '%s\n' '--- real document stylesheet ---'
cat -n mobile/src/components/rich-markdown/document-style.ts | sed -n '1,90p'
printf '%s\n' '--- page stylesheet contract/tests ---'
cat -n mobile/src/components/rich-markdown/page-stylesheet.test.ts | sed -n '1,120p'
printf '%s\n' '--- exact root/page font-size declarations ---'
rg -n -C 4 '(^|[,{[:space:]])(html|body|:root|\\*)[^{}]*\\{|font-size\s*:' mobile/src --glob '*.ts' --glob '*.tsx' | head -240

Repository: stablyai/orca

Length of output: 8520


Treat an omitted font-size as unresolved.

When the matched rule has no font-size, readFontSize returns onSeam: true. The offender check then accepts the editable without checking its ancestor. A page or host can provide an inherited value such as 14 px. Return an unresolved result for the missing declaration, and update the inheritance fixture to expect an unresolved host. This does not treat every inherited value as unsafe; it reports values this checker cannot prove are at or above the floor.

# Conflicts:
#	config/scripts/mobile-web-app-session-terminal-closure.test.mjs
…every id

CodeRabbit, `mobile-web-app-editable-host-font-size.mjs:50`, and right on the
code: the pattern started from `id="…"`, so it matched only hosts that carry one.
The no-id guard fired for a file with *no* named host at all, which means a file
holding a named host beside an anonymous one reported the named one as clean and
said nothing about the other. An editable is its tag; the id is read out of the
tag afterwards.

Also `:145`, also right: the sibling search was `startsWith(directory + '/')`,
which reaches the subtree, and the walk stops at the first file whose sheet opens
the host's selector. The closure's order is the bundler's rather than
alphabetical, so a sheet one directory down could answer for the sibling the host
actually gets. Now the immediate directory only.

Red first, both cases in the census's own file. The mixed fixture reported one
host where two were planted (1 failed, 7 passed); the nested fixture, with the
nested sheet first in the closure and a compliant 18 px rule in it, hid a 14 px
sibling and reported no offender (1 failed, 8 passed). 9 passed after.

Claude-Session: https://claude.ai/code/session_01JNnE9qzUZMMnqpZWCqM3nb
CodeRabbit, `mobile-web-app-editable-host-font-size.mjs:110`, and right for the
CSS case: `readFontSize` answered `onSeam: true` for a rule that declares no
`font-size`, so the offender check accepted the host without being able to say
what size it gets. The inherited value comes from a rule this walk does not read —
the host element's own, or the page's root — and it can be 14 px.

So "no declaration" becomes "cannot say" and lands in
`unresolvedEditableHostStyles`, which the session closure census holds at empty.
Not an offender: an offender is a size this walk read and found under the floor.

The `TextInput` half of the seam still lets an absent `fontSize` through as
inheritance. That is main's policy and it is about a prop rather than a cascade, so
it is not touched here; the divergence is stated in the reader's own comment.

Red first: the inheritance fixture reported no unresolved host where the size is
unknowable (1 failed, 8 passed), 9 passed after. The real tree is unaffected —
the editor declares its size on the seam — and the closure census still reads an
empty unresolved list.

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 — two minor suggestions inline.

Reviewed changes

  • The editor document mounts in the page — rich-markdown-web-document-mount.ts plants the markup in a host, scopes the document sheet onto it, calls the real factory with the page's seams, and disposes; the web sibling adds a deferred-call queue because ready is posted synchronously before the handle is assigned.
  • One shared toolbar — MobileRichMarkdownToolbar.tsx holds the fifteen commands both siblings render, replacing the copy inlined in the native component.
  • A root seam — document-host-seams.ts/document-scope.ts/editor-surface.ts let a page mount scope the surface read to its own host, so two editors during a stack transition cannot share one #editor.
  • The URL commands answered by a modal — TextInputModal gains onAfterClose; MobileRichMarkdownEditor.web.tsx resolves the command after the drawer loses focus, and editor-selection.ts saves and restores the caret across the wait.
  • The 16 px floor — document-style.ts binds the surface size to the text-input seam, and the new mobile-web-app-editable-host-font-size.mjs census starts from the markup rather than JSX TextInput.
  • Proof — mobile-web-app-rich-markdown-render.test.mjs runs the real component in Chromium and WebKit under the shipped CSP; unit tests for the mount, root scoping, page sheet, and toolbar; the session closure repinned to 4,360 / 1,018.

Pullfrog  | Fix all ➔ | Fix 👍s ➔ | View workflow run | Using DeepSeek Flash (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: 1


ℹ️ Review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Advanced

Run ID: e2fd0780-22de-4a84-8fdd-4b209675784d

📥 Commits

Reviewing files that changed from the base of the PR and between 556e728 and dda48c4.

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

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

@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.

ℹ️ Round-1 fixes look correct; one prior note still stands.

Reviewed changes

Incremental review of the three commits since 556e7284:

  • The census counts editable tags, not ids — EDITABLE_TAG matches each contenteditable="true" tag and reads its optional id from the tag, so an anonymous editable beside a named one in the same file is now found and reported unresolved rather than invisible.
  • No declared size is unresolved, not a pass — readFontSize returns null when the rule sets no font-size, so the closure census cannot silently pass an editable whose inherited value it cannot read.
  • Sheet lookup is the immediate directory — only files in the markup's own directory answer for its selector, so a nested sheet cannot substitute for the sibling the host actually gets.
  • :root descendants are refused — startsAtDocumentRoot catches :root .foo, :root > .foo, and :root.theme instead of rewriting them into a selector that matches nothing; bare :root still moves onto the host. page-stylesheet.test.ts pins both directions. The prior review thread on this is resolved.
  • Closure repin after the main merge — 4,358 modules / 1,016 local, measured on the merged head rather than summed.

The new fixtures are genuine measurements — the nested-sheet case reads a closure whose first entry is the nested sheet, and the no-size case previously asserted a pass, so each fails against the old implementation.

The one outstanding prior note is the hardcoded FLOOR = 16 in mobile-web-app-rich-markdown-render.test.mjs under a comment claiming it is read from the seam (still open as an inline thread).

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

… uses

CodeRabbit, `mobile-web-app-editable-host-font-size.mjs:119`, and right: the walk
read the first `font-size` in a rule, and CSS takes the last of equal importance.
`font-size: 16px; font-size: 14px;` was therefore reported compliant for a surface
the browser renders at 14 px. `!important` outranks every declaration that is not,
whatever the order.

The flag is also stripped from the value, which the finding did not name but the
fixture caught: without that, a compliant size carrying `!important` was reported
as an offender, because it matched neither the literal nor the substitution shape.

The declarations are split on the separator rather than matched with a value
pattern. A pattern excluding `}` cut `${TEXT_INPUT_FONT_SIZE}px` at the brace of
its own interpolation and reported the real editor as an offender — caught on the
first run of the fix, and the reason the split is the shape here.

Red first: 2 failed, 9 passed — the repeated-declaration fixture reported no
offender, and the important-declaration pair reported the wrong one of the two.
11 passed after.

Claude-Session: https://claude.ai/code/session_01JNnE9qzUZMMnqpZWCqM3nb
…of retyping it

pullfrog, `mobile-web-app-rich-markdown-render.test.mjs:37`, and right: the comment
said the floor was read from the seam and the constant was the literal `16`, which
is the shape the seam exists to prevent. It now comes from
`textInputFontSizeFloor(mobileDir)`, the same reader the closure census uses, which
throws rather than defaulting when the seam is gone.

The assertion becomes "at or above the floor" rather than equal to it. The seam is
`Math.max(bodySize, floor)`, so a theme raising the body size past the floor raises
what the page computes; equality against the floor would have been the same stale
literal one module further away.

Two controls, both run. Raising `TEXT_INPUT_FONT_SIZE_FLOOR` to 18 in the seam
keeps the case green on both engines, because the stylesheet reads the same module
and the page computed 18 — the two moving together is the point. Replacing the
stylesheet's `${TEXT_INPUT_FONT_SIZE}px` with a literal `14px` reds it on both
engines, `expected 14 to be greater than or equal to 16`, which is what says the
assertion carries weight. Both files were restored.

Claude-Session: https://claude.ai/code/session_01JNnE9qzUZMMnqpZWCqM3nb
# Conflicts:
#	config/scripts/mobile-web-app-session-terminal-closure.test.mjs
# Conflicts:
#	config/scripts/mobile-web-app-session-terminal-closure.test.mjs

@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: 1


ℹ️ Review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Advanced

Run ID: ab8468bc-2eb7-4938-a1f1-29d81d210558

📥 Commits

Reviewing files that changed from the base of the PR and between dda48c4 and 5eb1e44.

📒 Files selected for processing (4)
  • config/scripts/mobile-web-app-editable-host-font-size.mjs
  • config/scripts/mobile-web-app-editable-host-font-size.test.mjs
  • config/scripts/mobile-web-app-rich-markdown-render.test.mjs
  • config/scripts/mobile-web-app-session-terminal-closure.test.mjs

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

@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 two commits since the prior review are correct, and both outstanding prior threads are now resolved.

Reviewed changes

Incremental review of the five commits since dda48c4b (c945fc10, 94e8b1f1, and three merges of main):

  • The census reads the declaration the cascade uses — winningFontSize (mobile-web-app-editable-host-font-size.mjs:119) takes the last declaration among equal importance and lets !important outrank it, stripping the flag from the value. Previously readFontSize matched the first font-size: in the rule, so font-size: 16px; font-size: 14px; read as compliant for a surface the browser paints at 14 px.
  • The new fixtures can fail — repeated asserts the 14 px second declaration is an offender, and important-wins/important-offends pin both directions of the cascade. Each reds against the old first-match walk.
  • The render check reads the floor from the seam — FLOOR = textInputFontSizeFloor(mobileDir) and Number.parseFloat(size) >= FLOOR (mobile-web-app-rich-markdown-render.test.mjs:45,438), replacing the hardcoded 16. This closes the last open prior thread.
  • Session closure pin re-measured on the merged head — SESSION_ROUTE_MODULES = 4359 / 1,017 local, with the docstring reconciling main's corrected 4333 plus the editor's 26.

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

… host (round 3)

`ruleFor` returned the first exact `#id` rule and the walk stopped there, so a
later exact rule of equal specificity, or a higher-specificity subject rule that
still targets the host, could lower the rendered size unseen.

Every exact rule in the sheet is now collected in source order and read as one
cascade, and any other rule whose subject compound targets the host and declares
`font-size` makes the host unresolved rather than compliant. No specificity
arithmetic, and the sibling walk is 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.

Reviewed changes

Incremental review of the one commit since 5eb1e449b3 (5667d51435), which reworks the editable-host font-size census to evaluate every competing rule:

  • Every exact rule is read in source order — exactRules collects all #editor rules in a sheet and joins their declarations, so a later #editor { font-size: 14px } overrides an earlier compliant rule instead of being ignored; winningFontSize still resolves !important and last-of-equal-importance.
  • A higher-specificity subject is unresolved, not compliant — unrankableHostRules flags a rule such as main#editor, #editor.x, or a comma list holding one that declares a size, since the census does no specificity arithmetic; the surface is reported as a hole rather than passing.
  • Selector matching gained an id boundary — selectorPattern appends (?![\w-]), so #editor no longer matches #editor-notes; the selector list is split on commas so a host riding in one reaches the verdict, and descendant (#editor p) and pseudo-element (::before) rules are left out of the way.
  • Fixtures can fail — later-exact, earlier-exact (control), subject-specificity, subject-in-list, neighbour-id, and not-the-host each red against the pre-round-3 walk; the shipped document-style.ts still reads as on-seam with an empty unresolved list.

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

@Jinwoo-H
Jinwoo-H merged commit 841d06a into main Sep 22, 2026
32 checks passed
@Jinwoo-H
Jinwoo-H deleted the ota-c7-10-c2-editor-mount branch September 22, 2026 02:54
Jinwoo-H added a commit that referenced this pull request Sep 22, 2026
…ached it (#22135)

#21705 added agent-session-option-catalog-antigravity.ts to the option catalog
the session page reaches. It merged beside C2 (#22099), whose pin of 4,359 was
measured before it, so main reads one short. Measured at eb92222 and named
by diffing against the closure at 841d06a.

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