@@ -72,6 +72,10 @@ function makeStubDriver() {
7272
7373const sys = { context : { isSystem : true } } as any ;
7474
75+ /** The row as the stub driver stored it — what the write persisted, before any engine shaping. */
76+ const storedRow = ( engine : ObjectQL , object : string , id : unknown ) =>
77+ engine . getDriverForObject ( object ) ! . findOne ( object , { where : { id } } as any ) ;
78+
7579describe ( '[#7246] the option marked `default: true` is the field default' , ( ) => {
7680 let engine : ObjectQL ;
7781
@@ -132,7 +136,10 @@ describe('[#7246] the option marked `default: true` is the field default', () =>
132136 } ,
133137 } as any , 'test.issue7246' ) ;
134138 const row : any = await engine . insert ( 'opt_unmarked' , { title : 'D' } , sys ) ;
135- expect ( row . status ) . toBeUndefined ( ) ;
139+ // [#29538] The answer reads the unstored column `null`, as the next read
140+ // does; "left alone" is the STORED row's own: no key at all.
141+ expect ( row . status ) . toBeNull ( ) ;
142+ expect ( await storedRow ( engine , 'opt_unmarked' , row . id ) ) . not . toHaveProperty ( 'status' ) ;
136143 } ) ;
137144} ) ;
138145
@@ -348,8 +355,11 @@ describe('[#7246] the default follows the FIELD shape, not the option count', ()
348355 { label : 'Quick' , value : 'quick' } ,
349356 ] ) as any , 'test.issue7246' ) ;
350357 const row : any = await engine . insert ( 'opt_valueless' , { } , sys ) ;
351- expect ( row . tags ) . toBeUndefined ( ) ;
352- expect ( row . tags ) . not . toBeNull ( ) ;
358+ // [#29538] The answer reads the unstored column `null`, as the next read
359+ // does; "left unset" (no value, not even a stored `null`) is the STORED
360+ // row's own: no key at all.
361+ expect ( row . tags ) . toBeNull ( ) ;
362+ expect ( await storedRow ( engine , 'opt_valueless' , row . id ) ) . not . toHaveProperty ( 'tags' ) ;
353363 } ) ;
354364} ) ;
355365
@@ -400,6 +410,8 @@ describe('[#7246] the lint heuristic and the engine agree BY CONSTRUCTION', () =
400410 } ,
401411 } as any , 'test.issue7246' ) ;
402412 const row : any = await engine . insert ( 'opt_alias' , { } , sys ) ;
403- expect ( row . status ) . toBeUndefined ( ) ;
413+ // [#29538] The answer reads the unstored column `null`; the STORED row has no key.
414+ expect ( row . status ) . toBeNull ( ) ;
415+ expect ( await storedRow ( engine , 'opt_alias' , row . id ) ) . not . toHaveProperty ( 'status' ) ;
404416 } ) ;
405417} ) ;
0 commit comments