Skip to content

Commit 57e5e46

Browse files
committed
fix(runtime)!: PATCH /packages/:id refuses a read-only package with 422 WRITABLE_PACKAGE_REQUIRED
The manifest-edit arm now asks requireWritablePackage (isWritablePackage, the ADR-0070 D2 rule) after the manage_metadata and walled gates and before the body is read, in the order install-overwrite, disable, publish, revert and delete already use. Claude-Session: https://claude.ai/code/session_01LmjU2x1faLZ39DVTFyVca6 Co-authored-by: Claude <noreply@anthropic.com>
1 parent ade20c1 commit 57e5e46

1 file changed

Lines changed: 9 additions & 0 deletions

File tree

‎packages/runtime/src/domains/packages.ts‎

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2255,6 +2255,15 @@ export async function handlePackagesRequest(deps: DomainHandlerDeps, path: strin
22552255
// [ADR-0131 D12 items 7–8] Under a wall, the platform operator's.
22562256
const walled = await refuseWalledCatalogPackageWrite(deps, _context, `Updating package "${id}"`);
22572257
if (walled) return walled;
2258+
// [#24705] ADR-0070 D2: the manifest of a package the deployment
2259+
// ships is the deployment's, so this door refuses it with the
2260+
// answer install-overwrite, disable, publish, revert and delete
2261+
// give. Asked BEFORE the body is read, so the answer is the same
2262+
// whatever keys the body carries, and before `updatePackage`
2263+
// re-persists the edited manifest to `sys_packages`. An id nothing
2264+
// installed is writable by the predicate's own rule, so it still
2265+
// reaches the 404 below.
2266+
const readOnly = requireWritablePackage(deps, qlService, id, 'edit'); if (readOnly) return readOnly;
22582267
const src = (body?.manifest && typeof body.manifest === 'object' ? body.manifest : body) ?? {};
22592268
const patch: { name?: string; description?: string; version?: string } = {};
22602269
if (typeof src.name === 'string') patch.name = src.name.trim();

0 commit comments

Comments
 (0)