Heimdall/deployment/idunn/recipe.toml
Meta Vens 9b727abe4d Run pnpm through corepack in the build runner
The pinned node image provides npm but not pnpm, and the image entrypoint
execs node for an unrecognised first argument, so a pnpm step failed with
"Cannot find module /workspace/pnpm". Heimdall declares
packageManager: pnpm@10.33.0, and corepack ships with node and honours
that declaration, so it is the toolchain the image already has rather than
a second thing to install.

corepack needs a writable home; COREPACK_HOME joins the step environment
alongside NPM_CONFIG_CACHE and HOME, pointing into the bind-mounted cache.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
2026-09-06 16:43:10 +02:00

136 lines
4.6 KiB
TOML

# The runtime contract below is implemented as of 2026-09-06.
#
# GAMECULT_IDUNN_CANDIDATE_BIND src/config.ts takes the candidate socket
# over HOST/PORT, requires loopback and a
# usable port, and refuses to start unless
# GC_ACCESS_BASE_URL is set, so an
# ephemeral port can never become the
# provider-registered OAuth callback.
# GAMECULT_IDUNN_PROCESS_WRITE_LEASE src/process-write-lease.ts. The single
# writer of heimdall.service.cc declines
# unless the lease names this incarnation.
# GAMECULT_IDUNN_RUNTIME_BUNDLE read for expected.cc, which is how the
# process learns which incarnation it is.
#
# Health reports `warming` until the lease is held and `active` after, because
# Idunn must observe warming presence before it fences the incumbent.
#
# Still untested against a live Idunn: nothing here has been through an actual
# `idunn up heimdall`, and the daemon on yggdrasil is still the previous
# generation. Treat the first deployment as the real verification.
schema = "gamecult.idunn.target_declaration.v1"
target = "heimdall"
source_stamp_environment = "HEIMDALL_BUILD_COMMIT"
required_gitlinks = ["vendor/CultLib"]
# CultLib's TypeScript packages resolve through main/types to dist/, which a
# fresh checkout does not have. They must be built before Heimdall's own
# typecheck can resolve cultcache-ts, cultnet-ts or cultmesh-ts. This used to
# live in a shell manifest on the host; it belongs here, where the source seal
# covers it.
[[steps]]
id = "install-cultlib"
phase = "build"
runner = "node-build"
required_environment = ["NPM_CONFIG_CACHE", "HOME", "COREPACK_HOME"]
argv = ["npm", "ci", "--ignore-scripts", "--prefix", "vendor/CultLib"]
[[steps]]
id = "build-cultcache-ts"
phase = "build"
runner = "node-build"
required_environment = ["NPM_CONFIG_CACHE", "HOME", "COREPACK_HOME"]
argv = ["npm", "run", "build", "--prefix", "vendor/CultLib", "--workspace=cultcache-ts"]
[[steps]]
id = "build-cultnet-ts"
phase = "build"
runner = "node-build"
required_environment = ["NPM_CONFIG_CACHE", "HOME", "COREPACK_HOME"]
argv = ["npm", "run", "build", "--prefix", "vendor/CultLib", "--workspace=cultnet-ts"]
[[steps]]
id = "build-cultmesh-ts"
phase = "build"
runner = "node-build"
required_environment = ["NPM_CONFIG_CACHE", "HOME", "COREPACK_HOME"]
argv = ["npm", "run", "build", "--prefix", "vendor/CultLib", "--workspace=cultmesh-ts"]
[[steps]]
id = "install-heimdall"
phase = "build"
runner = "node-build"
required_environment = ["NPM_CONFIG_CACHE", "HOME", "COREPACK_HOME"]
argv = ["corepack", "pnpm", "install", "--frozen-lockfile"]
[[steps]]
id = "test-heimdall"
phase = "test"
runner = "node-build"
required_environment = ["NPM_CONFIG_CACHE", "HOME", "COREPACK_HOME"]
argv = ["corepack", "pnpm", "test"]
[[steps]]
id = "build-heimdall"
phase = "build"
runner = "node-build"
required_environment = ["NPM_CONFIG_CACHE", "HOME", "COREPACK_HOME"]
argv = ["corepack", "pnpm", "build"]
# The unit runs dist/src/index.js, and Node resolves its imports at runtime, so
# the release is the compiled output plus the production dependency tree. These
# are the two artifacts; nothing else from the build tree is installed.
[[artifacts]]
id = "heimdall-dist"
source_kind = "runner-output"
runner = "node-build"
source = "dist"
destination = "dist"
executable = false
[[artifacts]]
id = "heimdall-node-modules"
source_kind = "runner-output"
runner = "node-build"
source = "node_modules"
destination = "node_modules"
executable = false
[service]
executable_artifact = "heimdall-dist"
arguments = [
{ kind = "literal", value = "dist/src/index.js" },
{ kind = "literal", value = "--state-root" },
{ kind = "binding", name = "state_root" },
]
transport = "http"
route_required = true
optional_environment = []
required_environment = [
"GAMECULT_IDUNN_RUNTIME_BUNDLE",
"GAMECULT_IDUNN_CANDIDATE_BIND",
"GAMECULT_IDUNN_PROCESS_WRITE_LEASE",
"GC_ACCESS_BASE_URL",
"GC_ACCESS_DATABASE_URL",
]
[service.health]
contract = "heimdall.cultnet-rudp-access-health"
[state]
schema_generation = "heimdall-v1"
[[state.slots]]
id = "service"
relative_path = "heimdall.service.cc"
kind = "cultcache-file"
schema = "heimdall.service_state.v1"
writer = "process-bound-single-writer"
recovery = "preserve"
startup = "create-or-open-after-write-lease"
[[provides]]
capability = "gamecult.shared-auth"
schema = "heimdall.access-discovery.v1"
compatibility = "v1"