Repository navigation
test(native-chat): split the windowing test harness out of the suite - #20773
Conversation
#20719 grew NativeChatMessageList.windowing.test.tsx to 897 effective lines, past the 800 ceiling for test files, so oxlint fails on main. Moves the shared layout/ResizeObserver stubs into native-chat-windowing-test-harness.tsx. No test was changed, split or dropped: still 5 describes and 23 it() blocks, 29 assertions passing. The stubs' mutable knobs become one exported `layout` object because an imported binding cannot be reassigned across modules. AGENTS.md forbids a max-lines disable, so extraction is the fix.
|
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; 6 remain after this review. 📝 WalkthroughWalkthroughThe PR adds a shared happy-dom harness for NativeChat windowing tests. The harness provides deterministic transcript data, layout overrides, resize observation, rendering helpers, window-state inspection, and scrolling. The existing windowing test imports these helpers and moves mutable row-height and transcript-geometry state onto the shared Priority: ⬇️ Low Merge Risk: ⚪ Minimal · up to The test-harness extraction has no identified merge-blocking risk. 🚥 Pre-merge checks | ✅ 3 | ❌ 2❌ Failed checks (2 warnings)
✅ Passed checks (3 passed)
Full details: Description checkExplanation The description explains the oxlint failure, the harness extraction, the unchanged test coverage, and the verification results. It does not follow the required template because it omits the required Linked Issue, Visual Proof, AI Disclosure, Review, Agent skill upstream boundary, Notes, and Checklist sections. Resolution Complete the required template sections. Add a linked issue after "Fixes #". Add "N/A" with a reason under Visual Proof because this is a test-only refactor. Include the required testing checklist and the applicable review, compatibility, and build-status details.
✨ Finishing Touches 💡 1📝 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 critical issues — one minor doc nit inline.
Reviewed changes
- Extracts the windowing test harness into
native-chat-windowing-test-harness.tsx— the layout/ResizeObserverstubs, render/read helpers, and shared constants move out ofNativeChatMessageList.windowing.test.tsx, unblocking themax-linesfailure onmain. - Collapses three module-level
letknobs into one exportedlayoutobject —belowTranscriptPx,aboveTranscriptPx, andmeasuredRowHeightskeep their single shared cell, so the stubs and cases still see the same values. - Leaves the suite itself untouched — same 5
describeblocks and same 29 executed tests; no case split or dropped.
Verified this session: vitest run on the suite → 29 passed; oxlint on both files → 0 warnings/0 errors; tsc -p config/tsconfig.web.json --noEmit reports no errors in either changed file. The harness filename does not match vitest's **/*.test.ts(x) include, so it is not collected as its own suite — consistent with the repo's other *-test-harness.ts modules.
DeepSeek Flash (free via Pullfrog for OSS) | 𝕏
| /** Everything the document holds above the spacer: the scroll root's top gutter, | ||
| * and the "load earlier" block whenever there is older history to page in. This | ||
| * is the virtualizer's `scrollMargin`, and it is the larger half of the gap | ||
| * between the document's end and the end the virtualizer computes. */ | ||
|
|
||
| /** Heights the stubbed layout reports per row index, when a case wants a row to | ||
| * measure as something other than its estimate. Empty means "every row at its | ||
| * estimate", which is what every non-growth case wants. */ | ||
|
|
||
| /** Layout knobs the stubs read and a case writes. One shared cell so the test | ||
| * module and the stubs below see the same values. */ | ||
| export const layout: { | ||
| belowTranscriptPx: number | ||
| aboveTranscriptPx: number | ||
| measuredRowHeights: readonly number[] | ||
| } = { belowTranscriptPx: BELOW_TRANSCRIPT_PX, aboveTranscriptPx: 0, measuredRowHeights: [] } |
There was a problem hiding this comment.
The JSDoc for aboveTranscriptPx and measuredRowHeights moved across verbatim, but it now sits above the layout declaration with no member to attach to — three comment blocks in a row, only the last one documenting anything. Folding the two field docs into the object type keeps the semantics the knobs carried in the original file.
| /** Everything the document holds above the spacer: the scroll root's top gutter, | |
| * and the "load earlier" block whenever there is older history to page in. This | |
| * is the virtualizer's `scrollMargin`, and it is the larger half of the gap | |
| * between the document's end and the end the virtualizer computes. */ | |
| /** Heights the stubbed layout reports per row index, when a case wants a row to | |
| * measure as something other than its estimate. Empty means "every row at its | |
| * estimate", which is what every non-growth case wants. */ | |
| /** Layout knobs the stubs read and a case writes. One shared cell so the test | |
| * module and the stubs below see the same values. */ | |
| export const layout: { | |
| belowTranscriptPx: number | |
| aboveTranscriptPx: number | |
| measuredRowHeights: readonly number[] | |
| } = { belowTranscriptPx: BELOW_TRANSCRIPT_PX, aboveTranscriptPx: 0, measuredRowHeights: [] } | |
| /** Layout knobs the stubs read and a case writes. One shared cell so the test | |
| * module and the stubs below see the same values. */ | |
| export const layout: { | |
| belowTranscriptPx: number | |
| /** Everything the document holds above the spacer: the scroll root's top gutter, | |
| * and the "load earlier" block whenever there is older history to page in. This | |
| * is the virtualizer's `scrollMargin`, and it is the larger half of the gap | |
| * between the document's end and the end the virtualizer computes. */ | |
| aboveTranscriptPx: number | |
| /** Heights the stubbed layout reports per row index, when a case wants a row to | |
| * measure as something other than its estimate. Empty means "every row at its | |
| * estimate", which is what every non-growth case wants. */ | |
| measuredRowHeights: readonly number[] | |
| } = { belowTranscriptPx: BELOW_TRANSCRIPT_PX, aboveTranscriptPx: 0, measuredRowHeights: [] } |
…tablyai#20773) stablyai#20719 grew NativeChatMessageList.windowing.test.tsx to 897 effective lines, past the 800 ceiling for test files, so oxlint fails on main. Moves the shared layout/ResizeObserver stubs into native-chat-windowing-test-harness.tsx. No test was changed, split or dropped: still 5 describes and 23 it() blocks, 29 assertions passing. The stubs' mutable knobs become one exported `layout` object because an imported binding cannot be reassigned across modules. AGENTS.md forbids a max-lines disable, so extraction is the fix.

mainis currently failingoxlint:#20719 ("add a message rail for jumping between your prompts") took the file from exactly 800 effective lines to 897. Every PR branched after it inherits a red
static analysisjob.Fix
Moves the shared layout and
ResizeObserverstubs intonative-chat-windowing-test-harness.tsx. AGENTS.md forbids adding amax-linesdisable, so extraction is the available fix.No test was changed, split, or dropped — still 5
describeblocks and 23it()blocks, same file, same order. Only the harness moved.One real change was required: the stubs' mutable knobs (
belowTranscriptPx,aboveTranscriptPx,measuredRowHeights) were module-levellets that cases reassign. An imported binding can't be reassigned across a module boundary, so they became one exportedlayoutobject and the ~15 assignment sites now writelayout.measuredRowHeights = …. The stubs and the cases still share a single cell, which is what the original relied on.Verification
vitest run --config config/vitest.config.ts …windowing.test.tsx→ 29 passed.tsc -p config/tsconfig.web.json --noEmit→ no errors in either file.oxlint src config tests mobile→ exit 0 (was failing onmain).