0
Fork 0
mirror of https://github.com/mastra-ai/mastra.git synced 2026-11-17 08:44:46 +00:00
mastra/stores/libsql/tsconfig.build.json
NikAiyer 49b9bc8dd8
Add a child-process peer helper for cross-process durable tests and port harness case T79 (#26034)
## Summary

Cross-process durable tests only mean something with two real OS
processes: an in-process stand-in passes falsely because the run
registry is module-level. This adds a reusable child-process peer helper
(one temp dir with a shared `UnixSocketPubSub` socket and one shared
LibSQL file; spawn, signal, waitFor, result, pause/resume, cleanup) and
ports harness case T79 — aborting a durable run from another process —
as its first user. It lives in `stores/libsql`, which already depends on
`@mastra/core` and `tsx` and is where CI already builds and tests on
durable changes.

## Changes

- `peer-helper.ts` / `peer-runtime.ts` — helper API and fixture-side
runtime (env bootstrap, config self-check, flush-before-exit).
- `fixtures/` — the T79 peer fixture plus a self-test fixture.
- `xproc-abort.test.ts` — T79 as the five harness conditions: plain,
durable and evented in-process, plus durable and evented across
processes, with the in-process vs cross-process comparison.
- `peer-helper.test.ts` — helper self-tests: shared socket, shared
database, hang guard, pause/resume, separate module graphs.

## Test plan

- `pnpm test` in `stores/libsql` (new files included) and `pnpm
test:memory`.
- `npx tsc --noEmit -p tsconfig.json` and `pnpm lint`.
- CI routes changes under `packages/core/src/agent/durable` and
`packages/core/src/events` to these tests.


<!-- This is an auto-generated comment: release notes by coderabbit.ai
-->
## ELI5

This change lets tests run separate programs that share a database and a
message connection. It checks whether one program can stop a run started
by another, and provides tools for similar tests.

## Changes

- Added a reusable helper to start and manage peer processes that share
LibSQL and Unix socket pub/sub resources.
- Added peer fixtures and helper tests for shared resources, startup
checks, waits, worker settings, and failure handling.
- Added T79 tests for plain, durable, and evented in-process aborts, and
for durable and evented cross-process aborts. The tests compare
cross-process results with in-process controls.
- Updated the LibSQL build configuration to exclude test files.

## Checks

The PR description lists `pnpm test`, `pnpm test:memory`, `npx tsc
--noEmit -p tsconfig.json`, and `pnpm lint` as planned checks. Results
were not provided.
<!-- end of auto-generated comment: release notes by coderabbit.ai -->

---------

Co-authored-by: mastracode <284800079+mastra-platform[bot]@users.noreply.github.com>
2026-10-06 17:09:29 -05:00

9 lines
258 B