@@ -135,21 +135,24 @@ async function boot(environmentId?: string) {
135135 engine . insert ( NAME , { title } , { context : { isSystem : true } } as any ) ;
136136
137137 /**
138- * A package-less row of the object as it exists at rest — the save door
139- * resolves a package-less save of an item a package holds to that
140- * package's row, so such a row is only ever a stored one.
138+ * A row of the object as it exists at rest, bound to `packageId` (`null`:
139+ * no package). The save door writes neither once another package's row
140+ * owns the object: it resolves a package-less save to that package's row,
141+ * and [#23416, ADR-0029 D9.9] refuses a save naming a second package. So
142+ * such a row is only ever a stored one.
141143 */
142- const seedUnboundRow = async ( ) => {
143- const body = ticket ( ' Ticket unbound') ;
144+ const seedStoredRow = async ( packageId : string | null ) => {
145+ const body = ticket ( ` Ticket ${ packageId ?? ' unbound'} ` ) ;
144146 const now = new Date ( ) . toISOString ( ) ;
145147 await engine . insert ( 'sys_metadata' , {
146- id : 'seed_active_unbound' , type : 'object' , name : NAME , organization_id : null ,
147- package_id : null , state : 'active' , metadata : JSON . stringify ( body ) , checksum : hashSpec ( body , 'object' ) ,
148+ id : `seed_active_ ${ packageId ?? 'unbound' } ` , type : 'object' , name : NAME , organization_id : null ,
149+ package_id : packageId , state : 'active' , metadata : JSON . stringify ( body ) , checksum : hashSpec ( body , 'object' ) ,
148150 version : 1 , created_at : now , updated_at : now ,
149151 } , { context : { isSystem : true } } as any ) ;
150152 } ;
153+ const seedUnboundRow = ( ) => seedStoredRow ( null ) ;
151154
152- return { save, remove, storedPackages, hasTable, records, insertRecord, seedUnboundRow } ;
155+ return { save, remove, storedPackages, hasTable, records, insertRecord, seedStoredRow , seedUnboundRow } ;
153156}
154157
155158const ok = ( res : any ) => {
@@ -167,10 +170,12 @@ const refusedConflict = (res: any) => {
167170/** Two packages' rows of the object, its table and one record — the card's setup. */
168171async function twoPackageObject ( environmentId ?: string ) {
169172 const h = await boot ( environmentId ) ;
170- // The registry holds one owner per object name, so the second package's
171- // write-through is refused (and logged) at save time; the row is stored.
173+ // [#23416, ADR-0029 D9.9] The save door refuses a save into a second
174+ // package of an object a runtime-authored row owns, so Q's row is one
175+ // stored before that refusal existed: seeded, not saved. The registry
176+ // holds P, as the refused write-through left it.
172177 ok ( await h . save ( P ) ) ;
173- ok ( await h . save ( Q ) ) ;
178+ await h . seedStoredRow ( Q ) ;
174179 await h . insertRecord ( 'kept' ) ;
175180 expect ( await h . storedPackages ( ) ) . toEqual ( [ P , Q ] ) ;
176181 expect ( await h . hasTable ( ) ) . toBe ( true ) ;
0 commit comments