Skip to content

test(install,audit-engine): concurrent install-hardening and attestation cases, shared canonical DB in javascript-shipped #1839 - #2186

Merged
nc9 merged 1 commit into
mainfrom
boat/slow-tests-1839
Nov 21, 2026
Merged

nc9 merged 1 commit into
mainfrom
boat/slow-tests-1839

Conversation

@nc9

@nc9 nc9 commented Nov 20, 2026

Copy link
Copy Markdown
Contributor

Part of #1839. Test-only change: no user-visible behaviour, so no changelog.d entry.

What changed

  • scripts/install-hardening-168.test.ts: every case runs test.concurrent. Each install already gets its own mkdtemp root, shims, HOME and process group, so the cases share nothing. This is the pattern install-contract.test.ts already uses (f0c1a6d). 14.1 s to 1.7 s.
  • scripts/install-attestation-169.test.ts: the same, 9.0 s to 3.1 s.
  • packages/audit-engine/tests/javascript-shipped-report.test.ts: each fixture copies the shared canonicalFixtureDb() file instead of regenerating the 500-page crawl. The copy is needed because a test body writes to its DB. 36.4 s to 34.8 s.

No test is deleted, skipped or weakened. Every assertion and timing bound is unchanged.

Per-file timing (AC 1)

I timed every test file bun discovers (1,487 files, same discovery as scripts/test-suites.ts) alone, one file per invocation, run from the repo root on public main 9994763 (48-core sandbox, bun 1.4.4):

set -u
while IFS= read -r f; do
  [ -n "$f" ] || continue
  t0=$(date +%s%N); timeout 300 bun test --timeout 30000 "./$f" >/dev/null 2>&1; rc=$?
  printf '%s\t%s\t%s\n' $(( ($(date +%s%N) - t0) / 1000000 )) "$rc" "$f"
done < files.txt

The solo times add up to 1,546.8 s (25.8 min). They are an upper bound for the golden files: in one whole-tree process those files share the memoized canonical captures in helpers/golden-baseline.ts, so only the first file pays for the capture. The full 1,487-line TSV is kept with the lane report for attaching to the issue.

The 20 slowest files, with a reason for each one that stays slow (AC 2 and 3)

rank file before after change or reason
1 apps/cli/tests/cli/audit-max-duration-large-page-1332-e2e.test.ts 40.2s unchanged Two concurrent CLI runs over a 6 MiB page (:12-14, past the documented 5 MiB cap); the cap test needs a >10 s parse bounded by a 20 s budget (:101-114). Deliberate.
2 packages/audit-engine/tests/javascript-shipped-report.test.ts 36.4s 34.8s Fixture DB now copied from the shared canonicalFixtureDb instead of regenerated per test. Rest is two full runStreamingRules passes over the 518-page corpus (~17 s each, :66-90, :99-103), each with different assets.
3 packages/audit-engine/tests/streaming-collector-rules-golden.test.ts 35.0s unchanged Already uses canonicalV1Snapshot/V2Snapshot (:55-56); solo time is the two engine captures of the 500-page golden corpus. Shared when run with sibling golden files.
4 packages/audit-engine/tests/streaming-rules-canonical-golden.test.ts 34.8s unchanged Same: shared canonical v1+v2 captures (:28-29); 500-page golden corpus.
5 packages/audit-engine/tests/broken-anchors-streaming-golden.test.ts 34.5s unchanged Seeds extra links into its own model (:45-48), so it cannot reuse the canonical DB; needs one v1 and one v2 full-rule capture (:56-57).
6 packages/audit-engine/tests/golden-baseline.test.ts 34.1s unchanged Already memoized; the determinism test (:53-59) deliberately takes a second independent v1 capture.
7 packages/rules/tests/security/leaked-secrets-cap-1554-hostile.test.ts 29.4s unchanged Hostile 5 MB and 10 MiB single pages of secret-shaped values, with the collector budget lifted to 600 s (:82); sizes are the point (cap, retention). Plus GC settling per test (:46-56).
8 apps/cli/tests/cli/audit-max-duration-e2e.test.ts 26.0s unchanged Real-time budget tests (BUDGET_S 3 s / 5 s, 700 ms page delay, 3 s slow assets); concurrent ones already overlap (~10 s each). Making the 7 sub-second validation tests concurrent was tried: no measurable gain (25.5s), reverted.
9 packages/audit-engine/tests/rule-cache-replay-golden.test.ts 25.2s unchanged 13 tests, each builds its own seeded crawl (:112-137) and runs the engine several times (fresh vs replayed byte-compare); that is the coverage.
10 packages/crawler/tests/preamble-budget.test.ts 20.6s unchanged Real stalls with tight elapsed-time assertions: three tests wait the 1.5 s preamble budget (~3 s each) and the walk tests stall bodies (:160-230, :345-460). Kept serial so timing bounds do not see each other's load.
11 packages/audit-engine/tests/report-stream-v2-golden.test.ts 18.7s unchanged Already one shared streaming run over the canonical DB (:26-45); that run is the cost.
12 packages/rules/tests/integrity-adversarial-784.test.ts 18.3s unchanged 36 tests, per-test times sum to ~18 s: 2-4 MB hostile CSS/HTML inputs and doubling-cost linearity checks (0.5/1/2 MB). Sizes are deliberate.
13 packages/rules/tests/integrity-default-budget-1462.test.ts 18.0s unchanged 6 shapes x 3 runs of 5-7 MB, 76k-330k control pages built and scanned (~2 s each with budget off). Sizes are deliberate.
14 packages/audit-engine/tests/wcag-checklist-canonical-3094.test.ts 17.6s unchanged One v1 pipeline over the canonical DB (:19-26); not the memoized snapshot because it needs the full report object, not the baseline snapshot.
15 packages/audit-engine/tests/golden-finding-messages-229.test.ts 17.4s unchanged Uses canonicalV1Snapshot (:84); solo time is that one v1 capture.
16 packages/crawler/tests/entry-fetch-timeout.test.ts 16.3s unchanged One test (10 s) serves a 600 ms TTFB on every path against a 400 ms deadline (:69-79, :175-185) so each probe and the entry retry hit real timeouts; that is the scenario.
17 packages/audit-engine/tests/streaming-rules-golden.test.ts 15.9s unchanged Five distinct crawls (rich, clean, edge, batch 3 vs 200), each run through v1 and v2 (:186-265).
18 packages/crawler/tests/adaptive-ramp-crawl.test.ts 15.7s unchanged Wall-clock comparison of a flat vs ramped crawl of 25-page-per-slot corpus at 25 ms latency (:62-66); asserts ramped < 0.85 x flat, so the latency cannot be shrunk without noise.
19 scripts/install-hardening-168.test.ts 14.1s 1.7s Each install() already runs in its own mkdtemp root with its own shims, HOME and process group; all tests now test.concurrent (same approach as install-contract, f0c1a6d). 3 repeat runs stable, 36 pass.
20 apps/cli/tests/commands/feedback-cli.test.ts 13.9s unchanged Two tests wait the CLI's real 5 s stdin-idle give-up (~5.4 s each); they share the stub server's received array (:11-13, :243, :256), so running them concurrently would race.

