Remove invocation analyze projection
This commit is contained in:
@@ -151,22 +151,18 @@ func (analyzeStage) Run(ctx context.Context, env *Env, m *manifest.Manifest) (*S
|
||||
reusedArtifacts := []map[string]any{}
|
||||
reusedSeen := map[string]struct{}{}
|
||||
sessionRecords := manifest.CloneAnalyzeArtifactCollection(workPlan.ProjectedRecords)
|
||||
invocationRecords := make(map[string]manifest.AnalyzeArtifactRecord)
|
||||
priorCurrentRecords := make(map[string]manifest.AnalyzeArtifactRecord)
|
||||
for _, item := range reconciliation.Ordered {
|
||||
if item.Stored != nil && item.Stored.Status == manifest.AnalyzeArtifactCurrent {
|
||||
priorCurrentRecords[item.Key] = *item.Stored
|
||||
}
|
||||
}
|
||||
invocationKeys := make(map[string]struct{}, len(workPlan.ExecutionOrder)+len(workPlan.ReusedCurrent))
|
||||
currentKeys := make(map[string]struct{}, len(workPlan.ExecutionOrder)+len(workPlan.ReusedCurrent))
|
||||
for _, item := range workPlan.ExecutionOrder {
|
||||
invocationKeys[item.Key] = struct{}{}
|
||||
currentKeys[item.Key] = struct{}{}
|
||||
}
|
||||
for _, item := range workPlan.ReusedCurrent {
|
||||
invocationKeys[item.Key] = struct{}{}
|
||||
if record, ok := sessionRecords[item.Key]; ok {
|
||||
invocationRecords[item.Key] = record
|
||||
}
|
||||
currentKeys[item.Key] = struct{}{}
|
||||
}
|
||||
|
||||
for _, item := range workPlan.ExecutionOrder {
|
||||
@@ -185,7 +181,6 @@ func (analyzeStage) Run(ctx context.Context, env *Env, m *manifest.Manifest) (*S
|
||||
"",
|
||||
executionErr,
|
||||
sessionRecords,
|
||||
invocationRecords,
|
||||
), executionErr
|
||||
}
|
||||
priorRecord, hadPriorRecord := priorCurrentRecords[item.Key]
|
||||
@@ -199,7 +194,6 @@ func (analyzeStage) Run(ctx context.Context, env *Env, m *manifest.Manifest) (*S
|
||||
fingerprint,
|
||||
err,
|
||||
sessionRecords,
|
||||
invocationRecords,
|
||||
), err
|
||||
}
|
||||
|
||||
@@ -236,18 +230,16 @@ func (analyzeStage) Run(ctx context.Context, env *Env, m *manifest.Manifest) (*S
|
||||
fingerprint,
|
||||
recordErr,
|
||||
sessionRecords,
|
||||
invocationRecords,
|
||||
), recordErr
|
||||
}
|
||||
sessionRecords[plan.Name] = record
|
||||
invocationRecords[plan.Name] = record
|
||||
|
||||
sourceID, ok := runtimeCatalog.SourceIDForConfiguredKey(plan.Name)
|
||||
if !ok {
|
||||
catalogErr := fmt.Errorf("analyze: source id not found for artifact %q", plan.Name)
|
||||
return failedAnalyzeResult(
|
||||
execution, item, artifactCfg, fingerprint, catalogErr,
|
||||
sessionRecords, invocationRecords,
|
||||
sessionRecords,
|
||||
), catalogErr
|
||||
}
|
||||
if err := runtimeCatalog.MarkAvailableGeneratedEvidence(
|
||||
@@ -261,14 +253,14 @@ func (analyzeStage) Run(ctx context.Context, env *Env, m *manifest.Manifest) (*S
|
||||
catalogErr := fmt.Errorf("analyze: mark generated artifact %q available: %w", sourceID, err)
|
||||
return failedAnalyzeResult(
|
||||
execution, item, artifactCfg, fingerprint, catalogErr,
|
||||
sessionRecords, invocationRecords,
|
||||
sessionRecords,
|
||||
), catalogErr
|
||||
}
|
||||
if !hadPriorRecord || !sameAnalyzeOutputIdentity(priorRecord, record) {
|
||||
staleUnscheduledAnalyzeDependents(
|
||||
env.Config.Pipeline.Scriptorium.Artifacts,
|
||||
plan.Name,
|
||||
invocationKeys,
|
||||
currentKeys,
|
||||
sessionRecords,
|
||||
)
|
||||
}
|
||||
@@ -295,8 +287,7 @@ func (analyzeStage) Run(ctx context.Context, env *Env, m *manifest.Manifest) (*S
|
||||
GeneratedConfigs: dedupeAndSortPaths(generatedConfigs),
|
||||
Metadata: metadata,
|
||||
AnalyzeState: &AnalyzeStateProjection{
|
||||
Session: sessionRecords,
|
||||
Invocation: manifest.CloneAnalyzeArtifactCollection(invocationRecords),
|
||||
Session: sessionRecords,
|
||||
},
|
||||
}, nil
|
||||
}
|
||||
@@ -308,7 +299,6 @@ func failedAnalyzeResult(
|
||||
fingerprint string,
|
||||
cause error,
|
||||
sessionRecords map[string]manifest.AnalyzeArtifactRecord,
|
||||
invocationRecords map[string]manifest.AnalyzeArtifactRecord,
|
||||
) *StageResult {
|
||||
record := manifest.AnalyzeArtifactRecord{
|
||||
Key: item.Key,
|
||||
@@ -332,11 +322,9 @@ func failedAnalyzeResult(
|
||||
}
|
||||
}
|
||||
sessionRecords[item.Key] = record
|
||||
invocationRecords[item.Key] = record
|
||||
staleAnalyzeDependents(artifactCfgMap(execution), item.Key, sessionRecords)
|
||||
return &StageResult{AnalyzeState: &AnalyzeStateProjection{
|
||||
Session: manifest.CloneAnalyzeArtifactCollection(sessionRecords),
|
||||
Invocation: manifest.CloneAnalyzeArtifactCollection(invocationRecords),
|
||||
Session: manifest.CloneAnalyzeArtifactCollection(sessionRecords),
|
||||
}}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user