Skip to content

Audit the test suite: golden guards not run by default, fixture + dupe gaps #73

Description

@thalida

Audit the frontend + backend test suites for gaps, redundancy, and guard coverage. Surfaced while building the World Almanac / server-side-stats work (#60 / PR #72), where a real building-dimension NaN regression slipped through every --project=unit run.

Known findings to start from

  1. Golden/equivalence tests don't run in the default suite. bench/layoutGolden.bench.test.ts, bench/decorationGolden.bench.test.ts (and the other bench/*) live in the bench vitest project, which npx vitest run --project=unit / just test-app does not execute (only npm run bench does). So the bit-identical layout guard never runs locally or (verify) in CI. → Decide: run a golden subset in the normal suite/CI, or document the gap.

  2. layoutGolden can't guard the stats path. It calls layoutCity({ tree }) with no manifest.stats. After the server-side-stats migration the layout consumes manifest.stats (with a tree-walk only as a degenerate fallback), so the golden test exercises the fallback, not the real path. → Wire representative stats into the golden fixtures and recapture the baseline.

  3. Golden fixtures lack edge files. genWeightedTree (tests/_helpers/layoutTreeFixtures) appears to generate no 0-byte, 0-line, or media files — exactly the cases that produced the Math.log(0) → NaN building geometry. → Add fixtures covering empty files, binary/0-line files, and media files.

  4. Duplicate / overlapping tests. Tests were added per-task during the World Almanac work without first auditing existing coverage. Check for redundancy (e.g. almanac/overview, layout dimensions, reactiveRebuild, stats) and consolidate.

  5. Stats-less layout callers. Confirm no production path calls layoutCity without manifest.stats (currently only the golden bench test does); decide whether the layout should keep a self-contained tree-walk fallback or require stats.

Goal

A test suite where a building-dimension / layout-output change cannot merge green, the golden guards actually run, fixtures cover the size edge-cases, and there's no redundant coverage.

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions