Strip underscore-prefixed keys from logging redaction - #641
Merged
Conversation
Segmented-national children carry _emit_microdata, and the observability wrapper splats redact_params_for_logging(params) into operation() as attribute keys. The backend rejects keys starting with '_', so every child crashed before running (Fixes #640 — the post-#637 deploy failure). redact_params_for_logging now drops all underscore-prefixed keys (internal control/routing flags, never loggable), not just the hardcoded _telemetry/_metadata; correlation ids are still surfaced explicitly. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #640
What
redact_params_for_loggingnow drops all underscore-prefixed keys, not just the hardcoded_telemetry/_metadata. Correlation ids are still surfaced explicitly.Why
Merging #637 turned segmented national on, and the deploy failed at beta integration: every segmented-national child (
run_simulation_segment) crashed before running any simulation, in its observability wrapper —Child payloads carry
_emit_microdata: True(required — it drives the child's microdata emission for the reduce).run_simulation_segmentsplatsredact_params_for_logging(params)intooperation(..., **redacted_params);_emit_microdatasurvived redaction and reached the observability backend as an attribute key, which the backend rejects. The parent (run_simulation) never carries_emit_microdata, so only the children crashed — the fan-out mechanics and fail-fast otherwise worked. Prod was gated (skipped) and is unaffected; main's deploy pipeline is red until this lands.#637's staging validation (C7) missed it because the throwaway benchmark's
run_simulation_segmentcalledrun_simulation_impldirectly with no observability wrapper — the exact wrapper that fails.Fix scope
One rule in
logging_redaction.py(not key.startswith("_")) covers all three splat sites (run_simulation,run_simulation_segment,run_budget_window_batch), and future-proofs any new internal_-key.redacted_paramsfeeds only observability attributes — nothing functional depends on it; the real params reachrun_simulation_impluntouched.Tests
test_app_redaction.py: new regression asserting no_-prefixed key survives redaction while routing context +run_idare preserved (4 pass).🤖 Generated with Claude Code