Skip to content

[Epic] Rebuild the test suite: decide what each tier is for, then keep, rewrite or delete every test against that #3733

Not planned
1 of 1 issue completed

Description

@malibio

Intended to be run as a spec with its plan and tasks in NodeSpace, once this project's work has moved there (#3712). Phase 1 writes nothing and can be done before that.

Overview

The test suite has grown through several changes of direction: the universal graph, the node type registry, the playbook engine, the removal of Pro code, the agent and skill redesign. Some tests were carried through each change, some went stale, and some guard things the product no longer does. Nobody has looked at the suite as a whole. This epic does: first a strategy that says what each tier of tests is for, then every test is kept, rewritten or deleted against it.

Problem Statement

The size of the suite today:

  • Frontend: 339 test files, about 112,000 lines, against about 74,000 lines of frontend source. The tests are larger than what they test.
  • Rust: about 4,200 inline unit tests and 162 integration test files (about 85,000 lines) across core, agent, daemon, CLI, the app library, the NLP engine and the types crate. 120 tests are marked ignored.
  • Tooling: 48 test files under scripts/.
  • Plus the browser tier, the headless end-to-end tier, the Tauri-seam tier, the performance benchmarks and the agent evals.

What that costs:

  • A merge gate runs all of it for every merge, one at a time across the team. A warm run today spent about 99s on the frontend tier, 61s on Rust, 47s on the Tauri seam and 27s on tooling, before compile time, and a cold or contended run is far longer.
  • A change of shape breaks tests in bulk. One field added to the task type meant touching fixtures in four integration test files for reasons unrelated to what those tests check.
  • A stale test costs every time it fails for a reason that is not a defect, and a test that can never fail costs a slot and protects nothing.
  • Nothing says which tier a new test belongs in beyond "99% in Happy-DOM", so tests land wherever the nearest example is.

Proposed Solution

Phase 1: Measure and classify (no test changes)

  • For every test file: what behaviour it protects, which tier it is in, how long it takes, how often it has failed in the last merges and why (a defect, a stale assumption, or load).
  • Mark each: keep as is, keep but move tier, rewrite, merge into another, or delete, with the reason. Mark the 120 ignored Rust tests the same way.
  • Find tests that cannot fail: assert on what they set up, recompute the expected value the way the code does, or assert only that a mock was called.
  • Find the fixtures and builders whose shape changes ripple through unrelated tests.

Phase 2: The strategy

A testing strategy, written in nodespace-docs before any rewrite, that decides:

  • what each tier exists to catch, and what does not belong in it;
  • where a test of a given behaviour goes, as a rule a person or an agent can apply;
  • what a test must assert to count (behaviour through a public interface, from an independent source of truth);
  • how fixtures are built so a shape change is one edit;
  • what the merge gate runs for every merge and what runs less often;
  • a target for the gate's test time, and what is traded to reach it.

Phase 3: Rebuild, a package at a time

  • Apply the classification: delete, move, merge and rewrite, one package or tier per pull request, so each lands through the gate on its own.
  • A rewritten test is shown to fail with the behaviour it protects reverted.
  • Coverage of behaviour is the measure, not line coverage and not test count.

Phase 4: Keep it that way

  • The rule for where a test goes is in the guide and in the review procedure.
  • A check where one is cheap: no new ignored test without a reason, no test under the wrong directory for its tier.

Documentation

  • testing-guide.md and e2e-testing.md - the current guidance this replaces or amends
  • ADR-047 (the merge gate is the single full run) and ADR-048 (the Tauri-seam tests) in nodespace-docs decisions/ - what the gate runs and why
  • agent-eval.md - the evals, which are in scope for the strategy and out of scope for the rebuild
  • Updates: the testing guide is rewritten from the Phase 2 strategy; ADR-047 is amended if what the gate runs changes

Architecture Impact

May amend ADR-047 if the strategy changes what every merge runs. No product change.

Acceptance Criteria

  • Phase 1: every test file and every ignored test has a classification with a reason, and the slowest and most often failing tests are named with their cost
  • Phase 2: the strategy is written and accepted by the user before any test is rewritten
  • Phase 3: every test is kept, moved, merged, rewritten or deleted as classified, and no test remains that the classification marked as unable to fail
  • No ignored test remains without a stated reason
  • A change to a core type's shape touches fixtures in one place
  • The merge gate's test time against the Phase 2 target is recorded, before and after
  • The guide and the review procedure state where a new test goes
  • Each pull request passes bun run quality:fix and the merge gate

Technical Specifications

Reference Files

  • packages/desktop-app/src/tests/ (339 files), packages/desktop-app/vitest.config.ts and the browser and performance configs
  • packages/*/tests/it/ (one integration binary per crate) and the inline #[cfg(test)] modules
  • scripts/*.test.ts
  • scripts/test-gate.ts, scripts/gate-scope.ts, scripts/gate-stage.ts - what runs when, and the per-stage timings in the gate logs
  • packages/agent/tests/it/ and the eval harness

Implementation Details

Dependencies

Related Issues

Non-Goals

  • Raising line coverage
  • Changing the merge queue or the machine slot
  • Rewriting the agent evals
  • New test frameworks

Inputs from retiring browser dev mode (#3785)

Added while planning #3785, which is tracked as a sub-issue of this epic: a Phase 3 deliverable (delete the browser path and its tests) that starts once the Phase 2 strategy is accepted. The strategy in Phase 2 owns the decision below; #3785 follows it rather than making it separately.

What rides the browser path today (Phase 1 inventory)

Browser mode (dev:browser) runs the frontend in Chrome against the HTTP dev-proxy (packages/dev-tools/) through HttpAdapter. These tests exist because of that second path and need a classification:

  • The e2e tier: test:e2e, vitest.e2e.config.ts, src/tests/e2e/*.e2e.ts, daemon-harness.ts (spawns a real nodespaced plus the proxy and drives HttpAdapter).
  • Adapter-parity tests, whose job is to prove two backend paths agree: app-lib/tests/it/adapter_contract_test.rs, schema_parity_test.rs, and adapter-contract.e2e.ts. With one path they are candidates to delete or restate against the Tauri seam alone.
  • Proxy and adapter unit tests: dev-proxy-*.test.ts, browser-sync-service.test.ts, backend-adapter.test.ts, adapter-core.test.ts.

The decision the strategy has to make: what covers the frontend-to-daemon path

Browser mode gave one cheap thing: the real frontend against the real daemon, headless, with no Tauri process. Replacing it is a tier decision, not a script deletion. The options, with what the debug-bridge trial and the tooling showed:

Option Covers Does not cover Notes
UI e2e: Vite + Playwright (Chromium) with @tauri-apps/api/mocks mockIPC The real UI behaviour (typing, selection, panes, navigation) against fixture command results Command-to-daemon integration Tauri's own recommended approach; no daemon, no proxy; cheap and deterministic in CI. The test:browser tier already runs Chromium.
Tauri-seam tier (ADR-048) Command layer to a real nodespaced The UI Already exists. Together with the row above it covers both sides of the IPC boundary.
Daemon-level e2e over gRPC Daemon services end to end The frontend and the command layer Keeps the "real daemon" round trip without HTTP.
Full-stack shim (forward invoke to gRPC) Real frontend plus real daemon, headless This is the dev-proxy by another name; choosing it means keeping what #3785 deletes.
Debug bridge driving a real app The shipped WKWebView, real commands Passive IPC capture of the app's own calls; real pointer/:hover; CI use Needs a running desktop app, and launching it takes over the per-user launchd job for the debug daemon label (not isolatable by HOME). Good for agent debugging, not a CI tier.
tauri-driver (WebDriver) No macOS WKWebView driver; not available for this project.

Recommended starting point for Phase 2 to test against: mocked-IPC Playwright for UI behaviour plus the Tauri-seam tier for the command layer, and drop the full-stack HTTP tier unless Phase 1 finds failures only it caught.

Gate-time data point (for the "target for the gate's test time")

A docs-only change ran the full gate in about 13 minutes on a warm gate checkout: frontend 178s (parallel with the compile stages), then scripts 68s, skill 18s, Rust nextest 223s, browser 7s, e2e 15s, Tauri seam 186s to 391s across runs, plus about 2 minutes of clippy and compiles. test:changed already classifies docs-only diffs through gate-scope.ts; the merge gate does not use it. Whether the gate should scope by diff is a Phase 2 question because it changes the "one full run on exactly what lands" guarantee in ADR-047.

Also found: tests leaking into the real home

One test helper created databases under the real ~/.nodespace/database/ (243 files accumulated); fixed. Phase 1 should look for the same class: tests that write outside their temp dir (the real home, ~/Library/LaunchAgents, the per-user launchd label) and tests that read machine-global state (the incompatible-database marker made a seam test fail on a developer machine). A cheap Phase 4 check is a gate step that fails if the real home changed during the run.

Sub-issues

Sub-issues

1 of 1 Issues completed
Loading 1 sub-issues

Activity

  1. mstomar125 commented on Nov 16, 2026

    @mstomar125
    Contributor

    Parked as deferred on 2026-11-16: this is known future work that cannot be finished now, so it stays open in Backlog but is excluded from the drain. Reopen the discussion when the product direction, budget or a device makes it actionable.

  2. added
    defer
    on Nov 16, 2026
  3. malibio commented on Nov 28, 2026

    @malibio
    CollaboratorAuthor

    Moved to NodeSpace: the spec "The test suite is rebuilt against what each tier is for" (b32d5fee-9e54-4561-b17e-928449c0fee0) in the NodeSpace workspace. The team's work is tracked there, so this GitHub copy is closed to keep its status in one place.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    defertesting

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions