Skip to content

test: harden flaky async transport and logger rotation tests #59

Description

@Coldaine

Why

Several tests use custom waitFor polling loops or real filesystem rotation with retry sleeps. Critique flagged flake risk in CI (especially Windows runners). Hardening now prevents intermittent red builds as the suite grows post–PR #48.

Hot spots

File Pattern Lines
shadow-agent/tests/capture/capture-transports.test.ts Custom waitFor (4s timeout) L22+, L157–278
shadow-agent/tests/capture/session-manager.test.ts Duplicate waitFor helper L28+, L92+
shadow-agent/tests/electron/start-main-process-privacy.test.ts vi.waitFor ~L102
shadow-agent/tests/logger.test.ts File rotation poll loop L204–240

Acceptance criteria

  • Extract shared waitFor to tests/helpers/ with fake-clock or event-based resolution where possible.
  • Replace busy-poll transport tests with deterministic event emitters or vi.advanceTimersByTime where applicable.
  • Logger rotation test uses temp dir + explicit size trigger without unbounded retry loop (or mark @flaky with ticket if unavoidable).
  • Document CI timeout budget for transport integration tests.
  • Zero flaky failures over 10 consecutive CI runs on main (or document exceptions).

References

  • docs/plans/plan-testing-observability.md — determinism first
  • PR #48

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions