Skip to content

provisionProductionEnvironment reads a flat POST /cloud/environments payload; the producer nests the row under environment #6629

Description

@hotlong

provisionProductionEnvironment reads the POST /cloud/environments success payload as a FLAT object, but the control plane nests the row under environment — so id and hostname are always undefined.

Found while implementing the ADR-0006 D2 producer-half rename in the cloud repo (objectstack-ai/cloud#1691). Not caused by that rename — this mismatch is on a handler that rename does not touch. Filed unassigned for triage; no fix attempted here.

Measured

packages/app-shell/src/console/organizations/provisionEnvironment.ts declares

  • ProvisionedEnvironment as { id?: string; hostname?: string; alreadyProvisioned?: boolean }, with id documented as "Environment id (control-plane sys_environment row), when this call minted it";
  • and returns body.data directly as that type, after a deliberately strict envelope check that only verifies data is an object.

The producer is packages/service-cloud/src/routes/environment-lifecycle.ts in objectstack-ai/cloud, which registers POST /cloud/environments and answers 201 with

ok({ environment: result.environment, warnings: result.warnings, durationMs: result.durationMs, ...(hostnameAssignment ? { hostnameAssignment } : {}) })

So data.id and data.hostname do not exist on the wire; the row is one level down, under data.environment. The cloud repo's own tests agree — apps/cloud/test/billing-order-flow.test.ts and production-flow.test.ts read body.data.environment.id.

Why it is quiet

Both fields are optional on the type and the whole call is best-effort by contract (a 403/409 resolves to alreadyProvisioned: true, a genuine failure is swallowed by the caller and the onboarding gate provisions lazily). So nothing throws — the function just reports a successful provision whose id and hostname are undefined, which is the exact "successful provision carrying no env at all" outcome the strict envelope check in that file was written to prevent. The check catches a missing data, not a data of the wrong shape.

Note for whoever picks this up

The cloud control plane is mid-rename under ADR-0006 D2 (epic objectstack-ai/objectstack#12865): response payload keys project / projects become environment / environments on the OTHER control-plane routes. POST /cloud/environments is not part of that rename — it has always answered environment — so a fix here is stable against that work rather than racing it.

Generated by Claude Code

Metadata

Metadata

Assignees

Labels

domain:uiobjectui ui stream: fix lands on the published library or apps — objectui execution seatpm:dispatchedpriority:p1

Type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions