Repository navigation
Reuse event byte sizes when relay watchers notify several clients - #24558
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 configurationConfiguration used: Repository UI Review profile: CHILL Plan: Advanced Run ID: 📒 Files selected for processing (2)
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 relay watcher batch publisher now caches grouped event byte sizes on the batch sizing object and reuses them across clients. New tests check lookup counts and emitted frames across root styles and client capacities. They also cover oversized events, client detachment, publication errors, and closed roots. Priority: ⬇️ Low Merge Risk: ⚪ Minimal · up to The change can proceed through normal merge checks; no concrete issue with watcher frames or cached sizing remains identified. 🚥 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 |
There was a problem hiding this comment.
✅ No new issues found.
Reviewed changes
- Share the ordered byte array across chunking clients —
watcherBatchSizinggains an optionalgroupedEventBytes?: number[](relay-watcher-event-emitter.ts:15-19), lazily built from the memoizedgroupedgrouping viasizing.groupedEventBytes ??= grouped.map(...)(:135-137) and reused by every client that takes the chunking path, instead of remapping for each client. - Compatibility test coverage — new
relay-watcher-shared-byte-index.test.tsasserts exactMap.prototype.getlookup counts and full frame bytes against an independent maximal-capacity encoder across POSIX, Windows drive, and UNC roots, plus ordering, per-emit rebuild, oversized-event, synchronous-detach, error, and short-circuit cases.
The optimization is sound: grouped and eventBytes are memoized once per emitRelayWatcherEvents call and never mutated during the synchronous emit, per-event sizes are capacity-independent, and sizing is call-local so nothing persists across emits. Whole-batch and unused paths still skip measurement. The tests are a genuine oracle rather than a mirror of the implementation's arithmetic, and the exact lookup-count assertions would fail without the change.
deepseek-v4.1-flash (free via Pullfrog for OSS) | 𝕏
Store the existing grouped numeric byte-size array on the already call-local watcher batch sizing object, for reuse by later chunking clients.
1c46cba to
9ac4fa1
Compare
…24962) * fix(opencode): bind legacy attach status to its TUI pane Adapt the official v1 TUI API to the existing pane reporter and learn structural session identity only after execution-host admission. Preserve known creators, gate new reports to capable hosts, and register the legacy TUI entry without changing user settings or overlay targets. Credit werlang for the same-directory investigation in #

ELI5
When several clients watch the same folder, Orca works out the shared event sizes once. Each client still gets its own correctly sized messages.
What Changed
Relay watcher output already shared event grouping and measurement, but rebuilt the same ordered size array for every client needing chunks. That array now lives on the existing per-call sizing object. Per-client capacity, chunk boundaries, order, sequence/ACK fields, overflow/resync, admission and errors remain unchanged.
Why
Events are copied into private plain records and the shared grouping/measurement are immutable during one synchronous emit. Reusing only their numeric sizes avoids extra Map lookups and array construction without sharing client frames or introducing a persistent cache. Whole-batch and unused paths still avoid this work.
Linked Issue
Internal performance audit; no pre-existing issue.
Visual Proof
N/A — internal preparation changes; diagnostics or published watcher frames remain identical.
Testing
5000events over3chunking clients: measured-event lookups15000->5000 for POSIX, Windows drive and UNC paths;2fresh1000event emits4000->2000. Complete raw frames match an independent maximal-capacity encoder before count checks. Frozen stock4count regressions fail/5compatibility controls pass. Author76tests/6suites and independent96distincttests/8suites pass, covering framing, admission, overflow/oversized events, synchronous detachment, errors, setup/shutdown and settlement/drain. tc:node and full pnpm tc, scopedlint/format, changed-code quality and Electron Vite build pass on macOS.
All test launches used ORCA_BACKGROUND_LAUNCH=1.
Review
Independent audit_renderer review approved the final two file hashes, independently reproduced stock count failures and reviewed output, freshness and failure boundaries.
Agent skill upstream boundary
Notes
CI currently rejects three unchanged terminal write-spy fixture lines on main. #24600 repairs that separate fixture; rerun against the repaired base before merging this PR.
Invariant: exact ordered per-client watcher publications and unchanged wire/capacity/overflow ownership. Pure sizing reuse adds no poll, timer, query, grouping, transport event or threshold. Nearest runtime-files.watcher-process-isolation lifecycle/publication portions covered; full physical watcher fault/Electron gate is an accepted gap for this pure numeric-array change. Runtime-flavored folder paths covered; folder workspaces need no Git. Native Linux/Windows, live SSH/WSL/mixed peers, physical mobile and soak remain gaps. No latency claim.
Checklist
Current review and integration
Reapplied only this PR’s reviewed files on main
53f9ea, preserving all newer main changes. Independent code review approves the exact scope as Low risk and found no regression or negative user-facing trade-off. Existing successful controls and new stock-negative tests are recorded in the review; fresh revised-head CI is required before merge.The current-main controls pass 133 tests, plus full Node and supported mobile app typechecks. Existing generated assets were borrowed unchanged for compiler inputs; no install, generation or build ran. Physical native/remote/device and overall CPU/heap claims remain outside this validation.
Review-bot follow-up
This is an internal repository-maintainer audit; the pull-request template exempts maintainers from opening needless issues and from external-contributor AI disclosure. The automatic docstring-coverage suggestion is declined under AGENTS.md’s concise non-obvious-comments policy. Actual code/test findings are addressed with regression controls.