Repository navigation
Reduce unit test waits, byte comparisons and import overhead - #25187
Conversation
|
Navigate logical layers of code changes, visualize relationships, and explore their blast radius. No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configuration
📒 Files selected for processing (3)
Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 8 remain after this review. 📝 WalkthroughWalkthroughThe pull request updates test fixtures and assertions across session handling, OpenCode, persistence, SSH listing, window services, and range selection. Tests use explicit timer advancement for deadline and polling checks, batch SQLite fixture mutations, and compare persisted bytes with Buffer.equals. New shared fixtures support SSH listing and main-window service tests. A reference report records paired test timings and the controls and limits used in those comparisons. Priority: ➖ Normal Merge Risk: ⚪ Minimal · up to The reported table and test-cleanup issues are fixed. No actionable merge-blocking risk is established; the complete suite still needs its normal required CI run. 🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
Full details: Docstring CoverageExplanation Docstring coverage is 4.76% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 21 functions across 20 files. (1 skipped: 1 unsupported.)
✨ 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.
Actionable comments posted: 2
ℹ️ Review info
⚙️ Run configuration
- Configuration used: Repository UI
- Review profile: CHILL
- Plan: Advanced
- Run ID:
6080f576-16e9-445f-9ad2-18869defccdb
📒 Files selected for processing (20)
docs/reference/ci-runner-efficiency.mdsrc/main/antigravity/native-account-store.test.tssrc/main/native-chat/agent-session-wire/structured-agent-session-claude-stop-ends-session.test.tssrc/main/native-chat/agent-session-wire/structured-agent-session-stop-deadline.test-fixture.tssrc/main/native-chat/transcript-opencode-subscribe.test.tssrc/main/opencode/hook-plugin-opencode2-tui-ownership.test.tssrc/main/persistence/loading-store/profile-state-sqlite-authority.test.tssrc/main/persistence/loading-store/profile-state-store-backups.test.tssrc/main/persistence/profile-state/profile-state-authority-bootstrap.test.tssrc/main/persistence/profile-state/profile-state-backup-worker.test.tssrc/main/persistence/profile-state/profile-state-database-snapshot.test.tssrc/main/persistence/profile-state/profile-state-database.test.tssrc/main/runtime/quarter-circle-title-send-authorization.test.tssrc/main/runtime/structured-agent-session-codex-turn-end-settlement.test.tssrc/main/ssh/ssh-relay-gc-listing.test-fixture.tssrc/main/ssh/ssh-remote-commands.test.tssrc/main/window/attach-main-window-services.test.tssrc/main/window/main-window-service-stubs.test-fixture.tssrc/renderer/src/components/diff-comments/useDiffCommentDecorator.range-selection.test.tsxsrc/renderer/src/components/native-chat/NativeChatStructuredSessionDelivery.test.tsx
Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 7 remain after this review.
|
|
||
| | Window-service attachment, 31 cases | 11.910s | 1.619s | 86.4% | [37186340840](https://github.com/stablyai/orca/actions/runs/37186340840) | | ||
|
|
||
| | OpenCode 2 TUI ownership, 41 cases | 16.811s | 2.429s | 85.6% | [37187699312](https://github.com/stablyai/orca/actions/runs/37187699312) | | ||
|
|
||
| | Title-send authorization, nine cases | 29.545s | 12.995s | 56.0% | [37188423318](https://github.com/stablyai/orca/actions/runs/37188423318) | | ||
|
|
||
| | Range selection, 15 cases | 9.737s | 7.130s | 26.8% | [37188996198](https://github.com/stablyai/orca/actions/runs/37188996198) | |
There was a problem hiding this comment.
📐 Maintainability & Code Quality | 🟡 Minor | ⚡ Quick win
Remove the blank lines inside the timing table.
In Markdown, a blank line ends a table. Lines 65, 67, 69 and 71 come after blank lines, so the renderer does not show them as rows of the table. Each line has no header or delimiter row, so it shows as plain text with pipes. As a result, the report loses four of its ten workloads from the table.
Proposed fix
| OpenCode subscription, 28 cases | 47.347s | 6.284s | 86.7% | [37184858823](https://github.com/stablyai/orca/actions/runs/37184858823) |
-
| Window-service attachment, 31 cases | 11.910s | 1.619s | 86.4% | [37186340840](https://github.com/stablyai/orca/actions/runs/37186340840) |
-
| OpenCode 2 TUI ownership, 41 cases | 16.811s | 2.429s | 85.6% | [37187699312](https://github.com/stablyai/orca/actions/runs/37187699312) |
-
| Title-send authorization, nine cases | 29.545s | 12.995s | 56.0% | [37188423318](https://github.com/stablyai/orca/actions/runs/37188423318) |
-
| Range selection, 15 cases | 9.737s | 7.130s | 26.8% | [37188996198](https://github.com/stablyai/orca/actions/runs/37188996198) |📝 Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
| | Window-service attachment, 31 cases | 11.910s | 1.619s | 86.4% | [37186340840](https://github.com/stablyai/orca/actions/runs/37186340840) | | |
| | OpenCode 2 TUI ownership, 41 cases | 16.811s | 2.429s | 85.6% | [37187699312](https://github.com/stablyai/orca/actions/runs/37187699312) | | |
| | Title-send authorization, nine cases | 29.545s | 12.995s | 56.0% | [37188423318](https://github.com/stablyai/orca/actions/runs/37188423318) | | |
| | Range selection, 15 cases | 9.737s | 7.130s | 26.8% | [37188996198](https://github.com/stablyai/orca/actions/runs/37188996198) | | |
| | Window-service attachment, 31 cases | 11.910s | 1.619s | 86.4% | [37186340840](https://github.com/stablyai/orca/actions/runs/37186340840) | | |
| | OpenCode 2 TUI ownership, 41 cases | 16.811s | 2.429s | 85.6% | [37187699312](https://github.com/stablyai/orca/actions/runs/37187699312) | | |
| | Title-send authorization, nine cases | 29.545s | 12.995s | 56.0% | [37188423318](https://github.com/stablyai/orca/actions/runs/37188423318) | | |
| | Range selection, 15 cases | 9.737s | 7.130s | 26.8% | [37188996198](https://github.com/stablyai/orca/actions/runs/37188996198) | |
| if (vi.isFakeTimers()) { | ||
| vi.clearAllTimers() | ||
| } | ||
| vi.useRealTimers() |
There was a problem hiding this comment.
🎯 Functional Correctness | 🟡 Minor | ⚡ Quick win
🔎 Supported by static analysis
🏁 Script executed:
sed -n '85,205p' src/main/opencode/hook-plugin-opencode2-tui-ownership.test.ts
sed -n '1,65p' src/shared/promise-timeout-fallback.tsRepository: stablyai/orca
Length of output: 4623
🏁 Script executed:
sed -n '1,90p' src/main/opencode/hook-plugin-opencode2-tui-ownership.test.ts
rg -n '"vitest"|from .node:timers|withTimeout\\(' package.json pnpm-lock.yaml src/main/opencode src/shared -g '*.ts' -g 'package.json' -g 'pnpm-lock.yaml' | head -100Repository: stablyai/orca
Length of output: 3228
Keep fake timers active through cleanup assertions.
afterEach starts each close wrapper, then restores real timers before await cleanup() resumes. The vi.isFakeTimers() guard is therefore false, so pending timers are not checked. Clear fixture timers before invoking cleanup, await cleanup while fake timers remain active, and restore real timers after the bounded wait. Use a captured real timer for the two-second deadline because withTimeout uses the fakeable global setTimeout.
Suggested fix
-import { withTimeout } from '../../shared/promise-timeout-fallback'
+
+const realSetTimeout = globalThis.setTimeout
+const realClearTimeout = globalThis.clearTimeout
...
afterEach(async () => {
- const closing = [...cleanups].map((cleanup) => cleanup())
postDelayMs = 0
for (const finish of delayedPosts) {
finish()
}
if (vi.isFakeTimers()) {
vi.clearAllTimers()
}
- vi.useRealTimers()
+ const closing = [...cleanups].map((cleanup) => cleanup())
+ let timeout: ReturnType<typeof realSetTimeout> | undefined
+ const deadline = new Promise<boolean>((resolve) => {
+ timeout = realSetTimeout(() => resolve(false), 2000)
+ })
try {
expect(
- await withTimeout(
- Promise.all(closing).then(() => true),
- 2000,
- false
- )
+ await Promise.race([
+ Promise.all(closing).then(() => true, () => false),
+ deadline
+ ])
).toBe(true)
} finally {
+ if (timeout !== undefined) {
+ realClearTimeout(timeout)
+ }
+ vi.useRealTimers()
cleanups.clear()There was a problem hiding this comment.
✅ No new issues found.
Reviewed changes — the full diff at ae2e6a3 (test support and docs only; no production behavior changes).
- Scoped fake clocks in deadline tests — new
structured-agent-session-stop-deadline.test-fixture.tsandreadAgentEvidenceAtDeadline/useProbeClockhelpers advance onlyDate/setTimeout/clearTimeoutafter real child readiness, then assert before/at boundaries (6599/6600, 1049/1050, grace−1/grace, probe 999/1000). - Native byte comparison —
readFileSync(x).toEqual(prev)replaced with.equals(prev)).toBe(true)across six profile-state suites and the Antigravity account store. - Batched SQLite fixture writes —
transcript-opencode-subscribe.test.tswraps uninterrupted writes inBEGIN/COMMITbetween unchanged observation barriers. - Real SSH GC listing fixture —
ssh-relay-gc-listing.test-fixture.tsdrives the productionexecCommandlimiter over a real/bin/shshell channel and adds 63 dirs to cross the 64-result cap. - Window-service wiring assertions — five registrar modules are now mocked and asserted for exact args/order; shared stubs moved to
main-window-service-stubs.test-fixture.ts. - Range-selection isolation — the unused
NotesSendMenuis stubbed and asserted never to render; the 15 test bodies are unchanged.
I checked the load-bearing invariants: execCommand returns the tail of output (appendExecOutputTail slices the last MAX_EXEC_OUTPUT_CHARS), so the cap-length and truncated-valid-names assertions are sound; listRelayBaseDirsCommand's awk preserves find order, so the first-64 comparison does not depend on filesystem ordering; awaitStoppedRequestEnd resolves void, so the fixture spy does not mask a return value; and withTimeout(..., false) resolves false on a rejected cleanup, so the teardown control can fail.
deepseek-v4.1-flash (free via Pullfrog for OSS) | 𝕏
There was a problem hiding this comment.
ℹ️ No critical issues — one documentation note below.
Reviewed changes — the delta since the prior pullfrog review at ae2e6a3 (test support and docs only; no production behavior changes).
- TUI teardown assertions now actually run —
hook-plugin-opencode2-tui-ownership.test.tsawaits the registered cleanups while the fake clock is still active and checksvi.getTimerCount()beforevi.useRealTimers(), using a native 2s deadline via capturedrealSetTimeout/realClearTimeoutinstead ofwithTimeout. This closes the gap carried forward from the prior review, where the timer-leak assertion was skipped on the afterEach path. - Managed hook refresh env isolation — the coverage test now saves, clears and restores
XDG_CONFIG_HOMEalongsideGROK_HOME/KIMI_CODE_HOME, so a repeated run cannot reuse a deleted fixture. - Docs table alignment — the October 4 benchmark table in
docs/reference/ci-runner-efficiency.mdis padded to aligned columns.
ℹ️ Nitpicks
docs/reference/ci-runner-efficiency.md:136still reads "Teardown restores real clocks before its bounded wait." The restructured afterEach now waits for cleanup first and callsvi.useRealTimers()afterward, so the sentence describes the inverse order.
deepseek-v4.1-flash (free via Pullfrog for OSS) | 𝕏

ELI5
CI spends less time waiting on simulated deadlines and comparing large files byte by byte. The tests keep their original scenarios and now catch several timing and SSH-limit faults that the old assertions missed.
What Changed
Stub an unused saved-note menu import and assert it stays unused. Mock unrelated window-service registrars and assert their exact wiring. Batch OpenCode fixture writes between unchanged observation barriers. Use scoped clocks after title-send terminal setup, OpenCode TUI native import, provider child/stream readiness and in the real React delivery-hook tests. Replace deep Buffer traversal with native equality of every byte and length. Replace the expensive SSH directory population with fewer, longer real paths that cross the actual transport limit, and add 65 valid installs to exercise the 64-result limit. Check pending TUI timers before restoring its test clock, using a native two-second cleanup deadline. Isolate Muse settings from an inherited
XDG_CONFIG_HOMEso repeated runs cannot reuse a deleted fixture.Why
This reduces test work without shortening production deadlines or cutting scenarios. Missing provider output still uses a real observation window; child processes, SQLite operations, encrypted-cap fixtures and SSH shell enumeration remain real. Clock boundaries and SSH output limits are more precisely checked.
Linked Issue
N/A — internal CI optimization.
Visual Proof
N/A — test code and fixtures only; application behavior is unchanged.
Testing
These are focused workload measurements, not whole-shard or queue-delay claims. All case names and outcomes match between treatments. The profile cohort keeps four existing Linux skips; SSH keeps four unavailable PowerShell 5.1 skips on the hosted image. Failure controls catch six provider deadline faults, eight delivery-hook faults, nine byte/length faults and eight real SSH transport/filter/order faults. Separate OpenCode captures match 124,754,101 bytes of ordered rows, page/signal requests and subscription callbacks; all five row/frontier/cap/commit/rollback faults fail in both schemas. Two delivery faults pass the old tests and fail the new boundary assertions. Nine window wiring/order faults fail the intended assertions. TUI captures match separate ordered event and full POST streams (1,040 rows), excluding wall timestamps and cross-stream timing; eleven semantic/timer faults and four failure-restoration controls qualify. Four provider failure-path controls prove early rejection/refusal and timer restoration, including a native test timeout. Six title wrapper/guard/false-identity faults fail the exact before/at assertions; three real range/hunk/draft faults and a menu-boundary invocation control fail with mocks cleared. The teardown qualification passes both 41-case versions and all 12 controls, including interval/retry leaks that the old teardown missed, and native cleanup stalls. Separately, two repeated four-case Muse fixture runs pass against the same stale settings file; removing either the installer or refresher still fails the existing coverage assertion. Final-head required CI will qualify the complete suite before merge. The first aggregate source comparison was rejected for an incorrect serializer ledger and this reproduced configuration-isolation failure; it supplies no whole-suite speed claim. A new comparison will use the repaired common fixture and independently corrected case ledger.
Review
Clocks are scoped and restored after cleanup; provider clocks begin only after real child readiness. Buffer.equals checks complete bytes and length. SSH uses a real shell channel and the production output limiter, with platform path utilities and unchanged unavailable-shell skip rules. Production, remote execution and persistence behavior are unchanged.
Agent skill upstream boundary
Checklist