Skip to content

[CI] test(persistence): reuse first constructors in six more suites - #26250

Merged
nwparker merged 1 commit into
mainfrom
nwparker/persistence-six-fixture-first-construction
Oct 7, 2026
Merged

nwparker merged 1 commit into
mainfrom
nwparker/persistence-six-fixture-first-construction

Conversation

@nwparker

@nwparker nwparker commented Oct 7, 2026 •

Copy link
Copy Markdown
Contributor

ELI5

Six persistence test files repeatedly reload the persistence code before opening their first database. Reuse the existing test constructor for that first opening so the same checks spend less time importing code.

What Changed

Only the first Store in each case uses the existing SQLite test harness and canonical constructor. Each case still has its own temporary directory, real database and persisted state. Later disk reloads keep their existing module reset/import path. Reset the existing retirement collision cache before each case.

The two removal suites use their existing explicit data-file setup rather than installing a new application environment. Automation suites retain their existing per-case environment, cipher registration, owner fencing, cleanup and subsequent reloads.

Why

Reduce repeated imports without caching databases or removing persistence checks. Reuse established fixtures rather than adding a second persistence implementation. All six suites remain actual-Node runtime contracts even when Bun coordinates tests.

Linked Issue

Internal maintainer test-performance work; no pre-existing issue. The repository template asks maintainers to avoid opening needless issues.

Visual Proof

N/A — test fixtures only; no application appearance or interaction changes.

Testing

  • Automated tests updated; original assertions, case registrations and later cold reloads retained.
  • Manual application UI testing — not applicable to fixture-only changes.

MacOS qualification: all 178 original cases across 12 related files passed in eight accepted before/after runs: Bun and actual Node coordinators, shuffle seeds 104729 and 130363. Exact named-case identities/statuses, routes, resolved settings, source hashes, normal process close and recorded coordinator census matched. The six timed files contain 43 original cases, all on actual Node. pnpm tc:node, changed-code quality, format checks and diff checks passed.

Before/after measurements

Whole pnpm test command through normal close, macOS, four workers and filesystem module cache disabled in both arms. First runs counted; alternating schedule before0, after0, after1, before1, before2, after2.

Pair Before After
1 4.972701s 4.233648s
2 4.597520s 4.108990s
3 4.598695s 4.146612s
Mean 4.722972s 4.163083s

11.8546% less elapsed time / 1.1345× for these 43 cases. All three pairs improved. All six timed attempts qualified; zero timing/preflight rejections, retries or discarded qualified samples.

One earlier correctness run (before/Node/seed130363) passed all 178 tests but was disqualified for unrelated external Vitest coordinators. Its raw reports and process proof are retained. A separately named quiet recheck passed every qualification guard; no test failure was retried or ignored.

Frozen source 76d1b7bf29932f6e1edfb6b0b34d65c5c88e5f55. Local raw evidence: notes/bun-migration/performance/persistence-six-firstctor-76d1-* and persistence-first-construction-six-families-76d1-*. All 48 earlier source guards and six candidate file bodies match the prior source-only proposal; a fresh epoch records the current source rather than relabeling old results. The consumed benchmark plan has a copied prose label saying five files; its authoritative file arrays, recorded routes and case map contain six files / 43 cases. That wording is retained as an artifact finding; no consumed plan was edited. This focused result does not establish whole-suite acceleration or the historical two-times goal.

Full CI run 37644725348 passed on exact head 7c4b7032af8a948dd751a89571b7153f8d3ae61a, synthetic source c09d6c2e1bf5e82c40b5ac3e5e372c1b33cd486b with parents 76d1b7bf + 7c4b7032. All 11,678 files ran exactly once across five passing shards: 11,538 passed, 140 existing skips; 112,609 passed cases, one expected failure and 1,052 existing skips. Zero failures, unhandled errors, omitted failures or added/missing files. All 43 changed cases completed under actual node-runtime; all 18 stock source/configuration/registry/setup guards match incoming main. Stock artifacts prove enrollment/raw counts/runtime markers; the local eight-report qualification separately proves exact selected case maps. No deadline, assertion, skip, route or shutdown guard is weakened.

CodeRabbit review covers exact 7c4b7032: zero actionable findings and zero unresolved threads. Its generic 0% docstring-coverage warning for six existing fixture functions is advisory, not a repository requirement; adding boilerplate to meet its 80% threshold conflicts with the repository’s concise-comment rule. Constructor ownership, later cold reloads and cleanup are explained above. Other advisory description/issue checks passed.

Review

Independent source review checks the first-construction gate, fresh database ownership, collision-cache reset and retained later reloads. Independent fresh evidence review passed: all eight 178-case qualification maps match and all six timed runs retain the same 43 actual-Node cases, resolved settings and source fingerprints, with normal close and zero noise/errors. Full CI and exact-head automated review completed; no actionable findings remain.

Agent skill upstream boundary

  • Not applicable; no upstream agent-skill source copied.

Notes

No production behavior, host/SSH execution, folder-workspace handling, native runtime or wire changes.

Checklist

  • Small and focused; before/after, mechanism and alternatives explained.
  • N/A visual proof explained.
  • Self-reviewed for correctness, security and performance.
  • Cross-platform and SSH impact considered.
  • Full CI completed on final source.

@coderabbitai

coderabbitai Bot commented Oct 7, 2026 •

Copy link
Copy Markdown
Contributor

Review in 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: d4bc2535-f24b-4ede-900e-b02c6fcc3bd2
📥 Commits

Reviewing files that changed from the base of the PR and between 76d1b7b and 7c4b703.

📒 Files selected for processing (6)
  • src/main/automations/automation-owner-fencing.test.ts
  • src/main/automations/automation-update-host-retarget.test.ts
  • src/main/automations/automation-workspace-host-attribution.test.ts
  • src/main/automations/service-precheck.test.ts
  • src/main/worktree-removal-close-records.test.ts
  • src/main/worktree-removal-session-partition-fencing.test.ts

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


📝 Walkthrough

Walkthrough

Six test files now use shared persistence test state and reset retirement-collision cache state before each test. Their store helpers create a fresh or canonical store on the first call and retain the existing SQLite-store path for later calls. The host-retarget tests add cases for orphan target preservation and explicit project changes.

Priority: ⬇️ Low

Merge Risk: ⚪ Minimal · up to 7c4b7

The changes are confined to persistence tests, with targeted runs and typechecking reported as passing. Full CI is pending; no specific merge-blocking issue is evident.

🚥 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 6 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 identifies the test-focused persistence change and specifies that the first constructors are reused across six additional suites.
Description check ✅ Passed The description is complete and follows the repository template. It explains the change, rationale, testing, performance results, review status, scope, and checklist items. The lack of a linked issue …
  • 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.

@nwparker
nwparker merged commit a576c0b into main Oct 7, 2026
30 checks passed
@nwparker nwparker changed the title test(persistence): reuse first constructors in six more suites [CI] test(persistence): reuse first constructors in six more suites Oct 9, 2026
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