Skip to content

fix(builder): provision() respects autoProvision + per-call override#86

Merged
jbiskur merged 4 commits into
mainfrom
fix/provision-respects-autoprovision-pathway
May 18, 2026
Merged

fix(builder): provision() respects autoProvision + per-call override#86
jbiskur merged 4 commits into
mainfrom
fix/provision-respects-autoprovision-pathway

Conversation

@jbiskur
Copy link
Copy Markdown
Contributor

@jbiskur jbiskur commented May 18, 2026

Summary

  • PathwaysBuilder.provision() previously ignored autoProvision and always called registerPathwayInstance(), which crashed in prod (pathwayMode: "managed" default) when no managedConfig.endpointUrl was supplied — even with autoProvision.pathway: false.
  • provision() now mirrors startPump() semantics: shared-resource provisioning is gated on dataCore / flowType / eventType, and the pathway instance is upserted only when pathway: true.
  • Adds an optional per-call override argument so callers can flip the behavior at a specific call-site (parity with startPump(options.autoProvision)).

Why this matters

usable-chat production boot is currently crash-looping because the bootstrap calls pathways.provision() and the library tries to upsert a managed pathway despite autoProvision: { pathway: false }. The managed pathway is managed manually via CP/MCP — the library should never auto-create it. This patch unblocks that deployment.

Test plan

  • New test suite tests/pathway-builder-provision.test.ts (5 steps), all passing:
    • managed prod default → shared resources only, no pathway upsert (no endpointUrl needed)
    • autoProvision: { pathway: true } → managed upsert fires
    • virtual default → shared resources only, no by-name upsert
    • defaultAutoProvision: false → nothing provisioned
    • per-call override beats builder-level setting
  • Existing builder/pump/router suites: 16 passed (145 steps) when postgres-backed tests are excluded (require local postgres)
  • CI green

jbiskur and others added 2 commits May 18, 2026 11:11
…ll override

Previously `PathwaysBuilder.provision()` unconditionally called
`registerPathwayInstance()`, ignoring the builder's `autoProvision` config.
In production with the default `pathwayMode: "managed"` this attempted to
upsert a managed pathway and crashed with
`managedConfig.endpointUrl is required when provisioning a managed pathway`
even when callers had set `autoProvision.pathway: false`.

`provision()` now mirrors the `startPump()` semantics:
- only provisions data-core / flow-types / event-types when their flag is on
- only upserts the pathway instance when `autoProvision.pathway` is true
- accepts an optional per-call autoProvision override

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Unrelated to the provision() fix in this PR but blocking it — dnt was
resolving the existing `^0.19.0` constraint to 0.19.1, which trips a
date-fns type-declaration error during the npm typecheck step. Bumping
to ^0.21.2 (the current latest) gets us past it.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@jbiskur jbiskur force-pushed the fix/provision-respects-autoprovision-pathway branch from ab8b29f to 84b0521 Compare May 18, 2026 10:27
jbiskur and others added 2 commits May 18, 2026 11:30
date-fns 4.2.0 (released after our last green CI on 2026-05-05) dropped
the top-level `types` field from package.json. dnt 0.41.3's bundled
TypeScript 5.x can't resolve type defs through the exports map, so the
npm build typecheck errors with `Could not find a declaration file for
module 'date-fns'` for any transitive importer (e.g. @flowcore/data-pump).

Pin to 4.1.0 — the last version with the top-level `types` field —
until dnt is updated or date-fns restores the field.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Deno 2.6.1 / TS 5.9 tightened the inferred type of the `init` parameter
in `stub(globalThis, "fetch", …)` callbacks so that the standard
`RequestInit.body` property is no longer visible. Explicitly cast to
`RequestInit | undefined` to dodge the regression without changing
runtime behaviour.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@jbiskur jbiskur merged commit 589f0c4 into main May 18, 2026
1 check passed
@jbiskur jbiskur deleted the fix/provision-respects-autoprovision-pathway branch May 18, 2026 10:36
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