fix(pathways): never register a pathway instance in development - #104
Merged
Conversation
`runtimeEnv: "development"` performed the by-name pathway upsert whenever `autoProvision.pathway` was true, then started pulse and command polling against the returned pathwayId. Every developer boot therefore created a shared control-plane resource, left a stray pathway row behind, and polled for datapumpRestart commands aimed at real deployments. Development now skips pathway-instance registration outright, matching the documented contract and the `test` runtime. The guard sits in registerPathwayInstance(), so provision(), startPump(), and the leader bootstrap path are all covered. Without a pathwayId, auto-pulse and the command poller stay off too. Adds `allowDevelopmentPathwayRegistration` as an explicit escape hatch for local control-plane work. It is separate from `autoProvision.pathway` and logs a warning on every boot. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
runtimeEnv: "development"performed the by-name pathway upsert wheneverautoProvision.pathwaywas true, then started pulse and command polling against the returnedpathwayId.Every developer boot therefore:
datapumpRestartcommands that may be aimed at a real deployment.It was silent, because
NoopLoggeris the library default.Two docs disagreed on the intended behaviour and the library followed the wrong one:
79a08d39-e7b5-44ec-a3c0-262f292a1b22(Declarative Registration & Auto-Provisioning) — "development never provisions a pathway instance". This is the intended contract.4888704b-9166-4145-83c0-2b35544ab58e(April 2026 Runtime Split) — runtime table listed development registration asopt-in. Wrong; being corrected separately.Reported in
861eec82-a79b-4c95-b101-3aebaae3c9d8. Decision taken by @jbiskur on 2026-08-16: development must not auto-provision a pathway instance.Changes
registerPathwayInstance()now returns early whenruntimeEnv === "development". The guard sits in one place, soprovision(),startPump(), and the leader bootstrap path are all covered.pathwayId, auto-pulse and the command poller stay off in development by themselves.allowDevelopmentPathwayRegistrationbuilder option — an explicit escape hatch for local control-plane work. It is deliberately separate fromautoProvision.pathwayand logs atwarnon every boot.registerPathwayInstance(), so it can no longer report a registration that did not happen.opt-in→skipped, plus a note explaining why.Type of Change
Behaviour change for consumers: anyone relying on development registration loses it on upgrade.
allowDevelopmentPathwayRegistration: truerestores it.Testing
deno test -A --ignore=tests/postgres-pathway-state.test.ts; the postgres suites need port 5432, which was occupied locally — CI runs its own service)New steps in
tests/pump-runtime-behavior.test.ts:autoProvision: { pathway: true }→ noPUT /api/v1/pathways/by-name/{name}, pump still startsstartPump()override → also ignoredprovision()→ no by-name upsert eitherallowDevelopmentPathwayRegistration: true→ registers, and warnsTwo existing steps asserted the defective behaviour and were inverted.
Checklist
deno fmt,deno lint,deno check src/mod.tscleandeno run -A bin/build-npm.tssucceeds🤖 Generated with Claude Code