Skip to content

fix(redactions): apply sorted_redaction after other redactions#907

Open
leno23 wants to merge 1 commit into
mitsuhiko:masterfrom
leno23:fix/sorted-redaction-order-683
Open

fix(redactions): apply sorted_redaction after other redactions#907
leno23 wants to merge 1 commit into
mitsuhiko:masterfrom
leno23:fix/sorted-redaction-order-683

Conversation

@leno23
Copy link
Copy Markdown

@leno23 leno23 commented May 17, 2026

Summary

Fixes #683.

sorted_redaction() is now applied in a second pass after all other redactions, so snapshot output no longer depends on the order entries appear in the redaction map.

Changes

  • Add Redaction::Sort variant used by sorted_redaction()
  • Redactions::apply_to_content runs non-sort redactions first, then sort redactions
  • Document that sort redaction order in the map is irrelevant

Test plan

  • cargo test -p insta --lib --features redactions,json sort_redaction_order
  • cargo test -p insta --test test_redaction --features redactions,json,yaml
  • CI

Sort redactions now run in a second pass so value replacements (e.g.
`[].a => "[redacted]"`) are applied before sorting. Fixes mitsuhiko#683.

Co-authored-by: Cursor <cursoragent@cursor.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.

Redaction order seems to matter when using sorted_redaction

1 participant