Repository navigation
[CI] perf(tests): avoid repeated persistence imports in automation fixtures - #26111
Conversation
…/vitest-transform-cache
…form-cache # Conflicts: # src/renderer/src/components/native-chat/native-chat-composer-field-resume.test.tsx
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configuration
📒 Files selected for processing (7)
Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 1 remain after this review. 📝 WalkthroughWalkthroughThe shared Vitest options now set Priority: ⬇️ Low Merge Risk: ⚪ Minimal · up to No production behavior change or concrete test-isolation regression was established. The change is mergeable after normal CI checks. 🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches📝 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 |
ELI5
Six automation test suites already used the persistence harness but repeatedly rebuilt its large module graph when opening a store. Reusing the harness's existing store factory makes the same 53 cases 5.80% faster in a matched four-worker comparison.
What Changed
Import the existing
createStoreandtestStateinstead of maintaining six local factories that reset modules and dynamically import persistence. Every construction still creates a fresh Store and real SQLite authority. Persisted-state rewrites, flush/freeze/reopen checks, encryption mocks, assertions, timers, service shutdown and directory cleanup remain unchanged. Stock file isolation and Node runtime routing remain enabled.Why
These suites test automation behavior and real database reloads; none asserts cold module startup. The shared factory already installs the same fake app environment, initializes the current data path and opens the same SQLite authority. Reuse avoids duplicate fixture code and repeated imports without adopting another runner, sharing evaluated state between files, or changing deadlines. Tests that intentionally exercise module identity or captured startup paths retain their resets.
Linked Issue
Maintainer-requested test performance work; no separate issue. Built on merged #26095; its independent cache measurement is not combined with this result.
Visual Proof
N/A — test fixtures only; no product UI or interaction change.
Testing
Frozen source:
80f0728952843785dad6384ba51e16ef6877d58d, with only this six-file patch differing between arms. Both arms used the same six physical files, four workers, cache explicitly disabled, existing setups/flags, actual Node runtime pool and wholepnpm testtiming. Three pairs ran in alternating order; every timed sample is included.All six files / 53 original named cases passed, with exact case/status and runtime-route parity, unchanged source within each invocation, and no unhandled/lifecycle errors or other observed test coordinators. Resolved isolation, setups, cache flags and worker limits were verified. AST comparison preserves the original test bodies, hooks, timers and cipher mocks. The preceding nine-case trial measured 8.451 → 8.010 s (5.21%) across three pairs; that narrower result is not added to the table above.
pnpm tc:node, changed-code quality and formatting passed locally on macOS with background launches.This is a scoped suite measurement, not a full-suite or CI-wall-time claim. The requested 2× full-suite target remains unmet. Linux is qualified by PR CI; Windows is not locally measured.
Final full CI run 37586310094 tested
7b67e7c60b29(parents80f072895284and final head6d90d51802dd), with tested source bytes identical to the final head. All five actual assignment artifacts cover 11,407 physical files exactly once: 11,272 passed, 135 existing skips, zero failed/unhandled/missing/duplicated. Static/typechecking, relay integration, selection evidence and aggregate verification passed. The PR now targets main after #26095 merged; final review reports no actionable comments and zero unresolved threads. This proves correctness coverage, not a full-suite timing improvement.Review
No production code or persistence format changes. Reuse is limited to the audited automation fixtures; shared singleton hooks remain the production implementations, with per-file isolation retained. SSH/host fences and real SQLite reload assertions are unchanged.
Agent skill upstream boundary
Checklist