From 5f18379da57c41c816b138056340b33a1013320d Mon Sep 17 00:00:00 2001 From: Tom Boucher Date: Fri, 29 May 2026 17:12:41 -0400 Subject: [PATCH] fix(#478): delete wall-clock elapsed-time assertions per ADR 456 (keep correctness invariants) (#480) Co-authored-by: CI Rebase Check Co-authored-by: Claude Sonnet 4.6 --- .../bug-3670-cursor-local-install-migration-lock.test.cjs | 7 ------- tests/feat-3594-parser-adversarial-frontmatter.test.cjs | 7 +------ tests/health-validation.test.cjs | 4 ---- tests/read-injection-scanner.test.cjs | 4 +--- 4 files changed, 2 insertions(+), 20 deletions(-) diff --git a/tests/bug-3670-cursor-local-install-migration-lock.test.cjs b/tests/bug-3670-cursor-local-install-migration-lock.test.cjs index f6b120158..a68a16564 100644 --- a/tests/bug-3670-cursor-local-install-migration-lock.test.cjs +++ b/tests/bug-3670-cursor-local-install-migration-lock.test.cjs @@ -301,7 +301,6 @@ test('T5: unreclaimable same-PID lock throws bounded error (reclaim-unlink failu return originalUnlinkSync.call(fs, targetPath); }); - const startMs = Date.now(); assert.throws( () => runInstallerMigrations({ configDir, @@ -314,10 +313,4 @@ test('T5: unreclaimable same-PID lock throws bounded error (reclaim-unlink failu }, 'must throw "installer migration lock is held" when reclaim-unlink fails — not spin indefinitely' ); - const elapsedMs = Date.now() - startMs; - - // Must resolve within a generous but finite window (fix + timeout overhead). - // If it spins (deadlock regression), the process-level test timeout fires instead. - t.diagnostic(`T5 elapsed: ${elapsedMs}ms (expected ≤500ms for lockTimeoutMs:200 + overhead)`); - assert.ok(elapsedMs < 500, `T5 must resolve within 500ms; actual ${elapsedMs}ms — possible spin-loop regression`); }); diff --git a/tests/feat-3594-parser-adversarial-frontmatter.test.cjs b/tests/feat-3594-parser-adversarial-frontmatter.test.cjs index 09f435b3a..efa0ce229 100644 --- a/tests/feat-3594-parser-adversarial-frontmatter.test.cjs +++ b/tests/feat-3594-parser-adversarial-frontmatter.test.cjs @@ -114,14 +114,9 @@ describe('feat-3594: frontmatter parser handles null bytes without truncation', }); describe('feat-3594: frontmatter parser handles bounded-large inputs in reasonable time', () => { - test('64KB frontmatter with 2000 array items parses under 2 seconds and returns the right shape', () => { + test('64KB frontmatter with 2000 array items parses and returns the right shape', () => { const content = loadFixture('huge-bounded.md'); - const startedAt = Date.now(); const fm = extractFrontmatter(content); - const elapsedMs = Date.now() - startedAt; - // Time bound is generous — a parser regression that makes this O(n^2) - // would blow well past 2s on this fixture. - assert.ok(elapsedMs < 2000, `parse took ${elapsedMs}ms — should be < 2000ms`); assert.equal(fm.phase, '06'); assert.ok(Array.isArray(fm.plans), 'plans must be parsed as an array'); assert.equal(fm.plans.length, 2000, 'all 2000 array items must be captured'); diff --git a/tests/health-validation.test.cjs b/tests/health-validation.test.cjs index a02affc89..e59eb5dbc 100644 --- a/tests/health-validation.test.cjs +++ b/tests/health-validation.test.cjs @@ -374,13 +374,9 @@ describe('stateReplaceFieldWithFallback field-miss warning', () => { } } - const { performance } = require('perf_hooks'); - const start = performance.now(); const result = runGsdTools('validate health', tmpDir); - const elapsed = performance.now() - start; assert.ok(result.success, `validate health should succeed: ${result.error}`); - assert.ok(elapsed < 3000, `Should complete in under 3000ms, took ${elapsed.toFixed(0)}ms`); const output = JSON.parse(result.output); assert.ok(typeof output.status === 'string', 'Should return a status string'); diff --git a/tests/read-injection-scanner.test.cjs b/tests/read-injection-scanner.test.cjs index 7c8b792b8..8ed06f209 100644 --- a/tests/read-injection-scanner.test.cjs +++ b/tests/read-injection-scanner.test.cjs @@ -104,11 +104,9 @@ describe('gsd-read-injection-scanner: advisory output', () => { assert.ok(out.hookSpecificOutput.additionalContext.includes('/home/user/project/README.md')); }); - test('SCAN-07: hook completes within 5s on large content', () => { + test('SCAN-07: hook exits cleanly on large content', () => { const bigContent = 'x'.repeat(500_000); // 500KB of benign content - const start = Date.now(); const r = runHook(readPayload('/tmp/large.ts', bigContent), 6000); - assert.ok(Date.now() - start < 5000, 'hook should complete within 5s'); assert.equal(r.exitCode, 0); assert.equal(r.stdout, ''); });