Repository navigation
fix(lint): main lint is red — split native-chat-ask.ts under the max-lines limit - #31734
brennanb2025 wants to merge 1 commit into
Conversation
…-ask.ts Main's lint fails max-lines on src/shared/native-chat-ask.ts (310 code lines against 300). Move the PTY keystroke builders for Claude's and Codex's question selectors into native-chat-ask-keystrokes.ts unchanged and update importers.
📝 Walkthrough
Priority: ⬇️ Low Merge Risk: 🔵 Low · up to
|
There was a problem hiding this comment.
Actionable comments posted: 1
ℹ️ Review info
⚙️ Run configuration
- Configuration used: Repository UI
- Review profile: CHILL
- Plan: Advanced
- Run ID:
12e728eb-79e6-4407-8e81-0bc9d909055a
📒 Files selected for processing: 5
mobile/src/session/mobile-prompt-controller.test.tsmobile/src/session/use-mobile-native-chat-answer-send.tssrc/renderer/src/components/native-chat/native-chat-interactive-prompt.tssrc/shared/native-chat-ask-keystrokes.tssrc/shared/native-chat-ask.ts
Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 3 remain after this review.
|
|
||
| /** The picked labels + trimmed free text for one question, in option order. */ | ||
| function answerLabels(question: AskQuestion, sel: AskAnswerSelection | undefined): string[] { | ||
| export function answerLabels(question: AskQuestion, sel: AskAnswerSelection | undefined): string[] { |
There was a problem hiding this comment.
🎯 Functional Correctness | 🟡 Minor | ⚡ Quick win
🔎 Supported by static analysis
🏁 Script executed:
#!/bin/bash
# Find imports of the moved symbols that still point at native-chat-ask (not the keystrokes module).
rg -nU --type=ts -C2 "(buildAskAnswerKeys|buildCodexAskAnswerKeys|AskAnswerKeyGroup)" \
-g '!src/shared/native-chat-ask-keystrokes.ts' | rg -n "native-chat-ask['\"]|native-chat-ask-keystrokes"
# List every importer of the old module for manual review.
rg -n --type=ts "from '.*native-chat-ask'" -g '!node_modules'Repository: stablyai/orca
Length of output: 4662
🏁 Script executed:
#!/bin/bash
set -eu
printf '%s\n' '--- stale importer ---'
nl -ba tests/e2e/native-chat-ssh-delivery.unit.test.ts | sed -n '1,35p'
printf '%s\n' '--- old module moved-symbol references/exports ---'
rg -n -C2 --type=ts 'buildAskAnswerKeys|buildCodexAskAnswerKeys|AskAnswerKeyGroup|^export ' src/shared/native-chat-ask.ts || true
printf '%s\n' '--- new module ---'
nl -ba src/shared/native-chat-ask-keystrokes.ts | sed -n '1,140p'Repository: stablyai/orca
Length of output: 11485
Update the remaining stale import.
tests/e2e/native-chat-ssh-delivery.unit.test.ts imports buildAskAnswerKeys from the old module. Import it from native-chat-ask-keystrokes instead.
Suggested fix
-import { buildAskAnswerKeys } from '../../src/shared/native-chat-ask'
+import { buildAskAnswerKeys } from '../../src/shared/native-chat-ask-keystrokes'|
Closing as a duplicate: #31729 already moves the same code out of native-chat-ask.ts (and fixes the browser pane), so this PR's whole change is held there. |
ELI5
Main's lint is red: one shared file about chat questions grew past the 300-code-line limit. This moves one self-contained part of it (the code that turns a question answer into keystrokes for the agent's terminal) into its own file. Nothing behaves differently.
What Changed
src/shared/native-chat-ask.tshad 310 code lines against the 300 limit for.tsfiles (max-linesin.oxlintrc.json, blank lines and comments skipped). Recent main commits fix(agent-status): questions over 16 KB show their card with every option #31632 and fix(native-chat): Codex async questions show an answer card on desktop and phone #31652 together pushed it over, so the static lint job fails on every PR based on current main (for example build: generate the RPC params catalog and bundled skill guides at build time #30644: https://github.com/stablyai/orca/actions/runs/39697950184/job/119559979235).src/shared/native-chat-ask-keystrokes.tsholds the PTY keystroke builders, moved unchanged:AskAnswerKeyGroup, the selector key constants,buildAskAnswerKeys(Claude's arrow-navigate selector) andbuildCodexAskAnswerKeys(Codex's request_user_input overlay).answerLabelsstays innative-chat-ask.ts(it also backsformatAskAnswer) and is now exported so the keystroke module can use it.native-chat-interactive-prompt.ts(which re-exports these for the renderer, so other renderer files are unchanged), mobile'suse-mobile-native-chat-answer-send.ts, andmobile-prompt-controller.test.ts.native-chat-ask.tsis now about 225 code lines; the new file about 87.User-facing change: none. Developer-facing change: main's lint goes green again for this file.
Why
The keystroke builders are the one part of the file with a single job of their own (driving each agent's terminal question selector) and only one dependency back (
answerLabels), so they split out cleanly with a pure move. Nomax-linesdisable.Plan (light path): move the keystroke builders into a sibling module, update imports, run the covering tests, let CI be the lint and typecheck gate.
ClientHostedBrowserPagePane.tsxalso fails max-lines on main; that is fixed separately in #31729 and not touched here.Linked Issue
N/A (main's lint is red; no issue).
Visual Proof
N/A: code move only, no UI or behavior change.
Testing
src/shared/native-chat-ask.test.ts,src/shared/native-chat-ask-fifo.test.ts,src/renderer/src/components/native-chat/native-chat-interactive-prompt.test.ts(covers both keystroke builders): 53 passed locally.Mobile tests touching the moved imports run in CI.
I manually tested these changes locally
Automated tests added/updated, or explained why not below (existing tests cover the moved code; no new behavior)
AI Disclosure
Review
Agent skill upstream boundary
Notes
Pure code move; no security, platform, SSH, mobile behavior, compatibility or performance impact.
Checklist
N/Awith reasonpnpm lint,pnpm typecheck,pnpm test, andpnpm buildpass (or CI will cover; local preferred)