Skip to content

fix: build before testing on the publish path - #51

Merged
maxigimenez merged 1 commit into
mainfrom
fix/publish-build-before-test
Sep 7, 2026
Merged

maxigimenez merged 1 commit into
mainfrom
fix/publish-build-before-test

Conversation

@maxigimenez

Copy link
Copy Markdown
Owner

Follow-up to #50. The 0.0.4 publish failed at Test.

What broke

publish-cli.yml runs Lint → Test → Build. ci.yml builds first — which is why #50's PR checks were green and the publish was not.

The bundled-manifest test added in #50 read packages/common/dist/ to check that every exports entry names a file the build emitted. On the publish path there is no build yet, so all fourteen entries looked unbuilt:

+ "  @sentinel0/common/github → ./dist/github.js (not built)",

The fix

The test no longer depends on a build. It maps each ./dist/<module>.{js,d.ts} target back to src/<module>.ts and asserts the source exists, and flags any target shape the mapping doesn't recognise so it can't pass by accident.

Guarding it with skipIf(!existsSync(dist)) — the pattern common's circular-import guard uses — would have been the worse fix: green, and testing nothing, on the one path that publishes. prepare-package.mjs still asserts against real dist/ at pack time, where a build has just run and cannot be absent.

publish-cli.yml builds before testing anyway, matching ci.yml. That also un-skips common/test/built-output.test.ts, which imports the compiled package to catch circular imports the source alias hides — it had been skipping silently on every publish.

Verification

From a clean tree (pnpm clean), both orders:

no dist/ after build
CLI suite 57 passed 57 passed
common suite 3 passed, 1 skipped 4 passed

And the test is not vacuous — adding an ./ghost export with no source module fails it with no dist/ present:

× names only modules packages/common actually has
+   "./dist/ghost.js — no src/ghost.ts to build it from",

Then the full publish sequence in the new order — lint, build, test, exec-bit, pack — followed by a clean npm install of the tarball: the bundle gate passes and sentinel0 start reaches its config check.

🤖 Generated with Claude Code

https://claude.ai/code/session_01EkUWsM92gcbit4p6hEhuyV

The 0.0.4 publish failed at Test. `publish-cli.yml` runs Lint → Test → Build,
where `ci.yml` builds first, and the bundled-manifest test added in #50 read
`packages/common/dist/` — absent at that point, so every `exports` entry
looked unbuilt.

The test no longer depends on a build: it maps each `./dist/<module>.{js,d.ts}`
target back to `src/<module>.ts` and asserts the source exists, flagging any
target shape the mapping does not recognise so it cannot pass by accident.
Guarding it with `skipIf(!existsSync(dist))` — the pattern `common`'s
circular-import guard uses — would have been the worse fix: green, and testing
nothing, on the one path that publishes. `prepare-package.mjs` still asserts
against real `dist/` at pack time, where a build has just run.

`publish-cli.yml` now builds before testing anyway, matching `ci.yml`. That
also un-skips `common/test/built-output.test.ts`, which imports the compiled
package to catch circular imports the source alias hides and had been skipping
silently on every publish.

Verified both ways from a clean tree: with no `dist/` present the suite passes
and still fails on an `exports` entry with no source module; in the new order
`common` reports 4 files passed rather than 3 passed and 1 skipped. The packed
tarball installs clean, clears the bundle gate, and `sentinel0 start` reaches
its config check.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01EkUWsM92gcbit4p6hEhuyV
@maxigimenez
maxigimenez merged commit 57d7ddd into main Sep 7, 2026
2 checks passed
@maxigimenez
maxigimenez deleted the fix/publish-build-before-test branch September 7, 2026 08:10
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.

1 participant