Expose chunk plan provenance and safe diagnostics

This commit is contained in:
2026-07-18 00:45:01 +00:00
parent 8ba5228c01
commit 6fc6ce0adb
15 changed files with 363 additions and 41 deletions

View File

@@ -273,11 +273,32 @@ func cloneMetadata(metadata map[string]any) map[string]any {
}
out := make(map[string]any, len(metadata))
for key, value := range metadata {
out[key] = value
out[key] = cloneJSONMetadataValue(value)
}
return out
}
func cloneJSONMetadataValue(value any) any {
switch typed := value.(type) {
case map[string]any:
return cloneMetadata(typed)
case []any:
out := make([]any, len(typed))
for i := range typed {
out[i] = cloneJSONMetadataValue(typed[i])
}
return out
case stdjson.RawMessage:
return append(stdjson.RawMessage(nil), typed...)
case []byte:
return append([]byte(nil), typed...)
case []string:
return append([]string(nil), typed...)
default:
return value
}
}
func encoderErrorf(format string, args ...any) error {
return fmt.Errorf("json output encoder: "+format, args...)
}