@@ -259,25 +259,23 @@ export function packagelessOverlayWriteRefusal(
259259 const sole = pairs . length === 1 ? pairs [ 0 ] ! : undefined ;
260260 // One base: its pair, by name. Several: the pair of the base the writer
261261 // customizes, each named — never guessed (the ceremony lists such a row).
262- const into = sole
263- ? `'${ sole . pair } ' (?package=${ sole . pair } )`
264- : `the pair of the package it customizes (${ pairs . map ( ( p ) => `'${ p . pair } '` ) . join ( ' or ' ) } , as ?package=<that pair>)` ;
262+ const pair = sole ? `'${ sole . pair } ' (?package=${ sole . pair } )` : `the pair of the package it customizes (${ pairs . map ( ( p ) => `'${ p . pair } '` ) . join ( ' or ' ) } )` ;
265263 const declared = sole ? `overrides: { package: '${ sole . base } ', basedOn }` : 'overrides: { package: <that base>, basedOn }' ;
264+ // The fix first, then the rule and the ceremony: the REST door bounds a
265+ // refusal's text (`CLIENT_MESSAGE_MAX`, 500 characters, `@objectstack/types`),
266+ // and Setup shows that text as sent.
266267 const ceremony = sole
267- ? 'A package-less customization stored before this release is still served; run '
268- + `\`os migrate packageless-overlays\` first to move it into '${ sole . pair } '.`
269- : 'A package-less customization stored before this release is still served; run '
270- + '`os migrate packageless-overlays` first: it lists a name several packages ship for you to place.' ;
271- const fix = operation === 'delete'
272- ? `Remove it from ${ into } . ${ ceremony } `
273- : operation === 'rollback'
274- ? `Its customization belongs in ${ into } : run \`os migrate packageless-overlays\` to move the row there, then roll it back.`
275- : `${ operation === 'publish' ? 'Publish' : 'Save' } it into ${ into } , declaring ${ declared } . ${ ceremony } ` ;
276- const what = operation === 'rollback' ? 'a rollback of its package-less row' : 'a write naming no package' ;
277- const err = new Error (
278- `${ item } ${ shipped } , and ${ what } onto a packaged item is closed: a customization of an installed package `
279- + `lives in its paired .custom package (ADR-0146 D11). ${ fix } ` ,
280- ) ;
268+ ? `\`os migrate packageless-overlays\` moves it into '${ sole . pair } '`
269+ : '`os migrate packageless-overlays` lists it for you to place' ;
270+ const closed = 'A write naming no package onto a packaged item is closed (ADR-0146 D11); '
271+ + `a package-less customization stored before it is still served until ${ ceremony } .` ;
272+ const message = operation === 'rollback'
273+ ? `${ item } ${ shipped } , and a rollback of its package-less row is closed (ADR-0146 D11): run `
274+ + `\`os migrate packageless-overlays\` to move the row into ${ pair } , then roll it back there.`
275+ : operation === 'delete'
276+ ? `${ item } ${ shipped } : remove its customization from ${ pair } . ${ closed } `
277+ : `${ item } ${ shipped } : ${ operation === 'publish' ? 'publish' : 'save' } it into ${ pair } , declaring ${ declared } . ${ closed } ` ;
278+ const err = new Error ( message ) ;
281279 ( err as any ) . code = 'NOT_OVERRIDABLE' ;
282280 ( err as any ) . status = 403 ;
283281 return err ;
0 commit comments