@@ -344,6 +344,28 @@ func TestNarrowVerifiedEntries_StickyPrecision(t *testing.T) {
344344 assert .Empty (t , result .wplans [0 ].Rewrites )
345345 })
346346
347+ t .Run ("SHA metadata repairs to branch" , func (t * testing.T ) {
348+ tagger , _ := newTagger (t )
349+ report := fastPathReport (sha )
350+ report .Inventory [0 ].Dep .Branch = "main"
351+ report .ActionRefs = []parserlock.ActionRef {{
352+ Owner : "actions" ,
353+ Repo : "checkout" ,
354+ Ref : sha ,
355+ }}
356+
357+ result , err := planWorkflow (context .Background (), report , PlanOptions {Tagger : tagger }, func (string ) {})
358+ require .NoError (t , err )
359+
360+ require .Len (t , result .entries , 1 )
361+ assert .Equal (t , "main" , result .entries [0 ].Ref )
362+ assert .Equal (t , sha , result .entries [0 ].AutoFixedRef )
363+ assert .Equal (t ,
364+ map [string ]string {"actions/checkout@" + sha : "actions/checkout@main" },
365+ result .wplans [0 ].Rewrites ,
366+ )
367+ })
368+
347369 t .Run ("repair preserves source NWO spelling" , func (t * testing.T ) {
348370 tagger , _ := newTagger (t )
349371 report := fastPathReport (sha )
@@ -474,6 +496,29 @@ func TestPlanRejectsRepairConflictingWithSymbolicEntry(t *testing.T) {
474496 require .ErrorContains (t , err , "conflicting planned target actions/checkout@v4.2.1" )
475497}
476498
499+ func TestPlanExcludesLoadFailuresFromCommit (t * testing.T ) {
500+ const sha = "abc1230000000000000000000000000000000000"
501+ blocked := checks.WorkflowReport {
502+ Path : ".github/workflows/broken.yml" ,
503+ SkipCommit : true ,
504+ Inventory : []checks.InventoryEntry {{
505+ Dep : dep.Dependency {NWO : "actions/checkout" , Ref : "v4" , SHA : sha },
506+ File : ".github/workflows/broken.yml" ,
507+ }},
508+ }
509+ valid := checks.WorkflowReport {Path : ".github/workflows/valid.yml" }
510+
511+ record , err := Plan (context .Background (), & checks.Report {
512+ Workflows : []checks.WorkflowReport {blocked , valid },
513+ }, PlanOptions {Pool : pinpool .New (2 , nil )})
514+ require .NoError (t , err )
515+
516+ require .Len (t , record .Workflows , 1 )
517+ assert .Equal (t , valid .Path , record .Workflows [0 ].Path )
518+ require .Len (t , record .Entries , 1 )
519+ assert .Equal (t , blocked .Path , record .Entries [0 ].Workflows [0 ])
520+ }
521+
477522func TestPlanWorkflow_SelfRepositoryDependencyIsNotRewrittenOnFastPath (t * testing.T ) {
478523 const sha = "abc1230000000000000000000000000000000000"
479524
0 commit comments