Skip to content

Garry's Opinionated OpenClaw/Hermes Agent Brain

TypeScript

ci(persistence): run the unit-lane PostgreSQL arms in 8 shards with measured weights

garrytan4e0378d08264
diff --git a/.github/workflows/persistence-validation.yml b/.github/workflows/persistence-validation.yml
index 4bcb814414..fc70a76453 100644
--- a/.github/workflows/persistence-validation.yml
+++ b/.github/workflows/persistence-validation.yml
@@ -178,17 +178,18 @@ jobs:
# unit lane). The list is test/postgres-unit-arms.txt;
# scripts/check-postgres-lane-coverage.ts fails a new DATABASE_URL-gated arm
# until it is listed there or wrapped in a test/e2e registerPostgresTests
- # file. The five shards are balanced by measured runtime
- # (scripts/postgres-arm-weights.json), sized so each shard's p95 test time
- # stays inside the step's 20 minutes on a runner up to 2x slower.
+ # file. The eight shards (ARM_SHARDS in scripts/postgres-unit-arms.ts) are
+ # balanced by measured runtime (scripts/postgres-arm-weights.json, mined from
+ # this job's logs); each shard's measured sum must stay well inside the
+ # step's 20 minutes (ARM_SHARD_BUDGET_MS).
unit-postgres-arms:
- name: Unit-lane PostgreSQL arms ${{ matrix.shard }}/5 / Bun ${{ matrix.bun }}
+ name: Unit-lane PostgreSQL arms ${{ matrix.shard }}/8 / Bun ${{ matrix.bun }}
runs-on: ubicloud-standard-4-ubuntu-2404
timeout-minutes: 30
strategy:
fail-fast: false
matrix:
- shard: [1, 2, 3, 4, 5]
+ shard: [1, 2, 3, 4, 5, 6, 7, 8]
bun: ['1.4.0', '1.4.3']
# Event parity: every event, pull requests and merge-queue runs
# included, runs both supported Bun versions (docs/TESTING.md#event-parity).
@@ -229,11 +230,11 @@ jobs:
receipts_init pg-arms || exit 2
# The list lives in test/postgres-unit-arms.txt (one path per line);
# shards balance by measured runtime (scripts/postgres-arm-weights.json).
- selected=$(bun scripts/postgres-unit-arms.ts shard "$SHARD" 5)
+ selected=$(bun scripts/postgres-unit-arms.ts shard "$SHARD" 8)
files=()
while IFS= read -r file; do [ -n "$file" ] && files+=("$file"); done <<< "$selected"
if [ "${#files[@]}" -eq 0 ]; then
- echo "::error::shard $SHARD/5 selected no files from test/postgres-unit-arms.txt. Why: an empty shard would pass without running any PostgreSQL arm. Fix: run 'bun scripts/postgres-unit-arms.ts shard $SHARD 5' locally and correct the list. Docs: docs/TESTING.md#postgres-arm-lanes" >&2
+ echo "::error::shard $SHARD/8 selected no files from test/postgres-unit-arms.txt. Why: an empty shard would pass without running any PostgreSQL arm. Fix: run 'bun scripts/postgres-unit-arms.ts shard $SHARD 8' locally and correct the list. Docs: docs/TESTING.md#postgres-arm-lanes" >&2
exit 1
fi
# One bun process per file: *.serial.test.ts files require their own
@@ -244,7 +245,7 @@ jobs:
failed=()
for file in "${files[@]}"; do
echo "::group::$file"
- receipt_begin primary "s$SHARD-$(basename "$file" .ts)" "$SHARD" 5 postgres "$file"
+ receipt_begin primary "s$SHARD-$(basename "$file" .ts)" "$SHARD" 8 postgres "$file"
rc=0
bun --no-env-file test --timeout=120000 ${RECEIPT_ARGS[@]+"${RECEIPT_ARGS[@]}"} "$file" || rc=$?
receipt_end "$rc"
diff --git a/docs/TESTING.md b/docs/TESTING.md
index bea95763a3..2ad4beac69 100644
--- a/docs/TESTING.md
+++ b/docs/TESTING.md
@@ -278,7 +278,12 @@ imports it (`registerPostgresTests`), a `tests/heavy/` script that names it,
or a row in `scripts/e2e-backend-matrix.txt`. Unit-lane files with no other
Postgres owner are listed in `test/postgres-unit-arms.txt`, read by
`persistence-validation.yml`'s `unit-postgres-arms` job (one Bun process per
-file), the [race hunt](#race-hunt) and the lane guard.
+file), the [race hunt](#race-hunt) and the lane guard. The job runs
+`ARM_SHARDS` (8) shards balanced by `scripts/postgres-arm-weights.json`,
+medians mined from the job's own logs with
+`bun scripts/postgres-unit-arms.ts mine <job logs>`; re-mine after adding heavy
+files. `test/scripts/postgres-unit-arms.test.ts` fails when a shard's weighted
+sum passes 80% of the step's 20-minute timeout.
`bun run check:postgres-lanes` (in `verify`) fails on every arm with no lane
and on a bad list row. An arm deliberately left out is an `ALLOWLIST` row in
`scripts/check-postgres-lane-coverage.ts` naming its reason and TODO; a row
diff --git a/scripts/postgres-arm-weights.json b/scripts/postgres-arm-weights.json
index a255f219c4..aeb449f366 100644
--- a/scripts/postgres-arm-weights.json
+++ b/scripts/postgres-arm-weights.json
@@ -1,208 +1,305 @@
{
- "test/activation-unbound-rooted-6449.test.ts": 6988,
- "test/alias-source-cascade-5094.test.ts": 16666,
- "test/attribution-backfill-history.test.ts": 25788,
- "test/backstop-same-page-shadow-managed-6333.test.ts": 7387,
- "test/behavior-change-notice.test.ts": 7392,
- "test/belief-ledger-coverage.test.ts": 126854,
- "test/belief-ledger-group.test.ts": 16434,
- "test/belief-ledger-identity.test.ts": 51738,
- "test/belief-ledger-lifecycle.test.ts": 51359,
- "test/belief-ledger-page-at-time.test.ts": 40050,
- "test/belief-ledger-privacy.test.ts": 23543,
- "test/belief-ledger-purge-review.test.ts": 132400,
- "test/belief-ledger-purge.test.ts": 82113,
- "test/belief-ledger-restore.test.ts": 137755,
- "test/belief-ledger-touched.test.ts": 35900,
- "test/belief-ledger-trust.test.ts": 15917,
- "test/belief-ledger-w5-time-model.test.ts": 10050,
- "test/belief-ledger-weekly-diff.test.ts": 62250,
- "test/belief-ledger-weekly-probes.test.ts": 26000,
- "test/capacity-bounded-read-6803.test.ts": 3000,
- "test/capture-consent-admission.test.ts": 10340,
- "test/capture-dispatch-provenance-6524.test.ts": 7890,
- "test/chronicle-backfill-max-usd.test.ts": 6426,
- "test/claude-cli-output-cap.test.ts": 6616,
- "test/colon-slug-windows-5032.test.ts": 8787,
- "test/company-brain-policy.test.ts": 15903,
- "test/company-brain-runtime.test.ts": 26974,
- "test/conversation-facts-oversized-sidecar.test.ts": 5184,
- "test/cycle/synthesize-concepts-merge.test.ts": 10502,
- "test/decide/conflict-proposals-managed.test.ts": 6815,
- "test/declared-lineage-visibility.test.ts": 6849,
- "test/derived-link-reconciliation.test.ts": 8003,
- "test/doctor-frontmatter-holds.test.ts": 11210,
- "test/doctor-image-embedding-coverage.test.ts": 6208,
- "test/doctor-keyword-plan-6495.test.ts": 4346,
- "test/doctor-routing-skill-pack-source.test.ts": 5763,
- "test/embed-stale-images-managed-6529.test.ts": 8584,
- "test/embedding-completion-atomic.serial.test.ts": 6798,
- "test/engine-sql-facts-keyset.test.ts": 6582,
- "test/extract-all-stamp-intersection.serial.test.ts": 9341,
- "test/extract-atoms-input-truncated-6503.test.ts": 12114,
- "test/extract-endpoint-revision.serial.test.ts": 9158,
- "test/extract-entities-managed.test.ts": 29072,
- "test/extract-timeline-from-meetings-managed.test.ts": 21187,
- "test/extraction-watermark-atoms.test.ts": 6351,
- "test/fact-fence-adoption-exits.test.ts": 26963,
- "test/fact-purge-lookup-timeout-6511.test.ts": 8682,
- "test/fence-repair-receipts.test.ts": 11974,
- "test/frontmatter-reserved-keys-6454.test.ts": 9760,
- "test/get-chunks-paging.test.ts": 6453,
- "test/graduation-copy.test.ts": 92395,
- "test/graduation-digest.test.ts": 3935,
- "test/graduation-drain.test.ts": 14809,
- "test/graduation-inventory.test.ts": 6326,
- "test/graduation-rollback.test.ts": 111365,
- "test/graduation-state.test.ts": 186463,
- "test/graduation-target.test.ts": 4130,
- "test/graduation-verify-sync-freshness.test.ts": 8934,
- "test/graduation-verify.test.ts": 25245,
- "test/grandfather-managed.test.ts": 55407,
- "test/harness-skills-epoch.test.ts": 4291,
- "test/held-read-signals.test.ts": 9120,
- "test/hold-action-chain-6712.test.ts": 40000,
- "test/import-frontmatter-key-order-5158.test.ts": 7496,
- "test/import-inline-chunk-keep.test.ts": 6570,
- "test/import-revision-concurrency.test.ts": 4485,
- "test/keyword-statement-timeout-knob-6495.test.ts": 13994,
- "test/lane-apply-pipelining.test.ts": 4014,
- "test/large-pages/chunk-visibility.test.ts": 7528,
- "test/large-pages/managed-streamed-import.test.ts": 38870,
- "test/large-pages/managed-sync-segmented-rename.test.ts": 16690,
- "test/large-pages/segment-vector-reuse.test.ts": 7486,
- "test/large-pages/segmented-body-unreachable.test.ts": 4675,
- "test/large-pages/segmented-derived-work.test.ts": 45646,
- "test/large-pages/segmented-embedding-paths.test.ts": 16576,
- "test/large-pages/segmented-embedding.test.ts": 8959,
- "test/large-pages/segmented-shrink-below-ceiling.test.ts": 67509,
- "test/large-pages/segmented-versions.test.ts": 9239,
- "test/link-cross-source.test.ts": 16240,
- "test/link-preparation-shared-index.test.ts": 13507,
- "test/links-attendance-blocked.test.ts": 9107,
- "test/managed-cycle-pull-upstream.test.ts": 9016,
- "test/managed-facts-withdrawal-recovery-6506.test.ts": 8291,
- "test/managed-facts-withdrawn-skip-6506.test.ts": 11603,
- "test/managed-lint.test.ts": 10341,
- "test/managed-maintenance-links.test.ts": 6276,
- "test/managed-sweep-corpus-windows.test.ts": 15047,
- "test/managed-sweep-refused-window-retry.test.ts": 11493,
- "test/managed-sweep-timeline.test.ts": 5607,
- "test/managed-sync-bulk.test.ts": 193028,
- "test/managed-sync-checkpoint-replaced.test.ts": 8941,
- "test/managed-sync-chunker-version.test.ts": 8968,
- "test/managed-sync-concurrent-write-hold.test.ts": 16198,
- "test/managed-sync-drain.test.ts": 10209,
- "test/managed-sync-foreground-priority.test.ts": 52904,
- "test/managed-sync-group-completion.test.ts": 11296,
- "test/managed-sync-group-uncommitted-head.test.ts": 18510,
- "test/managed-sync-images-5493.test.ts": 14953,
- "test/managed-sync-lanes.test.ts": 19286,
- "test/managed-sync-orphans-incarnation-6518.test.ts": 5169,
- "test/managed-sync-page-fault-holds.test.ts": 24587,
- "test/managed-sync-pinned-reads.test.ts": 29255,
- "test/managed-sync-preparation-stalled-holds.test.ts": 42860,
- "test/managed-sync-row-parity.test.ts": 11212,
- "test/managed-sync-stale-group-head.test.ts": 8122,
- "test/migration-persistence-request-slug-index.test.ts": 11093,
- "test/owner-refusal.test.ts": 6837,
- "test/pack-relation-direction-engine.test.ts": 7782,
- "test/page-embedding-budget.test.ts": 8388,
- "test/page-embedding-content-validity.test.ts": 6779,
- "test/page-embedding-install-batch.test.ts": 5564,
- "test/page-prepare-shared-origin-6517.test.ts": 17121,
- "test/page-purge-journal-timeout-6511.test.ts": 23239,
- "test/page-state-engine.test.ts": 6367,
- "test/persistence-background-pause.test.ts": 6386,
- "test/persistence-bounded-read-session.test.ts": 9664,
- "test/persistence-capacity-forecast.test.ts": 14088,
- "test/persistence-capacity-notices.test.ts": 7656,
- "test/persistence-commit-durability.test.ts": 6734,
- "test/persistence-deactivate.test.ts": 24753,
- "test/persistence-diagnostics.test.ts": 8770,
- "test/persistence-edit-embedding-reuse.test.ts": 6027,
- "test/persistence-embedding-noop-settle.test.ts": 10366,
- "test/persistence-file-import.test.ts": 37300,
- "test/persistence-git-subdir-origin.test.ts": 18315,
- "test/persistence-graph-publication.test.ts": 6258,
- "test/persistence-history-fixture.test.ts": 33255,
- "test/persistence-image-import.serial.test.ts": 8315,
- "test/persistence-import-batch.test.ts": 27787,
- "test/persistence-managed-lifecycle.test.ts": 21835,
- "test/persistence-managed-sync.test.ts": 88809,
- "test/persistence-manifest-git-scope.test.ts": 7881,
- "test/persistence-memory-mutations.test.ts": 13197,
- "test/persistence-page-authority.test.ts": 7632,
- "test/persistence-physical-root-device.test.ts": 7327,
- "test/persistence-preactivation-claim.test.ts": 12442,
- "test/persistence-publication-deadline.test.ts": 20426,
- "test/persistence-receipt-true-up.test.ts": 15138,
- "test/persistence-reconcile-git-dirty-6138.test.ts": 8445,
- "test/persistence-skill-bundles.serial.test.ts": 8866,
- "test/persistence-skill-crash.slow.test.ts": 43178,
- "test/persistence-skip-cost.test.ts": 7714,
- "test/persistence-sync-cursor-adoption.test.ts": 60388,
- "test/persistence-sync-cursor-options.test.ts": 11035,
- "test/persistence-sync-cursor-strategy-6696.test.ts": 11399,
- "test/persistence-sync-fence-holds.test.ts": 32583,
- "test/persistence-sync-holds.test.ts": 33680,
- "test/persistence-sync-lease.test.ts": 28063,
- "test/persistence-write-stall.test.ts": 6148,
- "test/persistence-writer-fences.test.ts": 6141,
- "test/physical-root-birth-tolerance-6501.test.ts": 13215,
- "test/purge-fact.test.ts": 9458,
- "test/purge-global-marker.test.ts": 6639,
- "test/recall-page-fill.test.ts": 18213,
- "test/remediation-manual-only.test.ts": 10764,
- "test/repair-apply-pending-6543.test.ts": 63980,
- "test/repair-embedding-effects.test.ts": 16658,
- "test/repair-failed-writes-conflict-6429.test.ts": 6471,
- "test/repair-failed-writes-drift-w411.test.ts": 7790,
- "test/repair-fences.test.ts": 22434,
- "test/repair-frontmatter-keys-sweep-6454.test.ts": 11598,
- "test/repair-frontmatter.test.ts": 25869,
- "test/repair-receipt-compaction.test.ts": 8748,
- "test/scripts/test-stress-postgres.test.ts": 12609,
- "test/search/page-rank-cut.test.ts": 12057,
- "test/search/rerank-gate-hybrid.test.ts": 11809,
- "test/search/rerank-gate-telemetry.test.ts": 5756,
- "test/shared-content-freshness.test.ts": 10820,
- "test/shared-skills-catalog.test.ts": 69953,
- "test/shared-skills-retention-capacity.test.ts": 7872,
- "test/shared-skills-source-opt-out.test.ts": 7528,
- "test/shared-skills-writer-boundary.test.ts": 31470,
- "test/source-retire-missing-checkout.test.ts": 5776,
- "test/source-row-diagnostics.test.ts": 4605,
- "test/stats-health-source-scope.test.ts": 3488,
- "test/sync-capacity-preflight.test.ts": 9493,
- "test/sync-drain-claims.test.ts": 16210,
- "test/sync-drain-head-blocked-6543.test.ts": 7583,
- "test/sync-drain-inpass-stall.test.ts": 6902,
- "test/sync-drain-write-capacity.test.ts": 11054,
- "test/sync-exits-l4-6712.test.ts": 15000,
- "test/sync-frontmatter-recovery.test.ts": 9314,
- "test/sync-frontmatter-slug-conflict.test.ts": 7546,
- "test/sync-full-cursor-slices-6349.test.ts": 19023,
- "test/sync-full-untracked-import-5459.test.ts": 10408,
- "test/sync-group-member-order.test.ts": 10911,
- "test/sync-handler-drain-6706.test.ts": 34366,
- "test/sync-import-provenance-disk.test.ts": 12766,
- "test/sync-legacy-holds.test.ts": 13590,
- "test/sync-legacy-retry-actions-6696.test.ts": 9241,
- "test/sync-origin-live-wins-6517.test.ts": 6075,
- "test/sync-prescreen-drift-6712.test.ts": 93074,
- "test/sync-slug-root-mode-6694.test.ts": 16023,
- "test/sync-staged-catchup.test.ts": 11428,
- "test/sync-status-failure-detail-6513.test.ts": 5932,
- "test/sync-waiver-budget.test.ts": 9112,
- "test/sync-waiver-run-imports.test.ts": 16156,
- "test/takes-vector-lifecycle-5885.serial.test.ts": 12541,
- "test/terminal-failures-6650.test.ts": 17078,
- "test/trust-channel-writes.test.ts": 12183,
- "test/trust-guarded-supersession.test.ts": 12870,
- "test/trust-owner-actions.test.ts": 13005,
- "test/unbound-source-6536.test.ts": 7861,
- "test/withdrawal-overlay-concurrency.test.ts": 5602,
- "test/withdrawal-publication-file.test.ts": 7149,
- "test/writer-status-owner-backends.test.ts": 5086
+ "test/activation-unbound-rooted-6449.test.ts": 6916,
+ "test/alias-source-cascade-5094.test.ts": 12843,
+ "test/attribution-backfill-history.test.ts": 29993,
+ "test/backstop-same-page-shadow-managed-6333.test.ts": 8364,
+ "test/behavior-change-notice.test.ts": 5717,
+ "test/belief-ledger-coverage.test.ts": 172566,
+ "test/belief-ledger-group.test.ts": 23278,
+ "test/belief-ledger-identity.test.ts": 51297,
+ "test/belief-ledger-lifecycle.test.ts": 49392,
+ "test/belief-ledger-page-at-time.test.ts": 70804,
+ "test/belief-ledger-privacy.test.ts": 19637,
+ "test/belief-ledger-purge-review.test.ts": 179944,
+ "test/belief-ledger-purge.test.ts": 94113,
+ "test/belief-ledger-restore.test.ts": 127424,
+ "test/belief-ledger-touched.test.ts": 40421,
+ "test/belief-ledger-trust.test.ts": 15569,
+ "test/belief-ledger-w5-time-model.test.ts": 21908,
+ "test/belief-ledger-weekly-diff.test.ts": 90910,
+ "test/belief-ledger-weekly-probes.test.ts": 31452,
+ "test/capacity-bounded-read-6803.test.ts": 10729,
+ "test/capture-consent-admission.test.ts": 9738,
+ "test/capture-dispatch-provenance-6524.test.ts": 5310,
+ "test/chronicle-backfill-max-usd.test.ts": 5329,
+ "test/claim-fifo-foreground-waiting.test.ts": 5109,
+ "test/claim-lease-holder-only-6712.test.ts": 5122,
+ "test/claude-cli-output-cap.test.ts": 4782,
+ "test/colon-slug-windows-5032.test.ts": 6490,
+ "test/company-brain-policy.test.ts": 11940,
+ "test/company-brain-runtime.test.ts": 24708,
+ "test/conversation-facts-oversized-sidecar.test.ts": 5854,
+ "test/cycle/synthesize-concepts-merge.test.ts": 8443,
+ "test/decide/conflict-proposals-managed.test.ts": 7564,
+ "test/declared-lineage-visibility.test.ts": 7191,
+ "test/derived-link-reconciliation.test.ts": 7254,
+ "test/doctor-frontmatter-holds.test.ts": 12737,
+ "test/doctor-image-embedding-coverage.test.ts": 4230,
+ "test/doctor-keyword-plan-6495.test.ts": 3777,
+ "test/doctor-routing-skill-pack-source.test.ts": 6141,
+ "test/doctor-sync-freshness-skill-pack-6076.test.ts": 5131,
+ "test/embed-stale-images-managed-6529.test.ts": 7363,
+ "test/embedding-completion-atomic.serial.test.ts": 7292,
+ "test/engine-sql-facts-keyset.test.ts": 5280,
+ "test/extract-all-stamp-intersection.serial.test.ts": 9066,
+ "test/extract-atoms-input-truncated-6503.test.ts": 12337,
+ "test/extract-endpoint-revision.serial.test.ts": 6906,
+ "test/extract-entities-managed.test.ts": 21309,
+ "test/extract-timeline-from-meetings-managed.test.ts": 16836,
+ "test/extraction-watermark-atoms.test.ts": 5115,
+ "test/fact-fence-adoption-exits.test.ts": 22470,
+ "test/fact-purge-lookup-timeout-6511.test.ts": 5982,
+ "test/fence-repair-receipts.test.ts": 13524,
+ "test/frontmatter-reserved-keys-6454.test.ts": 6193,
+ "test/get-chunks-paging.test.ts": 5648,
+ "test/graduation-copy.test.ts": 76246,
+ "test/graduation-digest.test.ts": 2430,
+ "test/graduation-drain.test.ts": 10681,
+ "test/graduation-inventory.test.ts": 5039,
+ "test/graduation-rollback.test.ts": 95894,
+ "test/graduation-state.test.ts": 148972,
+ "test/graduation-target.test.ts": 3523,
+ "test/graduation-verify-sync-freshness.test.ts": 7029,
+ "test/graduation-verify.test.ts": 16144,
+ "test/grandfather-managed.test.ts": 54013,
+ "test/harness-skills-epoch.test.ts": 3207,
+ "test/held-read-signals.test.ts": 9918,
+ "test/hold-action-chain-6712.test.ts": 20219,
+ "test/import-frontmatter-key-order-5158.test.ts": 4679,
+ "test/import-inline-chunk-keep.test.ts": 5647,
+ "test/import-revision-concurrency.test.ts": 4900,
+ "test/keyword-statement-timeout-knob-6495.test.ts": 13000,
+ "test/keyword-timeout-negative-cache-6495.test.ts": 4985,
+ "test/lane-apply-pipelining.test.ts": 3502,
+ "test/large-pages/chunk-retirement-plan.test.ts": 6298,
+ "test/large-pages/chunk-visibility.test.ts": 5277,
+ "test/large-pages/contextual-reembed-segmented.test.ts": 7070,
+ "test/large-pages/credential-reseal-segments.test.ts": 7882,
+ "test/large-pages/doctor-skipped-segmented.test.ts": 15705,
+ "test/large-pages/forget-reason-segmented.test.ts": 8000,
+ "test/large-pages/forget-scope.test.ts": 19427,
+ "test/large-pages/gbra117-segmented-classes-window.test.ts": 54177,
+ "test/large-pages/held-budget-count-list.test.ts": 10775,
+ "test/large-pages/held-budget-shrink.test.ts": 14124,
+ "test/large-pages/managed-import-outside-root.test.ts": 21093,
+ "test/large-pages/managed-links-timeline-heap.test.ts": 27916,
+ "test/large-pages/managed-streamed-import.test.ts": 44064,
+ "test/large-pages/managed-sync-segmented-rename.test.ts": 18998,
+ "test/large-pages/managed-sync-streamed.test.ts": 120084,
+ "test/large-pages/oversized-backfill-segmented.test.ts": 5523,
+ "test/large-pages/page-purge-segments.test.ts": 31638,
+ "test/large-pages/pinned-segmented-reads.test.ts": 33363,
+ "test/large-pages/projection-demotion-race.test.ts": 6071,
+ "test/large-pages/projection-parity.test.ts": 45132,
+ "test/large-pages/purge-fact-inflight-staging.test.ts": 12694,
+ "test/large-pages/purge-fact-segmented-preimage.test.ts": 22919,
+ "test/large-pages/purge-inflight-create.test.ts": 9987,
+ "test/large-pages/purge-replay-segments.test.ts": 8948,
+ "test/large-pages/purge-segment-residue.test.ts": 5805,
+ "test/large-pages/purge-segmented-versions-batch.test.ts": 8261,
+ "test/large-pages/purge-segments.test.ts": 13531,
+ "test/large-pages/recovery-budget-ceiling.slow.test.ts": 162951,
+ "test/large-pages/recovery-budget-default.test.ts": 3554,
+ "test/large-pages/remote-get-page-privacy.test.ts": 62014,
+ "test/large-pages/remote-versions-storage-change.test.ts": 6694,
+ "test/large-pages/remote-window-privacy.test.ts": 65750,
+ "test/large-pages/restore-deferred-retire.test.ts": 28820,
+ "test/large-pages/restore-segmented-reprojects.test.ts": 71842,
+ "test/large-pages/sealed-segmented-search.test.ts": 12746,
+ "test/large-pages/second-write-deferred-retire.test.ts": 11177,
+ "test/large-pages/segment-rewrite-cr-tier.test.ts": 10021,
+ "test/large-pages/segment-vector-reuse.test.ts": 3780,
+ "test/large-pages/segmented-append-reembed.test.ts": 8848,
+ "test/large-pages/segmented-body-unreachable.test.ts": 4758,
+ "test/large-pages/segmented-bom.test.ts": 17008,
+ "test/large-pages/segmented-conversation-facts.test.ts": 32849,
+ "test/large-pages/segmented-conversation-sidecar-token.test.ts": 25115,
+ "test/large-pages/segmented-core-list.test.ts": 32775,
+ "test/large-pages/segmented-create-searchable.test.ts": 24171,
+ "test/large-pages/segmented-delete-crash.slow.test.ts": 58656,
+ "test/large-pages/segmented-delete-restore-file.slow.test.ts": 115593,
+ "test/large-pages/segmented-delete-stage-crash.slow.test.ts": 142772,
+ "test/large-pages/segmented-derived-parity.test.ts": 15691,
+ "test/large-pages/segmented-derived-passes.test.ts": 18580,
+ "test/large-pages/segmented-derived-work.test.ts": 67171,
+ "test/large-pages/segmented-embedding-paths.test.ts": 22698,
+ "test/large-pages/segmented-embedding.test.ts": 4335,
+ "test/large-pages/segmented-evidence-read-cost.test.ts": 32368,
+ "test/large-pages/segmented-evidence.test.ts": 49244,
+ "test/large-pages/segmented-extraction-stale.test.ts": 9820,
+ "test/large-pages/segmented-facts-forced-lines.test.ts": 14707,
+ "test/large-pages/segmented-facts-reconcile.test.ts": 81083,
+ "test/large-pages/segmented-file-drift-ledger.test.ts": 28626,
+ "test/large-pages/segmented-file-drift.test.ts": 94460,
+ "test/large-pages/segmented-forced-cuts.test.ts": 64597,
+ "test/large-pages/segmented-frontmatter-reimport.test.ts": 35454,
+ "test/large-pages/segmented-get-cli.test.ts": 24645,
+ "test/large-pages/segmented-get-page-parity.test.ts": 16639,
+ "test/large-pages/segmented-leads.test.ts": 16471,
+ "test/large-pages/segmented-loser-chunks.test.ts": 8580,
+ "test/large-pages/segmented-maintenance-commands.test.ts": 12884,
+ "test/large-pages/segmented-prior-view.test.ts": 14574,
+ "test/large-pages/segmented-read-refusals.test.ts": 9718,
+ "test/large-pages/segmented-real-size.slow.test.ts": 60327,
+ "test/large-pages/segmented-remember-refusal.test.ts": 27615,
+ "test/large-pages/segmented-repair-scans.test.ts": 14603,
+ "test/large-pages/segmented-search-dedup.test.ts": 10496,
+ "test/large-pages/segmented-semantic-writes-near-ceiling.slow.test.ts": 137063,
+ "test/large-pages/segmented-semantic-writes.test.ts": 87619,
+ "test/large-pages/segmented-shrink-below-ceiling.test.ts": 55616,
+ "test/large-pages/segmented-storage-visibility.test.ts": 19595,
+ "test/large-pages/segmented-sweep-deferral.test.ts": 14428,
+ "test/large-pages/segmented-switch.test.ts": 24070,
+ "test/large-pages/segmented-think-compile-leads.serial.test.ts": 15040,
+ "test/large-pages/segmented-timeline-heap.test.ts": 65737,
+ "test/large-pages/segmented-versions.test.ts": 6439,
+ "test/large-pages/segmented-withdrawn-fence-delete.test.ts": 49155,
+ "test/large-pages/streamed-import-drift.test.ts": 31552,
+ "test/large-pages/v251-master-reader-compat.test.ts": 6029,
+ "test/link-cross-source.test.ts": 11815,
+ "test/link-preparation-shared-index.test.ts": 8386,
+ "test/links-attendance-blocked.test.ts": 5638,
+ "test/managed-cycle-pull-upstream.test.ts": 8241,
+ "test/managed-facts-withdrawal-recovery-6506.test.ts": 8424,
+ "test/managed-facts-withdrawn-skip-6506.test.ts": 5731,
+ "test/managed-lint.test.ts": 10941,
+ "test/managed-maintenance-links.test.ts": 5512,
+ "test/managed-sweep-corpus-windows.test.ts": 7235,
+ "test/managed-sweep-refused-window-retry.test.ts": 12002,
+ "test/managed-sweep-timeline.test.ts": 5169,
+ "test/managed-sync-blocked-job-6858.test.ts": 6618,
+ "test/managed-sync-bulk.test.ts": 191348,
+ "test/managed-sync-checkpoint-replaced.test.ts": 7881,
+ "test/managed-sync-chunker-version.test.ts": 6028,
+ "test/managed-sync-concurrent-write-hold.test.ts": 15377,
+ "test/managed-sync-connection-loss.test.ts": 11834,
+ "test/managed-sync-drain.test.ts": 6617,
+ "test/managed-sync-foreground-priority.test.ts": 65410,
+ "test/managed-sync-gate-markers-6858.test.ts": 5954,
+ "test/managed-sync-group-completion.test.ts": 9385,
+ "test/managed-sync-group-uncommitted-head.test.ts": 17335,
+ "test/managed-sync-images-5493.test.ts": 9929,
+ "test/managed-sync-keep-disk-6858.test.ts": 26580,
+ "test/managed-sync-lanes.test.ts": 23604,
+ "test/managed-sync-orphans-incarnation-6518.test.ts": 5090,
+ "test/managed-sync-page-fault-holds.test.ts": 29063,
+ "test/managed-sync-pinned-reads.test.ts": 31607,
+ "test/managed-sync-preparation-stalled-holds.test.ts": 42263,
+ "test/managed-sync-row-parity.test.ts": 11180,
+ "test/managed-sync-stale-group-head.test.ts": 3609,
+ "test/migration-persistence-request-id-index.test.ts": 7905,
+ "test/migration-persistence-request-slug-index.test.ts": 6982,
+ "test/on-commit-embedding.serial.test.ts": 10795,
+ "test/owner-refusal.test.ts": 4683,
+ "test/pack-relation-direction-engine.test.ts": 8201,
+ "test/page-embedding-budget.test.ts": 6525,
+ "test/page-embedding-content-validity.test.ts": 6374,
+ "test/page-embedding-install-batch.test.ts": 5520,
+ "test/page-prepare-shared-origin-6517.test.ts": 12181,
+ "test/page-purge-journal-timeout-6511.test.ts": 23417,
+ "test/page-state-engine.test.ts": 4804,
+ "test/persistence-background-pause.test.ts": 6793,
+ "test/persistence-bounded-read-session.test.ts": 6002,
+ "test/persistence-capacity-forecast.test.ts": 9504,
+ "test/persistence-capacity-notices.test.ts": 5975,
+ "test/persistence-commit-durability.test.ts": 5391,
+ "test/persistence-deactivate.test.ts": 21568,
+ "test/persistence-diagnostics.test.ts": 5066,
+ "test/persistence-edit-embedding-reuse.test.ts": 7063,
+ "test/persistence-embedding-noop-settle.test.ts": 7906,
+ "test/persistence-file-import.test.ts": 29242,
+ "test/persistence-git-subdir-origin.test.ts": 12875,
+ "test/persistence-graph-publication.test.ts": 5611,
+ "test/persistence-history-fixture.test.ts": 32670,
+ "test/persistence-image-import.serial.test.ts": 5845,
+ "test/persistence-import-batch.test.ts": 23769,
+ "test/persistence-managed-lifecycle.test.ts": 17019,
+ "test/persistence-managed-sync.test.ts": 81036,
+ "test/persistence-manifest-git-scope.test.ts": 5251,
+ "test/persistence-memory-mutations.test.ts": 13438,
+ "test/persistence-page-authority.test.ts": 5700,
+ "test/persistence-physical-root-device.test.ts": 5704,
+ "test/persistence-preactivation-claim.test.ts": 9660,
+ "test/persistence-publication-deadline.test.ts": 22070,
+ "test/persistence-receipt-true-up.test.ts": 10110,
+ "test/persistence-reconcile-git-dirty-6138.test.ts": 4718,
+ "test/persistence-skill-bundles.serial.test.ts": 6341,
+ "test/persistence-skill-crash.slow.test.ts": 42237,
+ "test/persistence-skip-cost.test.ts": 6680,
+ "test/persistence-sync-cursor-adoption.test.ts": 61803,
+ "test/persistence-sync-cursor-options.test.ts": 7183,
+ "test/persistence-sync-cursor-strategy-6696.test.ts": 9025,
+ "test/persistence-sync-fence-holds.test.ts": 24290,
+ "test/persistence-sync-holds.test.ts": 26148,
+ "test/persistence-sync-lease.test.ts": 29136,
+ "test/persistence-write-stall.test.ts": 5169,
+ "test/persistence-writer-fences.test.ts": 5677,
+ "test/physical-root-birth-tolerance-6501.test.ts": 7970,
+ "test/purge-fact.test.ts": 9046,
+ "test/purge-global-marker.test.ts": 5759,
+ "test/purge-read-surfaces.test.ts": 15571,
+ "test/recall-page-fill.test.ts": 11301,
+ "test/remediation-manual-only.test.ts": 8890,
+ "test/repair-apply-pending-6543.test.ts": 55429,
+ "test/repair-embedding-effects.test.ts": 9807,
+ "test/repair-failed-writes-conflict-6429.test.ts": 8164,
+ "test/repair-failed-writes-drift-w411.test.ts": 6924,
+ "test/repair-fences.test.ts": 30142,
+ "test/repair-file-drift-deleted-6712.test.ts": 12523,
+ "test/repair-frontmatter-keys-sweep-6454.test.ts": 10005,
+ "test/repair-frontmatter.test.ts": 19966,
+ "test/repair-receipt-compaction.test.ts": 6534,
+ "test/scripts/test-stress-postgres.test.ts": 11753,
+ "test/search/page-rank-cut.test.ts": 12393,
+ "test/search/rerank-gate-hybrid.test.ts": 5815,
+ "test/search/rerank-gate-telemetry.test.ts": 5472,
+ "test/serve-head-watcher-managed.serial.test.ts": 7695,
+ "test/shared-content-freshness.test.ts": 5784,
+ "test/shared-skills-catalog.test.ts": 67000,
+ "test/shared-skills-retention-capacity.test.ts": 4750,
+ "test/shared-skills-source-opt-out.test.ts": 5259,
+ "test/shared-skills-writer-boundary.test.ts": 14123,
+ "test/source-retire-missing-checkout.test.ts": 4976,
+ "test/source-row-diagnostics.test.ts": 5411,
+ "test/stats-health-source-scope.test.ts": 5403,
+ "test/sync-capacity-preflight.test.ts": 6128,
+ "test/sync-checkpoint-moved-6834.test.ts": 16017,
+ "test/sync-drain-claims.test.ts": 12917,
+ "test/sync-drain-effect-recovery-blocked.test.ts": 7945,
+ "test/sync-drain-head-blocked-6543.test.ts": 6739,
+ "test/sync-drain-inpass-stall.test.ts": 5643,
+ "test/sync-drain-write-capacity.test.ts": 7263,
+ "test/sync-exits-l4-6712.test.ts": 9448,
+ "test/sync-freshness-6858.test.ts": 6665,
+ "test/sync-frontmatter-recovery.test.ts": 4538,
+ "test/sync-frontmatter-slug-conflict.test.ts": 5344,
+ "test/sync-full-cursor-slices-6349.test.ts": 13560,
+ "test/sync-full-untracked-import-5459.test.ts": 11074,
+ "test/sync-group-member-order.test.ts": 11977,
+ "test/sync-handler-drain-6706.test.ts": 30787,
+ "test/sync-import-provenance-disk.test.ts": 9977,
+ "test/sync-inexact-rename-6729.test.ts": 28197,
+ "test/sync-legacy-holds.test.ts": 13719,
+ "test/sync-legacy-retry-actions-6696.test.ts": 9536,
+ "test/sync-legacy-slug-adoption-6727.test.ts": 12865,
+ "test/sync-origin-live-wins-6517.test.ts": 5129,
+ "test/sync-prescreen-both-delta-6712.test.ts": 21329,
+ "test/sync-prescreen-drift-6712.test.ts": 73377,
+ "test/sync-slug-root-mode-6694.test.ts": 11415,
+ "test/sync-staged-catchup.test.ts": 9704,
+ "test/sync-status-failure-detail-6513.test.ts": 5317,
+ "test/sync-waiver-budget.test.ts": 7073,
+ "test/sync-waiver-run-imports.test.ts": 12215,
+ "test/take-resolution-survives-publish.test.ts": 4251,
+ "test/takes-vector-lifecycle-5885.serial.test.ts": 12108,
+ "test/terminal-failures-6650.test.ts": 14924,
+ "test/trust-channel-writes.test.ts": 13149,
+ "test/trust-guarded-supersession.test.ts": 12700,
+ "test/trust-held-removals.test.ts": 13717,
+ "test/trust-owner-actions.test.ts": 9971,
+ "test/unbound-source-6536.test.ts": 6346,
+ "test/unindexed-files.test.ts": 15325,
+ "test/withdrawal-overlay-concurrency.test.ts": 4717,
+ "test/withdrawal-publication-file.test.ts": 6562,
+ "test/writer-status-owner-backends.test.ts": 6336
}
diff --git a/scripts/postgres-unit-arms.ts b/scripts/postgres-unit-arms.ts
index 26acdb433d..0db8b99301 100644
--- a/scripts/postgres-unit-arms.ts
+++ b/scripts/postgres-unit-arms.ts
@@ -18,6 +18,10 @@ import { loadWeights, partition } from './sharding.ts';
export const ARMS_LIST = 'test/postgres-unit-arms.txt';
export const ARM_WEIGHTS = 'scripts/postgres-arm-weights.json';
+/** persistence-validation's unit-postgres-arms matrix size; test/scripts/postgres-unit-arms.test.ts pins the workflow to it. */
+export const ARM_SHARDS = 8;
+/** The workflow step's `timeout-minutes: 20`: a shard whose files run longer is cut off mid-list. */
+export const ARM_SHARD_BUDGET_MS = 20 * 60 * 1000;
const DOCS = 'docs/TESTING.md#postgres-arm-lanes';
const PATH_RE = /^test\/[\w./-]+\.test\.ts$/;
diff --git a/test/scripts/postgres-unit-arms.test.ts b/test/scripts/postgres-unit-arms.test.ts
index 3bdb19c70a..e647a03b3d 100644
--- a/test/scripts/postgres-unit-arms.test.ts
+++ b/test/scripts/postgres-unit-arms.test.ts
@@ -6,8 +6,10 @@
*/
import { describe, expect, test } from 'bun:test';
import { spawnSync } from 'node:child_process';
+import { readFileSync } from 'node:fs';
import { join } from 'node:path';
-import { mineArmWeights, parseArmsList, readArmsList } from '../../scripts/postgres-unit-arms.ts';
+import { ARM_SHARD_BUDGET_MS, ARM_SHARDS, ARM_WEIGHTS, mineArmWeights, parseArmsList, readArmsList } from '../../scripts/postgres-unit-arms.ts';
+import { computeQuantile, loadWeights, partition } from '../../scripts/sharding.ts';
const REPO = join(import.meta.dir, '..', '..');
const cli = (...args: string[]) => spawnSync(process.execPath, [join(REPO, 'scripts', 'postgres-unit-arms.ts'), ...args], { encoding: 'utf8', cwd: REPO });
@@ -27,6 +29,24 @@ describe('postgres-unit-arms list', () => {
expect(shards.every(s => s.length > 0)).toBe(true);
});
+ test('the workflow runs ARM_SHARDS shards inside the ARM_SHARD_BUDGET_MS step timeout', () => {
+ const workflow = readFileSync(join(REPO, '.github', 'workflows', 'persistence-validation.yml'), 'utf8');
+ const job = workflow.slice(workflow.indexOf(' unit-postgres-arms:'), workflow.indexOf('\n invariants:'));
+ const shards = Array.from({ length: ARM_SHARDS }, (_, i) => i + 1);
+ expect(job).toContain(`shard: [${shards.join(', ')}]`);
+ expect(job).toContain(`Unit-lane PostgreSQL arms \${{ matrix.shard }}/${ARM_SHARDS}`);
+ expect(job).toContain(`postgres-unit-arms.ts shard "$SHARD" ${ARM_SHARDS})`);
+ expect(job).toMatch(new RegExp(`- name: Require PostgreSQL arms of unit-lane suites\\n\\s+timeout-minutes: ${ARM_SHARD_BUDGET_MS / 60_000}\\n`));
+ });
+
+ test('every CI shard\'s measured weight leaves a fifth of the step budget as headroom', () => {
+ const files = readArmsList(REPO).files;
+ const weights = loadWeights(join(REPO, ARM_WEIGHTS));
+ const p75 = computeQuantile(files.filter(f => weights.has(f)).map(f => weights.get(f)!), 0.75);
+ const sums = partition(files, weights, ARM_SHARDS).map(shard => shard.reduce((ms, f) => ms + (weights.get(f) ?? p75), 0));
+ expect(sums.filter(ms => ms > ARM_SHARD_BUDGET_MS * 0.8)).toEqual([]);
+ });
+
test('comments and blank lines are ignored; a new path is a one-line edit', () => {
expect(parseArmsList('# header\n\ntest/a.test.ts\ntest/b/c.serial.test.ts\n')).toEqual({ files: ['test/a.test.ts', 'test/b/c.serial.test.ts'], errors: [] });
});