Skip to content

fix(test): keep persisted session fixtures independent of Vitest - #42543

Merged
nwparker merged 1 commit into
mainfrom
fix/playwright-agent-session-seeding-886bcf25
Nov 15, 2026
Merged

nwparker merged 1 commit into
mainfrom
fix/playwright-agent-session-seeding-886bcf25

Conversation

@nwparker

@nwparker nwparker commented Nov 15, 2026 •

Copy link
Copy Markdown
Contributor

ELI5

Let Playwright prepare persisted chat records without loading Vitest's test hooks.

Files Added Deleted Net
Test 46 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​78 $\color{#cf222e}{\Huge{\mathbf{−}}}$​96 $\color{#cf222e}{\Huge{\mathbf{−}}}$​18
Prod 10 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​205 $\color{#cf222e}{\Huge{\mathbf{−}}}$​210 $\color{#cf222e}{\Huge{\mathbf{−}}}$​5

What Changed

Playwright discovery for wsl-move-moved-project-chats.spec.ts currently crashes when its store-seeding import loads Vitest. All four general E2E shards in #42528 stop before running tests; the same single-spec discovery failure reproduces on pristine main.

  • Move ten persisted-store fixture declarations into their concrete persistence fixture owner. Update all 54 consumers to import definitions directly, without forwarding exports or wrappers.
  • Keep asynchronous worker setup, shared test-store caches and their cleanup in the existing Vitest harness. The raw persistence fixture opens and closes its own connection in finally.
  • Remove the Playwright spec's dependency on cleanup for caches that its seeding code never opens.
  • Remove two empty CLI suite declarations that Vitest rejects. Preserve both actual CLI cases and all existing assertions.

Why

The same persisted-record fixtures serve unit tests and Playwright. Their defining owner can remain independent of either runner; worker-owning fixtures retain the hooks that manage their resources.

Linked Issue

Prerequisite CI repair for #42528; no separate issue.

Visual Proof

N/A — test fixture ownership and discovery; no application visual or interaction change.

Testing

  • Matched background discovery on the branch and pristine main: same Vitest import error before this fix.
  • Repaired discovery for all 91 general specs from the failed CI selection: zero errors, 149 registrations; no test bodies executed.
  • Owning tests: all 162 assertions across 45 files passed. Two empty suite errors reproduced on pristine main; after removing the empty groups, both actual CLI cases pass.
  • Full TypeScript checking, scoped lint and formatting: passed on macOS.
  • Independent source, cleanup, binding, oracle and actual-commit audits: passed. No actual cases or assertions retired; no tests added.
  • Final ORCA_BACKGROUND_LAUNCH=1 pnpm check:changed --maxWorkers=4: all 27 checks passed in 185.7 seconds, including related unit selection, immediately before push. Hosted checks required before merge.

Risk

Level: Low. Incorrect fixture ownership could omit worker cleanup or prevent tests from loading. The asynchronous harness retains its lifecycle; extracted SQL bodies and all registered test callbacks remain unchanged. This changes test support only. A plain revert restores the previous fixture dependency.

Review

Independent reviews cover direct-owner bindings, complete declaration bodies, eager module order, runner-neutral closure, database ownership and cleanup, unchanged test oracles, and the exact deletion of two empty groups. Detailed evidence stays local.

Agent skill upstream boundary

  • Not applicable: no upstream skill-installer material is copied or translated.

Notes

After this prerequisite merges, #42528 will rebase onto the actual main result and undergo fresh validation. The folder cleanup tracker remains local.

Checklist

  • Focused on the reproduced discovery failure and empty-suite gate failure
  • Explained the change and risk
  • Visual proof marked N/A
  • Source, resource lifecycle and test-oracle reviews complete
  • Final changed-file gate complete
  • Hosted checks pass before merge

@coderabbitai

coderabbitai Bot commented Nov 15, 2026

Copy link
Copy Markdown
Contributor

Explain Change →

No actionable comments were generated in the recent review.

Walkthrough

A new persistence test fixture contains agent-session database seeding, reading, and editing helpers. The record-store test harness removes these helpers, and test consumers update their imports. Test assertions and behavior are otherwise unchanged, except for the removal of two empty subprocess suites and a journal-database close call.

Merge Risk: Minimal · up to afee9

This is a test-only refactor that moves persistence fixtures out of the Vitest harness so Playwright discovery no longer depends on it. It has no production impact, and no actionable merge-blocking risk remains. Hosted checks should still pass before merge.

Pre-merge checks: Passed 4

Check name Status Explanation
Title check Passed The title "fix(test): keep persisted session fixtures independent of Vitest" matches the main change. The PR moves persisted-store fixture declarations into a persistence fixture module that does not …
Description check Passed The description follows the repository template. It includes ELI5, What Changed, Why, Linked Issue, Visual Proof (marked N/A with a reason), Testing, Risk (Low, with a revert path), Agent skill upstre…
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: Title check

Explanation

The title "fix(test): keep persisted session fixtures independent of Vitest" matches the main change. The PR moves persisted-store fixture declarations into a persistence fixture module that does not depend on Vitest, and updates consumers to import them directly. The title is specific and concise, and it names the primary purpose of the change.

Full details: Description check

Explanation

The description follows the repository template. It includes ELI5, What Changed, Why, Linked Issue, Visual Proof (marked N/A with a reason), Testing, Risk (Low, with a revert path), Agent skill upstream boundary, Notes, and Checklist. The Linked Issue section says there is no separate issue and refers to prerequisite CI repair for #42528. The template asks for an issue link for outside contributors. The author's Testing section lists results but not the template's manual-test checkbox state. The AI Disclosure section is blank, which the template allows for internal contributors. These gaps are minor.

  • Autofix · 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

Recent review info

Run configuration

  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: Repository UI
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 41946d43-f121-454d-9fce-171e3777a32f
Commits

Reviewing files that changed from the base of the PR and between 1a811b1 and afee992.

Files selected for processing: 56

  • src/main/github/pr-watch/pr-event-delivery.test.ts
  • src/main/github/pr-watch/pr-head-evaluation.test.ts
  • src/main/github/pr-watch/pr-pending-actions.test.ts
  • src/main/github/pr-watch/pr-watch-service.test.ts
  • src/main/native-chat/agent-session-journal/database/journal-sql-database.test.ts
  • src/main/native-chat/agent-session-journal/database/journal-sql-legacy-retention.test.ts
  • src/main/native-chat/agent-session-journal/replay/journal-pause-mark-restore.test.ts
  • src/main/native-chat/agent-session-journal/store-lifecycle/journal-host-database-test-support.ts
  • src/main/native-chat/agent-session-wire/acquisition/testing/structured-agent-session-fork.test-fixture.ts
  • src/main/native-chat/agent-session-wire/host/structured-agent-session-snapshot-routes.test.ts
  • src/main/native-chat/agent-session-wire/host/testing/structured-agent-session-attachment-admission.test.ts
  • src/main/native-chat/agent-session-wire/host/testing/structured-agent-session-catalog-mutation.test-fixture.ts
  • src/main/native-chat/agent-session-wire/host/testing/structured-agent-session-exit-delivery.test.ts
  • src/main/native-chat/agent-session-wire/host/testing/structured-agent-session-leftover-settlement.test-fixture.ts
  • src/main/native-chat/agent-session-wire/host/testing/structured-agent-session-prompt-answer-receipts.test.ts
  • src/main/native-chat/agent-session-wire/host/testing/structured-agent-session-queued-action-receipts.test.ts
  • src/main/native-chat/agent-session-wire/host/testing/structured-agent-session-queued-repeat-press.test.ts
  • src/main/native-chat/agent-session-wire/host/testing/structured-agent-session-resend-ledger-refusal.test.ts
  • src/main/native-chat/agent-session-wire/host/testing/structured-agent-session-restart-failure-filing.test.ts
  • src/main/native-chat/agent-session-wire/host/testing/structured-agent-session-rewind-usage-limit.test-fixture.ts
  • src/main/native-chat/agent-session-wire/host/testing/structured-conversation-command.test.ts
  • src/main/native-chat/agent-session-wire/journal-ingress/testing/structured-agent-session-dispatch.test.ts
  • src/main/native-chat/agent-session-wire/journal-ingress/testing/structured-agent-session-transition-rollback.test.ts
  • src/main/native-chat/agent-session-wire/journal-ingress/testing/structured-agent-session-transition.test.ts
  • src/main/native-chat/agent-session-wire/publication/history/testing/agent-session-history-contract.test-fixture.ts
  • src/main/native-chat/agent-session-wire/rewind/structured-rewind-completion.test-support.ts
  • src/main/native-chat/agent-session-wire/termination/testing/structured-agent-session-stale-verdict-persistence.test.ts
  • src/main/runtime/agent-senders/runtime-agent-sender-associations.test.ts
  • src/main/runtime/agent-senders/runtime-agent-sender-chat-lineage.test.ts
  • src/main/runtime/agent-session/lifecycle/structured-agent-session-tab-authority.test-support.ts
  • src/main/runtime/agent-session/naming/structured-agent-session-provider-naming-shutdown.test.ts
  • src/main/runtime/agent-session/ownership/agent-session-launch-env-admission.test.ts
  • src/main/runtime/agent-session/ownership/agent-session-lease-renewal.test.ts
  • src/main/runtime/agent-session/ownership/agent-session-permission-backfill.test.ts
  • src/main/runtime/agent-session/ownership/agent-session-released-reservation-replay.test.ts
  • src/main/runtime/agent-session/records/agent-session-acquired-account.test.ts
  • src/main/runtime/agent-session/records/agent-session-inventory-scale.test.ts
  • src/main/runtime/agent-session/records/agent-session-provider-alias-lookup.test.ts
  • src/main/runtime/agent-session/records/agent-session-record-store-damaged.test.ts
  • src/main/runtime/agent-session/records/agent-session-record-store-maintenance.test.ts
  • src/main/runtime/agent-session/records/agent-session-record-store-persistence.test-fixture.ts
  • src/main/runtime/agent-session/records/agent-session-record-store-tab-table.test.ts
  • src/main/runtime/agent-session/records/agent-session-record-store-test-harness.ts
  • src/main/runtime/agent-session/records/agent-session-record-store.test.ts
  • src/main/runtime/agent-session/records/agent-session-store-transactions.test.ts
  • src/main/runtime/agent-session/records/structured-agent-session-startup-tab-restore.test.ts
  • src/main/runtime/agent-session/structured-agent-session-runtime.test.ts
  • src/main/runtime/agent-session/structured-agent-session-startup-reconcile.test.ts
  • src/main/runtime/orchestration/terminal-authority/structured-sessions/structured-chat-mail-custody.test.ts
  • src/main/runtime/rpc/methods/agent-launch/agent-launch-replay.test.ts
  • src/main/runtime/rpc/methods/structured-sessions/conversation/structured-agent-session-restart-unregistered-agent.test.ts
  • src/main/runtime/rpc/methods/structured-sessions/protocol/structured-agent-session-at-rest.test.ts
  • src/main/runtime/rpc/server/orchestration-cli-subprocess.test.ts
  • src/main/runtime/session-tabs/renderer-owned-tab-properties.test.ts
  • tests/e2e/cross-version-wire/agent-session-kill-delivered-downgrade.unit.test.ts
  • tests/e2e/wsl-move-moved-project-chats.spec.ts

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

@nwparker
nwparker merged commit 552c71e into main Nov 15, 2026
65 checks passed
@nwparker
nwparker deleted the fix/playwright-agent-session-seeding-886bcf25 branch November 15, 2026 00:30
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