Skip to content

450#457

Merged
RAprogramm merged 2 commits into
mainfrom
450
Jul 5, 2026
Merged

450#457
RAprogramm merged 2 commits into
mainfrom
450

Conversation

@RAprogramm

Copy link
Copy Markdown
Owner

Closes #450

Wires DisplayMode into Display for Error — error output now adapts to the deployment environment, as the README originally promised.

Behavior

Mode Selected by Output
Prod MASTERROR_ENV=prod / k8s / release build compact JSON, no ANSI
Staging MASTERROR_ENV=staging JSON + source_chain, no ANSI
Local MASTERROR_ENV=local / debug build multi-line report; colored styles this layout only

Mode is detected once per process and cached; MASTERROR_ENV=local is the escape hatch for in-cluster CLI tools; without std the mode falls back to build profile.

Redaction fixes (security-relevant)

  • Prod/Staging JSON previously printed Hash and Last4 fields raw — now sha256 hex / masked (field omitted when masking yields nothing)
  • Redact fields render as a [REDACTED] placeholder (consistent with ProblemJson) instead of being silently omitted
  • Local layout now honors field redaction and MessageEditPolicy::Redact (previously printed everything raw)
  • Sanitizers extracted into a shared pub(crate) redaction module used by both Display and ProblemJson — one source of truth

Breaking (0.x behavior change, targeted at 0.29.0)

Default (non-colored) Display output changes from a one-line kind label to the mode-appropriate layout. The stable short form remains error.kind's Display. Log-parsing consumers should pin MASTERROR_ENV.

Tests

Per-mode dispatch tests via a test-only RAII mode override (no env mutation in-process; a dedicated single-test integration binary exercises the real MASTERROR_ENV path), full redaction matrix per layout, strengthened caching test. Rebased over #451's StoredSource storage and re-verified: 1451+ tests, doctests, no_std build, clippy zero warnings, nightly fmt, readme_sync — all green.

@codecov

codecov Bot commented Jul 5, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 98.75931% with 5 lines in your changes missing coverage. Please review.

Files with missing lines Patch % Lines
src/app_error/redaction.rs 97.83% 4 Missing ⚠️
src/app_error/core/display.rs 99.52% 1 Missing ⚠️

📢 Thoughts on this report? Let us know!

@RAprogramm RAprogramm merged commit 1027ccb into main Jul 5, 2026
29 checks passed
@RAprogramm RAprogramm deleted the 450 branch July 5, 2026 07:05
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.

Wire DisplayMode into Display for Error or drop the dead formatting paths

1 participant