Skip to content

Commit ce744bc

Browse files
claude[bot]zhuangjianguoclaude
authored
fix(rest): thread ?mode=draft on the compound-name metadata write door (#11933)
* fix(rest): thread ?mode=draft on the compound-name meta write door Part of #11712. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_019siH5jDmk5hrayvfyojUqR * test(rest): pin the compound door's draft/publish parity; record the new engine double Part of #11712. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_019siH5jDmk5hrayvfyojUqR * docs(changeset): name the missing compound-arity REST promotion door Part of #11712. The changeset becomes CHANGELOG.md, so a consumer who starts using ?mode=draft on a compound name learns from the same paragraph that the per-item REST promotion door does not exist in that arity yet (#11932). Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_019siH5jDmk5hrayvfyojUqR --------- Co-authored-by: Claude <zhuangjianguo@steedos.com> Co-authored-by: Claude Opus 5 <noreply@anthropic.com>
1 parent c97edee commit ce744bc

4 files changed

Lines changed: 656 additions & 1 deletion

File tree

Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
---
2+
'@objectstack/rest': patch
3+
---
4+
5+
fix(rest): `?mode=draft` now stages on the compound-name metadata write door
6+
7+
`PUT /api/v1/meta/:type/:section/:name` — the compound-name door, the one you
8+
reach with a name like `views/all_leads` — built its `saveMetaItem` request
9+
field by field and `mode` was not one of the fields. Its single-segment twin
10+
`PUT /api/v1/meta/:type/:name` has read that parameter all along. The parameter
11+
was never refused here, only dropped, so the request was answered `200` and
12+
published **live**. Both doors now read it.
13+
14+
**Two behaviour changes, and both can be observed by an unchanged caller.**
15+
16+
**1. `?mode=draft` on this door changes OUTCOME, not acceptance.** The request
17+
was accepted before and is accepted now; what moved is what it does.
18+
19+
| Request | Before | After |
20+
| --- | --- | --- |
21+
| `PUT /meta/object/crm/task?mode=draft` | `200`, `"state":"active"` — the live row overwritten, nothing staged | `200`, `"state":"draft"` — a staged row written, the live row untouched |
22+
23+
If you send `?mode=draft` to a compound name today and rely on the write going
24+
live — for instance because you never call `POST /meta/:type/:name/publish`
25+
those writes stop taking effect immediately and start waiting for a promotion.
26+
Drop the parameter to keep publishing straight away. `mode=publish`, an
27+
unrecognised `mode=`, an empty `mode=` and no `mode` at all are all unchanged:
28+
they publish, exactly as before. The spelling test is the twin's, `draft`
29+
case-insensitive.
30+
31+
⚠️ **The draft you can now stage has no per-item REST promotion door in this
32+
arity.** `POST /meta/:type/:name/publish` is mounted for single-segment names
33+
only, while its read twin `GET /meta/:type/:section/:name/published` is mounted
34+
for both — so a compound-named draft is writable and readable over REST and not
35+
promotable there. Until that route exists, promote through
36+
`POST /packages/:id/publish-drafts` (whole-package) or the runtime dispatcher's
37+
own `meta.publish` verb. Tracked in #11932; this release does not change it.
38+
39+
**2. A repeated `?mode` is now REFUSED where it was accepted.** This narrows
40+
what the door takes. `?mode=draft&mode=draft` arrives as an array; the
41+
`typeof === 'string'` test is false for it, so before this change it fell back
42+
to publishing live under a `200`. It is now answered `400`
43+
`{ "error": { "code": "VALIDATION_ERROR" } }` and nothing is written — the
44+
#6877 guard this door already applied to `force` and `package`, extended to the
45+
parameter it just gained, and the same answer the single-segment twin has given
46+
for a repeated `mode` since #6877. A single occurrence encoded as an array
47+
(`?mode=draft` once) is still accepted; the guard unwraps rather than
48+
blanket-refusing.
49+
50+
Nothing else on the door moved: `?force`, `?package`, the `meta-envelope`
51+
write face, the `manage_metadata` gate and the `501` envelope are untouched,
52+
and the single-segment twin is untouched.

0 commit comments

Comments
 (0)