Skip to content

chore: declare the API's env in Railway IaC, and release 0.0.3 - #48

Closed
maxigimenez wants to merge 1 commit into
mainfrom
chore/railway-secret-key-and-0.1.0
Closed

maxigimenez wants to merge 1 commit into
mainfrom
chore/railway-secret-key-and-0.1.0

Conversation

@maxigimenez

@maxigimenez maxigimenez commented Sep 7, 2026 •

Copy link
Copy Markdown
Owner

You were right — #47 documented setting SENTINEL0_SECRET_KEY on Railway but left .railway/railway.ts declaring only DATABASE_URL, so railway config plan showed the key as a removal.

That was worse than a plan-noise problem. The key is what decrypts every stored tracker credential, so an apply would have deleted it and made all of them unreadable — and the failure shape is that the deploy succeeds and the Integrations screen starts throwing.

The actual scope

env is reconciled, not merged: a variable set outside this file and absent from it is removed. That was never specific to the new key. Every one of these was one railway config apply away from the same silent deletion:

DASHBOARD_URL · CORS_ORIGINS · LOG_LEVEL · DATABASE_POOL_MAX · DATABASE_SSL · SLACK_WEBHOOK_HOST

So all of them are now declared with preserve(), alongside SENTINEL0_SECRET_KEY. A declared name that isn't set yet is a no-op; an undeclared one is a deletion waiting to happen — which makes declaring the full set strictly safer than declaring only what happens to be in use today.

PORT stays undeclared: Railway injects it rather than it being configured.

pnpm railway:plan now reports "Your Railway configuration is already up to date." — verified against the live project, which also confirms nothing else had drifted.

The trap is written down in CLAUDE.md and docs/deploy-cloud.md, since it will bite the next variable otherwise.

Release 0.0.3

pnpm version:set 0.0.3 across the root, all five packages, and the cli's internal @sentinel0/* pins, with the lockfile regenerated to record them.

Stale version numbers move with it: the sample /health output in api.md and deploy-cloud.md said 0.0.1, releasing.md installed a 0.0.1 tarball, and both it and publish-cli.yml used 0.0.2 as their "next release" example — now 0.0.4.

Publishing is still workflow_dispatch, so this bumps the numbers and ships nothing on its own.

Verification

pnpm build, pnpm lint, pnpm test — 526 tests pass. railway.ts typechecks, and railway:plan is clean.

🤖 Generated with Claude Code

https://claude.ai/code/session_01V2EALFY5U8TCSXHMTnUmra

`SENTINEL0_SECRET_KEY` was documented as something to set on the Railway
dashboard, and `.railway/railway.ts` was left declaring only `DATABASE_URL` --
so `railway config plan` showed the key as a *removal*, and an apply would have
deleted it. Since that key is what decrypts every stored tracker credential,
the next apply would have made all of them unreadable, and the shape of the
failure is that the deploy succeeds and the Integrations screen starts throwing
instead.

A service's `env` is reconciled rather than merged: a variable set outside this
file and absent from it is removed. That is not specific to the new key --
`DASHBOARD_URL`, `CORS_ORIGINS`, `LOG_LEVEL`, `DATABASE_POOL_MAX`,
`DATABASE_SSL` and `SLACK_WEBHOOK_HOST` were all one apply away from the same
deletion, silently, because nothing reads them until the moment they matter.

So every variable the api service reads is now declared with `preserve()`. A
declared name that is not set yet is a no-op, while an undeclared one is a
deletion waiting to happen, which makes declaring the full set strictly safer
than declaring the ones that happen to be in use today. `PORT` stays out: it is
injected by Railway rather than configured. `pnpm railway:plan` reads clean
again.

The version goes to 0.0.3 across the workspace and the cli's internal
`@sentinel0/*` pins, with the lockfile regenerated to record them. Stale
version numbers in the docs move with it: the sample `/health` output in
api.md and deploy-cloud.md said 0.0.1, releasing.md packed a 0.0.1 tarball, and
both it and publish-cli.yml used 0.0.2 as their "next release" example, which
is now 0.0.4.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01V2EALFY5U8TCSXHMTnUmra
@maxigimenez
maxigimenez force-pushed the chore/railway-secret-key-and-0.1.0 branch from d000092 to e77dac0 Compare September 7, 2026 07:42
@maxigimenez maxigimenez closed this Sep 7, 2026
@maxigimenez
maxigimenez deleted the chore/railway-secret-key-and-0.1.0 branch September 7, 2026 07:42
@maxigimenez maxigimenez changed the title chore: declare the API's env in Railway IaC, and release 0.1.0 chore: declare the API's env in Railway IaC, and release 0.0.3 Sep 7, 2026
@maxigimenez

Copy link
Copy Markdown
Owner Author

Superseded by #49 — this one was auto-closed when the branch was renamed from chore/railway-secret-key-and-0.1.0 to chore/railway-env-and-0.0.3 (the version bump is 0.0.3, not 0.1.0). Same commit, same content.

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