Skip to content

Commit f7534a6

Browse files
committed
chore(changeset): declare the publish re-parse a narrowing, with its upgrade-guide entry
Claude-Session: https://claude.ai/code/session_017xRBcRoJWF7MQr6HoRgBeC Co-authored-by: Claude <noreply@anthropic.com>
1 parent 502a4a7 commit f7534a6

2 files changed

Lines changed: 42 additions & 5 deletions

File tree

Lines changed: 14 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,23 @@
11
---
2-
'@objectstack/metadata-protocol': patch
2+
'@objectstack/metadata-protocol': minor
3+
'@objectstack/spec': patch
34
---
45

5-
fix(metadata-protocol): publishing an object draft judges it by the current ObjectSchema
6+
fix(metadata-protocol)!: publishing an object draft judges it by the current ObjectSchema
67

78
Clause-②: no
8-
Metadata-protocol: none
9+
Metadata-protocol: narrowed
10+
11+
<!-- adr-0087: registered publish-refuses-object-draft-the-current-schema-refuses -->
12+
13+
**BREAKING** for an object draft the current `ObjectSchema` refuses. Before this change it published; now it is refused at publish, and the refusal names the fix. Stored metadata is not rewritten or refused at boot, and an active row is unchanged. The refusal comes at the next publish of such a draft.
914

1015
A save checks an object body against the current `ObjectSchema` and refuses it with `422 INVALID_METADATA`. Publishing a draft did not repeat that check. So an object draft saved before a stricter `ObjectSchema` rule landed went live at publish, even though that rule refuses it. One example is a sealed object with no `tenant_id` chain column (ADR-0154 D10).
1116

12-
Both publishes, per item and per package (including the pass that judges a batch before it writes on a store that cannot roll back), now check the draft the same way a save does. They refuse it with the same `422 INVALID_METADATA` and the same `issues[]`, before anything is written. The draft is checked as the publish would serve it, after the stored-row conversions are applied. So a draft stored in a spelling a later release retired, which those conversions rewrite, still publishes as before.
17+
Both publishes now check the draft the same way a save does: per item (`POST /api/v1/meta/object/:name/publish`) and per package (`POST /api/v1/packages/:id/publish-drafts`), including the pass that judges a batch before it writes on a store that cannot roll back. They refuse it with the same `422 INVALID_METADATA` and the same `issues[]` before anything is written. The draft stays a draft, and a package publish refuses its whole batch with nothing promoted. The draft is checked as the publish would serve it, after the stored-row conversions are applied. So a draft stored in a spelling a later release retired, which those conversions rewrite, still publishes as before.
18+
19+
## FROM → TO
20+
21+
- A pending object draft the current schema refuses, for example a sealed audit object (`lifecycle.seal`) with no `chainField` and no `tenant_id` field. That draft is refused at publish. The fix: declare the chain column, `fields: { tenant_id: { type: 'lookup', reference: 'sys_organization' } }`, or name one, `lifecycle: { seal: { valueFields: [...], chainField: 'organization_id' } }`. Then save the draft again and publish. Whatever the refusal's `issues[]` names, the fix is the one a save of the same body asks for. To find such drafts before upgrading, read each pending object draft: those whose `_diagnostics.valid` is `false` are the ones a publish will refuse.
1322

14-
A refused draft stays a draft. To publish it, fix the keys the issues name and save it again, the same fix a save of that body asks for. Every body this refuses is one a save of the same body already refuses.
23+
`@objectstack/spec` adds only the upgrade-guide entry `publish-refuses-object-draft-the-current-schema-refuses`.
Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
// Copyright (c) 2026 ObjectStack. Licensed under the Apache-2.0 license.
2+
3+
import type { SemanticMigration } from '../../types.js';
4+
5+
// The upgrade-guide entry of the publish door's object re-parse (#35924): the
6+
// per-item and package publish now judge a stored object draft by the current
7+
// `ObjectSchema`, as the save door judges the same body. Notice only: no key
8+
// is removed and no D2 conversion exists. A draft the ADR-0087 chain converts
9+
// is judged as served and keeps publishing; what is refused is a draft the
10+
// current schema refuses after the chain, and its fix is the author's.
11+
export const entry: SemanticMigration = {
12+
id: 'publish-refuses-object-draft-the-current-schema-refuses',
13+
surface:
14+
'The per-item publish (`POST /api/v1/meta/object/:name/publish`) and the package publish (`POST /api/v1/packages/:id/publish-drafts`) of an '
15+
+ '`object` draft: the draft is parsed against the current `ObjectSchema`, as served (the stored-row conversion '
16+
+ 'chain applied), before it is promoted, and refused `422 INVALID_METADATA` with the save door\'s `issues[]`',
17+
replacement:
18+
'Fix the keys the refusal\'s `issues[]` names, save the draft again (the save answers the same refusal until '
19+
+ 'the body parses), then publish',
20+
reason:
21+
'A draft saved before a stricter `ObjectSchema` rule landed (for example a sealed audit object with no '
22+
+ '`tenant_id` chain column, ADR-0154 D10) was promoted live at publish, unjudged by that rule, while a save of '
23+
+ 'the same body is refused. Stored metadata is not rewritten or refused at boot; an active row is unchanged. '
24+
+ 'The next publish of such a draft is refused, the draft stays a draft, and a package publish refuses its '
25+
+ 'whole batch with nothing promoted.',
26+
acceptanceCriteria:
27+
'Every pending object draft reads `_diagnostics.valid: true`; a publish of every object draft the package carries succeeds.',
28+
};

0 commit comments

Comments
 (0)