Skip to content

Avoid repeated runtime imports and recovery fixture seeding in CI - #25155

Merged
nwparker merged 1 commit into
mainfrom
nwparker/ci-tail-recovery-fixtures-20261004
Oct 4, 2026
Merged

nwparker merged 1 commit into
mainfrom
nwparker/ci-tail-recovery-fixtures-20261004

Conversation

@nwparker

@nwparker nwparker commented Oct 4, 2026 •

Copy link
Copy Markdown
Contributor
Files Added Deleted Net
Test 5 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​187 $\color{#cf222e}{\Huge{\mathbf{−}}}$​231 $\color{#cf222e}{\Huge{\mathbf{−}}}$​44
Prod 1 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​43 0 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​43

ELI5

CI spends less time loading the runtime for helper tests and recreating identical recovery databases. Three hosted pairs reduced the final runtime cohort from 22.1 to 13.6 seconds and the recovery crash suite from 24.1 to 8.1 seconds.

What Changed

Import existing terminal helpers directly. Replace ten test-local simulations with a case that exercises actual runtime cache reuse and blocked-prompt timestamps, retaining the genuine helper and prune checks. Seed each recovery fixture variant once after its child closes, copy its complete database/WAL family into isolated roots, and compare every file byte with Buffer.equals.

Why

The removed simulations passed when production caching, timestamping or prune invalidation was broken; the real runtime checks fail each fault. Copying settled seeds avoids redundant setup while retaining all 46 crash boundaries and retries. Four additional controls check isolation and complete WAL copies. A cache shortcut was deferred after stale-transform controls failed; a separate layout optimization was restored after complete-file timing showed no gain.

Linked Issue

N/A — internal CI optimization.

Visual Proof

N/A — tests and test fixtures only.

Testing

  • Local targeted tests, lint and formatting passed.
  • Automated tests updated; original recovery boundaries preserved.
  • Measurement run: three alternating one-worker ARM pairs, Node 24.21.0; hosted Node typecheck passed.
  • Import-only comparison retained the same 15 tests: median 19.257 → 1.768s. Final four-file cohort including the new runtime case: 22.122 → 13.601s (38.5%). Recovery, including four new controls: 24.082 → 8.105s (66.3%).
  • Cache, timestamp and prune faults passed the old copied loops but failed real runtime assertions. Database/WAL last-byte corruption, shared paths, missing WAL and seed-variant collision faults failed the intended recovery assertion.
  • These focused workload results do not establish whole-shard or queue-delay improvements. Required CI will qualify the final head before merge.

Review

Each recovery child and crash boundary still runs against its own directory. Seeds are copied after process closure, paths are remapped with platform path functions, and original seed bytes are checked after all crashes. Runtime production behavior is unchanged.

Agent skill upstream boundary

  • Not applicable; no upstream skill source is copied.

Checklist

  • Focused on test setup and useful coverage.
  • Explained before/after, mechanism and alternatives.
  • N/A visual proof has a reason.
  • Reviewed fixture isolation and cleanup.
  • Platform/SSH application behavior is unchanged; local macOS and hosted Linux ARM verified.
  • Local checks passed; final-head required CI covers integration and packaging.

@nwparker
nwparker marked this pull request as ready for review October 4, 2026 07:00
@coderabbitai

coderabbitai Bot commented Oct 4, 2026

Copy link
Copy Markdown
Contributor

Review in Change Stack →

Navigate logical layers of code changes, visualize relationships, and explore their blast radius.

🧰 Additional context used
📚 Code guidelines (1)
AGENTS.md — auto-discovered

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: 3bb3754a-c8cd-4caa-8f79-d2bcd2ae9f51
📥 Commits

Reviewing files that changed from the base of the PR and between ce07786 and 7a94b1e.

📒 Files selected for processing (6)
  • docs/reference/ci-runner-efficiency.md
  • src/main/persistence/profile-state/profile-state-recovery-crash-boundaries.test.ts
  • src/main/runtime/orca-runtime-tail-wait-memo.test.ts
  • src/main/runtime/pty-transcript-prune-wait-cache.test.ts
  • src/main/runtime/retained-tail-redraw-window.equivalence.test.ts
  • src/main/runtime/terminal-projection.test.ts

Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 5 remain after this review.


📝 Walkthrough

Walkthrough

Runtime tests now import terminal helpers directly and cover wait-state scans, blocked-prompt timestamps, and tail trimming. Recovery tests use copied seeded fixtures and check copy isolation, artifact contents, and missing-WAL failure. The CI report records test changes, hosted timing comparisons, and cache experiments. No production-code changes are described.

Priority: ⬇️ Low

Merge Risk: ⚪ Minimal · up to 7a94b

This change only adjusts test setup and coverage, plus a CI report. Production behavior is unchanged, and no concrete merge-blocking issue was found.

🚥 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 6 functions across 5 files. (1 skipped: 1 … Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly summarizes the main changes: reducing repeated runtime imports and recovery fixture seeding in CI.
Description check ✅ Passed The description covers the change, rationale, testing, review considerations, visual proof, and checklist. It identifies the linked issue as not applicable for this internal CI optimization and explai…
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.
Full details: Docstring Coverage

Explanation

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 6 functions across 5 files. (1 skipped: 1 unsupported.)

  • Fix all pre-merge checks with AI
✨ Finishing Touches 💡 1
📝 Generate docstrings 💡
  • Commit to this branch
  • Create a new PR
  • Autopilot · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

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 new issues found.

Reviewed changes

  • Docs log entry — appends an "October 4 runtime imports and recovery fixtures" section to docs/reference/ci-runner-efficiency.md; pure append.
  • Replaced simulated memoization tests — orca-runtime-tail-wait-memo.test.ts drops the copied-loop simulations that modeled the runtime instead of exercising it, and keeps the two computeTerminalTailWaitState helper checks, importing the helper from terminal-wait-tail-state.
  • New real-runtime prune/wait test — pty-transcript-prune-wait-cache.test.ts drives onPtyData with a leaf-only history so the leaf scan path runs, spies computeTerminalTailWaitState, and asserts exact scan counts plus waitBlockedAt stamping across split, settled, and evicted prompts.
  • Direct helper imports — the redraw-window equivalence and terminal-projection tests now import from terminal-tail-buffer, terminal-tail-redraw-buffer, and orca-runtime-terminal-projection rather than pulling in the whole orca-runtime (all are re-exported from orca-runtime.ts, so the bindings are unchanged).
  • Seeded recovery fixtures — profile-state-recovery-crash-boundaries.test.ts now seeds each of the three fixture variants once and clones the settled root per test, with byte-exact Buffer.equals checks, a copy-isolation/WAL family control block, an incomplete-WAL control, and an afterAll guard that the seed bytes are unchanged.

I verified locally that all five changed test files pass (50 recovery + 7 runtime tests), check:code-quality:changed is clean, and the new runtime test is genuinely sensitive: forcing the previous wait state to always recompute fails it at the memoization scan-count assertion. I also confirmed killRecoveryAt awaits the child close before the seed is copied, and that Node's cpSync into an existing directory copies contents (not a nested basename), so the clone path remap is correct. No production behavior is touched, and no actionable findings.

Pullfrog  | View workflow run | Using deepseek-v4.1-flash (free via Pullfrog for OSS) | 𝕏

@nwparker
nwparker merged commit ffd23fe into main Oct 4, 2026
64 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.

1 participant