From eaed61cebddcbc13bf037000e727ea6f5b27dace Mon Sep 17 00:00:00 2001 From: PolinaGurinovich97 Date: Mon, 14 Sep 2026 20:47:47 +0200 Subject: [PATCH] fix(fixtures): pack under a canonical name so the suite works on any branch MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit `npm pack` names its output after `package.json#version` and cannot be told otherwise, so the packed artifact is `epam-ai-dial-ui-kit-0.0.0.tgz` on `development` and `epam-ai-dial-ui-kit-0.14.0.tgz` on `release-0.14`. Two places pinned the `0.0.0` spelling — all ten fixture manifests and the `--from-tarball` argument in `verify:distribution` — so on a release branch every fixture failed to install: npm error enoent ENOENT: no such file or directory, open '…/fixtures/.tarballs/epam-ai-dial-ui-kit-0.0.0.tgz' and `Verify package distribution` reported ten regressions that were really one wrong path. It fails that way for any PR opened against a release branch, which is how it surfaced on the 0.14 cherry-pick of #872. The packed tarball is now renamed to one canonical, version-free name that both the fixtures and the export-surface check point at, and the runner fails loudly if the pack step leaves anything other than exactly one `.tgz` behind. Co-Authored-By: Claude Opus 5 --- fixtures/consumer-esm/package.json | 2 +- fixtures/consumer-file-manager/package.json | 2 +- fixtures/consumer-grid/package.json | 2 +- fixtures/consumer-json-editor/package.json | 2 +- .../consumer-markdown-editor/package.json | 2 +- .../package.json | 2 +- .../package.json | 2 +- fixtures/consumer-mixed-grid/package.json | 2 +- .../consumer-schema-renderer/package.json | 2 +- fixtures/consumer-subpaths/package.json | 2 +- fixtures/run-all.mjs | 26 ++++++++++++++++++- package.json | 2 +- 12 files changed, 36 insertions(+), 12 deletions(-) diff --git a/fixtures/consumer-esm/package.json b/fixtures/consumer-esm/package.json index 8b26f60c..f3da4f48 100644 --- a/fixtures/consumer-esm/package.json +++ b/fixtures/consumer-esm/package.json @@ -10,7 +10,7 @@ "smoke": "node smoke-test.mjs" }, "dependencies": { - "@epam/ai-dial-ui-kit": "file:../.tarballs/epam-ai-dial-ui-kit-0.0.0.tgz", + "@epam/ai-dial-ui-kit": "file:../.tarballs/ai-dial-ui-kit.tgz", "@floating-ui/react": "^0.27.19", "@tabler/icons-react": "^3.41.1", "classnames": "^2.5.1", diff --git a/fixtures/consumer-file-manager/package.json b/fixtures/consumer-file-manager/package.json index 63db9b2a..6df91439 100644 --- a/fixtures/consumer-file-manager/package.json +++ b/fixtures/consumer-file-manager/package.json @@ -9,7 +9,7 @@ "assert": "node ../shared/assert-static-graph.mjs --dist dist --require ag-grid-community,ag-grid-react --forbidden @monaco-editor/react,monaco-editor,@uiw/react-md-editor,@uiw/react-markdown-preview" }, "dependencies": { - "@epam/ai-dial-ui-kit": "file:../.tarballs/epam-ai-dial-ui-kit-0.0.0.tgz", + "@epam/ai-dial-ui-kit": "file:../.tarballs/ai-dial-ui-kit.tgz", "@floating-ui/react": "^0.27.19", "@tabler/icons-react": "^3.41.1", "classnames": "^2.5.1", diff --git a/fixtures/consumer-grid/package.json b/fixtures/consumer-grid/package.json index 564685ab..55a25efb 100644 --- a/fixtures/consumer-grid/package.json +++ b/fixtures/consumer-grid/package.json @@ -10,7 +10,7 @@ "smoke": "node smoke-test.mjs" }, "dependencies": { - "@epam/ai-dial-ui-kit": "file:../.tarballs/epam-ai-dial-ui-kit-0.0.0.tgz", + "@epam/ai-dial-ui-kit": "file:../.tarballs/ai-dial-ui-kit.tgz", "@floating-ui/react": "^0.27.19", "@tabler/icons-react": "^3.41.1", "classnames": "^2.5.1", diff --git a/fixtures/consumer-json-editor/package.json b/fixtures/consumer-json-editor/package.json index 8f86ebb6..e1ee2c50 100644 --- a/fixtures/consumer-json-editor/package.json +++ b/fixtures/consumer-json-editor/package.json @@ -9,7 +9,7 @@ "assert": "node ../shared/assert-static-graph.mjs --dist dist --forbidden ag-grid-community,ag-grid-react,@uiw/react-md-editor,@uiw/react-markdown-preview --dynamic-require @monaco-editor/react,monaco-editor" }, "dependencies": { - "@epam/ai-dial-ui-kit": "file:../.tarballs/epam-ai-dial-ui-kit-0.0.0.tgz", + "@epam/ai-dial-ui-kit": "file:../.tarballs/ai-dial-ui-kit.tgz", "@floating-ui/react": "^0.27.19", "@monaco-editor/react": "^4.7.0", "@tabler/icons-react": "^3.41.1", diff --git a/fixtures/consumer-markdown-editor/package.json b/fixtures/consumer-markdown-editor/package.json index fee13cff..49cf81ad 100644 --- a/fixtures/consumer-markdown-editor/package.json +++ b/fixtures/consumer-markdown-editor/package.json @@ -9,7 +9,7 @@ "assert": "node ../shared/assert-static-graph.mjs --dist dist --forbidden ag-grid-community,ag-grid-react,@monaco-editor/react,monaco-editor,@uiw/react-md-editor,@uiw/react-markdown-preview --dynamic-require @uiw/react-md-editor,@uiw/react-markdown-preview,@monaco-editor/react,monaco-editor" }, "dependencies": { - "@epam/ai-dial-ui-kit": "file:../.tarballs/epam-ai-dial-ui-kit-0.0.0.tgz", + "@epam/ai-dial-ui-kit": "file:../.tarballs/ai-dial-ui-kit.tgz", "@floating-ui/react": "^0.27.19", "@monaco-editor/react": "^4.7.0", "@tabler/icons-react": "^3.41.1", diff --git a/fixtures/consumer-mixed-grid-editor-loader/package.json b/fixtures/consumer-mixed-grid-editor-loader/package.json index ea55dbd3..976b0e84 100644 --- a/fixtures/consumer-mixed-grid-editor-loader/package.json +++ b/fixtures/consumer-mixed-grid-editor-loader/package.json @@ -10,7 +10,7 @@ "smoke": "node smoke-test.mjs" }, "dependencies": { - "@epam/ai-dial-ui-kit": "file:../.tarballs/epam-ai-dial-ui-kit-0.0.0.tgz", + "@epam/ai-dial-ui-kit": "file:../.tarballs/ai-dial-ui-kit.tgz", "@floating-ui/react": "^0.27.19", "@tabler/icons-react": "^3.41.1", "classnames": "^2.5.1", diff --git a/fixtures/consumer-mixed-grid-editors-subpath/package.json b/fixtures/consumer-mixed-grid-editors-subpath/package.json index 3a364d42..c9499042 100644 --- a/fixtures/consumer-mixed-grid-editors-subpath/package.json +++ b/fixtures/consumer-mixed-grid-editors-subpath/package.json @@ -10,7 +10,7 @@ "smoke": "node smoke-test.mjs" }, "dependencies": { - "@epam/ai-dial-ui-kit": "file:../.tarballs/epam-ai-dial-ui-kit-0.0.0.tgz", + "@epam/ai-dial-ui-kit": "file:../.tarballs/ai-dial-ui-kit.tgz", "@floating-ui/react": "^0.27.19", "@tabler/icons-react": "^3.41.1", "classnames": "^2.5.1", diff --git a/fixtures/consumer-mixed-grid/package.json b/fixtures/consumer-mixed-grid/package.json index b6666792..7917e541 100644 --- a/fixtures/consumer-mixed-grid/package.json +++ b/fixtures/consumer-mixed-grid/package.json @@ -10,7 +10,7 @@ "smoke": "node smoke-test.mjs" }, "dependencies": { - "@epam/ai-dial-ui-kit": "file:../.tarballs/epam-ai-dial-ui-kit-0.0.0.tgz", + "@epam/ai-dial-ui-kit": "file:../.tarballs/ai-dial-ui-kit.tgz", "@floating-ui/react": "^0.27.19", "@tabler/icons-react": "^3.41.1", "classnames": "^2.5.1", diff --git a/fixtures/consumer-schema-renderer/package.json b/fixtures/consumer-schema-renderer/package.json index 63dec5e2..75506f88 100644 --- a/fixtures/consumer-schema-renderer/package.json +++ b/fixtures/consumer-schema-renderer/package.json @@ -9,7 +9,7 @@ "assert": "node ../shared/assert-static-graph.mjs --dist dist --forbidden ag-grid-community,ag-grid-react,@uiw/react-md-editor,@uiw/react-markdown-preview,@monaco-editor/react,monaco-editor --dynamic-require @monaco-editor/react,monaco-editor --dynamic-after SchemaAdditionalPropertiesEditor:monaco-editor" }, "dependencies": { - "@epam/ai-dial-ui-kit": "file:../.tarballs/epam-ai-dial-ui-kit-0.0.0.tgz", + "@epam/ai-dial-ui-kit": "file:../.tarballs/ai-dial-ui-kit.tgz", "@floating-ui/react": "^0.27.19", "@monaco-editor/react": "^4.7.0", "@tabler/icons-react": "^3.41.1", diff --git a/fixtures/consumer-subpaths/package.json b/fixtures/consumer-subpaths/package.json index 7d6d7af4..c0787571 100644 --- a/fixtures/consumer-subpaths/package.json +++ b/fixtures/consumer-subpaths/package.json @@ -11,7 +11,7 @@ "test:cjs": "node cjs.cjs" }, "dependencies": { - "@epam/ai-dial-ui-kit": "file:../.tarballs/epam-ai-dial-ui-kit-0.0.0.tgz", + "@epam/ai-dial-ui-kit": "file:../.tarballs/ai-dial-ui-kit.tgz", "@floating-ui/react": "^0.27.19", "@modelcontextprotocol/sdk": "^1.29.0", "@monaco-editor/react": "^4.7.0", diff --git a/fixtures/run-all.mjs b/fixtures/run-all.mjs index b7fcb98f..4bce3085 100644 --- a/fixtures/run-all.mjs +++ b/fixtures/run-all.mjs @@ -15,6 +15,7 @@ import { mkdirSync, readFileSync, readdirSync, + renameSync, rmSync, } from 'node:fs'; import { dirname, join, resolve as resolvePath } from 'node:path'; @@ -24,6 +25,18 @@ const fixturesDir = dirname(fileURLToPath(import.meta.url)); const repoRoot = resolvePath(fixturesDir, '..'); const npmExecPath = process.env.npm_execpath; +/* + * `npm pack` names its output after `package.json#version`, and it cannot be + * told otherwise — so the filename is `…-0.0.0.tgz` on `development` and + * `…-0.14.0.tgz` on `release-0.14`. A fixture cannot pin a filename that + * moves with the branch: every one of them pinned the `0.0.0` spelling, so on + * a release branch all ten failed to install with `ENOENT` and this suite + * reported ten regressions that were really one wrong path. The packed + * artifact is therefore renamed to this one canonical, version-free name, + * which is what the fixtures pin. + */ +const CANONICAL_TARBALL = 'ai-dial-ui-kit.tgz'; + const runNpm = (args, cwd) => { if (npmExecPath) { execFileSync(process.execPath, [npmExecPath, ...args], { @@ -64,6 +77,17 @@ const main = () => { mkdirSync(tarballDir, { recursive: true }); runNpm(['pack', '--pack-destination', tarballDir], repoRoot); + const packed = readdirSync(tarballDir).filter((f) => f.endsWith('.tgz')); + if (packed.length !== 1) { + throw new Error( + `Expected exactly one packed tarball in ${tarballDir}, found ${ + packed.length === 0 ? 'none' : packed.join(', ') + }`, + ); + } + renameSync(join(tarballDir, packed[0]), join(tarballDir, CANONICAL_TARBALL)); + console.log(`Packed ${packed[0]} as ${CANONICAL_TARBALL}`); + const results = []; for (const name of listFixtureDirs()) { const dir = join(fixturesDir, name); @@ -74,7 +98,7 @@ const main = () => { console.log(`\n=== ${name} ===`); try { - // The tarball is rebuilt under the same versioned filename on every + // The tarball is rebuilt under the same canonical filename on every // run. Remove the generated lockfile (which pins the old tarball's // integrity) and the installed package itself. Keeping unrelated, // already-valid dependencies makes local re-runs fast; a clean CI diff --git a/package.json b/package.json index becc48b2..16cfb292 100644 --- a/package.json +++ b/package.json @@ -60,7 +60,7 @@ "test:run": "vitest run", "verify:agent-hook": "npm run typecheck && npm run lint:check && npm run test:run", "fixtures:run-all": "node fixtures/run-all.mjs", - "verify:distribution": "npm run fixtures:run-all && node tools/export-surface.mjs --check tools/baselines/root-exports.json && node tools/export-surface.mjs --verify-against-baseline tools/baselines/root-exports.json --from-tarball fixtures/.tarballs/epam-ai-dial-ui-kit-0.0.0.tgz && node tools/verify-pack-contents.mjs", + "verify:distribution": "npm run fixtures:run-all && node tools/export-surface.mjs --check tools/baselines/root-exports.json && node tools/export-surface.mjs --verify-against-baseline tools/baselines/root-exports.json --from-tarball fixtures/.tarballs/ai-dial-ui-kit.tgz && node tools/verify-pack-contents.mjs", "format": "prettier --check .", "format-fix": "prettier --write .", "preview": "vite preview",