Skip to content

test(native-chat): split the windowing test harness out of the suite - #20773

Merged
nwparker merged 1 commit into
mainfrom
nwparker/fix-native-chat-windowing-max-lines
Sep 15, 2026
Merged

nwparker merged 1 commit into
mainfrom
nwparker/fix-native-chat-windowing-max-lines

Conversation

@nwparker

@nwparker nwparker commented Sep 15, 2026 •

Copy link
Copy Markdown
Contributor
Files Added Deleted Net
Test 1 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​31 $\color{#cf222e}{\Huge{\mathbf{−}}}$​291 $\color{#cf222e}{\Huge{\mathbf{−}}}$​260
Prod 1 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​289 0 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​289

main is currently failing oxlint:

NativeChatMessageList.windowing.test.tsx:1133:3: error eslint(max-lines):
File has too many lines (897). help: Maximum allowed is 800.

#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 analysis job.

Fix

Moves the shared layout and ResizeObserver stubs into native-chat-windowing-test-harness.tsx. AGENTS.md forbids adding a max-lines disable, so extraction is the available fix.

No test was changed, split, or dropped — still 5 describe blocks and 23 it() blocks, same file, same order. Only the harness moved.

One real change was required: the stubs' mutable knobs (belowTranscriptPx, aboveTranscriptPx, measuredRowHeights) were module-level lets that cases reassign. An imported binding can't be reassigned across a module boundary, so they became one exported layout object and the ~15 assignment sites now write layout.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 on main).

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

coderabbitai Bot commented Sep 15, 2026

Copy link
Copy Markdown
Contributor

Review Change StackReview Change Stack

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: ccd2859a-ff63-4164-b80d-84d02f6777bb

📥 Commits

Reviewing files that changed from the base of the PR and between 99062ed and 0916c13.

📒 Files selected for processing (2)
  • src/renderer/src/components/native-chat/NativeChatMessageList.windowing.test.tsx
  • src/renderer/src/components/native-chat/native-chat-windowing-test-harness.tsx

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


📝 Walkthrough

Walkthrough

The 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 layout object.

Priority: ⬇️ Low

Merge Risk: ⚪ Minimal · up to 0916c

The test-harness extraction has no identified merge-blocking risk.

🚥 Pre-merge checks | ✅ 3 | ❌ 2

❌ Failed checks (2 warnings)

Check name Status Explanation Resolution
Description check ⚠️ Warning 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 L… 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, a…
Docstring Coverage ⚠️ Warning Docstring coverage is 58.33% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 12 functions across 2 files. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (3 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly and concisely describes the primary change: extracting the NativeChat windowing test harness from the test suite.
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 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.

  • Fix all pre-merge checks with AI
✨ Finishing Touches 💡 1
📝 Generate docstrings 💡
  • Create stacked PR
  • Commit on current branch

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 critical issues — one minor doc nit inline.

Reviewed changes

  • Extracts the windowing test harness into native-chat-windowing-test-harness.tsx — the layout/ResizeObserver stubs, render/read helpers, and shared constants move out of NativeChatMessageList.windowing.test.tsx, unblocking the max-lines failure on main.
  • Collapses three module-level let knobs into one exported layout object — belowTranscriptPx, aboveTranscriptPx, and measuredRowHeights keep their single shared cell, so the stubs and cases still see the same values.
  • Leaves the suite itself untouched — same 5 describe blocks 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.

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

Comment on lines +25 to +40
/** 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: [] }

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.

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.

Suggested change
/** 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: [] }

@nwparker
nwparker merged commit ef39f32 into main Sep 15, 2026
29 checks passed
@nwparker
nwparker deleted the nwparker/fix-native-chat-windowing-max-lines branch September 15, 2026 04:35
ivanvykopal pushed a commit to ivanvykopal/orca that referenced this pull request Sep 20, 2026
…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.
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