Reuse artifact dependents during analysis
This commit is contained in:
@@ -41,10 +41,10 @@ their scope. Unless assigned otherwise, a finding remains independent audit
|
|||||||
remediation. Shared code does not make a refactoring a prerequisite or assign
|
remediation. Shared code does not make a refactoring a prerequisite or assign
|
||||||
the whole finding to a roadmap.
|
the whole finding to a roadmap.
|
||||||
|
|
||||||
Twenty-eight entries are closed by the safety, transfer, audio discovery, S3
|
Twenty-nine entries are closed by the safety, transfer, audio discovery, S3
|
||||||
planning, prerequisite-history, publication-import, CLI classification,
|
planning, prerequisite-history, publication-import, CLI classification,
|
||||||
inspection aggregation, test maintenance, dead-code removal, and associated
|
inspection aggregation, test maintenance, dead-code removal, and associated
|
||||||
documentation work; 15 remain open. **Planned** identifies
|
documentation work; 14 remain open. **Planned** identifies
|
||||||
an agreed remedy awaiting implementation. **Potentially eliminated** requires verification that the offending
|
an agreed remedy awaiting implementation. **Potentially eliminated** requires verification that the offending
|
||||||
lifecycle is removed. **Coordinate** identifies shared changes, not a commitment
|
lifecycle is removed. **Coordinate** identifies shared changes, not a commitment
|
||||||
that a related feature implements the entire finding. Findings close only after their
|
that a related feature implements the entire finding. Findings close only after their
|
||||||
@@ -559,7 +559,10 @@ Related: [CAT-10](#cat-10--p2-hydrate-previous-inputs-for-the-full-analysis-prer
|
|||||||
|
|
||||||
### CAT-18 — P3: Reuse the analysis reverse-dependency index within an invocation
|
### CAT-18 — P3: Reuse the analysis reverse-dependency index within an invocation
|
||||||
|
|
||||||
Status: Open
|
Status: Closed
|
||||||
|
|
||||||
|
**Closure.** Analysis reuses its operation-owned graph for success and failure
|
||||||
|
invalidation, including eligibility barriers. Analyze and checkpoint tests pass.
|
||||||
|
|
||||||
Original findings: [EF-02](02-efficiency.md#ef-02--p3-analysis-rebuilds-the-same-dependency-index-after-each-completion).
|
Original findings: [EF-02](02-efficiency.md#ef-02--p3-analysis-rebuilds-the-same-dependency-index-after-each-completion).
|
||||||
|
|
||||||
|
|||||||
@@ -277,7 +277,7 @@ Validation: `go test ./internal/config ./internal/artifactdeps ./internal/artifa
|
|||||||
|
|
||||||
## Stage 8: Reuse Reverse Dependencies Throughout Analysis
|
## Stage 8: Reuse Reverse Dependencies Throughout Analysis
|
||||||
|
|
||||||
CAT IDs: CAT-18. Status: Pending.
|
CAT IDs: CAT-18. Status: Complete.
|
||||||
|
|
||||||
Read [EF-02](audit/02-efficiency.md#ef-02--p3-analysis-rebuilds-the-same-dependency-index-after-each-completion)
|
Read [EF-02](audit/02-efficiency.md#ef-02--p3-analysis-rebuilds-the-same-dependency-index-after-each-completion)
|
||||||
and `stage/analyze.go`, `analyze_execution_state.go`, and checkpoint tests.
|
and `stage/analyze.go`, `analyze_execution_state.go`, and checkpoint tests.
|
||||||
|
|||||||
@@ -200,11 +200,11 @@ func artifactCfgMap(execution analyzeExecutionContext) map[string]config.Scripto
|
|||||||
}
|
}
|
||||||
|
|
||||||
func staleAnalyzeDependents(
|
func staleAnalyzeDependents(
|
||||||
configured map[string]config.ScriptoriumArtifactConfig,
|
graph *artifactdeps.Graph,
|
||||||
changed string,
|
changed string,
|
||||||
records map[string]manifest.AnalyzeArtifactRecord,
|
records map[string]manifest.AnalyzeArtifactRecord,
|
||||||
) {
|
) {
|
||||||
staleAnalyzeDependentClosure(configured, changed, records, nil)
|
staleAnalyzeDependentClosure(graph, changed, records, nil)
|
||||||
}
|
}
|
||||||
|
|
||||||
func currentAnalyzeArtifactRecord(
|
func currentAnalyzeArtifactRecord(
|
||||||
@@ -284,46 +284,25 @@ func sameAnalyzeOutputIdentity(left, right manifest.AnalyzeArtifactRecord) bool
|
|||||||
}
|
}
|
||||||
|
|
||||||
func staleUnscheduledAnalyzeDependents(
|
func staleUnscheduledAnalyzeDependents(
|
||||||
configured map[string]config.ScriptoriumArtifactConfig,
|
graph *artifactdeps.Graph,
|
||||||
changed string,
|
changed string,
|
||||||
currentKeys map[string]struct{},
|
currentKeys map[string]struct{},
|
||||||
records map[string]manifest.AnalyzeArtifactRecord,
|
records map[string]manifest.AnalyzeArtifactRecord,
|
||||||
) {
|
) {
|
||||||
staleAnalyzeDependentClosure(configured, changed, records, func(key string) bool {
|
staleAnalyzeDependentClosure(graph, changed, records, func(key string) bool {
|
||||||
_, evaluated := currentKeys[key]
|
_, evaluated := currentKeys[key]
|
||||||
return !evaluated
|
return !evaluated
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
func staleAnalyzeDependentClosure(
|
func staleAnalyzeDependentClosure(
|
||||||
configured map[string]config.ScriptoriumArtifactConfig,
|
graph *artifactdeps.Graph,
|
||||||
changed string,
|
changed string,
|
||||||
records map[string]manifest.AnalyzeArtifactRecord,
|
records map[string]manifest.AnalyzeArtifactRecord,
|
||||||
eligible func(string) bool,
|
eligible func(string) bool,
|
||||||
) {
|
) {
|
||||||
reverse := make(map[string][]string, len(configured))
|
for _, key := range graph.Dependents(changed, eligible) {
|
||||||
for key, artifactCfg := range configured {
|
|
||||||
for _, dependency := range artifacts.NormalizedDependencyKeys(artifactCfg.DependsOn) {
|
|
||||||
reverse[dependency] = append(reverse[dependency], key)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
for key := range reverse {
|
|
||||||
sort.Strings(reverse[key])
|
|
||||||
}
|
|
||||||
queue := append([]string(nil), reverse[changed]...)
|
|
||||||
seen := make(map[string]struct{}, len(queue))
|
|
||||||
for len(queue) > 0 {
|
|
||||||
key := queue[0]
|
|
||||||
queue = queue[1:]
|
|
||||||
if _, visited := seen[key]; visited {
|
|
||||||
continue
|
|
||||||
}
|
|
||||||
seen[key] = struct{}{}
|
|
||||||
if eligible != nil && !eligible(key) {
|
|
||||||
continue
|
|
||||||
}
|
|
||||||
staleAnalyzeRecord(records, key)
|
staleAnalyzeRecord(records, key)
|
||||||
queue = append(queue, reverse[key]...)
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -93,7 +93,7 @@ func (state *analyzeExecutionState) acceptArtifact(
|
|||||||
prior, hadPrior := state.priorCurrentRecords[plan.Name]
|
prior, hadPrior := state.priorCurrentRecords[plan.Name]
|
||||||
if !hadPrior || !sameAnalyzeOutputIdentity(prior, record) {
|
if !hadPrior || !sameAnalyzeOutputIdentity(prior, record) {
|
||||||
staleUnscheduledAnalyzeDependents(
|
staleUnscheduledAnalyzeDependents(
|
||||||
artifactCfgMap(state.execution),
|
state.execution.Graph,
|
||||||
plan.Name,
|
plan.Name,
|
||||||
state.evaluatedKeys,
|
state.evaluatedKeys,
|
||||||
state.records,
|
state.records,
|
||||||
@@ -229,7 +229,7 @@ func (state *analyzeExecutionState) failedResult(
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
state.records[item.Key] = record
|
state.records[item.Key] = record
|
||||||
staleAnalyzeDependents(artifactCfgMap(state.execution), item.Key, state.records)
|
staleAnalyzeDependents(state.execution.Graph, item.Key, state.records)
|
||||||
state.installManifestCollection()
|
state.installManifestCollection()
|
||||||
return &StageResult{}
|
return &StageResult{}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user