@@ -1022,15 +1022,26 @@ describe('uncountable effects (#4354 follow-up)', () => {
10221022 expect ( res . summary ) . toMatchObject ( { acted : 0 , unmeasured : 1 } ) ;
10231023 } ) ;
10241024
1025- it ( 'persists as a queryable column, null when never tracked' , async ( ) => {
1025+ /**
1026+ * ONE engine double for the three `recordTerminal` pins in this describe,
1027+ * rather than one apiece. `check:engine-double-contract` counts unguarded
1028+ * doubles PER FILE against a shrink-only baseline, so three copies of the
1029+ * same four members would have been three new ledger rows for one fact —
1030+ * and the gate's own advice is to reuse the double the file already has.
1031+ */
1032+ function recordingRunStore ( ) : { store : ObjectStoreSuspendedRunStore ; rows : any [ ] } {
10261033 const rows : any [ ] = [ ] ;
10271034 const engine : any = {
10281035 async find ( ) { return [ ] ; } ,
10291036 async insert ( _o : string , row : any ) { rows . push ( row ) ; return row ; } ,
10301037 async update ( ) { return 1 ; } ,
10311038 async delete ( ) { return 1 ; } ,
10321039 } ;
1033- const store = new ObjectStoreSuspendedRunStore ( engine ) ;
1040+ return { store : new ObjectStoreSuspendedRunStore ( engine ) , rows } ;
1041+ }
1042+
1043+ it ( 'persists as a queryable column, null when never tracked' , async ( ) => {
1044+ const { store, rows } = recordingRunStore ( ) ;
10341045 await store . recordTerminal ( {
10351046 runId : 'r1' , flowName : 'f' , status : 'completed' , startedAt : AT ,
10361047 summary : { selected : 9 , acted : 0 , skipped : 0 , unmeasured : 3 , nodes : [ ] , gates : [ ] } ,
@@ -1047,14 +1058,7 @@ describe('uncountable effects (#4354 follow-up)', () => {
10471058 // them, and a contained failure is read from the run row, not alerted on
10481059 // by that filter.
10491060 it ( 'carries the #14456 failure count through the persisted summary, absent when never tracked' , async ( ) => {
1050- const rows : any [ ] = [ ] ;
1051- const engine : any = {
1052- async find ( ) { return [ ] ; } ,
1053- async insert ( _o : string , row : any ) { rows . push ( row ) ; return row ; } ,
1054- async update ( ) { return 1 ; } ,
1055- async delete ( ) { return 1 ; } ,
1056- } ;
1057- const store = new ObjectStoreSuspendedRunStore ( engine ) ;
1061+ const { store, rows } = recordingRunStore ( ) ;
10581062 await store . recordTerminal ( {
10591063 runId : 'r1' , flowName : 'f' , status : 'completed' , startedAt : AT ,
10601064 summary : summarizeRun ( [
@@ -1074,14 +1078,7 @@ describe('uncountable effects (#4354 follow-up)', () => {
10741078 } ) ;
10751079
10761080 it ( 'keeps the failure count when the detail is dropped for size' , async ( ) => {
1077- const rows : any [ ] = [ ] ;
1078- const engine : any = {
1079- async find ( ) { return [ ] ; } ,
1080- async insert ( _o : string , row : any ) { rows . push ( row ) ; return row ; } ,
1081- async update ( ) { return 1 ; } ,
1082- async delete ( ) { return 1 ; } ,
1083- } ;
1084- const store = new ObjectStoreSuspendedRunStore ( engine ) ;
1081+ const { store, rows } = recordingRunStore ( ) ;
10851082 // A pathological flow: enough nodes to blow the 16 KiB summary cap, so
10861083 // the per-node `failures` this count folds is exactly what gets
10871084 // dropped. The total has to survive the drop or the compacted row goes
0 commit comments