Files
PaperClipAI/scripts/__tests__
Dotta 8fabcfff30 Split oversized native-runtime integration tests for file-parallel CI (#22948)
## Thinking Path

> - Paperclip is the open source app people use to manage AI agents for
work.
> - The native-runtime integration test lane
(`general-server-native-runner`) runs real-process Vitest suites with
file parallelism enabled.
> - Three oversized files (`plugin-runner-eviction.integration.test.ts`
at 307s, `plugin-runner-release-resume.integration.test.ts` at 200s, and
`native-runner-restart-diskless.integration.test.ts` at 191s) exceed the
180s per-file budget and bound the entire lane wall-clock time because
shards cannot split a single file.
> - Each file runs parameterized test matrices serially inside one
Vitest worker while other workers sit idle.
> - This pull request moves each suite body into a shared helper under
`server/src/__tests__/helpers/` and splits the parameterized cases
across focused `.integration.test.ts` entrypoints, updating the suite
list, nightly manifest, duration manifest, and shard tests.
> - The benefit is cutting `Verify Paperclip Runner (vitest native
server)` wall-clock time from ~461s down to ~157s while keeping
identical test cases and assertions.

## Linked Issues or Issue Description

**What existing behavior does this improve?**
Execution time of the `general-server-native-runner` Vitest lane in PR
and release verification workflows.

**Subsystem affected**
server/ — REST API & orchestration services

**Current behavior**
Three parameterized integration test files exceed the 180s
`PAPERCLIP_CI_OVERSIZED_TEST_FILE_SECONDS` budget
(`plugin-runner-eviction.integration.test.ts` takes 307s,
`plugin-runner-release-resume.integration.test.ts` takes 200s, and
`native-runner-restart-diskless.integration.test.ts` takes 191s).
Because Vitest parallelizes across files, the slowest single file bounds
the entire lane to ~461s total job time.

**Proposed behavior**
Extract each suite body into `server/src/__tests__/helpers/` and run
disjoint slices of the exact same parameterized cases across focused
`.integration.test.ts` files so Vitest fork workers execute them
concurrently.

**Reason and benefit**
Cuts the `Verify Paperclip Runner (server-integration)` / `vitest native
server` CI lane by roughly 5 minutes (461s -> 157s measured in CI) with
zero change to test logic, timeouts, or assertions.

**Breaking changes**
None. All existing test cases remain covered in the same
`general-server-native-runner` group.

## What Changed

- Extracted `server/src/__tests__/helpers/plugin-runner-eviction.ts` and
split its 42 cases across 4 entrypoints by `(codex | claude) x (retired
| abrupt)`:
-
`server/src/services/native-runtime/plugin-runner-eviction-codex-retired.integration.test.ts`
(11 cases)
-
`server/src/services/native-runtime/plugin-runner-eviction-codex-abrupt.integration.test.ts`
(10 cases)
-
`server/src/services/native-runtime/plugin-runner-eviction-claude-retired.integration.test.ts`
(11 cases)
-
`server/src/services/native-runtime/plugin-runner-eviction-claude-abrupt.integration.test.ts`
(10 cases)
- Extracted
`server/src/__tests__/helpers/plugin-runner-release-resume.ts` and split
its 19 cases across 2 entrypoints:
-
`server/src/services/native-runtime/plugin-runner-release-resume-cached.integration.test.ts`
(8 cases)
-
`server/src/services/native-runtime/plugin-runner-release-resume-adopted.integration.test.ts`
(11 cases)
- Extracted
`server/src/__tests__/helpers/native-runner-restart-diskless.ts` and
split its 2 cases across 2 entrypoints with isolated embedded Postgres
comments:
-
`server/src/services/native-runtime/native-runner-restart-diskless-direct.integration.test.ts`
(`preparedTask: false`)
-
`server/src/services/native-runtime/native-runner-restart-diskless-prepared-task.integration.test.ts`
(`preparedTask: true`)
- Updated `scripts/run-vitest-stable.mjs`,
`scripts/ci/nightly-only-suites.json`,
`scripts/general-server-shard-durations.json`, and
`scripts/__tests__/run-vitest-stable-shard.test.mjs` to register the
split files and remove the three replaced paths.

## Verification

- `node --test scripts/check-test-budget.test.mjs
scripts/__tests__/run-vitest-stable-shard.test.mjs
scripts/__tests__/run-vitest-stable-pr-mode.test.mjs` (53/53 passed)
- `node scripts/check-test-budget.mjs --base origin/master` (passed)
- `ci / Verify Paperclip Runner (vitest native server)` passed in 157s
on this PR (down from 461s on master).

## Risks

- Low risk. Each entrypoint runs a disjoint, exhaustive slice of the
original parameterized matrix against the same helper implementation,
with no production code changes and no schema migrations.

## Model Used

- Google Gemini 3.1 Pro (thinking mode, tool use and code execution)

## Checklist

- [x] I have included a thinking path that traces from project context
to this change
- [x] I have specified the model used (with version and capability
details)
- [x] I have checked ROADMAP.md and confirmed this PR does not duplicate
planned core work
- [x] I have searched GitHub for duplicate or related PRs and linked
them above
- [x] I have either (a) linked existing issues with `Fixes: #` / `Closes
#` / `Refs #` OR (b) described the issue in-PR following the relevant
issue template
- [x] I have not referenced internal/instance-local Paperclip issues or
links (only public GitHub `#NNN` / `github.com/paperclipai/paperclip`
URLs)
- [x] My branch name describes the change (e.g. `docs/...`, `fix/...`)
and contains no internal Paperclip ticket id or instance-derived details
- [x] I have run tests locally and they pass
- [x] I have added or updated tests where applicable
- [x] I have updated relevant documentation to reflect my changes
- [x] I have considered and documented any risks above
- [ ] All Paperclip CI gates are green
- [ ] Greptile is 5/5 with no open P2s, recommendations, or follow-ups
- [x] I will address all Greptile and reviewer comments before
requesting merge
2026-11-25 10:27:26 -06:00
..