From 5434760ddf88106d78e335c092367512bb34eacd Mon Sep 17 00:00:00 2001 From: DongHyeonka Date: Sat, 15 Aug 2026 21:30:54 +0900 Subject: [PATCH] fix: keep the fixture evidence test about preservation, and stop scanning worktrees MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The release-evidence test asserted that every artifact a candidate is assembled from survives the copy, which quietly assumed the checkout had already run the release chain. It holds in this repository and fails in a product repository that has not, where `artifacts/performance/bundle.json` simply does not exist yet — a fact about the checkout, not about the copier. It now asserts that whatever release evidence is present is preserved, and that at least one thing was, so it cannot pass by finding nothing to check. Vitest also walked `.worktrees/`. A git worktree inside the repository is a different checkout of a different branch; running its tests against this checkout's config produces failures that belong to neither and cost real time to attribute. Co-Authored-By: Claude Opus 5 --- tests/unit/removal-fixture.test.ts | 19 ++++++++++++++++--- vitest.config.ts | 4 ++++ 2 files changed, 20 insertions(+), 3 deletions(-) diff --git a/tests/unit/removal-fixture.test.ts b/tests/unit/removal-fixture.test.ts index 1366ef1..0be5ac3 100644 --- a/tests/unit/removal-fixture.test.ts +++ b/tests/unit/removal-fixture.test.ts @@ -103,13 +103,26 @@ describe("release evidence fixture copy", () => { const root = await mkdtemp(nodePath.join(tmpdir(), "release-evidence-")); await copyReleaseEvidenceTree(process.cwd(), root); - // Every artifact a candidate archive is assembled from has to survive; a - // fixture missing one of these cannot build a candidate at all, and every - // provider suite then fails while constructing its own fixture. + // Every release artifact that exists here has to survive the copy; a + // fixture missing one cannot build a candidate at all, and every provider + // suite then fails while constructing its own fixture. + // + // Which ones exist depends on what this checkout has generated — a product + // repository that has not run the release chain has fewer than the template + // does — so the subject is preservation, not the presence of a full chain. + // Requiring at least one keeps that from quietly asserting nothing. + let preserved = 0; for (const evidence of RELEASE_CANDIDATE_EVIDENCE_PATHS) { if (!evidence.startsWith("artifacts/")) continue; + try { + await access(evidence); + } catch { + continue; + } await expect(access(nodePath.join(root, evidence)), evidence).resolves.toBeUndefined(); + preserved += 1; } + expect(preserved).toBeGreaterThan(0); // The regenerated trees are why this is a filter and not a plain copy: they // are tens of megabytes of traces and coverage HTML. They still exist, // because the repository inventory expects the directories. diff --git a/vitest.config.ts b/vitest.config.ts index 406932a..5358cb1 100644 --- a/vitest.config.ts +++ b/vitest.config.ts @@ -11,6 +11,10 @@ export default defineConfig({ exclude: [ ...configDefaults.exclude, ".tmp/**", + // A git worktree inside the repository is a different checkout of a + // different branch. Running its tests against this checkout's config + // reports failures that belong to neither. + ".worktrees/**", "tests/fixtures/v8-coverage-counter-semantics/**", ], coverage: {