@@ -189,14 +189,16 @@ test('recovery never accepts stale pre-existing plan artifacts when provider wri
189189 assert . equal ( readJson ( p . state ) . stages . plan . status , 'failed' ) ;
190190} ) ;
191191
192- test ( 'audit rejects unknown model references and publish rejects stale source artifacts' , async ( ) => {
192+ test ( 'audit sanitizes unknown model references and publish rejects stale source artifacts' , async ( ) => {
193193 const root = fixture ( ) ; const p = projectPaths ( root ) ; const provider = installFakeProvider ( root ) ;
194194 fs . writeFileSync ( path . join ( root , 'src' , 'Resource.java' ) , 'class Resource {}\n' ) ;
195195 const config = readJson ( p . config ) ; config . commandCode = { executable : provider , trust : false , skipOnboarding : false , yolo : false , maxTurns : { default : 30 } } ; writeJson ( p . config , config ) ;
196196 const run = spawnSync ( process . execPath , [ cli , 'all' ] , { cwd : root , encoding : 'utf8' , env : { ...process . env , DOCGEN_PROGRESS : '0' } } ) ; assert . equal ( run . status , 0 , run . stderr || run . stdout ) ;
197197 const traceFile = path . join ( p . traceability , 'pages' , 'overview.json' ) ; const trace = readJson ( traceFile ) ; trace . claims [ 0 ] . sourceModelRefs = [ 'system:does-not-exist' ] ; writeJson ( traceFile , trace ) ;
198- await assert . rejects ( ( ) => audit ( root ) , / Q u a l i t y f a i l e d / ) ; const report = readJson ( path . join ( p . audit , 'deterministic.json' ) ) ; assert ( report . errors . some ( ( error ) => / u n k n o w n s o u r c e M o d e l R e f / . test ( error ) ) ) ;
199- trace . claims [ 0 ] . sourceModelRefs = [ 'system:resource' ] ; writeJson ( traceFile , trace ) ; await audit ( root ) ;
198+ const summary = await audit ( root ) ;
199+ const sanitizedTrace = readJson ( traceFile ) ;
200+ assert . deepEqual ( sanitizedTrace . claims [ 0 ] . sourceModelRefs , [ ] ) ;
201+ assert . equal ( summary . deterministicFailures , 0 ) ;
200202 fs . appendFileSync ( path . join ( root , 'src' , 'Resource.java' ) , '// stale\n' ) ;
201203 assert . throws ( ( ) => publish ( root ) , / s t a l e r e l a t i v e t o c u r r e n t s o u r c e / ) ;
202204} ) ;
@@ -221,7 +223,7 @@ test('enterprise model bundle repairs a missing decisions object without discard
221223 const config = readJson ( p . config ) ; config . commandCode = { executable : provider , trust : false , skipOnboarding : false , yolo : false , maxTurns : { default : 30 } } ; config . budget . maxProviderCalls = 12 ; writeJson ( p . config , config ) ;
222224 const run = spawnSync ( process . execPath , [ cli , 'all' ] , { cwd : root , encoding : 'utf8' , env : { ...process . env , DOCGEN_PROGRESS : '0' , DOCGEN_TEST_OMIT_MODEL_ONCE : 'decisions' } } ) ;
223225 assert . equal ( run . status , 0 , `STDERR:\n${ run . stderr } \nSTDOUT:\n${ run . stdout } ` ) ;
224- assert . match ( run . stderr , / m o d e l E n t e r p r i s e R E P A I R \| b u n d l e o m i t t e d d e c i s i o n s / ) ;
226+ assert . match ( run . stderr , / m o d e l E n t e r p r i s e R E P A I R \| u n r e s o l v e d : d e c i s i o n s / ) ;
225227 assert . equal ( fs . existsSync ( path . join ( p . model , 'decisions.json' ) ) , true ) ;
226228 assert . equal ( readJson ( p . state ) . stages . modelEnterprise . status , 'completed' ) ;
227229 const budget = readJson ( p . budget ) ; assert . equal ( budget . usage . providerCalls , 5 ) ; assert . equal ( budget . usage . failedCalls , 0 ) ;
0 commit comments