From a01e01d00712e9c957ba4e6566e0c8e8a9c05056 Mon Sep 17 00:00:00 2001 From: Claude Date: Thu, 30 Jul 2026 16:18:39 +0000 Subject: [PATCH] fix(cloud-connection): align the marketplace seed test's timeout with its sibling (#3785) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit marketplace-install-local-state-machine-exempt.test.ts failed under a full-repo `pnpm test` at 30s while passing every time the package ran alone. Both marketplace seed tests drive MarketplaceInstallLocalPlugin, whose seeding path dynamically imports the real @objectstack/runtime (unmocked on purpose, in both recordSeedSummary and mergeSeedDatasetsIntoKernel). That cold import costs seconds by itself and multiples of that under a fully parallel turbo run, and it is charged to whichever test triggers it first. The sibling marketplace-install-local-seed-lookup.test.ts was diagnosed as exactly this — "an import stall, not a hang" — and raised to 120s. This file was left at 30s and kept flaking the same way. The budget is now aligned, with the rationale stated locally instead of only in the sibling. The flaky set is exactly the intersection of "does not mock @objectstack/runtime" and "actually drives seeding": conflict, bundle no mock, but never reach the import default reseed, heal mock the module default seed-lookup no mock, seeds 120s (already) state-machine-exempt no mock, seeds 120s (here) So the two tests #3785 recorded are the only two that can hit this, and no other file needs the same treatment. Evidence this is a budget shortfall and not a race: the assertion passes (no missing seed rows), and under the same full-parallel load that produced the 30076ms failure the test now completes in 15696ms. Note that single pass alone does not prove the fix — 15.7s would have fit the old budget too. The argument is the ratio: a cost whose typical value is ~15s under load, and which has been observed above 30s, cannot live inside a 30s budget. 120s matches the sibling and leaves a genuine hang detectable, just later. Refs #3785 Co-Authored-By: Claude Opus 5 Claude-Session: https://claude.ai/code/session_014DQuJBNpwStpJvo3owBw2B --- .changeset/marketplace-seed-test-budget.md | 32 +++++++++++++++++++ ...install-local-state-machine-exempt.test.ts | 11 ++++++- 2 files changed, 42 insertions(+), 1 deletion(-) create mode 100644 .changeset/marketplace-seed-test-budget.md diff --git a/.changeset/marketplace-seed-test-budget.md b/.changeset/marketplace-seed-test-budget.md new file mode 100644 index 0000000000..d87b739d7f --- /dev/null +++ b/.changeset/marketplace-seed-test-budget.md @@ -0,0 +1,32 @@ +--- +"@objectstack/cloud-connection": patch +--- + +fix(cloud-connection): align the marketplace seed test's timeout with its sibling (#3785) + +`marketplace-install-local-state-machine-exempt.test.ts` failed under a +full-repo `pnpm test` at 30s, while passing every time the package ran alone. + +Both marketplace seed tests drive `MarketplaceInstallLocalPlugin`, whose +seeding path dynamically imports the real `@objectstack/runtime` (unmocked on +purpose, twice: `recordSeedSummary` and `mergeSeedDatasetsIntoKernel`). That +cold import costs seconds by itself and multiples of that under a fully +parallel turbo run, and it is charged to whichever test triggers it first. + +Its sibling `marketplace-install-local-seed-lookup.test.ts` was diagnosed as +exactly this — *"an import stall, not a hang"* — and raised to 120s. This file +was left at 30s and kept flaking the same way. The budget is now aligned, with +the rationale stated locally rather than only in the sibling. + +The flaky set turns out to be exactly the intersection of "does not mock +`@objectstack/runtime`" and "actually drives seeding": + +| test | mocks runtime | drives seeding | budget | +| :--- | :--- | :--- | :--- | +| `conflict`, `bundle` | no | **no** — never reaches the import | default | +| `reseed`, `heal` | **yes** | yes | default | +| `seed-lookup` | no | yes | 120s (already) | +| `state-machine-exempt` | no | yes | 120s (this change) | + +So the two tests #3785 recorded are the only two that can hit this, and no +other file needs the same treatment. A genuine hang still fails — later. diff --git a/packages/cloud-connection/src/marketplace-install-local-state-machine-exempt.test.ts b/packages/cloud-connection/src/marketplace-install-local-state-machine-exempt.test.ts index dbf1fe55a4..f31d232e7d 100644 --- a/packages/cloud-connection/src/marketplace-install-local-state-machine-exempt.test.ts +++ b/packages/cloud-connection/src/marketplace-install-local-state-machine-exempt.test.ts @@ -208,7 +208,16 @@ beforeEach(() => { dir = mkdtempSync(join(tmpdir(), 'mil-fsm-exempt-')); }); afterEach(() => { rmSync(dir, { recursive: true, force: true }); vi.restoreAllMocks(); }); describe('marketplace install — state_machine initialStates exemption (#3433)', () => { - it('lands every mid-lifecycle seed row (no initialStates rejection on the marketplace seam)', { timeout: 30_000 }, async () => { + // Same budget, same reason, as `marketplace-install-local-seed-lookup.test.ts` + // (#3785): both drive `MarketplaceInstallLocalPlugin`, whose install handler + // dynamically imports the real @objectstack/runtime (unmocked on purpose). + // That cold import costs seconds on its own and multiples of that under a + // fully parallel turbo run, where this file competes with every other + // package's suite for cores. The sibling was diagnosed as exactly this — + // "an import stall, not a hang" — and raised to 120s; this one was left at + // 30s and kept flaking the same way (observed again at 30076ms). A genuine + // hang still fails here, just later. + it('lands every mid-lifecycle seed row (no initialStates rejection on the marketplace seam)', { timeout: 120_000 }, async () => { const { engine, store, registry } = makeEngine(); const rawApp = makeRawApp(); const { ctx, fire } = makeCtx(rawApp, {