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
feat(client): let meta.saveItem send the query string its route already reads (#11714)
* feat(client): let meta.saveItem send the query string its route already reads
The Phase 3a-destructive gate refuses with `409 DESTRUCTIVE_CHANGE` and ends
`— re-submit with ?force=true to proceed.` Both REST `PUT` doors read `?force`
and thread it, so the clause is true of an HTTP caller. It was false of a
first-party SDK caller: both `saveItem` declarations built a bare path and a
body and sent no query string at all, so doing exactly what the refusal said
returned the identical refusal and the only remedy was raw `fetch`.
Adds an optional `SaveMetaItemOptions` bag — `force`, `packageId`, `mode` —
matching `getItem`'s house shape on the same object and covering exactly the
three parameters `PUT /api/v1/meta/:type/:name` reads. One exported type and
one query builder are shared by the unscoped client and the environment-scoped
twin so the two cannot drift; an options-less call builds a byte-identical URL
to before.
Fixes#11391
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_019siH5jDmk5hrayvfyojUqR
* docs(client): warn that ?mode=draft never reaches the compound-name door
Review follow-up. This PR exposes `mode` on a client that addresses BOTH
`PUT` doors, and `PUT /meta/:type/:section/:name` never reads the parameter
while its single-segment twin does — so a compound-name save with
`{ mode: 'draft' }` is ignored and PUBLISHED LIVE, answered 200, with no
signal at the call site. That is this card's own defect shape one parameter
over, and it became reachable only because this PR made `mode` settable.
Measured over the compound handler's body (rest-server.ts 6646-6824): `force`
and `package` ARE both read and threaded there; `mode` is the only one of the
three that is not (zero hits, reverse-checked with `compoundName`). The
docstring therefore names the gap narrowly and states why the remedy is NOT
to refuse the whole bag on a compound name — that would break the two
parameters that work in order to warn about the one that does not. Threading
it is the route's decision, filed as #11712 rather than guessed at here.
Also renames the two new locals from `qs` to `query`. Measured on this file:
of 37 `const qs =` bindings, 27 hold a bare `params.toString()`, 8 hold a
string already carrying its `?`, and 2 hold a `URLSearchParams` object — one
name, three meanings. These carry their `?`, so they say so.
Comments and local names only; no behaviour change.
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_019siH5jDmk5hrayvfyojUqR
---------
Co-authored-by: Claude <noreply@anthropic.com>
0 commit comments