@@ -5,6 +5,7 @@ import { describe, expect, it } from 'vitest';
55// cannot accept a call ObjectQL refuses (`check:engine-double-contract`).
66import { assertEngineDeleteDispatch , assertEngineUpdateDispatch , assertEngineFindOnePredicate , hashSpec } from '@objectstack/metadata-core' ;
77import { ObjectSchema } from '@objectstack/spec/data' ;
8+ import { ALL_CONVERSIONS } from '@objectstack/spec' ;
89// The draft verdict reaches `import('@objectstack/lint')`; paid at collection,
910// never inside a case's clock (`check:test-source-alias`).
1011import '@objectstack/lint' ;
@@ -172,6 +173,22 @@ function rewriteStoredDraft(rows: Map<string, Row>, name: string, body: unknown)
172173 row . checksum = hashSpec ( body , 'object' ) ;
173174}
174175
176+ /** The ADR-0087 conversion whose retired object key the legacy-spelling CONTROL stores. */
177+ const LEGACY_SPELLING_CONVERSION = 'object-external-sharing-model-removed' ;
178+
179+ /**
180+ * The object keys conversion `id` strips, with the values its own fixture
181+ * stores: the keys of the fixture's first `before` object that the matching
182+ * `after` object no longer carries.
183+ */
184+ function retiredObjectKeysOf ( id : string ) : Record < string , unknown > {
185+ const conversion = ALL_CONVERSIONS . find ( ( c ) => c . id === id ) ;
186+ if ( ! conversion ) throw new Error ( `no ADR-0087 conversion '${ id } '` ) ;
187+ const [ before ] = ( conversion . fixture . before as { objects : Array < Record < string , unknown > > } ) . objects ;
188+ const [ after ] = ( conversion . fixture . after as { objects : Array < Record < string , unknown > > } ) . objects ;
189+ return Object . fromEntries ( Object . entries ( before ?? { } ) . filter ( ( [ key ] ) => ! ( after && key in after ) ) ) ;
190+ }
191+
175192const rowsFor = ( rows : Map < string , Row > , name : string ) =>
176193 Array . from ( rows . values ( ) )
177194 . filter ( ( r ) => r . type === 'object' && r . name === name )
@@ -308,10 +325,14 @@ describe('[#35924] what the publish still promotes', () => {
308325 const { engine, rows } = makeStubEngine ( ) ;
309326 const protocol = new ObjectStackProtocolImplementation ( engine ) ;
310327 const name = 'crm_ledger' ;
311- // `externalSharingModel` is tombstoned on the object shape (a live
312- // author is refused at parse) and stripped from a stored row by the
313- // chain (`object-external-sharing-model-removed`).
314- const legacy = { ...sealedLedger ( name ) , externalSharingModel : 'private' } ;
328+ // The retired spelling comes from the retirement kit's own fixture,
329+ // never authored here: the keys the conversion's `before` object
330+ // carries and its `after` object does not. This file authors no
331+ // retired key, so the kit's tree-scoped absence pin keeps its radius.
332+ // Its key is tombstoned on the object shape (a live author is refused
333+ // at parse) and stripped from a stored row by the chain.
334+ const legacy = { ...sealedLedger ( name ) , ...retiredObjectKeysOf ( LEGACY_SPELLING_CONVERSION ) } ;
335+ expect ( Object . keys ( retiredObjectKeysOf ( LEGACY_SPELLING_CONVERSION ) ) ) . not . toEqual ( [ ] ) ;
315336 expect ( ObjectSchema . safeParse ( legacy ) . success ) . toBe ( false ) ;
316337 await stagePreRefinementDraft ( protocol , rows , name , legacy ) ;
317338
0 commit comments