Skip to content

fix(test): clean before build:test so orphan dist cannot mask deleted sources - #1944

Merged
Astro-Han merged 2 commits into
mainfrom
fix/test-dist-hygiene
Aug 3, 2026
Merged

fix(test): clean before build:test so orphan dist cannot mask deleted sources#1944
Astro-Han merged 2 commits into
mainfrom
fix/test-dist-hygiene

Conversation

@Astro-Han

@Astro-Han Astro-Han commented Aug 3, 2026

Copy link
Copy Markdown
Contributor

Summary

build:test was an incremental tsc build that never removed the compiled output of deleted sources. When a source file and its test were removed (e.g. composer-skill-picker in #1915), the orphan dist artifacts survived, and node --test "dist/**/*.test.js" picked up the stale test, which then crashed against the deleted component — surfacing as mysterious undefined.label failures. Clean runs (npm test) and CI (fresh checkout) were unaffected; only the local build:test/test:fast path was.

This PR makes build:test the single owner of dist freshness: it runs npm run clean first, so dist is always derived from current sources and orphan artifacts cannot exist. Full rebuild costs ~6.5s locally (measured), so there is no practical incremental-vs-clean tradeoff. test/test:full no longer repeat the clean (build:test owns it).

Closes #1941 (the issue is a stale-dist false positive; the clean-build gate removes the mechanism that produced it).

Verification

  • Planted an orphan file in packages/ui/dist, ran npm run build:test (6.53s real, exit 0), confirmed the orphan was removed by the leading clean.
  • Clean builds now pass the affected suites: @maka/ui 247/247, @maka/cli 467/467, @maka/desktop 1400/1400; the stale runtime/dist/__tests__/agent-team-tools.test.js orphan is gone.
  • npm run test:scripts 23/23, npm run format:check clean.
  • Independently reviewed (gpt-5.6-sol): PASS, no P0–P3; confirmed first-principles fit (test-consumed compile tree must derive from current sources, fail closed) and that orphan detection in check-stale-dist.mjs would be inferior (mtime-only, not wired into the test path).

@Astro-Han
Astro-Han marked this pull request as ready for review August 3, 2026 06:30
@Astro-Han
Astro-Han merged commit ac8b281 into main Aug 3, 2026
5 checks passed
@Astro-Han
Astro-Han deleted the fix/test-dist-hygiene branch August 3, 2026 06:35
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

bug(ui): composer-skill-picker tests crash — ComposerSkillPicker reads undefined label/panelAriaLabel

1 participant