Skip to content

tech-debt: drop process.env mutation from dispatcher test files (parallel-safety) #1130

Description

@sahrizvi

Follow-up from v0.9.6 review — coderabbit MAJOR on PR #1129 discussion r3839417768.

Context

Both dispatcher test files set ALTIMATE_TELEMETRY_DISABLED=true in beforeAll and clear it in afterAll:

  • packages/opencode/test/altimate/dispatcher.test.ts (existing — shipped months ago)
  • packages/opencode/test/skill/release-v0.9.6-adversarial.test.ts (v0.9.6)

Problem

Mutating process.env in a shared bun-test process isn't parallel-safe. bun test runs test files sequentially in one process by default in this repo, so it's not biting anyone today — but the moment someone enables bun test --concurrency N (or bun makes parallel-file execution the default), these files can:

  • Observe each other's env-var mutations mid-run
  • Have their afterAll restore step race an unrelated file's beforeAll set

Flakes, not correctness bugs — but hard to diagnose once they land.

The actual fix (small)

Delete the env-var setup entirely. Both test files exercise Dispatcher.call which wraps every Telemetry.track call in try { ... } catch {} that swallows all errors. The env var was defensive against nothing — telemetry firing during a test cannot fail the test regardless.

Concrete diff, ~5 lines of removal per file:

- beforeAll(() => {
-   process.env.ALTIMATE_TELEMETRY_DISABLED = "true"
- })
- afterAll(() => {
-   delete process.env.ALTIMATE_TELEMETRY_DISABLED
- })

(plus the save/restore additions in the release test file — those were a partial patch that still didn't reach parallel-safety; drop them too.)

Priority

P3 — advisory. Not blocking any current or planned work. Address whenever a contributor is next in the dispatcher test area, or as part of a broader "make tests parallel-safe" pass if the repo ever flips --concurrency on.

References

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions