Skip to content

perf(checks): bound earlier error context collection - #20211

Merged
nwparker merged 2 commits into
mainfrom
OrcaWin/perf-check-log-context
Sep 13, 2026
Merged

nwparker merged 2 commits into
mainfrom
OrcaWin/perf-check-log-context

Conversation

@OrcaWin

@OrcaWin OrcaWin commented Sep 12, 2026 •

Copy link
Copy Markdown
Collaborator
Files Added Deleted Net
Test 1 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​25 0 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​25
Prod 1 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​6 $\color{#cf222e}{\Huge{\mathbf{−}}}$​2 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​4

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:

Error spacing Before After
Every line (4.29 MB) 20.75 ms 3.69 ms
Every 10 lines 10.98 ms 3.63 ms
Every 1,000 lines 6.60 ms 3.78 ms
Only first line 6.95 ms 6.65 ms

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

  • 12 focused tests passed on Windows, including eight dense/sparse/overlapping context fixtures checked against the original forward-collection algorithm.
  • All benchmark inputs produced identical complete excerpts before and after.
  • Node typecheck, targeted lint and formatting passed.
  • Installed tools invoked directly with ORCA_BACKGROUND_LAUNCH=1; pnpm dependency rebuilding encountered native FTK1011 long-path errors.

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

  • Not applicable.

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.

@coderabbitai

coderabbitai Bot commented Sep 12, 2026 •

Copy link
Copy Markdown
Contributor

Review Change StackReview Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Advanced

Run ID: 87f57d93-69f1-429c-8628-22ca85b6e34e

📥 Commits

Reviewing files that changed from the base of the PR and between 20ab995 and 2a60b9a.

📒 Files selected for processing (2)
  • src/shared/check-job-log-tail-slice.test.ts
  • src/shared/check-job-log-tail-slice.ts

Included review availability: Your plan provides up to 10 included reviews per hour; 6 remain after this review.


📝 Walkthrough

Walkthrough

collectEarlierErrorLineIndexes now scans backward from the recent-log boundary and keeps the newest qualifying error-context lines before sorting them for output. A parameterized test covers error spacings from 1 to 100 across a 500-line log and verifies the 30-line limit, separator, and remaining tail.

Priority: ⬇️ Low

Merge Risk: ⚪ Minimal · up to 2a60b

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)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 1 functions across 2 files. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
Title check ✅ Passed The title clearly and concisely describes the main performance optimization: bounding earlier error-context collection.
Description check ✅ Passed The description covers the change, rationale, performance results, testing, visual proof, review notes, and scope. The Linked Issue section states that no existing issue is linked, although the templa…
  • Fix all pre-merge checks with AI
✨ Finishing Touches 💡 1
📝 Generate docstrings 💡
  • Create stacked PR
  • Commit on current branch

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@pullfrog pullfrog Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ℹ️ No critical issues — one maintainability suggestion inline.

Reviewed changes

  • Bound earlier error context collection — collectEarlierErrorLineIndexes now 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).

Pullfrog  | Fix all ➔ | Fix 👍s ➔ | View workflow run | Using openrouter/deepseek/deepseek-v4.1-flash (free via Pullfrog for OSS) | 𝕏

Comment thread src/shared/check-job-log-tail-slice.ts Resolved
@nwparker
nwparker merged commit 2285971 into main Sep 13, 2026
28 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants