You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
#7180 needs a real provisioning core, but the maintainer's own 2026-07-18 research comment on that
issue found a genuine open business/architecture question blocking the real implementation: how a
per-tenant Postgres actually gets provisioned (Cloudflare Hyperdrive fronting a managed Postgres vs.
a self-run pool vs. something else) — that decision is explicitly not made yet and is out of
scope here.
The same comment, however, recommended a concrete, immediately-buildable piece that doesn't wait on
that decision: write provisionTenant()/deprovisionTenant() as real orchestration logic — create-
container, provision-DB, inject-secrets-via-#7174's-broker as explicit steps — behind an
injectable driver interface, fully tested against a fake/in-memory driver. This mirrors an
existing, proven pattern in this monorepo: packages/loopover-engine/src/miner/driver-factory.ts's CodingAgentDriver interface, which ships a createFakeCodingAgentDriver/createNoopCodingAgentDriver
alongside its real CLI-subprocess/Agent-SDK drivers specifically so orchestration logic can be fully
tested without any real external dependency. This issue applies the identical shape to tenant
provisioning.
Note: this is genuinely greenfield. The control-plane/ package referenced in #7173's ratified
location decision (a new standalone package, repo-root, alongside review-enrichment/) does not
exist in the repository yet. This issue's own deliverables include bootstrapping that package's
skeleton to the minimum needed to host this code — mirror review-enrichment/'s existing structure
(package.json, tsconfig.json, src/, test/) as the precedent for a new repo-root TypeScript
package, rather than inventing a different layout.
⚠️Hard constraint, read before starting. This issue's deliverable is the orchestration logic
and its driver interface, tested only against a fake/in-memory driver. It explicitly does not
include: a real Cloudflare Containers API call, a real Postgres provisioning call, or any live
infrastructure credential. A PR that wires a real Cloudflare Containers or Postgres SDK call does
NOT resolve this issue — that work is separate, blocked-on-the-still-open-Postgres-provider-decision
follow-up work, not this issue's scope.
Implement provisionTenant(tenant, product, driver) / deprovisionTenant(tenant, product, driver)
as real orchestration logic against that interface only — product-agnostic (same call shape for
an ORB tenant and an AMS tenant, per Provisioning core: create/destroy a tenant's Container + Postgres DB #7180's own "product-agnostic" deliverable).
Provide a fake/in-memory driver implementation (mirroring createFakeCodingAgentDriver's shape —
an in-memory map standing in for "a container exists"/"a DB exists," toggled by the same
create/destroy calls) sufficient to exercise the full lifecycle in tests.
Bootstrap the control-plane/ package skeleton (package.json, tsconfig, test runner) only to the
extent needed to host this module — no unrelated scaffolding.
New code under a new control-plane/ package — if this package is not added to the root Codecov coverage.include alongside src/**/workers/**, note that explicitly in the PR so a future
reader isn't confused about why Codecov doesn't gate it (matching this repo's own documented
convention for apps/**-style exclusions). If it can be included, target the same 99%+ patch bar as src/**. Either way, the orchestration logic and both driver-lifecycle branches (success and
destroy-of-nonexistent-tenant) need explicit test coverage.
Expected Outcome
provisionTenant()/deprovisionTenant() exist as real, fully-tested orchestration logic with a
clean driver seam. Once the Postgres-provider decision is eventually made, a real driver can be
written and swapped in without touching this orchestration code at all — the same way driver-factory.ts's real CLI drivers slot in next to its fake one today.
packages/loopover-engine/src/miner/driver-factory.ts — the injectable-driver precedent this
mirrors (CodingAgentDriver, createFakeCodingAgentDriver)
src/selfhost/pg-adapter.ts — existing driver-shape precedent the eventual real Postgres driver
should conform to (not needed for this issue, cited for whoever picks up the real-driver follow-up)
review-enrichment/package.json — structure precedent for bootstrapping the new control-plane/
package
Context
#7180 needs a real provisioning core, but the maintainer's own 2026-07-18 research comment on that
issue found a genuine open business/architecture question blocking the real implementation: how a
per-tenant Postgres actually gets provisioned (Cloudflare Hyperdrive fronting a managed Postgres vs.
a self-run pool vs. something else) — that decision is explicitly not made yet and is out of
scope here.
The same comment, however, recommended a concrete, immediately-buildable piece that doesn't wait on
that decision: write
provisionTenant()/deprovisionTenant()as real orchestration logic — create-container, provision-DB, inject-secrets-via-#7174's-broker as explicit steps — behind an
injectable driver interface, fully tested against a fake/in-memory driver. This mirrors an
existing, proven pattern in this monorepo:
packages/loopover-engine/src/miner/driver-factory.ts'sCodingAgentDriverinterface, which ships acreateFakeCodingAgentDriver/createNoopCodingAgentDriveralongside its real CLI-subprocess/Agent-SDK drivers specifically so orchestration logic can be fully
tested without any real external dependency. This issue applies the identical shape to tenant
provisioning.
Note: this is genuinely greenfield. The
control-plane/package referenced in #7173's ratifiedlocation decision (a new standalone package, repo-root, alongside
review-enrichment/) does notexist in the repository yet. This issue's own deliverables include bootstrapping that package's
skeleton to the minimum needed to host this code — mirror
review-enrichment/'s existing structure(
package.json,tsconfig.json,src/,test/) as the precedent for a new repo-root TypeScriptpackage, rather than inventing a different layout.
Requirements
TenantProvisioningDriverinterface covering the three steps Provisioning core: create/destroy a tenant's Container + Postgres DB #7180's own comment namesexplicitly: create-container, provision-DB, inject-secrets (the last one calling into Generalize src/orb/broker.ts into a multi-secret-type broker shared by ORB + AMS hosted #7174's
already-merged broker-generalization work for credential injection — do not hand-roll a separate
secrets path).
provisionTenant(tenant, product, driver)/deprovisionTenant(tenant, product, driver)as real orchestration logic against that interface only — product-agnostic (same call shape for
an ORB tenant and an AMS tenant, per Provisioning core: create/destroy a tenant's Container + Postgres DB #7180's own "product-agnostic" deliverable).
createFakeCodingAgentDriver's shape —an in-memory map standing in for "a container exists"/"a DB exists," toggled by the same
create/destroy calls) sufficient to exercise the full lifecycle in tests.
control-plane/package skeleton (package.json, tsconfig, test runner) only to theextent needed to host this module — no unrelated scaffolding.
Deliverables
control-plane/package skeleton (mirroringreview-enrichment/'s structure)TenantProvisioningDriverinterface (create-container / provision-DB / inject-secrets shape)provisionTenant()/deprovisionTenant()orchestration logic implemented against theinterface, product-agnostic
Postgres dependency anywhere in this issue's test suite)
the fake) → destroy → container "gone" (via the fake)
Test Coverage Requirements
New code under a new
control-plane/package — if this package is not added to the root Codecovcoverage.includealongsidesrc/**/workers/**, note that explicitly in the PR so a futurereader isn't confused about why Codecov doesn't gate it (matching this repo's own documented
convention for
apps/**-style exclusions). If it can be included, target the same 99%+ patch bar assrc/**. Either way, the orchestration logic and both driver-lifecycle branches (success anddestroy-of-nonexistent-tenant) need explicit test coverage.
Expected Outcome
provisionTenant()/deprovisionTenant()exist as real, fully-tested orchestration logic with aclean driver seam. Once the Postgres-provider decision is eventually made, a real driver can be
written and swapped in without touching this orchestration code at all — the same way
driver-factory.ts's real CLI drivers slot in next to its fake one today.Links & Resources
packages/loopover-engine/src/miner/driver-factory.ts— the injectable-driver precedent thismirrors (
CodingAgentDriver,createFakeCodingAgentDriver)src/selfhost/pg-adapter.ts— existing driver-shape precedent the eventual real Postgres drivershould conform to (not needed for this issue, cited for whoever picks up the real-driver follow-up)
review-enrichment/package.json— structure precedent for bootstrapping the newcontrol-plane/package
reimplement