Harden output cache and debug state integration

This commit is contained in:
2026-07-18 13:00:04 +00:00
parent 26142f0e05
commit 8cb11e60e4
5 changed files with 575 additions and 4 deletions

View File

@@ -491,10 +491,19 @@ func debugSourceChunkEnvelope(chunk source.Chunk) debugSourceChunk {
}
func cloneSourceUnitsForDebug(units []source.SourceUnit) []source.SourceUnit {
cloned, err := cloneSourceUnits(units)
if err != nil {
if len(units) == 0 {
return nil
}
cloned := make([]source.SourceUnit, len(units))
for i, unit := range units {
cloned[i] = source.SourceUnit{
ID: unit.ID,
Kind: unit.Kind,
Text: string(redactSecretBytes([]byte(unit.Text))),
Ref: unit.Ref,
Metadata: redactSensitiveMap(unit.Metadata),
}
}
return cloned
}