You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Commit afb7f17
Browse filesBrowse the repository at this point in the historyBrowse files
fix(metadata-protocol): the per-item publish refuses an object without its package namespace prefix
The third door that makes an object live under a package now asks the
same judge as the direct save and the publish-drafts pre-flight, on the
package the promotion writes under, and refuses with NAMESPACE_PREFIX /
422 and the same sentence before anything is promoted.
Claude-Session: https://claude.ai/code/session_01AHeUBbe6S3JRawcpbLejXD
Co-authored-by: Claude <noreply@anthropic.com>
Copy file name to clipboardExpand all lines: .changeset/24547-active-save-namespace-prefix.md
+13-10Lines changed: 13 additions & 10 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -2,24 +2,27 @@
2
2
'@objectstack/metadata-protocol': minor
3
3
---
4
4
5
-
fix(metadata-protocol)!: the direct metadata save refuses an object whose name lacks its package's namespace prefix, as the package draft publish already does
5
+
fix(metadata-protocol)!: the direct metadata save and the per-item publish refuse an object whose name lacks its package's namespace prefix, as the package draft publish already does
6
6
7
7
Clause-②: no (narrowing)
8
8
9
-
<!-- adr-0087: not-required (no-migration-prescription) a refusal at the direct (publish-mode) metadata save door of an object name that the package draft publish pre-flight, `os validate` and `os build` already refuse under ADR-0129 D2: no authorable key, spelling, export, error code or stored shape moves, and no stored row is read, rewritten or converted. A stored object whose name lacks its package's prefix keeps loading and serving; the repair is a new object under the prefixed name, which moves its table and so is the author's decision, not something a ledger entry can derive. The other categories are closed on facts: the package publishes (not unpublished); no ADR-0087 id covers this door (not already-registered); and the change is a door verdict, not a declaration or an export (not runtime-interface-only or type-surface-only). -->
9
+
<!-- adr-0087: not-required (no-migration-prescription) a refusal at the direct (publish-mode) metadata save door and at the per-item publish door of an object name that the package draft publish pre-flight, `os validate` and `os build` already refuse under ADR-0129 D2: no authorable key, spelling, export, error code or stored shape moves, and no stored row is read, rewritten or converted. A stored object whose name lacks its package's prefix keeps loading and serving; the repair is a new object under the prefixed name, which moves its table and so is the author's decision, not something a ledger entry can derive. The other categories are closed on facts: the package publishes (not unpublished); no ADR-0087 id covers these doors (not already-registered); and the change is a door verdict, not a declaration or an export (not runtime-interface-only or type-surface-only). -->
10
10
11
-
**BREAKING** (an accept-set narrowing on the metadata save door), shipped as `minor` under the launch-window convention for breaking changes.
11
+
**BREAKING** (an accept-set narrowing on the metadata save and publish doors), shipped as `minor` under the launch-window convention for breaking changes.
12
12
13
-
ADR-0129 D2: a package declares its prefix once (`manifest.namespace`), and every object it defines is named `${namespace}_${shortName}`. The package draft publish (`POST /api/v1/packages/:id/publish-drafts`) refused an object draft without that prefix with `NAMESPACE_PREFIX`, while a direct save of the very same name under the very same package was stored `active` and went live. That left an object whose own package could never publish a draft of it again, and two doors giving opposite verdicts on one name.
13
+
ADR-0129 D2: a package declares its prefix once (`manifest.namespace`), and every object it defines is named `${namespace}_${shortName}`. The package draft publish (`POST /api/v1/packages/:id/publish-drafts`) refused an object draft without that prefix with `NAMESPACE_PREFIX`. Two other doors made that very same name `active`under the very same package: a direct save, and the publish of the single draft. That left an object whose own package could never publish a draft of it again, and three doors giving opposite verdicts on one name.
14
14
15
-
- FROM: a publish-mode object save bound to a package that declares a namespace answered `200` and stored the object `active` when its name lacked the `${namespace}_` prefix. This covers `PUT /api/v1/meta/object/:name?package=:id` (and `saveMetaItem` in publish mode), including a save naming no package that the door writes into such a package because the object's stored rows are bound to it.
16
-
- TO: it answers `422`, code `NAMESPACE_PREFIX`, with the sentence the draft publish gives for the same name, for example "Object 'v1_report' is missing the package namespace prefix. Rename it to 'rollup_v1_report' (namespace = 'rollup')." Nothing is written.
15
+
- FROM: an object made `active` under a package that declares a namespace was accepted with `200` when its name lacked the `${namespace}_` prefix. Two doors did this:
16
+
- a publish-mode save: `PUT /api/v1/meta/object/:name?package=:id` (and `saveMetaItem` in publish mode), including a save naming no package that the door writes into such a package because the object's stored rows are bound to it;
17
+
- the promotion of a single draft: `POST /api/v1/meta/object/:name/publish?package=:id` (and `publishMetaItem`), including a publish naming no package whose draft the door promotes into such a package.
18
+
- TO: both doors answer `422`, code `NAMESPACE_PREFIX`. The sentence is the one the draft publish gives for the same name, for example "Object 'v1_report' is missing the package namespace prefix. Rename it to 'rollup_v1_report' (namespace = 'rollup')."
19
+
- The save writes nothing.
20
+
- The publish promotes nothing, and the draft stays a draft.
17
21
- Fix: name the object `${namespace}_${shortName}` (here `rollup_v1_report`), as `os validate`, `os build` and the draft publish already require. A package's namespace is the one it declares, or the one derived from its id when it was installed without one (`com.v1.rollup` is `rollup`).
18
22
19
23
**Unchanged.**
20
24
21
-
- A package that declares no namespace, and a save bound to no package, are not judged.
22
-
- A draft save (`mode=draft`) stores as before; the draft publish judges the draft, as before, now with the same sentence the direct save gives.
25
+
- A package that declares no namespace, and a save or publish bound to no package, are not judged.
26
+
- A draft save (`mode=draft`) stores as before. The door that promotes the draft judges it, now with one sentence on all three doors.
23
27
-`sys_*` names are exempt, as everywhere the rule runs.
24
-
- Stored rows are not migrated and not refused on read. The next direct save of a stored object whose name lacks its package's prefix is refused.
25
-
- Not judged by this change: the promotion of a single draft (`POST /api/v1/meta/object/:name/publish`, `publishMetaItem`).
28
+
- Stored rows are not migrated and not refused on read. The next direct save or single-draft publish of a stored object whose name lacks its package's prefix is refused.
0 commit comments