Skip to content

objectstack.manifest.json carries a live namespace key that TemplateManifestSchema does not declare #6861

Description

@os-zhuang

Observation-class finding, spotted while implementing #6760 (ADR-0048 addendum Phase A1). Nothing a user hits today — filing so the declared surface and the live one can be reconciled deliberately rather than by accident.

The drift

TemplateManifestSchema (packages/spec/src/cloud/template-manifest.zod.ts) is documented as the schema of the on-disk objectstack.manifest.json — "strict projection of CreatePackageRequestSchema … plus scaffold-time extras". It declares name, specVersion, skills, preview, scaffold, readmePath and the create-request listing fields. It does not declare namespace.

But namespace is on that file and it is read:

  • packages/create-objectstack/src/templates/blank/objectstack.manifest.json ships "namespace": "blank".
  • packages/create-objectstack/src/index.ts rewrites it at scaffold time — if ('namespace' in m) m.namespace = namespace;.
  • packages/create-objectstack/src/rewrite-identity.ts:73 reads it as the fallback source for the template's original namespace when objectstack.config.ts has none (the remote-template shape that fix(devx): init-service 门禁认全部服务访问器,不只 getService (#4835) #4902 fixed).

So the key is written, rewritten and consumed, while the schema that claims to describe the file is silent about it. Anything validating objectstack.manifest.json against TemplateManifestSchema strips it.

Why this is being filed rather than fixed in #6760

#6760 adds namespace to CreatePackageRequestSchema, and TemplateManifestSchema is derived from it by .omit(). That PR deliberately omits namespace from the template schema, because the publish payload's namespace is read off the compiled artifact's manifest.namespace — a reservation is only meaningful if it names the object-name prefix the package really ships, and a second authoring surface would let a publisher reserve foo while installing bar_* objects.

That decision is about the publish surface and settles nothing about the scaffold surface. Whether objectstack.manifest.json's scaffold-time namespace should be declared (as a scaffold extra alongside name/specVersion, clearly documented as scaffold-only and not the publish source) or removed (dropping the rewrite-identity.ts:73 fallback and making objectstack.config.ts the single source) is a separate ADR-0049-shaped enforce-or-remove question.

Measured on

origin/main @ 578bdef. Files: packages/spec/src/cloud/template-manifest.zod.ts, packages/create-objectstack/src/index.ts (rewriteProjectIdentity), packages/create-objectstack/src/rewrite-identity.ts, packages/create-objectstack/src/templates/blank/objectstack.manifest.json.


Generated by Claude Code

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions