Skip to content

Commit a626c2d

Browse files
committed
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
1 parent ab72d62 commit a626c2d

2 files changed

Lines changed: 11 additions & 4 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 & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3899,15 +3899,17 @@ export class ObjectStackProtocolImplementation implements ObjectStackProtocol {
38993899
request.packageId != null &&
39003900
!this.isWritablePackage(request.packageId)
39013901
) {
3902+
// Surfaced verbatim as a console toast — keep the sentence
3903+
// user-actionable; the ADR pointer lives in `docs` below.
39023904
const err = new Error(
3903-
`[writable_package_required] Cannot author ${singularTypeForRepo}/${request.name} into `
3904-
+ `'${request.packageId}': it is a read-only code/installed package, not a writable base. `
3905-
+ `Create or select a writable base (package) first, then retry. `
3906-
+ `See docs/adr/0070-package-first-authoring.md.`,
3905+
`[writable_package_required] Cannot save ${singularTypeForRepo}/${request.name}: `
3906+
+ `the package '${request.packageId}' is read-only (provided by code or an installed app). `
3907+
+ `Switch to a writable package in the package selector, or create a new one, and retry.`,
39073908
);
39083909
(err as any).code = 'writable_package_required';
39093910
(err as any).status = 422;
39103911
(err as any).packageId = request.packageId;
3912+
(err as any).docs = 'docs/adr/0070-package-first-authoring.md';
39113913
throw err;
39123914
}
39133915
const orgId = request.organizationId ?? null;

0 commit comments

Comments
 (0)