Skip to content

persist-types: apply redaction in stats debug_json rendering#37462

Draft
jasonhernandez wants to merge 1 commit into
MaterializeInc:mainfrom
jasonhernandez:jason/stats-debug-json-redaction
Draft

persist-types: apply redaction in stats debug_json rendering#37462
jasonhernandez wants to merge 1 commit into
MaterializeInc:mainfrom
jasonhernandez:jason/stats-debug-json-redaction

Conversation

@jasonhernandez

Copy link
Copy Markdown
Contributor

Summary

PrimitiveStats already redacts its lower/upper bounds in its Debug impl via mz_ore::str::redact. The aggregate stats types (StructStats, PartStats, OptionStats, ColumnarStats) render Debug through debug_json, which did not apply the same masking, so the redaction behavior depended on which type the formatting started from.

This routes the debug_json leaf renderings (PrimitiveStats<T>, PrimitiveStats<Vec<u8>>, AtomicBytesStats, FixedSizeBytesStats) through the identical masking, keeping Debug output consistent across the stats hierarchy. As with redact, the masking is a no-op when soft assertions are enabled, so dev and test output is unchanged. Non-value fields (kind, len, column names, null counts) are left as is, mirroring the existing Debug impls.

The redact character mapping is now exposed as mz_ore::str::redact_char so both renderers share one definition.

debug_json has no consumers outside the Debug/Serialize rendering paths and tests, so no behavior change beyond the debug formatting.

Internal tracking: SEC-618

Test plan

  • New unit test for the JSON masking in mz-persist-types
  • cargo test -p mz-persist-types -p mz-ore passes
  • cargo clippy -p mz-persist-types -p mz-ore --all-targets clean

🤖 Generated with Claude Code

PrimitiveStats redacts lower/upper bounds in its Debug impl, but the
aggregate stats types (StructStats, PartStats, OptionStats,
ColumnarStats) render Debug through debug_json, which did not apply the
same masking. Route the debug_json leaves through the identical
redaction, a no-op when soft assertions are enabled, so Debug output is
consistently redacted regardless of which stats type it starts from.

Exposes the redact character mapping from mz_ore::str so both renderers
share one definition.

SEC-618

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant