diff --git a/.changeset/readonly-package-error-copy.md b/.changeset/readonly-package-error-copy.md new file mode 100644 index 000000000..f999dd529 --- /dev/null +++ b/.changeset/readonly-package-error-copy.md @@ -0,0 +1,5 @@ +--- +"@objectstack/metadata-protocol": patch +--- + +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. diff --git a/packages/metadata-protocol/src/protocol.ts b/packages/metadata-protocol/src/protocol.ts index 1e37dd742..67c0b5adf 100644 --- a/packages/metadata-protocol/src/protocol.ts +++ b/packages/metadata-protocol/src/protocol.ts @@ -3909,14 +3909,17 @@ export class ObjectStackProtocolImplementation implements ObjectStackProtocol { request.packageId != null && !this.isWritablePackage(request.packageId) ) { + // Surfaced verbatim as a console toast — keep the sentence + // user-actionable; the ADR pointer lives in `docs` below. const err = new Error( - `[writable_package_required] Cannot author ${singularTypeForRepo}/${request.name} into ` - + `'${request.packageId}': it is a read-only package. ` - + `Switch to or create a writable package, then retry.`, + `[writable_package_required] Cannot save ${singularTypeForRepo}/${request.name}: ` + + `the package '${request.packageId}' is read-only (provided by code or an installed app). ` + + `Switch to a writable package in the package selector, or create a new one, and retry.`, ); (err as any).code = 'writable_package_required'; (err as any).status = 422; (err as any).packageId = request.packageId; + (err as any).docs = 'docs/adr/0070-package-first-authoring.md'; throw err; } const orgId = request.organizationId ?? null;