Repository navigation
[CI] Reduce repeated UI imports in draft storage tests - #26145
Conversation
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configuration
📒 Files selected for processing (4)
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 draft-cache module now provides attachment-cache read, append, and test-clear functions. Reads return shallow copies. Appends store image IDs and paths, include present connection IDs, and set Priority: ⬇️ Low Merge Risk: ⚪ Minimal · up to No actionable merge-blocking issue is identified; the change is mergeable after normal checks. 🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✨ 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 |
ELI5
Draft storage tests loaded the attachment UI each time they simulated restarting the app. Reading attachments through the existing draft cache makes the same 40 cases finish in 5.302 instead of 10.567 seconds, a 49.83% reduction in matched whole-command time. Product behavior stays the same.
What Changed
Move the three existing attachment-cache functions into
native-chat-draft-cache.ts, preserving their declarations byte-for-byte. The attachment hook imports and reexports those same functions under their original public names. The storage test reloads the existing cache view instead of importing the React hook. A separate hook test now verifies that all three public exports are the exact cache functions.Why
The cache already reads and writes through the same draft storage owner. Reusing it avoids loading unrelated UI and translation modules in a storage-only test. Every module reset, storage reload, crash recovery, concurrent-window check, assertion and cleanup remains in place. This preserves isolation and persistence coverage without adding another cache or runner.
Linked Issue
Maintainer-requested test performance work; no separate issue. Independent of the cache, automation-fixture and pane-cleanup measurements.
Visual Proof
N/A — function relocation and test imports only; no rendered UI, interaction or React effect changes.
Testing
Frozen source
6d90d51802ddacbbcddaf4af6eeee85972b23789. Both arms ran the same physical file and 40 original named cases, four workers, cache explicitly disabled, existing six setup files, runtime routing and file isolation. Timing covers the wholepnpm testprocess through output and normal exit.All six qualified samples passed with exact case/status, configuration and runtime-route parity, unchanged source within each invocation, and no lifecycle or unhandled errors. One candidate invocation failed the preset external-coordinator guard; its raw results remain preserved and only that invalid invocation was repeated. Its original qualified control is retained. A later preflight rejected other coordinators before launching a timed child. The resulting order exceptions are recorded; no passing timing was excluded as an outlier.
The branch was then moved onto main
385fe8ab4eeed0ae819376bac59265f3945004fb. Its three measured files are byte-identical to the measured candidate. The separate public-export test was added after timing and is outside the 40-case cohort. The table remains the frozen-source measurement; final CI qualifies the integrated source separately.1c9f858cf65341d324af77e1010c484ab0dd48ad.1c9f858cf65341d324af77e1010c484ab0dd48ad; current-head review has no actionable comments or unresolved threads.088936a1b39ae111b008fc439bf4cc920652b62cretains all 11,412 incoming-main files and reports them exactly once: 11,277 passed, 135 existing skips, zero failed files and zero unhandled errors. Logs report 110,692 passing cases, one expected failure and 1,035 skipped cases; every physical-file runtime route and shard matches the source. All four changed files are byte-identical to the PR head.The measured speedup is 1.993× for this storage suite. It is not a full-suite or CI-wall-time result, and the requested whole-suite 2× goal remains unmet. Linux qualification depends on PR CI; Windows is not locally measured.
Review
The original hook API and the same draft owner remain in use. Direct hook imports may evaluate that owner earlier relative to React and translation initialization; its module graph depends on neither. Opening storage, hydration, unload listeners and broadcast setup remain lazy inside unchanged lifecycle functions. The existing journal token remains one per module/window, and the cache's existing empty listener map registers no listener at import time. No storage format, execution-host ownership, SSH attachment behavior or remote protocol changes.
Agent skill upstream boundary
Notes
The binding regression uses the real hook exports and existing storage cleanup. It adds no mock or replacement storage owner. Existing rendering, IndexedDB, reload, crash, multi-window and withdrawn-message tests remain covered.
Checklist