Skip to content

perf(test): remove redundant work from expensive tests #2382

Description

@Astro-Han

Problem

Some test paths consume substantial time and machine resources because they repeat setup work beyond what their assertions require:

  • Repeated Node subprocess startup in CLI and headless CLI tests.
  • Oversized fixtures that exceed a boundary by a large margin.
  • Repeated Electron launches with the same seeded state.
  • Fixed multi-second waits where an observable completion signal exists.
  • Repeated race rounds that amplify confidence but do not add a new contract.

The problem is not that these tests are slow. Real Git, SQLite, process, recovery, UDS, Harbor, and Electron boundaries are inherently expensive and often valuable.

The problem is paying the same cost repeatedly without gaining a distinct failure signal.

Goal

Reduce test wall time and peak resource pressure without weakening meaningful boundary coverage.

Apply two rules:

  1. Preserve every distinct behavior and real-system boundary.
  2. Remove work until removing more would lose a distinct failure signal.

Work

  • Replace oversized fixtures with the smallest fixture that crosses the asserted boundary.
  • Test most CLI semantics in process; retain representative subprocess tests for stdin, stdout, exit codes, signals, and persistence.
  • Merge compatible desktop assertions that repeatedly launch the same expensive fixture.
  • Replace fixed sleeps with controlled clocks, barriers, or observable readiness.
  • Keep one deterministic race case in the default suite and put repeated amplification in explicit stress coverage where justified.
  • Remeasure before changing global concurrency or CI scheduling.

Non-goals

  • Deleting tests solely because they are slow.
  • Replacing real boundary tests with mocks.
  • Removing distinct crash, recovery, Git, UDS, PTY, Harbor, or IPC semantics.
  • Adding a new test scheduler before redundant work has been removed.

Acceptance criteria

Each PR must:

  • Name the distinct contract that remains covered.
  • Provide comparable before/after timing.
  • Preserve representative real-boundary coverage.
  • Pass the affected workspace tests.

Stop when the remaining expensive tests each protect a distinct boundary or failure mode.

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions