Skip to content

Commit 75c310f

Browse files
os-zhuangclaude
andauthored
fix(metadata-protocol): user-facing copy for writable_package_required rejection (#2625)
* fix(metadata-protocol): user-facing copy for writable_package_required rejection The rejection message is surfaced verbatim as a Studio toast, but its copy was written for developers — it cited an internal ADR path as the remedy. Rewrite the sentence as end-user remediation (switch to a writable package in the package selector, or create one); the ADR pointer moves to a docs property on the error. code/status/packageId are unchanged, so API consumers and the ADR-0070 golden regression are unaffected. Found by the Studio package-create UX dogfood (#2609, tracking #2615). Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01DHQc5BdGhTzPfazex3vWdt * chore: retrigger CI Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01DHQc5BdGhTzPfazex3vWdt --------- Co-authored-by: Claude <noreply@anthropic.com>
1 parent da807f7 commit 75c310f

2 files changed

Lines changed: 11 additions & 3 deletions

File tree

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
"@objectstack/metadata-protocol": patch
3+
---
4+
5+
Rewrite the `writable_package_required` rejection message as user-facing remediation ("switch to a writable package in the package selector, or create a new one") instead of developer-facing copy that cited an internal ADR path — the message is surfaced verbatim as a Studio toast. The ADR pointer moves to a `docs` property on the error; `code`, `status`, and `packageId` are unchanged.

packages/metadata-protocol/src/protocol.ts

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3909,14 +3909,17 @@ export class ObjectStackProtocolImplementation implements ObjectStackProtocol {
39093909
request.packageId != null &&
39103910
!this.isWritablePackage(request.packageId)
39113911
) {
3912+
// Surfaced verbatim as a console toast — keep the sentence
3913+
// user-actionable; the ADR pointer lives in `docs` below.
39123914
const err = new Error(
3913-
`[writable_package_required] Cannot author ${singularTypeForRepo}/${request.name} into `
3914-
+ `'${request.packageId}': it is a read-only package. `
3915-
+ `Switch to or create a writable package, then retry.`,
3915+
`[writable_package_required] Cannot save ${singularTypeForRepo}/${request.name}: `
3916+
+ `the package '${request.packageId}' is read-only (provided by code or an installed app). `
3917+
+ `Switch to a writable package in the package selector, or create a new one, and retry.`,
39163918
);
39173919
(err as any).code = 'writable_package_required';
39183920
(err as any).status = 422;
39193921
(err as any).packageId = request.packageId;
3922+
(err as any).docs = 'docs/adr/0070-package-first-authoring.md';
39203923
throw err;
39213924
}
39223925
const orgId = request.organizationId ?? null;

0 commit comments

Comments
 (0)