0
Fork 0
mirror of https://github.com/mastra-ai/mastra.git synced 2026-11-17 08:44:46 +00:00
mastra/packages/memory/scripts/simulate
Tyler Barnes 43f77e77a0
ci: delete the Changed Test Gate (#29099)
## What this does

Deletes the Changed Test Gate workflow, its labeler workflow (which
labels PRs from the gate's result) and `scripts/pr-test-gate/`. The
gate's deployer rule is kept: it moves into Prebuild as a small
`Deployer E2E coverage` job.

## What the gate enforced, and what goes

The gate checked out the base branch, restored the PR's changed test
files on top of it, and ran them. Removing it drops two rules:

1. **Fail-before-fix.** If a PR changed tests, those tests had to fail
against the base branch ("Changed tests passed against the base branch.
They should fail before the PR code is applied."). This rule goes.
2. **External contributors must add tests.** A PR from outside the org
(`AUTHOR_ASSOCIATION` not OWNER/MEMBER/COLLABORATOR) with no changed
test files failed. This rule goes.

A third rule stays: **a PR that changes `packages/deployer/` must also
change `e2e-tests/monorepo/`** (`packages/deployer/AGENTS.md` and
`CHANGELOG.md` exempt; the same-repo Changesets release PR skipped).
It's now `Deployer E2E coverage` in `prebuild.yml`: a `git diff
--name-only` against the merge base, no install or build. It's its own
job rather than a step in `changes`, because a failing `changes` job
would skip every test job. `packages/deployer/AGENTS.md` now names that
job.

## Why dropping 1 and 2 is acceptable

- Neither rule was enforced at merge time: the gate isn't a required
check. The required checks are `Lint` and `Unit and E2E Tests / Merge
Test Reports`, and this PR touches neither.
- Of the gate's last 1000 runs, 8 failed. All 8 were the fail-before-fix
rule firing on tests that passed without the fix; each PR resolved it by
rewriting its tests. Across 812 gate logs from Aug–Oct, every run that
executed tests took the passing path (changed tests failed against base,
as required). So it shaped how a few tests were written, but no run
showed it stopping broken code from merging.
- It costs a runner, a checkout and a test run on every non-draft PR, on
top of Prebuild running the same changed tests against the PR head.
- External contributions still go through maintainer review, which can
ask for tests.

## Test plan

- [x] `rg` for remaining references: only two "former" comments and an
unrelated fixture name
- [x] `pnpm install --frozen-lockfile` works after removing
`scripts/pr-test-gate` (192 projects)
- [x] Deployer check shell logic run locally under `bash -eo pipefail`
with a stubbed diff: deployer-only change fails with the annotation;
deployer + `e2e-tests/monorepo/` passes; `AGENTS.md`/`CHANGELOG.md`-only
passes; no deployer change passes
- [ ] CI on this PR: no Changed Test Gate check appears; `Deployer E2E
coverage` passes


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

<!-- coderabbit-ai-generated:v1 -->

## ELI5

This change removes the old system that checked whether pull requests
added and tested tests. It keeps one focused rule: changes to the
deployer package must include a monorepo E2E test change, with specified
documentation files exempt.

## Changes

- Deleted the Changed Test Gate workflow, its labeler workflow, and the
`scripts/pr-test-gate/` package.
- Added a separate `Deployer E2E coverage` job to Prebuild. The job
checks the merge-base diff and fails when a non-exempt file under
`packages/deployer/` changes without a file under `e2e-tests/monorepo/`.
- Exempted `packages/deployer/AGENTS.md` and
`packages/deployer/CHANGELOG.md` from the coverage check.
- Updated `packages/deployer/AGENTS.md` to refer to the Prebuild job.
- Updated comments in the memory simulation config and two test
link-provider files.

## Validation

The PR description reports that `pnpm install --frozen-lockfile`
succeeded across 192 projects and that the deployer-check shell logic
passed the listed local cases. CI validation is not confirmed: the
description says it is not yet known whether the old check disappears
and the new job passes.

<!-- end of auto-generated comment: release notes by coderabbit.ai -->

---------

Co-authored-by: remy-builder[bot] <324360501+remy-builder[bot]@users.noreply.github.com>
History 2026-11-05 19:42:33 +00:00
..
diff.test.ts feat(memory): add an observational memory replay simulator (#22058) 2026-08-31 14:32:38 -04:00
diff.ts feat(memory): add an observational memory replay simulator (#22058) 2026-08-31 14:32:38 -04:00
extract.test.ts feat(memory): add an observational memory replay simulator (#22058) 2026-08-31 14:32:38 -04:00
extract.ts feat(memory): add an observational memory replay simulator (#22058) 2026-08-31 14:32:38 -04:00
README.md Knowledge alpha: standalone Knowledge for agents, Subconscious removed (#28353) 2026-10-30 22:24:20 -07:00
reconstruct.test.ts feat(memory): add an observational memory replay simulator (#22058) 2026-08-31 14:32:38 -04:00
reconstruct.ts refactor(memory): curate observations directly in Subconscious (#22738) 2026-09-01 23:03:56 -07:00
vitest.config.ts ci: delete the Changed Test Gate (#29099) 2026-11-05 19:42:33 +00:00

Conversation simulation

Extract recorded Observational Memory generations into a local input database and reconstruct their observation-cycle boundaries.

Flow

  1. Extract copies a bounded set of threads, messages, and Observational Memory generations from a Mastra-schema Postgres database into a local input database. The source is opened read-only.
  2. Reconstruct rebuilds the recorded observation-cycle boundaries. It does not rerun the observer, so prompt changes cannot silently alter those boundaries.

Lifecycle ordering across sync, buffered, idle, and resource-scoped observation strategies is covered by the observation-strategy tests. This simulator starts at the already-completed observation boundary.

Extract

pnpm simulate:extract \
  --source "$SIMULATE_SOURCE_URL" \
  --target "postgres://user@127.0.0.1:55432/simulate_input" \
  --threads 5
Flag Meaning
--source <url> Required. Opened read-only; never written.
--target <url> Required. Must use a literal loopback address.
--threads <n> Most-recent N threads with an OM record.
--thread-id <id> Repeatable explicit IDs; mutually exclusive with --threads.

The final lines report EXTRACTED_THREADS=, EXTRACTED_MESSAGES=, and EXTRACTED_OM_RECORDS=.

Reconstruction boundaries

Generation-zero leading observation text is kept. Leading text on later generations is a reflection head and is excluded. Duplicate generations are rejected; missing generations, empty chunks, and unparseable dates are reported as warnings. Input reconstruction currently supports thread-scoped OM records only.