@@ -59,6 +59,7 @@ type AutomaticPlan =
5959
6060type ManualIntervention =
6161 { compilerError :: Maybe String
62+ , directBlockers :: Array PackageName
6263 , packages :: Map PackageName Version
6364 , removals :: Array PackageName
6465 , targets :: Array PackageName
@@ -80,8 +81,8 @@ data ProbeResult
8081derive instance Eq ProbeResult
8182
8283data ManualRemovalResult
83- = RemovalVerified Int (Set PackageName ) (Array String )
84- | RemovalFailed Int (Set PackageName ) (Array String )
84+ = RemovalVerified Int (Set PackageName ) (Set PackageName ) ( Array String )
85+ | RemovalFailed Int (Set PackageName ) (Set PackageName ) ( Array String )
8586 | RemovalAnalysisFailed Int String
8687 | RemovalSearchTruncated Int
8788
@@ -545,6 +546,7 @@ planManualInterventions probe packageSet manifests components automatic = go emp
545546 { attempts = state.attempts + 1
546547 , interventions = state.interventions <>
547548 [ { compilerError: Just compilerError
549+ , directBlockers: Array .fromFoldable seeds
548550 , packages
549551 , removals: []
550552 , targets: Array .fromFoldable $ Map .keys latest
@@ -558,13 +560,14 @@ planManualInterventions probe packageSet manifests components automatic = go emp
558560 )
559561 rest
560562 else do
561- probeManualRemovals probe packageSet manifests packages removals (state.attempts + 1 ) >>= case _ of
562- RemovalVerified attempts verifiedRemovals additionalEvidence ->
563+ probeManualRemovals probe packageSet manifests packages seeds removals (state.attempts + 1 ) >>= case _ of
564+ RemovalVerified attempts directBlockers verifiedRemovals additionalEvidence ->
563565 go
564566 ( state
565567 { attempts = attempts
566568 , interventions = state.interventions <>
567569 [ { compilerError: Just $ combineCompilerEvidence compilerError additionalEvidence
570+ , directBlockers: Array .fromFoldable directBlockers
568571 , packages
569572 , removals: Array .fromFoldable verifiedRemovals
570573 , targets: Array .fromFoldable $ Map .keys latest
@@ -574,12 +577,13 @@ planManualInterventions probe packageSet manifests components automatic = go emp
574577 }
575578 )
576579 rest
577- RemovalFailed attempts failedRemovals additionalEvidence ->
580+ RemovalFailed attempts directBlockers failedRemovals additionalEvidence ->
578581 go
579582 ( state
580583 { attempts = attempts
581584 , interventions = state.interventions <>
582585 [ { compilerError: Just $ combineCompilerEvidence compilerError additionalEvidence
586+ , directBlockers: Array .fromFoldable directBlockers
583587 , packages
584588 , removals: Array .fromFoldable failedRemovals
585589 , targets: Array .fromFoldable $ Map .keys latest
@@ -607,33 +611,35 @@ probeManualRemovals
607611 -> ManifestIndex
608612 -> Map PackageName Version
609613 -> Set PackageName
614+ -> Set PackageName
610615 -> Int
611616 -> Run r ManualRemovalResult
612617probeManualRemovals probe packageSet manifests packages = go []
613618 where
614619 proposed = applyUpdates packageSet packages
615620
616- go evidence removals attempts
621+ go evidence directBlockers removals attempts
617622 | attempts >= manualProbeBudget = pure $ RemovalSearchTruncated attempts
618623 | otherwise = do
619624 let changes = map PackageSets.Update packages
620625 let removalChanges = Map .union (map (const PackageSets.Remove ) (Map .fromFoldable (map (\name -> Tuple name unit) (Array .fromFoldable removals)))) changes
621626 probe packageSet removalChanges >>= case _ of
622- Compiles -> pure $ RemovalVerified (attempts + 1 ) removals evidence
627+ Compiles -> pure $ RemovalVerified (attempts + 1 ) directBlockers removals evidence
623628 InfrastructureFailure error -> pure $ RemovalAnalysisFailed (attempts + 1 ) error
624629 CompilationFailure error -> do
625630 let nextEvidence = evidence <> [ error ]
626631 let remaining = Foldable .foldr Map .delete proposed removals
627632 let seeds = compilerFailurePackages packageSet packages error
633+ let nextDirectBlockers = Set .union directBlockers seeds
628634 case reverseDependencyClosure remaining manifests seeds of
629635 Left analysisError -> pure $ RemovalAnalysisFailed (attempts + 1 ) analysisError
630636 Right closure -> do
631637 let additions = Set .difference closure (Map .keys packages)
632638 let next = Set .union removals additions
633639 if next == removals then
634- pure $ RemovalFailed (attempts + 1 ) removals nextEvidence
640+ pure $ RemovalFailed (attempts + 1 ) nextDirectBlockers removals nextEvidence
635641 else
636- go nextEvidence next (attempts + 1 )
642+ go nextEvidence nextDirectBlockers next (attempts + 1 )
637643
638644combineCompilerEvidence :: String -> Array String -> String
639645combineCompilerEvidence initial additional =
0 commit comments