Ranks 21 to 40 (solo time):

  • 12.5s packages/audit-engine/tests/tech-bundle-allowance-1534.test.ts
  • 12.1s apps/cli/tests/crawler/per-host-throttle.test.ts
  • 12.1s scripts/install-contract.test.ts
  • 11.6s packages/rules/tests/exposed-actuator.test.ts
  • 11.4s packages/rules/tests/integrity-evasions-784.test.ts
  • 11.3s packages/rules/tests/collected-signals-retention-1565.test.ts
  • 11.1s apps/cli/tests/mcp/audit-website-max-duration-1271.test.ts
  • 11.1s apps/cli/tests/cli/pages-command-e2e.test.ts
  • 10.9s packages/rules/tests/overlay-css-1409.test.ts
  • 10.4s packages/rules/tests/integrity-caps-1462.test.ts
  • 9.9s apps/cli/tests/audit/analyze-streaming-1021.test.ts
  • 9.3s apps/cli/tests/audit/plugin-rule-packs-1599.test.ts
  • 9.3s apps/cli/tests/audit/tls-root-failure.test.ts
  • 9.2s apps/cli/tests/cli/audit-start-redirect-e2e.test.ts
  • 9.0s scripts/install-attestation-169.test.ts
  • 8.9s apps/cli/tests/cli/audit-exit-codes-1657-e2e.test.ts
  • 8.9s packages/audit-engine/tests/page-rule-residency-2343.test.ts
  • 8.7s apps/cli/tests/commands/audit-discovery-probes-wiring.test.ts
  • 8.7s packages/crawler/tests/rate-limit-crawl.test.ts
  • 8.6s apps/cli/tests/cli/audit-ignore-e2e.test.ts

AC 3: this PR takes the "stated reason" route for the files that stay slow. It does not show the release runner under 20 min. In CI the release quality gate already skips the re-run when main CI passed at the same sha (#1840).

Gates

  • bun run scripts/test-suites.ts --run rest: 3907 pass, 0 fail (94 s)
  • bun run scripts/test-suites.ts --run audit-engine: 2366 pass, 0 fail (377 s)
  • each changed file run alone and next to its siblings (install-contract, report-stream-v2-golden, wcag-checklist-canonical-3094); the install files were run 3 times, stable
  • packages/audit-engine: bun run typecheck passes (the package has no lint or format script)
  • oxlint on the 3 changed files: clean. oxfmt --check flags both scripts/ files on origin/main as well, and scripts/ sits outside the workspace format gate.

Agent skill change: none needed.

…es concurrently, copy the canonical crawl DB in javascript-shipped #1839

Signed-off-by: Nik Cubrilovic <[email protected]>
@nc9
nc9 marked this pull request as ready for review November 20, 2026 23:09
@nc9
nc9 merged commit 0310159 into main Nov 21, 2026
8 of 15 checks passed
@nc9
nc9 deleted the boat/slow-tests-1839 branch November 21, 2026 01:17
nc9 added a commit that referenced this pull request Nov 21, 2026
* origin/main:
  test(install,audit-engine): run install-hardening and attestation cases concurrently, copy the canonical crawl DB in javascript-shipped #1839 (#2186)
  build(packages): typecheck the tests of crawler, report, utils, tech-detect, core-contracts, config, waf-detect, threat-intel #1859 (#2190)
  fix(cli): refuse a run whose config rule selection plus WCAG level leaves zero rules #2110 (#2156)
  fix(rules): links/anchor-mismatch false positives on translated stores #2092 (#2162)
  fix(rules): coded gap skips for input not fully checked, batch 2 rules #2134 (#2163)
  test(audit-engine): carriedCheckAsFailure keeps the continuation mark #2098 (#2166)
  fix(rules): correct zoom-disabled 1.4.4 wording, related criteria for wcagNone rules #2115 (#2174)
  refactor(cli): list bash completion flags one per line #2116 (#2175)
  feat(rules): waive a public Supabase table by bare name in security/supabase-rls #2103 (#2177)
  test(rules): every site rule emits a check on a clean site, with a shrinking baseline #1741 (#2179)
  feat(rules): report each 5xx page as its own crawl/server-errors finding #2130 (#2181)

Signed-off-by: Nik Cubrilovic <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant