Repository navigation
perf(checks): bound earlier error context collection - #20211
Conversation
|
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: Your plan provides up to 10 included reviews per hour; 6 remain after this review. 📝 WalkthroughWalkthrough
Priority: ⬇️ Low Merge Risk: ⚪ Minimal · up to The bounded backward scan preserves the intended newest-context selection and ascending output order without leaving a concrete merge-blocking risk. 🚥 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 critical issues — one maintainability suggestion inline.
Reviewed changes
- Bound earlier error context collection —
collectEarlierErrorLineIndexesnow scans error markers newest-first, walks each ±2 window top-down, and returns as soon as 30 unique context indexes are retained, instead of collecting every context index and discarding all but the newest 30 (src/shared/check-job-log-tail-slice.ts:35). - Equivalence test for dense/sparse/overlapping spacings — new
it.each([1,2,3,5,7,11,31,100])fixture recomputes the expected excerpt with the forward-collection algorithm and asserts exact output (src/shared/check-job-log-tail-slice.test.ts:9).
I verified the early-return equivalence independently: because errors are scanned newest-first and each window is added from contextEnd down, every newly-added index is strictly smaller than all prior additions, so the first 30 unique indexes are the newest 30. A randomized harness comparing the old and new collectors over 200k inputs found no mismatches. Both call sites (github/.../check-job-log-tails.ts:77, gitlab-job-log-excerpt.ts:46) consume the sorted result unchanged, and the shared test files pass (20 passed).
openrouter/deepseek/deepseek-v4.1-flash (free via Pullfrog for OSS) | 𝕏

ELI5
Large failed-job logs produce the same excerpt without collecting thousands of error lines that will be discarded.
What Changed
Scan earlier error markers backwards and stop once the newest 30 context lines are known. Retain ascending output order, overlapping-context deduplication and existing byte caps. Shared by GitHub and GitLab.
Why
Measured the full sliceCheckLogTail operation on Windows Node 24, 200,000-line synthetic logs, median of 11 samples:
Log splitting still processes the full input. These measure local excerpt generation, not download latency.
Linked Issue
User-requested Windows/WSL performance audit; no existing issue linked.
Visual Proof
N/A — excerpt content and interaction behavior remain identical.
Testing
Review
Descending error windows add context in descending order, so earlier windows cannot add a newer index once 30 unique indexes are retained. No API, SSH routing, git command or workspace assumptions change.
Agent skill upstream boundary
Review follow-up
Documented the descending-addition invariant beside the loop: newest-first errors and descending context windows produce the newest unique indexes first. This explains why stopping at the existing cap preserves the original excerpt. All 12 log-excerpt tests and targeted lint/format checks pass.