Skip to content

refactor(native-chat): move transcript row context into its own hook - #29809

Merged
nwparker merged 1 commit into
mainfrom
nwparker/native-chat-message-list-lines
Oct 16, 2026
Merged

nwparker merged 1 commit into
mainfrom
nwparker/native-chat-message-list-lines

Conversation

@nwparker

@nwparker nwparker commented Oct 16, 2026 •

Copy link
Copy Markdown
Contributor
Files Added Deleted Net
Test 0 0 0 0
Prod 2 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​83 $\color{#cf222e}{\Huge{\mathbf{−}}}$​36 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​47

ELI5

The file that draws the chat transcript grew one line past the size limit, which fails the release check on main. This moves one self-contained piece of it into its own small file. Nothing the user sees changes.

What Changed

  • Before: NativeChatMessageList.tsx was 401 lines against the 400-line max-lines rule, so the static-analysis job on main (release-candidate check ci: full PR checks on main afea81ba789b — do not merge #29799) failed.
  • After: the block that assembles the per-row context object (agent name, prompt ids, expand state, link and reveal callbacks) lives in a new hook, use-native-chat-transcript-row-context.ts, next to the list. The list calls the hook with the same values.
  • Mechanism: a pure move. The hook wraps the same useMemo with the same fields and the same dependency list (session.agent is passed in as agent, hostWork is passed whole so the memo still keys on its identity), so rows get a context that changes exactly when it did before.

Why

Raising or disabling max-lines is not allowed. The row context is the most self-contained part of the component: it only reads values the list already has and returns one object, so moving it carries no risk to ordering between hooks. The navigation state looked like a candidate too, but it feeds the transcript window before the rail exists, so splitting it would mean threading state across a hook boundary.

Linked Issue

N/A (fixes the main release-candidate static-analysis failure, no issue filed).

Visual Proof

N/A: pure code move, no rendering or interaction change.

Testing

  • Full static-analysis job steps from pr.yml run locally (lint, anti-slop, focused and type-aware code-quality, changed-code quality, React Doctor, max-lines/ts-nocheck/electron-import/focus-read/layout-writer ratchets, localization, generated catalogs, entitlements): all pass. The CI-only bun typecheck:ci wrapper does not run on this machine, so pnpm tc was used instead: passes.

  • pnpm test src/renderer/src/components/native-chat --maxWorkers=1: 375 files, 3964 tests pass.

  • macOS only; no platform-specific code touched.

  • I manually tested these changes locally

  • Automated tests added/updated, or explained why not below: no new tests, behaviour is unchanged and covered by the existing native-chat suite.

Review

Pure move; no Codex review run (optional for a pure move).

Agent skill upstream boundary

  • Not applicable, or this change copies or mechanically translates no upstream skill-installer source, tests, fixtures, registry entries, path tables, comments, or documentation.

Notes

No security, cross-platform, SSH, mobile, compatibility, or performance impact: same memo, same inputs, same output.

Checklist

  • This PR is small and focused
  • I explained what changed and why (ELI5, the user-facing before/after, the mechanism, and why over the alternatives)
  • Before/after screenshots or videos attached for UI changes, or N/A with reason
  • Self-reviewed for correctness, security, and performance
  • Cross-platform, SSH/remote, and path/shortcut impact considered (or N/A)
  • pnpm lint, pnpm typecheck, pnpm test, and pnpm build pass (or CI will cover; local preferred)

@coderabbitai

coderabbitai Bot commented Oct 16, 2026

Copy link
Copy Markdown
Contributor

Review in 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: dde87d2f-e488-4423-af08-222b68384cd1
📥 Commits

Reviewing files that changed from the base of the PR and between 79b9163 and 00b2354.

📒 Files selected for processing: 2
  • src/renderer/src/components/native-chat/NativeChatMessageList.tsx
  • src/renderer/src/components/native-chat/use-native-chat-transcript-row-context.ts

Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 9 remain after this review.

📝 Walkthrough

NativeChatMessageList now uses useNativeChatTranscriptRowContext to provide transcript row context. The hook derives the agent name and optional actionable prompt IDs, includes the supplied row values and callbacks, and memoizes the resulting context.

Priority: ⬇️ Low

Merge Risk: ⚪ Minimal · up to 00b23

The transcript-row context extraction has no established behavior change or outstanding issue; it is ready to merge after normal checks.

Pre-merge checks: Passed 3 · Failed 2

Failed Failed checks: 2 warnings

Check name Status Explanation Resolution
Description check Warning The description covers the change, rationale, testing, visual proof, impact, and checklist. However, it does not provide the required linked issue and instead states N/A. Add a valid issue reference under the Linked Issue section, or explain the approved maintainer exception if the author is a repository maintainer.
Docstring Coverage Warning Docstring coverage is 50.00% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 2 functions across 2 files. Write docstrings for the functions missing them to satisfy the coverage threshold.
Passed Passed checks: 3 passed
Check name Status Explanation
Title check Passed The title clearly and concisely describes the main change: moving transcript row context assembly into a dedicated hook.
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.
  • Fix all pre-merge checks with AI
✨ Finishing Touches: 💡 1
📝 Generate docstrings: 💡
  • Commit to this branch
  • Create a new PR
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

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.

@nwparker
nwparker merged commit f2fb8ff into main Oct 16, 2026
30 checks passed
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