Repository navigation
Conversation
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Repository UI Review profile: CHILL Plan: Advanced Run ID: 📥 CommitsReviewing files that changed from the base of the PR and between 7ec681f970fae362da3c9c484050ea56b6f01697 and 6eadbe8. 📒 Files selected for processing (9)
Included review availability: Your plan provides up to 10 included reviews per hour; 9 remain after this review. 📝 WalkthroughWalkthroughThe mobile app registers an Android multi-window metrics plugin. The plugin updates activity configuration and injects Kotlin display-metric handling into Priority: ➖ Normal Merge Risk: ⚪ Minimal · up to No merge-blocking behavior is identified in the Android metrics, terminal scaling, or dependency updates. 🚥 Pre-merge checks | ✅ 3 | ❌ 2❌ Failed checks (2 warnings)
✅ Passed checks (3 passed)
Full details: Docstring CoverageExplanation Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 2 functions across 7 files. (2 skipped: 2 unsupported.) Full details: Description checkResolution Complete the repository template. Describe the change and reason, provide a linked issue, add visual proof or state N/A with a reason, document manual and automated testing, complete the required checklist, and address the remaining template sections.
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.
Important
mobile/app.json fails oxfmt --check, so the Mobile Checks format:check step (oxfmt --check .) will fail on this PR. Revert the formatting-only edits (or run pnpm format in mobile/).
Reviewed changes
react-native-screenspin + patch — pins the dependency to exactly4.26.2and patchesStackHeaderConfigAndroidNativeComponent.tsso RN 0.83.10 codegen accepts the command'sviewReftype.- Multi-window metrics plugin — new
mobile/plugins/android-multiwindow-metrics.jsreseeds bothDisplayMetricsHolderholders from the activity's windowedresources.displayMetricson create/resume/configuration change, requests a decor relayout, emitsdidUpdateDimensions, and addsdensityto the activityconfigChanges. - Registration + lockfile — plugin registered in
app.json;patchedDependenciesand the lockfilepatch_hashupdated to match.
ℹ️ Exported plugin transforms have no tests
injectDisplayMetrics and applyMultiWindowMetricsManifest are exported specifically for testing, but no test accompanies them. They do fragile string surgery (import insertion, super.onCreate(null) insertion, lastIndexOf('\n}') class-end detection) against an Expo template this repo does not pin, and no CI path runs expo prebuild — so template drift is only caught at Android release-build time (the plugin throws, which is at least loud). The sibling android-respect-rotation-lock.js is a single manifest write; this one is materially more logic.
Technical details
# Add unit tests for the multi-window metrics plugin
## Affected sites
- `mobile/plugins/android-multiwindow-metrics.js:55-84` — `injectDisplayMetrics` string surgery
- `mobile/plugins/android-multiwindow-metrics.js:86-95` — `applyMultiWindowMetricsManifest`
- `mobile/vitest.config.ts` — `include` only collects `src/**/*.test.ts(x)`, so a test must live under `src/` (or the include extended)
## Required outcome
- Cover the pure transforms with a small fixture resembling the Expo SDK 55 `MainActivity.kt`: assert idempotency (the `ORCA_MULTIWINDOW_METRICS` marker short-circuits), that both imports and both methods land inside the class, that `applyActivityDisplayMetrics()` precedes `super.onCreate(null)`, and that `density` is appended to (and not duplicated in) `configChanges`.
- Assert the throw paths for a missing `super.onCreate(null)` and a non-Kotlin MainActivity.
## Open questions for the human
- Is there a reason plugin tests are intentionally omitted (e.g. no prebuild harness), or was this just not done?ℹ️ Nitpicks
- The reason for the exact
[email protected]pin and its patch exists only in the PR description.pnpm-workspace.yaml'spatchedDependencieskey and the codegen constraint mean the next bump fails loudly, but a one-line note next to the pin (or a tracking issue for RN/react-native-screensfixing the codegen parser) would save the next maintainer the investigation. Upstream[email protected]still emitsReact.ComponentRef, so this is not a "bump fixes it" situation.
DeepSeek Flash (free via Pullfrog for OSS) | 𝕏
On Samsung One UI, split-window panes are assigned a density different from fullscreen (e.g. 321 vs 420 dpi). Three measurement paths in the app convert with a density different from the one Fabric/the WebView actually paint at: 1. react-native-screens FabricEnabledViewGroup.updateState converted the measured pane px back to dp with the process-global main-display density captured at process start, collapsing all ScreenStack content into a top-left box of pane*density-ratio (upstream software-mansion/react-native-screens#4159, fixed in 4.26.0). Pin react-native-screens to 4.26.2 - the first fix line that remains compatible with react-native 0.83 codegen (4.27+ needs newer codegen), plus a pnpm patch respelling one React.ComponentRef command argument that the 0.83.10 codegen parser rejects. 2. RN's process-global DisplayMetricsHolder stays frozen at process start (seeded once from the Application context, so activity recreation does not help). Text measurement (PixelUtil.pxToDp) and all other PixelUtil conversions then disagree with the mount density by exactly the mismatch ratio, so text is laid out into boxes that are the wrong fraction of the glyphs - clipped lines, cut descenders. Add an android-multiwindow-metrics config plugin that re-seeds BOTH holders from the windowed resources on create/resume/configurationChange, emits didUpdateDimensions, requests a decorView relayout, and adds density to configChanges so the switch reaches the hook without activity recreation. Unlike the DeX variant in stablyai#16018, the screen holder also takes windowed metrics, which the text pipeline requires. 3. The Android WebView pins its CSS-px-at-construction density to the display (Chrome-side; activity recreation does not change it), while the terminal fit protocol passes an RN-dp container height the web side consumed as CSS px. xterm then overallocated rows by the density ratio and its bottom rows sat below the visible viewport - the terminal could not scroll to the last lines in split view. Pass rnPixelRatio alongside containerHeight in the measure message and convert into the WebView's CSS px in measureFitDimensions; bump the terminal payload hash canary accordingly. The plugin's exported transforms are unit-tested (idempotent injection, hook ordering before super.onCreate(null), density append without duplication, throw paths) under a new plugins/**/*.test.js vitest include. Verified on Samsung foldable hardware (One UI, Android 16): layout and text fill the pane correctly in split panes and pop-up windows across recreation-free fullscreen<->split transitions, and the terminal viewport reaches its final buffer rows in split view. Co-Authored-By: CCCha <[email protected]> via Claude Code
7ec681f to
6eadbe8
Compare
There was a problem hiding this comment.
ℹ️ No critical issues — the prior
app.jsonformatting blocker is fixed and the new density conversion is dimensionally correct. One coverage gap inline.
Reviewed changes — the delta since the prior Pullfrog review (7ec681f970), focused on the app.json formatting revert and the new WebView density conversion:
- Reverted the
app.jsonformatting churn — only the plugin registration entry (app.json:85) remains;oxfmt --checknow passes on the file. - Added plugin transform tests —
mobile/plugins/android-multiwindow-metrics.test.jscovers idempotent injection,applyActivityDisplayMetrics()precedingsuper.onCreate(null),configChangesappend/dedup, and the missing-anchor throw;vitest.config.ts:16now collectsplugins/**/*.test.js. - Documented the exact
[email protected]pin + patch rationale abovepatchedDependenciesinpnpm-workspace.yaml. - Added a WebView density conversion —
TerminalWebView.tsx:319sendsrnPixelRatio: PixelRatio.get()withmeasure, andmeasureFitDimensionsconverts the RN-dp frame height into the WebView's own CSS px before computing rows; the payload golden hash/length were updated.
DeepSeek Flash (free via Pullfrog for OSS) | 𝕏
| if (typeof rnPixelRatioInjected === 'number' && rnPixelRatioInjected > 0 && containerHeightPx > 0 && window.devicePixelRatio > 0) { | ||
| vpHeight = containerHeightPx * (rnPixelRatioInjected / window.devicePixelRatio); | ||
| } |
There was a problem hiding this comment.
The new conversion is the only new logic in this commit and it has no unit coverage — the payload-hash test only proves the emitted document changed, not that the ratio is right. The repo already executes injected WebView JS in tests (terminal-webview-engine.test.ts via new Function, plus happy-dom suites), so a case with rnPixelRatio !== devicePixelRatio would pin the math against a future inversion or unit regression.
Technical details
# Test the density conversion in the measure path
## Affected sites
- `mobile/src/terminal/terminal-webview-html/host-message-router.ts:100-102` — RN dp → WebView CSS px conversion, untested
- `mobile/src/terminal/terminal-webview-payload-hash.test.ts:9-10` — golden hash/length only proves the document text changed
## Required outcome
- Exercise `measureFitDimensions` (directly or via a `measure` message) with `rnPixelRatio !== window.devicePixelRatio` and assert `rows === Math.max(8, Math.floor(containerHeight * rnPixelRatio / devicePixelRatio / cellHeight))`.
- Assert the identity case (`rnPixelRatio === devicePixelRatio`) leaves the pre-existing `rows` calculation unchanged.
## Suggested approach
- Follow the harness pattern in `mobile/src/terminal/terminal-webview-engine.test.ts` / `terminal-webview-query-reply.test.ts` (`new Function` over the injected fragment) with a stub `term._core._renderService.dimensions` and a settable `window.devicePixelRatio`.
## Open questions for the human
- Is the conversion intentionally left untested because the injected-JS harness is too costly, or was this just not done?|
Hi @jetd1, I tested this on a Samsung Galaxy Z Fold7 (One UI 9.0, Android 17) and wrote it up in #36305 with before/after videos. On One UI, entering and leaving split screen changes the window density (360 → 321 dpi here). With only This branch no longer merges cleanly with main (the terminal WebView files moved since September). If it helps, I'm happy to rebase it, or to open a focused PR with only the plugin and its test, credited to you. Whichever you and the maintainers prefer. |
|
Thanks for this! Your plugin pointed the way. #36977 lands the split-screen fix on current main, building on the same re-seeding approach. |

Uh oh!
There was an error while loading. Please reload this page.