Repository navigation
Commit fbefd17
committed
fix(metadata-protocol): the write refusal reports the package door, not only the type's flags (#7682)
`PUT /api/v1/meta/object/showcase_task` answered `403 NOT_OVERRIDABLE`
identically whether `?package=` named a read-only or a writable package:
`SysMetadataRepository.assertAllowed` discriminated on the metadata TYPE's
registry flags and never read the base the caller named. `ITEM_LOCKED` and
`WRITABLE_PACKAGE_REQUIRED` are both registered to this package in the
error-code ledger and neither was ever emitted on this path.
The refusal branch now reads the named base through the shared
`isWritablePackage` predicate (imported from `package-writability.ts`, the same
one `saveMetaItem`'s ADR-0070 D1 gate and the `/packages` lifecycle gate use):
* `override-artifact` into a read-only base -> 403 ITEM_LOCKED, carrying
ADR-0010's reserved `lockSource: 'package'` and the package id. "Pick a
writable base" would be a false prescription here, so the code names the
lock instead.
* `runtime-only` into a read-only base -> 422 WRITABLE_PACKAGE_REQUIRED, the
same code, status and prescription `saveMetaItem` already emits for exactly
this condition, now also stated at the single persistence route.
No ALLOW decision moves: every allow limb returns before this point, so an
ADR-0005 overlay (which names the read-only package it customizes by
construction) and the documented `OS_METADATA_WRITABLE` hatch behave exactly as
before -- both pinned, the hatch because #8146 must be free to move it
deliberately. A write naming no base keeps the previous codes verbatim, and the
DELETE verb is untouched (#6960).
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01AmES43BMDg4bPrxTdi5q7t1 parent 6ceffe0 commit fbefd17
3 files changed
Lines changed: 575 additions & 2 deletions
File tree
- .changeset
- packages/metadata-protocol/src
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
0 commit comments