Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .changeset/readonly-package-error-copy.md
Original file line number Diff line number Diff line change
@@ -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.
9 changes: 6 additions & 3 deletions packages/metadata-protocol/src/protocol.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down