feat(control-plane): stand up the real HTTP transport as a Cloudflare Worker#7960
Conversation
… Worker (#7654) Implements the POST/GET/DELETE /v1/tenants routes packages/loopover-miner's tenant-client.ts already hardcodes, Bearer-authenticated against a single admin token. Adds a KV-backed tenant registry (TenantProvisioningDriver has no enumeration concept by design) tracking name/product/lifecycle state only -- never a tenant's database connection details, which this transport never echoes on the wire. Not idempotent by design: recreating an active tenant is a 409, deleting an unknown one is a 404. Deploys as a real Cloudflare Worker (wrangler.jsonc, nodejs_compat for the existing Node-oriented auth/provisioning/pagerduty modules this reuses unmodified) -- this becomes the deployment target #7851's real Container/ Durable-Object driver will extend next, rather than standing up a second, redundant Worker just for that piece.
|
Superagent didn't find any vulnerabilities or security issues in this PR. |
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #7960 +/- ##
===========================================
+ Coverage 67.32% 91.86% +24.53%
===========================================
Files 735 738 +3
Lines 75458 75677 +219
Branches 22954 23004 +50
===========================================
+ Hits 50803 69519 +18716
+ Misses 20857 5080 -15777
+ Partials 3798 1078 -2720
Flags with carried forward coverage won't be shown. Click here to find out more.
|
|
Warning ⏸️ LoopOver review result - manual review recommendedReview updated: 2026-07-22 00:16:21 UTC
Review summary Nits — 7 non-blocking
Concerns raised — review before merging
📋 Copy for AI agents — paste into your coding agentDecision 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 #7654
packages/loopover-miner/lib/tenant-client.ts(already merged) hardcodes:POST /v1/tenants({name, product}),GET /v1/tenants({tenants: [...]}),DELETE /v1/tenants/:name— Bearer-authenticated against a singleADMIN_TOKENsecret.TenantProvisioningDriverhas no enumeration concept by design (create/destroy/exists are all per-tenant), soGET /v1/tenantsneeds its own durable inventory. Stores onlyname/product/lifecycle state/timestamps — never a tenant's database connection details (that's a credential, not admin-visible inventory).tenant-client.ts's own doc comment: "a create is not idempotent, so it must not be silently re-sent"): recreating an already-active tenant is a 409; deleting an unknown one is a 404, not a silent no-op. A torn-down tenant may be recreated.provisionTenant's result carries them (Real Postgres/Hyperdrive driver for control-plane's provisionDatabase/deprovisionDatabase #7653) — properly distributing those is Real secret-injection driver for control-plane's injectSecrets/revokeSecrets via the generalized broker #7852's job (the generalized secret broker); this transport doesn't create a new place for them to leak in the meantime.wrangler.jsonc,nodejs_compatenabled so the existing Node-orientedauth.ts/provisioning.ts/pagerduty-notify.tsmodules —node:crypto'stimingSafeEqual,Buffer,process.env— work unmodified inside it). This is deliberately the deployment target Real Cloudflare Containers driver for control-plane's createContainer/destroyContainer/containerExists #7851's real Container/Durable-Object driver will extend next, rather than standing up a second, separate Worker just for that piece (control-plane had zero Cloudflare bindings before this PR).Scope
type(scope): short summaryConventional Commit format.NEON_API_KEY/NEON_PROJECT_IDare set); does not implement real container creation (Real Cloudflare Containers driver for control-plane's createContainer/destroyContainer/containerExists #7851) or secret injection (Real secret-injection driver for control-plane's injectSecrets/revokeSecrets via the generalized broker #7852), both separate pieces.Validation
git diff --checknpm run typecheck(root)npm run control-plane:test— 82/82 passing (node --test).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 run cf:typecheck(Workers-runtime typecheck forworker.tsagainst@cloudflare/workers-types+nodetypes together, sincenodejs_compatgenuinely provides both).npx wrangler deploy --dry-runfromcontrol-plane/— resolves the KV binding and both vars correctly.npm audit --audit-level=moderate— pre-existing ambient advisories only (confirmed identical to what already exists in the already-mergedpackages/discovery-indexusing the samewranglerversion range); this PR's own new dependencies (hono,wrangler,@cloudflare/workers-types) introduce nothing new.onError500 path, KV pagination (including a key disappearing betweenlist()andget()), and an explicit check that database credentials never appear in any response body.Safety
ADMIN_TOKEN/NEON_API_KEY/PAGERDUTY_ROUTING_KEYare declared inenv.d.tsas wrangler secrets, never given real values in this repo.Notes
Follow-up infra work on top of #7180 (provisioning core) and #7653 (the Neon database driver this transport can select at runtime). Once this merges, #7851 (real Cloudflare Containers + Durable Object driver) becomes the next piece, extending this same Worker deployment rather than a new one.