feat(control-plane): provisionTenant/deprovisionTenant orchestration behind an injectable driver (fake driver only) - #7543
Conversation
…behind an injectable driver (fake driver only) Bootstrap a new standalone control-plane/ package (@loopover/control-plane, mirroring review-enrichment's structure) and add the tenant provisioning orchestration JSONbored#7180 needs, behind an injectable TenantProvisioningDriver interface tested only against an in-memory fake. - TenantProvisioningDriver: create-container / provision-DB / inject-secrets (the three steps JSONbored#7180 names) + idempotent teardown inverses + a containerExists reachability probe. Real Cloudflare/Postgres/broker drivers are out of scope (blocked on the unmade Postgres-provider decision); only the fake is implemented here. - provisionTenant()/deprovisionTenant(): product-agnostic orchestration (same call shape for ORB and AMS; product forwarded, never branched), running the three steps in order and tearing down in reverse. - createFakeTenantProvisioningDriver: in-memory driver with a call-order log, for full-lifecycle tests with no real infra dependency. Tests (node --test) cover the success lifecycle (create -> exists -> destroy -> gone) and the destroy-of-a-nonexistent-tenant no-op branch. Closes JSONbored#7524
|
Superagent didn't find any vulnerabilities or security issues in this PR. |
|
Tip ✅ LoopOver review result - approve/merge recommendedReview updated: 2026-07-20 21:37:07 UTC
Review summary Nits — 5 non-blocking
Decision drivers
Context & advisory signals — never blocks the verdict
Linked issue satisfactionAddressed Review context
Contributor next steps
Signal definitions
🧪 Chat with LoopOverAsk LoopOver a question about this PR directly in a comment — grounded only in the same cached, public-safe facts shown above, never a new claim.
Full command reference: https://loopover.ai/docs/loopover-commands 🧪 Experimental — new and may change. 🟩 Safe / merged · 🟦 Advisory · 🟨 Held for review · 🟥 Blocked / closed 💰 Earn for open-source contributions like this. Gittensor lets GitHub contributors earn for the work they already do — register to start earning →. Checked by LoopOver, a quiet PR intelligence layer for OSS maintainers.
|
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #7543 +/- ##
=======================================
Coverage 88.47% 88.47%
=======================================
Files 720 720
Lines 75733 75733
Branches 22547 22547
=======================================
Hits 67008 67008
Misses 7679 7679
Partials 1046 1046
Flags with carried forward coverage won't be shown. Click here to find out more. |
Summary
Builds the immediately-buildable piece #7180's research comment identified:
provisionTenant()/deprovisionTenant()as real orchestration logic behind an injectable driver interface, fully tested against a fake in-memory driver — without waiting on the still-open per-tenant-Postgres-provider decision.Greenfield: a new standalone
control-plane/repo-root package (@loopover/control-plane), bootstrapped mirroringreview-enrichment/'s structure (ownpackage.json/tsconfig/src/test, Node's built-innode --testrunner).What's here
TenantProvisioningDriver— the three steps Provisioning core: create/destroy a tenant's Container + Postgres DB #7180 names (create-container / provision-DB / inject-secrets) + their idempotent teardown inverses + acontainerExistsreachability probe. Mirrors theCodingAgentDriverinjectable-driver-with-fake pattern (packages/loopover-engine/src/miner/coding-agent-driver.ts).provisionTenant()/deprovisionTenant()— product-agnostic orchestration (identical call shape for an ORB and an AMS tenant;productis forwarded to every step, never branched on). Provision runs the three steps in order; deprovision tears down in reverse (revoke → drop → destroy) so a secret is never left addressable after its DB/container is gone.createFakeTenantProvisioningDriver— in-memory driver (mirroringcreateFakeCodingAgentDriver), with a call-order log for white-box assertions.Hard constraint honored
Fake driver only. No real Cloudflare Containers call, no real Postgres provisioning, no live credential — a real
inject-secretswould delegate to #7174's broker (src/orb/broker.ts) and real create/provision to the eventual Postgres driver, but none of those live paths are imported (dependencies: {}). Real drivers slot in behind this seam later without touching the orchestration, exactly likedriver-factory.ts's real drivers sit beside its fake today.Tests
control-plane/test/**(node --test, 10 tests): the acceptance-shape success lifecycle (create → container exists → destroy → container gone) and the required destroy-of-a-nonexistent-tenant no-op branch, plus fake-driver contract/idempotency tests. Run vianpm run control-plane:test(added to rootpackage.jsonmirroring therees:*scripts).Notes for reviewers
review-enrichment/,control-plane/is a standalone package with its ownnode --testrunner, so it's intentionally not added to the rootcodecov.yml/vitest.config.tscoverage.include— no root Codecov patch gate applies to it (matching the repo'sapps/**/rees convention).control-plane:install/control-plane:testscripts but intentionally does not touch.github/workflows/ci.yml. Wiring a path-filtered CI job (mirroring thereesjob) is a mechanical follow-up I kept out of this change to avoid a large edit to the shared workflow file — happy to add it here if preferred.Closes #7524