feat(control-plane): real Neon + Hyperdrive driver for tenant database provisioning - #7939
Conversation
…e provisioning (#7653) Implements provisionDatabase/dropDatabase for real against Neon (one Neon branch + dedicated database/role per tenant, idempotent create/destroy, operation polling to completion), composed onto the existing fake driver via a new driver-factory so createContainer/injectSecrets stay untouched until #7851/#7852 land their own real implementations. Widens TenantProvisioningDriver's provisionDatabase to return connection details instead of discarding them, threading the result through provisionTenant's own return value. Does not wire a Cloudflare Hyperdrive binding: control-plane has no deployable service/wrangler.jsonc yet (#7654), so there's nowhere for one to attach to today. Tests mock every Neon API call; no live credentials anywhere in this repo.
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #7939 +/- ##
==========================================
- Coverage 91.79% 91.41% -0.39%
==========================================
Files 733 735 +2
Lines 75133 75423 +290
Branches 22918 22950 +32
==========================================
- Hits 68971 68946 -25
- Misses 5083 5430 +347
+ Partials 1079 1047 -32
Flags with carried forward coverage won't be shown. Click here to find out more.
|
|
Tip ✅ LoopOver review result - approve/merge recommendedReview updated: 2026-07-21 20:05:48 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.
|
Summary
Closes #7653
provisionDatabase/dropDatabasefor real against Neon (part of Provisioning core: create/destroy a tenant's Container + Postgres DB #7180's provisioning core — the Neon + Cloudflare Hyperdrive provider decision was already made on Provisioning core: create/destroy a tenant's Container + Postgres DB #7180, the same decision Disposable per-attempt data/DB fork for APR execution (data-side equivalent of worktree-pool.ts) #7649/Neon branch-per-attempt disposable DB fork for APR execution (implements #7649) #7858 build on for APR's own per-attempt branch forking).TenantProvisioningDriver.provisionDatabase's return type fromPromise<void>to return connection details — a freshly created role's password would otherwise be silently discarded — and threads it throughprovisionTenant's own result.driver-factory.ts(withRealDatabaseDriver+createTenantProvisioningDriver): composes the real Neon driver's two methods onto the existing fake driver, leavingcreateContainer/injectSecrets/etc. untouched until Real Cloudflare Containers driver for control-plane's createContainer/destroyContainer/containerExists #7851/Real secret-injection driver for control-plane's injectSecrets/revokeSecrets via the generalized broker #7852 land their own real implementations. This lets Real Postgres/Hyperdrive driver for control-plane's provisionDatabase/deprovisionDatabase #7653 ship independently, since neither of those pieces exists yet.Scope
type(scope): short summaryConventional Commit format.control-plane/has no deployable service/wrangler.jsoncyet (Stand up control-plane's real HTTP transport (POST/GET/DELETE /v1/tenants) matching the already-merged client #7654, still open), so there is nowhere for one to attach to today. This returns the raw Neon connection details; Hyperdrive routing is Stand up control-plane's real HTTP transport (POST/GET/DELETE /v1/tenants) matching the already-merged client #7654's job once a real service exists.Validation
git diff --checknpm run typecheck(root)npm run control-plane:test— 55/55 passing (node --test, control-plane's own runner, not vitest).npm run control-plane:coverage— 100% line/branch/function coverage on every file this PR touches or adds; the only residual gap (settlement-backend-driver.ts) is pre-existing and untouched by this PR.npm audit --audit-level=moderate— pre-existing ambient advisories only, unrelated to this PR's dependencies (this PR adds none);audit.ymldocuments this as a scheduled, non-blocking check, not a per-PR gate.globalThis.fetchwith a strict ordered response queue (mirrorspagerduty-notify.test.ts's existing convention). A maintainer provisions a real Neon project/API key (NEON_API_KEY/NEON_PROJECT_ID) whenever ready to deploy for real; until thencreateTenantProvisioningDriverfalls back to the plain fake.Safety
NEON_API_KEYis read from environment/config only, never hardcoded.Notes
Follow-up infra work on top of #7180 (provisioning core) and #7649/#7858 (the Neon branch-per-attempt decision this reuses). Endpoint paths/response shapes follow Neon's public v2 API docs as read at the time of writing — flagged in
neon-database-driver.ts's header comment to verify against a live account before the first real deploy.