Public: anyone can read this; the crew can change it.

Data: managed Postgres on DigitalOcean as an infra kind (#16696) #17090

opened this

Parked 43h 35m ago

Managed Postgres on DigitalOcean is now an infra kind in Talk and MCP: it is priced, planned, built, and its URL is bound to the app as a secret. It is pushed, and the forge's check has not reported yet. The new tests (test/managed-database.test.ts), the dead-code test and tsc pass locally.

Notes

opened this

Managed Postgres on DigitalOcean is now an infra kind in Talk and MCP: it is priced, planned, built, and its URL is bound to the app as a secret. It is pushed, and the forge's check has not reported yet. The new tests (test/managed-database.test.ts), the dead-code test and tsc pass locally. I ran the gate and a hand-picked set of related suites, not the full suite.

What changed

  • Price read: src/cloud/database.ts holds a table of DO's four managed Postgres sizes at their list prices, one node each. DO's API lists sizes but not prices, so I copied the prices from memory of DO's pricing and have not checked them against DO's pricing page. Please check the table. It is dated by DB_PRICED_ON.
  • Plan step: planDatabase is pure, like the machine plan. It gives the steps (create, wait until online, bind), the monthly delta against the account's ceiling, the time to ready and the refusals. The refusals are the ceiling's own refusalOf sentences. It reuses AccountRead, refusalOf, NAME_TAKEN, NO_ACCOUNT and READ_ONLY.
  • Build: src/actions/database.ts checks the plan id against what stands now, then finds or creates the cluster at DO. It records a managed_database row (new migration, pinned) as soon as the cluster exists, waits until it is online, and writes the connection URL as DATABASE_URL on the app through putSecret. A repeat build only re-binds, and the URL is never in a return or an event. Each step emits an infra.step event.
  • Spend: accountCents now adds the account's databases, so the ceiling counts them. I exported caller from machine.ts to reuse its DO call wrapper.
  • Door: the infra MCP tool takes plan with {database: true, where: "digitalocean/<acct>@<region>:<size>", name, app}. apply takes that plan's id plus the same want, and is held for the person's word like any apply. The how-to is docs/features/managed-database.md. api.digitalocean.com was already in forge.json egress.

Left out

  • No terminal composer: the commit says No door:, because the terminal's infra screen only composes machines. This is the gap in "both doors".
  • No lifecycle: no retire, resize, backups or a page row yet. Spaces buckets and the other clouds are not covered.
  • Real DO untested: DigitalOcean's response shape (database.id, status: "online", connection.uri) is only exercised against a recorded fake.

Try: in Talk or MCP, infra plan {database: true, where: "digitalocean/main@nyc3:db-s-1vcpu-1gb", name: "shopdb", app: "owner/app"}. Read the steps and the $15 a month, then apply its id with the same want.

🤖 Generated with Claude Code

Closes #17074

4 earlier comments
commented

Managed Postgres on DigitalOcean is now an infra kind in Talk and MCP: it is priced, planned, built, and its URL is bound to the app as a secret. It is pushed, and the forge's check has not reported yet. The new tests (test/managed-database.test.ts), the dead-code test and tsc pass locally. I ran the gate and a hand-picked set of related suites, not the full suite.

What changed

  • Price read: src/cloud/database.ts holds a table of DO's four managed Postgres sizes at their list prices, one node each. DO's API lists sizes but not prices, so I copied the prices from memory of DO's pricing and have not checked them against DO's pricing page. Please check the table. It is dated by DB_PRICED_ON.
  • Plan step: planDatabase is pure, like the machine plan. It gives the steps (create, wait until online, bind), the monthly delta against the account's ceiling, the time to ready and the refusals. The refusals are the ceiling's own refusalOf sentences. It reuses AccountRead, refusalOf, NAME_TAKEN, NO_ACCOUNT and READ_ONLY.
  • Build: src/actions/database.ts checks the plan id against what stands now, then finds or creates the cluster at DO. It records a managed_database row (new migration, pinned) as soon as the cluster exists, waits until it is online, and writes the connection URL as DATABASE_URL on the app through putSecret. A repeat build only re-binds, and the URL is never in a return or an event. Each step emits an infra.step event.
  • Spend: accountCents now adds the account's databases, so the ceiling counts them. I exported caller from machine.ts to reuse its DO call wrapper.
  • Door: the infra MCP tool takes plan with {database: true, where: "digitalocean/<acct>@<region>:<size>", name, app}. apply takes that plan's id plus the same want, and is held for the person's word like any apply. The how-to is docs/features/managed-database.md. api.digitalocean.com was already in forge.json egress.

Left out

  • No terminal composer: the commit says No door:, because the terminal's infra screen only composes machines. This is the gap in "both doors".
  • No lifecycle: no retire, resize, backups or a page row yet. Spaces buckets and the other clouds are not covered.
  • Real DO untested: DigitalOcean's response shape (database.id, status: "online", connection.uri) is only exercised against a recorded fake.

Try: in Talk or MCP, infra plan {database: true, where: "digitalocean/main@nyc3:db-s-1vcpu-1gb", name: "shopdb", app: "owner/app"}. Read the steps and the $15 a month, then apply its id with the same want.

🤖 Generated with Claude Code

commented

The check failed because the new database build in src/actions/database.ts has a setTimeout sleep that the named-timers test didn't know about. I added an allowlist entry for it in test/timers-named.test.ts, worded like the other sleep entries. The sleep only resolves the promise its caller awaits, and the caller's work after the await is the caller's job.

bun test test/timers-named.test.ts passes, 9 of 9. I did not run the full suite or bun x tsc --noEmit, since the change is only a test allowlist line. The fix is pushed.

The gate noted three files with comment lines over 100 columns. Its --fix wrapped nothing and left the working tree unchanged. It also flagged getManagedDatabase as 0.84 similar to getChange in src/core/model_review.ts, which I left alone.

The commit says No door: because no page, action or tool changed.

commented

The check failed because main landed 20261201140000-scan-finding-excerpt.ts while my branch had 20261201140000-managed-database.ts. Both got generated index name m446, which is the duplicate identifier.

I merged origin/main into the branch and renamed my migration to 20261201150000-managed-database.ts, so it sorts after the other one. I regenerated src/generated/migrations.ts with bun scripts/own-source.ts. It now has m446 for scan-finding-excerpt and m447 for managed-database.

bun x tsc --noEmit is clean. The own-source, migrations and timers-named tests pass, 12 of 12. I did not run the full suite; the forge's check does that on the push, which is done.

The earlier check log also shows a design-drift warning for 11 one-off classes against a baseline of 10. The classes it lists are in src/web/ files this pull doesn't touch (build_info, conflicts, home_flow_style, iterations, talk_client, pick, feed_style). It was a warning, not the failure, and I didn't investigate it.

commented

This push fixes the failing gate on #17090, which was missing a pin for the 20261201150000-managed-database migration. I haven't seen the forge's check run on it yet.

  • What was wrong: an earlier merge renumbered the migration from …140000 to …150000. The old …140000 pin was still in the tree, and the new one had never been created.
  • What changed: I removed the stale 20261201140000-managed-database.pin and ran bun scripts/pin-migrations.ts, which created 20261201150000-managed-database.pin. That is the only change in this push, so there is no page, action, API route or MCP tool change and no door change.
  • Local checks: bun x tsc --noEmit is clean, and test/schema-migrations.test.ts passes (26 of 26) on its own. An earlier run showed 2 failures, but it ran at the same time as the background gate and typecheck. I reran the suite alone and didn't investigate those two, so I can't say what caused them. I did not run the full suite.
  • Gate: bun scripts/gate.ts printed no rule failure. It printed these notes:
    • Four files have comment lines over 100 columns, which the nightly rewrap handles.
    • getManagedDatabase in src/core/managed_database.ts is 0.84 similar to getChange in src/core/model_review.ts. I left this alone because it isn't a blocking rule.
    • The duplicate scan hit its 8-second limit and compared against only part of the tree.

I didn't check the other three recurring refusals (dead exports, issue numbers in direction lines, as never in tests) beyond what the gate reported.

commented

Closed by the crew: main moved under it 2 times and the branch could not be brought up to date. Conflicting files: src/generated/migrations.ts.

Sign in to join this conversation.

Search
↑↓ navigate ↵ open ⌘↵ its app esc close

Keyboard shortcuts

Docs