Skip to content

feat(cli,client)!: drop os environments create --template and the template_id body field (#3731) - #3738

Merged
os-zhuang merged 1 commit into
mainfrom
fix/3731-drop-dead-template-flag
Jul 28, 2026
Merged

feat(cli,client)!: drop os environments create --template and the template_id body field (#3731)#3738
os-zhuang merged 1 commit into
mainfrom
fix/3731-drop-dead-template-flag

Conversation

@os-zhuang

@os-zhuang os-zhuang commented Jul 28, 2026

Copy link
Copy Markdown
Contributor

Closes #3731. Sibling of #3702 / #3730 — the same dead concept, other half.

What was wrong

#3702 removed projects.listTemplates() because nothing mounted its route. The writing half survived, and it fails worse:

  • packages/cli/src/commands/environments/create.ts advertised --template as "Built-in template id (e.g. crm, todo, blank)" and forwarded it as template_id.
  • packages/client/src/index.ts declared template_id?: string on the projects.create() body.

Nothing reads it:

  • template_id / templateId appears in zero non-test .ts files in cloud.
  • sys_environment has no such column — the value is not even stored.
  • The create route whitelists what it consumes (environment-lifecycle.ts): displayName/display_name, organizationId/organization_id, isDefault, hostname, metadata, environmentType/environment_type — then hardcodes driver: 'turso', plan: FREE_PLAN, storageLimitMb: 1024, visibility: 'private'. template_id is not in the list.
  • sys_package.object.ts states the position: there "is no separate 'template' concept"; apps/cloud/objectstack.config.ts: "No built-in environment templates: every environment is provisioned empty."

The blank/crm/todo registry the flag named was the apps/server createTemplatesRoutePlugin snapshot (CHANGELOG ~L1143), removed when the control plane moved to cloud. The flag outlived the registry by an entire architecture.

So os env create --name X --template crm was accepted, sent, and dropped — no seeding, no error, no trace. Worse than the 404 its listing counterpart returned: a 404 tells the caller something is wrong; a silently ignored flag reports success. That is the "never advertise a capability the runtime doesn't deliver" corollary of Prime Directive #10.

Migration

os environments create --template <id> → drop the flag; it never did anything. Starter content comes from the App Marketplace: create the environment, then install the package (sys_package rows with is_starter = trueclient.projects.packages.install(envId, { packageId })), which is what the console already does. TypeScript now rejects template_id on projects.create(), which is the point — the field was being discarded on the wire.

Not the same --template as os init / create-objectstack (app / plugin / empty scaffolds). Those are local scaffolding, alive, and untouched — including every doc that mentions them. No doc references os environments create --template, so there was nothing to sweep.

Verification

  • packages/cli62 files / 642 tests pass; packages/client13 / 175 pass.
  • pnpm build 71/71 with dts on; packages/client/dist/index.d.ts no longer carries the property (the one remaining hit is the tombstone comment).
  • Behavioural, on the built CLI: --template is gone from environments create --help, and os environments create --org x --name y --template crm now exits with Error: Nonexistent flag: --template instead of silently "succeeding".

Found on the way, filed separately

The audit that produced this found that template_id is not the only unread field in that body — see #3739 for the full table (clone_from_environment_id unread, is_default sent in a dialect the handler does not accept, env_type likewise, slug/region/project_type/is_system never read, driver/plan/storage_limit_mb overridden by policy while typed as settable). That one needs decisions, not just a trim, and both route-level guards are blind to it because they compare URLs, not request bodies.

🤖 Generated with Claude Code

…template_id` body field (#3731)

The CLI advertised `--template` as "Built-in template id (e.g. crm, todo,
blank)" and forwarded it as `template_id` on `projects.create()`. Nothing
consumes it: `template_id`/`templateId` appears in zero non-test files in the
`cloud` repo, `sys_environment` has no such column, and the create route
whitelists what it reads (displayName, organizationId, isDefault, hostname,
metadata, environmentType) — `template_id` is not in the list. The
blank/crm/todo registry the flag named was the `apps/server`
`createTemplatesRoutePlugin` snapshot, removed when the control plane moved to
cloud; the flag outlived it.

So it was accepted, transmitted, and dropped — no seeding, no error, no stored
trace. Worse than the 404 its listing counterpart returned (#3702): a 404 tells
the caller something is wrong, a silently ignored flag reports success. That is
the "never advertise a capability the runtime doesn't deliver" corollary of
Prime Directive #10.

Starter content comes from the App Marketplace instead — `sys_package` rows
with `is_starter = true`, installed via `projects.packages.install`, which is
what the console already does.

NOT the same `--template` as `os init` / `create-objectstack` (app/plugin/empty
scaffolds); those are local scaffolding and are untouched. No doc references
`os environments create --template`, so nothing to sweep.

Closes #3731

Co-Authored-By: Claude <noreply@anthropic.com>
@vercel

vercel Bot commented Jul 28, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

1 Skipped Deployment
Project Deployment Actions Updated (UTC)
objectstack Ignored Ignored Jul 28, 2026 1:08am

Request Review

@github-actions github-actions Bot added documentation Improvements or additions to documentation tooling size/s labels Jul 28, 2026
@github-actions

Copy link
Copy Markdown
Contributor

📓 Docs Drift Check

This PR changes 2 package(s): @objectstack/cli, @objectstack/client.

18 hand-written doc(s) reference the affected code and may need an implementation-accuracy re-verification:

  • content/docs/ai/skills-reference.mdx (via packages/cli, packages/client)
  • content/docs/api/client-sdk.mdx (via @objectstack/cli, @objectstack/client)
  • content/docs/api/data-flow.mdx (via @objectstack/cli, @objectstack/client)
  • content/docs/api/environment-routing.mdx (via @objectstack/cli, @objectstack/client)
  • content/docs/api/error-catalog.mdx (via @objectstack/cli, @objectstack/client)
  • content/docs/automation/hook-bodies.mdx (via packages/cli)
  • content/docs/deployment/backup-restore.mdx (via @objectstack/cli)
  • content/docs/deployment/cli.mdx (via @objectstack/cli)
  • content/docs/deployment/self-hosting.mdx (via @objectstack/cli)
  • content/docs/getting-started/your-first-project.mdx (via @objectstack/cli, @objectstack/client)
  • content/docs/kernel/runtime-services/data-service.mdx (via packages/cli, packages/client)
  • content/docs/kernel/runtime-services/index.mdx (via packages/cli, packages/client)
  • content/docs/permissions/authentication.mdx (via @objectstack/cli, @objectstack/client)
  • content/docs/plugins/packages.mdx (via @objectstack/cli, @objectstack/client)
  • content/docs/protocol/kernel/plugin-spec.mdx (via @objectstack/cli)
  • content/docs/protocol/kernel/realtime-protocol.mdx (via @objectstack/cli, @objectstack/client)
  • content/docs/releases/implementation-status.mdx (via @objectstack/cli, @objectstack/client)
  • content/docs/releases/v16.mdx (via @objectstack/cli, @objectstack/client)

Advisory only. To re-verify, run the docs-accuracy-audit workflow scoped to these files:
node scripts/docs-audit/affected-docs.mjs origin/main → pass the list as args.docs.

@os-zhuang
os-zhuang merged commit 094fa34 into main Jul 28, 2026
16 checks passed
@os-zhuang
os-zhuang deleted the fix/3731-drop-dead-template-flag branch July 28, 2026 01:11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

documentation Improvements or additions to documentation size/s tooling

Projects

None yet

Development

Successfully merging this pull request may close these issues.

os env create --template and projects.create({ template_id }) send a field no control plane reads

1 participant