Redact invalid chunk plan lookup diagnostics
This commit is contained in:
@@ -47,11 +47,11 @@ func (r *Runner) runChunkPlan(ctx context.Context, input RunInput, doc *source.S
|
||||
if mode == ChunkCacheAuto {
|
||||
record, decision, err := input.ChunkPlans.Load(doc.Digest)
|
||||
result.lookup = decision
|
||||
result.summary.LookupStatus = string(decision.Status)
|
||||
result.summary.LookupReason = decision.Reason
|
||||
result.summary.LookupStatus = chunkPlanLookupStatus(decision.Status)
|
||||
result.summary.LookupReason = chunkPlanLookupReason(decision.Status)
|
||||
if err != nil {
|
||||
result.summary.LookupStatus = "skipped"
|
||||
result.summary.LookupReason = "chunk plan lookup failed"
|
||||
result.summary.LookupReason = chunkPlanLookupReason("")
|
||||
return result, fmt.Errorf("load chunk plan: %w", err)
|
||||
}
|
||||
switch decision.Status {
|
||||
@@ -68,13 +68,13 @@ func (r *Runner) runChunkPlan(ctx context.Context, input RunInput, doc *source.S
|
||||
result.setValidation(validationWarnings, rejection, err)
|
||||
return result, err
|
||||
}
|
||||
result.lookup = ChunkPlanDecision{Status: ChunkPlanInvalid, Reason: "stored chunk plan cannot be materialized against the current source"}
|
||||
result.lookup = ChunkPlanDecision{Status: ChunkPlanInvalid, Reason: chunkPlanLookupReason(ChunkPlanInvalid)}
|
||||
result.summary.LookupStatus = "invalid"
|
||||
result.summary.LookupReason = result.lookup.Reason
|
||||
result.summary.LookupReason = chunkPlanLookupReason(ChunkPlanInvalid)
|
||||
case ChunkPlanMissing, ChunkPlanInvalid:
|
||||
// Generate below.
|
||||
default:
|
||||
return result, fmt.Errorf("load chunk plan returned unsupported status %q", decision.Status)
|
||||
return result, fmt.Errorf("load chunk plan returned unsupported decision status")
|
||||
}
|
||||
}
|
||||
if mode == ChunkCacheAuto || mode == ChunkCacheRefresh {
|
||||
@@ -171,6 +171,32 @@ func (r *Runner) runChunkPlan(ctx context.Context, input RunInput, doc *source.S
|
||||
return result, nil
|
||||
}
|
||||
|
||||
func chunkPlanLookupStatus(status ChunkPlanStatus) string {
|
||||
switch status {
|
||||
case ChunkPlanHit:
|
||||
return "hit"
|
||||
case ChunkPlanMissing:
|
||||
return "missing"
|
||||
case ChunkPlanInvalid:
|
||||
return "invalid"
|
||||
default:
|
||||
return "skipped"
|
||||
}
|
||||
}
|
||||
|
||||
func chunkPlanLookupReason(status ChunkPlanStatus) string {
|
||||
switch status {
|
||||
case ChunkPlanHit:
|
||||
return "stored chunk plan is valid"
|
||||
case ChunkPlanMissing:
|
||||
return "chunk plan not found"
|
||||
case ChunkPlanInvalid:
|
||||
return "stored chunk plan is invalid"
|
||||
default:
|
||||
return "chunk plan lookup skipped"
|
||||
}
|
||||
}
|
||||
|
||||
func (result *chunkPlanExecution) setCandidate(record ChunkPlanRecord, action string) {
|
||||
cloned := cloneChunkPlanRecord(record)
|
||||
result.record = &cloned
|
||||
|
||||
Reference in New Issue
Block a user