@@ -418,6 +418,55 @@ describe("FRV immutable plan eligibility", () => {
418418} ) ;
419419
420420describe ( "FRV continuation preflight" , ( ) => {
421+ it ( "rejects parent-owned candidate artifacts before any GitHub access" , async ( ) => {
422+ const selected = child ( "normalCi" , "101" ) ;
423+ const parentOwnedPlan = {
424+ ...plan ( [ selected ] ) ,
425+ candidate : { producer : { runId : "77" } } ,
426+ } ;
427+ let reads = 0 ;
428+ let mutations = 0 ;
429+ const read = async ( ) => {
430+ reads += 1 ;
431+ throw new Error ( "unexpected GitHub read" ) ;
432+ } ;
433+ const mutate = async ( ) => {
434+ mutations += 1 ;
435+ } ;
436+
437+ await expect (
438+ continueFailed ( parentOwnedPlan , "77" , {
439+ getAttemptJobs : read ,
440+ getJobLog : read ,
441+ getParentJobs : read ,
442+ getRun : read ,
443+ getRunAttempt : read ,
444+ repository : REPOSITORY ,
445+ rerunFailed : mutate ,
446+ rerunParent : mutate ,
447+ verify : mutate ,
448+ } ) ,
449+ ) . rejects . toThrow (
450+ "parent-owned sealed candidate artifacts do not survive parent reruns; start a fresh all-group FRV" ,
451+ ) ;
452+ expect ( reads ) . toBe ( 0 ) ;
453+ expect ( mutations ) . toBe ( 0 ) ;
454+ } ) ;
455+
456+ it . each ( [
457+ [ "candidate-free" , undefined ] ,
458+ [ "externally produced" , { producer : { runId : "88" } } ] ,
459+ ] ) ( "allows %s plans through candidate ownership preflight" , async ( _label , candidate ) => {
460+ const selected = child ( "normalCi" , "101" ) ;
461+ await expect (
462+ preflightContinuation (
463+ { ...plan ( [ selected ] ) , candidate } ,
464+ "77" ,
465+ preflightMethods ( [ selected ] , ( entry ) => runFor ( entry , 1 , "failure" ) ) ,
466+ ) ,
467+ ) . resolves . toMatchObject ( { id : 77 } ) ;
468+ } ) ;
469+
421470 it ( "rejects fail-fast roots before any rerun mutation" , async ( ) => {
422471 const selected = child ( "normalCi" , "101" ) ;
423472 let mutations = 0 ;
0 commit comments