fix: two tests flaky under parallel CI load (S27 + trace snapshot)

Merged
AN
5mo ago
+38-12

What does this PR do?

Fixes two tests that pass locally but fail consistently in CI's parallel run (9474 tests / 378 files) — the repo's "no flaky tests under resource contention" case. They fail identically on three unrelated PRs (#854, #858, #863), blocking all of them; neither is caused by any feature change.

  • real-tool-simulation S27 (sql_analyze parse error): the progressive-suggestion dedup state is a module-global Set. The beforeEach reset used a dynamic await import, which under parallel CI can resolve to a different module instance than the tool's static import — so the real Set is never reset and accumulates sql_analyze from S25/S26, leaving S27 with no suggestion. Fix: import PostConnectSuggestions statically (same instance the tools use); reset in S27 too.
  • tracing-adversarial-snapshot (shows 'running' status): waited a fixed 50ms for a debounced async snapshot write — too short under CI load → reads a stale snapshot. Fix: poll the on-disk status until expected (4s timeout) instead of a fixed sleep.

Type of change

  • Bug fix (non-breaking change which fixes an issue)

Issue for this PR

Closes #879

How did you verify your code works?

  • Both affected files pass locally (61 tests); tsgo typecheck clean; marker check clean (test-only, no upstream-shared files).
  • The real proof is CI on this branch going green (the failures only reproduce under CI's parallel load).

Checklist

  • My code follows the style guidelines of this project
  • I have performed a self-review of my code
  • I have added tests that prove my feature works
  • New and existing unit tests pass locally with my changes

Summary by cubic

Fixes two parallel-CI flaky tests by resetting PostConnectSuggestions via static import (and in S27) and by polling trace snapshot status (4s timeout) instead of a 50ms sleep. Also raises Bun test timeout from 30s to 90s to prevent load-induced timeouts. Closes #879.

Summary by CodeRabbit

  • Tests
    • Improved reliability by replacing fixed delays with intelligent polling for snapshot verification
    • Enhanced test isolation to prevent cross-test flakiness and ensure consistent behavior across scenarios
  • Chores
    • Increased test runner timeout in CI to reduce spurious test failures due to longer test execution