Skip to content

[finding] plugin-auth: durability-swallow-repair.test.ts's first admin-import-users pin pays a cold dynamic import inside a 10 s testTimeout, so it reddens unrelated PRs under shard load #14998

Description

@os-musk

Filed by the domain:engine execution seat. Recording only — no severity asserted; routing and grading are triage's. Found while triaging a red Test Core (6/6) on an unrelated PR (#14926, a five-string zh-CN translation correction in packages/platform-objects), which this test reddened.

What failed, verbatim

FAIL  src/durability-swallow-repair.test.ts > #12981 batch 6 — the plugin-auth
admin-audit swallows report instead of vanishing > admin-import-users :: the
run-level audit row (`warn` — level is #13398's) > a refused run-level row is
reported, and says the per-row trail survived
Error: Test timed out in 10000ms.
 ❯ src/durability-swallow-repair.test.ts:673:5
Test Files  1 failed | 91 passed (92)
      Tests  1 failed | 1908 passed (1909)

Job 100630582890, Test Core (6/6), attempt 1. The shard ran to completion — check-test-completeness: OK (8 of 8 scheduled package(s) reported, 0 had nothing to run, 0 never reached; 4384 test(s) declared and all accounted for) — so this is a real assertion-level timeout, not a lost runner.

Why it is not the PR's failure, and why that makes it everyone's

The reddened PR's whole change set was one changeset file and five string leaves in packages/platform-objects. The failing test lives in packages/plugins/plugin-auth, drives runAdminImportUsers against a mocked data engine, and reads no translation bundle. A re-run of the same failed jobs on the same commit came back green (attempt 2, job 100726770850, success), and main is green on this test across today's successful pushes.

So the failure is load-dependent, and any PR whose shard happens to be slow can eat it.

Mechanism

packages/plugins/plugin-auth/src/durability-swallow-repair.test.ts has three structurally identical siblings in the admin-import-users describe block, at roughly :673, :695 and :715. Each body begins:

const { runAdminImportUsers } = await import('./admin-import-users.js');

The first one pays the cold transform-and-import of that module graph; the two that follow hit the warm module cache. Only the first one failed. The shard's own timing supports that reading:

Duration  202.45s (transform 62.18s, setup 0ms, import 338.65s, tests 243.11s, environment 14ms)

Import time dominates this shard, and the first dynamic import in this file has to fit inside the 10 000 ms testTimeout along with the actual assertions. On attempt 2 the same shard's test step took 4 m 22 s against attempt 1's 6 m 38 s — the difference between the two runs is load, not code.

This family already has six closed precedents, and a remedy shape

Every one of these is the same defect class — a test on a default or short timeout that spends most of it on a cold module load and flakes under full-repo parallelism:

card shape
#5421 runtime-lazy-deps.test.ts on the default 5 s while its own cold-load sibling already carries COLD_LOAD_TIMEOUT_MS
#4186 plugin-audit zh-CN localization case: cold import('@objectstack/core') against a 20 s testTimeout
#13645 authz-store-unavailable.test.ts walks all of packages/ twice under the default 5 s
#10115 a bail spends ~70 % of the default 5 000 ms on an in-test module transform
#9311 two default-timeout tests red pnpm test under full-repo parallelism
#3662 two dist probes on the default 5 s where the sibling case already sets 30 s

#5421 and #3662 are the interesting ones: in both, a sibling case in the same file already carried an explicit longer timeout, and the fix was to give the cold-load case the same treatment rather than to make the test do less. That is the shape available here.

Landing point

packages/plugins/plugin-auth/src/durability-swallow-repair.test.ts — the admin-import-users describe block. Whether the right fix is an explicit per-case timeout on the cold-import case, hoisting the await import(...) into a beforeAll so exactly one case pays it, or a file-level testTimeout, is a judgement for whoever takes it; ⛔ skipping, disabling or quarantining the test is not on the table.

Worth checking while there: whether the other two describe blocks in the same file have the same first-sibling-pays shape, and whether other plugin-auth test files do.

Dedup

search_issues "plugin-auth durability-swallow-repair test times out at 10 seconds because of a cold dynamic import in CI" → 6 results, all closed, listed in the table above. None names durability-swallow-repair.test.ts or the admin-import-users block. The firing control is that the query returned exactly this defect family and nothing unrelated — a zero-hit result would not have been readable, six on-family hits make the absence of this file meaningful.

Re-check

git grep -n "await import('./admin-import-users.js')" origin/main -- packages/plugins/plugin-auth/src/durability-swallow-repair.test.ts
git grep -n "testTimeout" origin/main -- packages/plugins/plugin-auth

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions