Skip to content

Commit 094fa34

Browse files
os-zhuangclaude
andauthored
feat(cli,client)!: drop os environments create --template and the template_id body field (#3731) (#3738)
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: Jack Zhuang <277994282+os-zhuang@users.noreply.github.com> Co-authored-by: Claude <noreply@anthropic.com>
1 parent d1557d9 commit 094fa34

3 files changed

Lines changed: 49 additions & 3 deletions

File tree

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
---
2+
"@objectstack/client": minor
3+
"@objectstack/cli": minor
4+
---
5+
6+
feat(cli,client)!: drop `os environments create --template` and the
7+
`template_id` body field — no control plane has ever read them (#3731)
8+
9+
The CLI advertised `--template` as *"Built-in template id (e.g. crm, todo,
10+
blank)"* and forwarded it as `template_id` on `projects.create()`. Nothing
11+
consumes it: `template_id` / `templateId` appears in **zero** non-test files in
12+
the `cloud` repo, `sys_environment` has no such column, and the create route
13+
whitelists what it reads (`displayName`, `organizationId`, `isDefault`,
14+
`hostname`, `metadata`, …) — `template_id` is not in the list. The
15+
`blank`/`crm`/`todo` registry the flag named was the `apps/server`
16+
`createTemplatesRoutePlugin` snapshot, removed when the control plane moved to
17+
`cloud`; the flag outlived it.
18+
19+
So the flag was accepted, transmitted, and dropped — no seeding, no error, no
20+
stored trace. That is worse than the 404 its listing counterpart returned
21+
(`projects.listTemplates`, deleted in #3702): a 404 tells the caller something
22+
is wrong, a silently ignored flag reports success.
23+
24+
**Migration.** `os environments create --template <id>` → drop the flag; it
25+
never did anything. Starter content comes from the App Marketplace: create the
26+
environment, then install the package (`sys_package` rows with
27+
`is_starter = true`, i.e. `client.projects.packages.install(envId, { packageId })`).
28+
Callers passing `template_id` to `client.projects.create()` should delete the
29+
property — TypeScript now rejects it, which is the point: an unknown field was
30+
being silently discarded on the wire.
31+
32+
Note this is **not** the same `--template` as `os init` / `create-objectstack`
33+
(`app` / `plugin` / `empty` scaffolds) — those are local scaffolding templates
34+
and are untouched.

packages/cli/src/commands/environments/create.ts

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,13 @@ export default class ProjectsCreate extends Command {
3131
name: Flags.string({ description: 'Display name', required: true }),
3232
plan: Flags.string({ description: 'Billing plan', default: 'free' }),
3333
driver: Flags.string({ description: 'Data-plane driver id' }),
34-
template: Flags.string({ description: 'Built-in template id (e.g. crm, todo, blank)' }),
34+
// No `--template`. It advertised "Built-in template id (e.g. crm, todo,
35+
// blank)" and sent `template_id`, which the control plane has never read —
36+
// the `blank`/`crm`/`todo` registry it named died with the `apps/server`
37+
// templates route. Removed in #3731: an accepted-and-dropped flag reports
38+
// success for work that never happened. Starter content is installed from
39+
// the App Marketplace instead (`os packages install`, `sys_package` with
40+
// `is_starter = true`).
3541
artifact: Flags.string({
3642
description: 'Path to a locally-compiled objectstack.json artifact to bind into this project',
3743
}),
@@ -80,7 +86,6 @@ export default class ProjectsCreate extends Command {
8086
display_name: flags.name,
8187
plan: flags.plan,
8288
driver: flags.driver,
83-
template_id: flags.template,
8489
clone_from_environment_id: flags['clone-from'],
8590
...(metadata ? { metadata } : {}),
8691
});

packages/client/src/index.ts

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1064,6 +1064,14 @@ export class ObjectStackClient {
10641064
/**
10651065
* Provision a new project. Delegates to
10661066
* `ProjectProvisioningService.provisionProject` on the server.
1067+
*
1068+
* No `template_id`: it was removed in #3731 because no control plane has
1069+
* ever read it — the `blank`/`crm`/`todo` registry it addressed died with
1070+
* the `apps/server` templates route, and `sys_environment` has no such
1071+
* column, so the field was accepted, transmitted, and dropped. Starter
1072+
* content is installed from the App Marketplace (`sys_package` with
1073+
* `is_starter = true`), which `projects.packages.install` already does.
1074+
* Its listing counterpart went the same way in #3702.
10671075
*/
10681076
create: async (req: {
10691077
organization_id: string;
@@ -1078,7 +1086,6 @@ export class ObjectStackClient {
10781086
is_system?: boolean;
10791087
storage_limit_mb?: number;
10801088
clone_from_environment_id?: string;
1081-
template_id?: string;
10821089
metadata?: Record<string, unknown>;
10831090
}) => {
10841091
const res = await this.fetch(`${this.baseUrl}/api/v1/cloud/environments`, {

0 commit comments

Comments
 (0)