mirror of
https://github.com/paperclipai/paperclip.git
synced 2026-11-26 10:07:24 +01:00
## Thinking Path > - Paperclip is the open source app people use to manage AI agents for work > - Release and master verification run serialized server integration suites across sharded CI jobs (`release-verify.yml`) > - `server/src/__tests__/heartbeat-process-recovery.test.ts` (17,926 lines, 466 expanded tests) takes ~6m 28s in a single file, so Vitest cannot shard it across runners even with 9 serialized shards (#22946) > - Because one file sets a hard floor on the serialized verification lane, release readiness stays slower than necessary after every merge > - This pull request moves the shared suite body into `server/src/__tests__/heartbeat-process-recovery.helper.ts` with four disjoint `part` slices and adds four thin test entrypoints (`heartbeat-process-recovery-part-{1..4}.test.ts`) > - The benefit is balanced shard distribution across serialized runners, cutting the single-file serialized ceiling by ~4.5 minutes while keeping all 466 test cases intact ## Linked Issues or Issue Description Refs #22946 **Area** CI / Test Infrastructure **Current Behavior** `server/src/__tests__/heartbeat-process-recovery.test.ts` runs as a single 17,926-line Vitest file (~344s recorded, ~388s in recent release runs), bounding `Serialized tests` even across 9 shards. **Proposed Improvement** Partition the suite into four thin entrypoint files (`heartbeat-process-recovery-part-{1..4}.test.ts`) backed by a shared `heartbeat-process-recovery.helper.ts`, with measured proportional shard weights in `scripts/serialized-shard-durations.json` and `scripts/ci/nightly-only-suites.json`. **Motivation / Use Case** Shorten master and release verification wall-clock latency without dropping or weakening any recovery test coverage. ## What Changed - Renamed `server/src/__tests__/heartbeat-process-recovery.test.ts` to `server/src/__tests__/heartbeat-process-recovery.helper.ts` exporting `registerHeartbeatProcessRecoverySuite(part: 1 | 2 | 3 | 4)`, hoisting `withTempPaperclipHome` to shared scope, making `beforeAll`'s `authUsers` seed `.onConflictDoNothing()` for shared `PAPERCLIP_TEST_DATABASE_URL` safety, routing dynamic `run-dispatch` imports through `../modules/run-dispatch/index.js`, and updating the two stack-trace file-name assertions to `.helper.ts`. - Added four 3-line entrypoints: `server/src/__tests__/heartbeat-process-recovery-part-{1,2,3,4}.test.ts`. - Updated `scripts/run-vitest-stable.mjs`, `scripts/serialized-shard-durations.json`, and `scripts/ci/nightly-only-suites.json` with the four part paths and measured proportional shard weights (`88511`, `102168`, `72141`, `81197` ms; sum `344017` ms). - Updated `.github/workflows/runner-chaos-evals.yml` (with `--no-file-parallelism` to preserve serial execution in that job), `maps/feature-map/recovery.md`, `packages/paperclip-runner/spec/evals/stress-workflow-traceability.json`, and `scripts/ci/test-selection.integration.test.mjs`. ## Verification - Executed all four split suites locally via Vitest against embedded Postgres — **466/466 tests passed** (0 failed, 0 skipped): - `heartbeat-process-recovery-part-1.test.ts`: 116/116 passed (199.67s under 4-way local contention) - `heartbeat-process-recovery-part-2.test.ts`: 103/103 passed (230.48s) - `heartbeat-process-recovery-part-3.test.ts`: 87/87 passed (162.74s) - `heartbeat-process-recovery-part-4.test.ts`: 160/160 passed (183.17s) - Verified brace-depth exhaustiveness across `heartbeat-process-recovery.helper.ts`: 0 top-level `it`/`it.each`/`describe` blocks outside `if (part === N)` guards. - `node scripts/check-module-boundaries.mjs` — passed. - `node scripts/check-maps.mjs` — passed. - `node scripts/check-test-budget.mjs --base origin/master` — passed. - `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 scripts/ci/test-selection.integration.test.mjs` — passed. ## Risks - Low risk: test-only partition; zero production runtime files changed. - Adding a future test to `heartbeat-process-recovery.helper.ts` outside an `if (part === N)` guard would not register in any part; documented the placement rule directly on `registerHeartbeatProcessRecoverySuite`. ## Model Used - Google Gemini (Antigravity agent with 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) --------- Co-authored-by: Paperclip <noreply@paperclip.ing>
92 lines
4.0 KiB
YAML
92 lines
4.0 KiB
YAML
name: Runner Chaos Evals
|
|
|
|
on:
|
|
schedule:
|
|
- cron: "43 7 * * 0"
|
|
workflow_dispatch:
|
|
workflow_call:
|
|
inputs:
|
|
ref:
|
|
description: Commit SHA, branch, or tag to verify before release
|
|
required: false
|
|
type: string
|
|
|
|
concurrency:
|
|
# Reusable calls inherit the caller's workflow name. Cloud readiness and
|
|
# Release verify the same SHA independently and must not cancel each other.
|
|
group: runner-chaos-evals-${{ github.workflow }}-${{ inputs.ref || github.ref }}
|
|
cancel-in-progress: true
|
|
|
|
jobs:
|
|
chaos_and_recovery:
|
|
name: Restart, replay, trace, and recovery faults
|
|
runs-on: ${{ vars.AWS_POST_MERGE_CI_ENABLED == 'true' && github.run_attempt >= 1 && github.repository == 'paperclipai/paperclip' && github.repository_id == '1170821064' && github.ref == 'refs/heads/master' && (github.event_name == 'push' || github.event_name == 'workflow_dispatch') && github.sha != '' && inputs.ref == github.sha && 'runs-on/fleet=paperclip-post-merge-x64/env=public-ci' || 'ubuntu-latest' }}
|
|
timeout-minutes: ${{ vars.AWS_POST_MERGE_CI_ENABLED == 'true' && github.run_attempt >= 1 && github.repository == 'paperclipai/paperclip' && github.repository_id == '1170821064' && github.ref == 'refs/heads/master' && (github.event_name == 'push' || github.event_name == 'workflow_dispatch') && github.sha != '' && inputs.ref == github.sha && 40 || 45 }}
|
|
permissions:
|
|
contents: read
|
|
|
|
steps:
|
|
- name: Checkout repository
|
|
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7
|
|
with:
|
|
ref: ${{ inputs.ref || github.sha }}
|
|
|
|
- name: Setup pnpm
|
|
uses: pnpm/action-setup@0977fd99725f1db4007ccb2928dbb4e90d06cc86 # v6
|
|
with:
|
|
version: 9.15.4
|
|
|
|
- name: Setup Node.js
|
|
uses: actions/setup-node@820762786026740c76f36085b0efc47a31fe5020 # v7
|
|
with:
|
|
node-version: 24
|
|
cache: pnpm
|
|
|
|
- name: Install dependencies
|
|
run: pnpm install --no-frozen-lockfile
|
|
|
|
- name: Build eval and Runner contracts
|
|
run: |
|
|
pnpm --filter @paperclipai/paperclip-eval-kernel build
|
|
pnpm --filter @paperclipai/paperclip-runner report:runner-chaos-evals
|
|
|
|
- name: Build native Runner test binaries
|
|
run: pnpm --filter @paperclipai/paperclip-runner build:rust
|
|
|
|
- name: Run Runner fault and replay suites
|
|
run: |
|
|
pnpm --filter @paperclipai/paperclip-runner exec vitest run \
|
|
src/eval/workflow-evals.test.ts \
|
|
src/native-session-runtime.test.ts \
|
|
src/live/live-session.test.ts \
|
|
src/live/turn-stream.test.ts \
|
|
src/protocol/replay-contract.test.ts \
|
|
src/drivers/opencode/mcp-bridge.test.ts \
|
|
src/drivers/acpx/runtime-host.test.ts
|
|
|
|
- name: Build server test dependencies
|
|
run: pnpm --filter @paperclipai/plugin-sdk ensure-build-deps
|
|
|
|
- name: Run server finalization and recovery suites
|
|
run: |
|
|
pnpm --filter @paperclipai/server exec vitest run --no-file-parallelism \
|
|
src/__tests__/native-finalization-recovery.test.ts \
|
|
src/__tests__/heartbeat-process-recovery-part-1.test.ts \
|
|
src/__tests__/heartbeat-process-recovery-part-2.test.ts \
|
|
src/__tests__/heartbeat-process-recovery-part-3.test.ts \
|
|
src/__tests__/heartbeat-process-recovery-part-4.test.ts \
|
|
src/__tests__/heartbeat-comment-wake-batching.test.ts \
|
|
src/__tests__/heartbeat-dependency-scheduling.test.ts \
|
|
src/__tests__/provider-trace-store.test.ts \
|
|
src/services/issue-thread-interaction-resolution.test.ts \
|
|
src/services/recovery/successful-run-handoff.test.ts
|
|
|
|
- name: Upload chaos eval bundle
|
|
if: always()
|
|
uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7
|
|
with:
|
|
name: runner-chaos-evals-${{ github.run_id }}
|
|
path: packages/paperclip-runner/.paperclip-local/evals/workflows/
|
|
retention-days: 30
|
|
if-no-files-found: error
|