fix(ci) Ship the compiled contract in the deploy tarball #15

Merged
araemer merged 1 commit from ship-built-contract into stage 2026-09-26 06:35:50 +00:00
Owner

Problem

Since #13, stage fails in two independent ways once it leaves CI:

  1. Runtime crash. The compiled backend imports the contract's enum constants as values, and plain Node cannot load the contract's TypeScript source (ERR_MODULE_NOT_FOUND …/api-contract/src/auth.js). Fixed on the contract side in recipe-platform build-contract-for-node, which now compiles to dist/ and points Node at it.
  2. Broken deploy package. build_stage.yaml and build_release.yaml ship node_modules/ in the tarball, but node_modules/@recipe/contract is a symlink to ../recipe-platform/api-contract, which does not exist on the target host.

Tests and tsc pass in both cases, so CI never caught either one.

Change

  • build_stage.yaml and build_release.yaml: after mv node_modules build, the symlink is replaced with a real copy of the contract's package.json and compiled dist/.
  • CLAUDE.md: documents that Node loads the contract's dist/, and that npm run build in ../recipe-platform/api-contract is needed after contract changes.

Verification

I ran the stage pipeline steps locally on fresh copies of both repos:

  • contract npm install, which builds dist/ via prepare
  • npm ci, 366/366 tests, npm run build
  • the new packaging step and tar

Then I unpacked the tarball in a directory with no recipe-platform next to it and booted node index.js against the dev DB. The server started and /health returned UP.

Merge order

The recipe-platform PR build-contract-for-node must be merged to main first. This workflow clones platform main, and without dist/ the copy step fails.

🤖 Generated with Claude Code

## Problem Since #13, `stage` fails in two independent ways once it leaves CI: 1. **Runtime crash.** The compiled backend imports the contract's enum constants as values, and plain Node cannot load the contract's TypeScript source (`ERR_MODULE_NOT_FOUND …/api-contract/src/auth.js`). Fixed on the contract side in recipe-platform `build-contract-for-node`, which now compiles to `dist/` and points Node at it. 2. **Broken deploy package.** `build_stage.yaml` and `build_release.yaml` ship `node_modules/` in the tarball, but `node_modules/@recipe/contract` is a symlink to `../recipe-platform/api-contract`, which does not exist on the target host. Tests and `tsc` pass in both cases, so CI never caught either one. ## Change - `build_stage.yaml` and `build_release.yaml`: after `mv node_modules build`, the symlink is replaced with a real copy of the contract's `package.json` and compiled `dist/`. - `CLAUDE.md`: documents that Node loads the contract's `dist/`, and that `npm run build` in `../recipe-platform/api-contract` is needed after contract changes. ## Verification I ran the stage pipeline steps locally on fresh copies of both repos: - contract `npm install`, which builds `dist/` via `prepare` - `npm ci`, 366/366 tests, `npm run build` - the new packaging step and `tar` Then I unpacked the tarball in a directory with no `recipe-platform` next to it and booted `node index.js` against the dev DB. The server started and `/health` returned `UP`. ## Merge order The recipe-platform PR `build-contract-for-node` must be merged to `main` **first**. This workflow clones platform `main`, and without `dist/` the copy step fails. 🤖 Generated with [Claude Code](https://claude.com/claude-code)
fix(ci) Ship the compiled contract in the deploy tarball
All checks were successful
/ test (pull_request) Successful in 44s
9b220bab04
The packaged node_modules contained @recipe/contract as a symlink to
../recipe-platform/api-contract, which does not exist on the target host. The stage and
release workflows now replace it with a real copy of the contract's package.json and
compiled dist/. Also documents the new local rebuild step in CLAUDE.md.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
araemer merged commit 70dc672be0 into stage 2026-09-26 06:35:50 +00:00
Sign in to join this conversation.
No reviewers
No labels
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
araemer/recipe-backend!15
No description provided.