Skip to content

feat(mint): capture closed-vocabulary server 5xx diagnostics - #1666

Merged
overtrue merged 1 commit into
mainfrom
p8/1083-mint-sut-5xx-diagnostics
Nov 27, 2026
Merged

overtrue merged 1 commit into
mainfrom
p8/1083-mint-sut-5xx-diagnostics

Conversation

@overtrue

@overtrue overtrue commented Nov 27, 2026 •

Copy link
Copy Markdown
Collaborator

Summary

Adds runner-local server-side 5xx diagnostic capture for MinIO mint runs so intermittent server errors (such as aws-sdk-java-v2 S3Client.putObject versions:S3Exception/500/- tracked in #1083) can be attributed directly from uploaded aggregate reports without carrying raw log text, request identifiers, host paths, or secrets off the runner.

Context & Audit of #1083

Changes

  • crates/fs: Add process-wide set_storage_error_observer(fn(&'static core::panic::Location<'static>)) -> bool and #[track_caller] storage_error() / storage_error_with(...), and change require_directory to accept a lazy impl FnOnce() -> HandlerError so healthy CRUD operations never invoke storage_error(). Add unit tests (src/storage_error_tests.rs) and a self-exec isolated child-process integration test (tests/crud/storage_error_observer.rs, keeping crates/fs at 1 linked test target).
  • compat/sut: Wire ServerErrorObserver into build_service (recording unexpected status >= 500 && status != 501 with closed-vocabulary method [nine standard methods + OTHER], operation, status, code, deadline, and server-minted request_id; never logging identities, headers, keys, or paths) and register record_fs_storage_error in logging::install() with host-prefix stripping (normalize_fs_location). rustfs_profile_tests posture golden remains byte-identical.
  • ci/mint: Redact GATEWAY_SUT_LOG in place and pass --sut-log "$GATEWAY_SUT_LOG" to ci/mint/report.py judge when present; extract_server_errors extracts only the three strict closed-vocabulary ERROR grammars (compat_sut_server_error, compat_sut_fs_storage_error, gateway_extension_panicked 500), drops request_id, deduplicates preserving order with (xN) capped at 50, writes server_errors to report.json and ### Server 5xx diagnostics to summary.md only when non-empty, and exits 3 if an explicit --sut-log is missing or unreadable. ci/mint/baseline.txt is unchanged.
  • Tests & guards: Add 5 probes to scripts/check_mint_report.sh (117 -> 122), unit & runner tests in scripts/test_mint_report_execution.py and scripts/test_mint_local_image.py, and 3 guard mutations in scripts/test_guard_scripts.sh.

Refs #1083

Why #1083 stays open: No e2e-mint.yml run has executed yet on post-#1659 / post-merge commits. Keeping #1083 open preserves honest measurement; if aws-sdk-java-v2 S3Client.putObject 500 recurs on a subsequent run, the new server_errors entries in report.json / summary.md will pinpoint the exact method/operation/status/code and crates/fs/src/<file>:<line> or contained panic.

Mutation Proofs

Every new assertion was mutated, confirmed red, and restored byte-identically:

  • M1_drop_track_caller: removed #[track_caller] on crates/fs/src/lib.rs::storage_error_with -> storage_error_tests::a_storage_error_with_reports_its_call_site failed (rc=101).
  • M2_eager_storage_error: eagerly constructed storage_error() in require_bucket -> isolated self-exec storage_error_observer::set_storage_error_observer_installs_once_and_fires_only_on_failure failed (healthy operations must not notify storage_error observer, rc=101).
  • M3_log_501_not_implemented: dropped status == 501 exclusion in compat/sut/src/logging.rs::emit_server_error -> n_healthy_4xx_and_501_answers_emit_no_server_error_event failed (rc=101).
  • M4_detach_observer_from_build_service: removed .observer(crate::logging::ServerErrorObserver) in compat/sut/src/service.rs -> a_backend_500_through_build_service_is_observed_without_secrets failed (rc=101).
  • M5_leak_host_prefix: returned unstripped path in compat/sut/src/logging.rs::normalize_fs_location -> n_normalize_fs_location_strips_host_prefix_and_rejects_foreign_paths failed (rc=101).
  • M6_drop_sut_log_flag_in_run_sh: removed --sut-log forwarding in ci/mint/run.sh -> test_mint_local_image.py::test_sut_log_is_redacted_and_summarized_when_present failed (rc=1).
  • M7a_drop_server_errors_in_report_py: hardcoded server_errors = [] in ci/mint/report.py -> scripts/check_mint_report.sh failed (rc=1).
  • M7b_leak_sut_log_text_in_report_py: passed unmatched SUT log lines through extract_server_errors -> scripts/check_mint_report.sh failed (must not appear in the output, rc=1).
  • M7c_ignore_missing_sut_log_in_report_py: returned [] on missing --sut-log instead of raising EXIT_ENVIRONMENT -> scripts/check_mint_report.sh failed (rc=1).

Verification

  • cargo fmt --all --check: pass
  • cargo clippy --workspace --all-targets -- -D warnings: pass (28.98s)
  • cargo test --workspace: pass across all crates (0 failures; rustfs-gateway-fs 137 lib + 519 crud, rustfs-gateway-compat-sut 472 bin + 7 binary including rustfs_profile_tests, rustfs-gateway-conformance 1168 lib + 140 integration + 1 list_allocations)
  • cargo xtask verify --crate rustfs-gateway-compat-sut: pass (prebuild 31.55s, loop 13.59s <= 30s)
  • cargo xtask verify --crate rustfs-gateway-fs: prebuild 30.29s (12 crates); loop hit the 30s deadline on macOS APFS fsync across pre-existing 517 tests/crud.rs cases while direct cargo test -p rustfs-gateway-fs passed all 656 tests (lib 4.12s, tests/crud.rs ~32s on macOS APFS; reported honestly rather than counted as a pass)
  • RUSTDOCFLAGS="-D warnings" cargo doc --workspace --no-deps: pass (41.56s)
  • python3 -m unittest scripts/test_mint_report_execution.py scripts/test_mint_local_image.py: 43/43 pass (28.09s)
  • Static guards (145/145, including check_test_target_coverage.sh, check_protected_files.sh, check_mint_report.sh 122 probes, check_mint_baseline.sh, check_sut_launcher.sh, check_secret_hygiene.sh), bash -n scripts/test_guard_scripts.sh, shellcheck -x -P scripts ci/mint/run.sh scripts/check_mint_report.sh: all pass.

No CI jobs were added; PR gate wall-clock budget impact is neutral.

Role Verdicts

  • simplicity-adversary: attacked FsBackend storage_error observer hook, isolated crud self-exec observer test, ServerErrorObserver closed-vocabulary formatting, ci/mint/run.sh redaction/flag plumbing, and ci/mint/report.py extract_server_errors grammar for unnecessary complexity or secret leakage — no break found

Add runner-local server 5xx diagnostic capture for MinIO mint runs so intermittent server errors (such as aws-sdk-java-v2 putObject 500s in #1083) can be attributed without carrying raw log text, request identifiers, host paths, or secrets off the runner.

- crates/fs: add process-wide set_storage_error_observer hook reporting only static #[track_caller] source locations, and make require_directory missing-error construction lazy so healthy operations never trigger storage_error().
- compat/sut: wire ServerErrorObserver into build_service (logging unexpected 5xx excluding 501 NotImplemented with closed-vocabulary method/operation/status/code/deadline plus server-minted request_id) and register record_fs_storage_error in logging::install() with host-prefix stripping.
- ci/mint: redact GATEWAY_SUT_LOG in place and pass --sut-log to report.py judge; extract only closed-vocabulary 5xx summaries into report.json (server_errors) and summary.md (### Server 5xx diagnostics when non-empty), exiting 3 if an explicit --sut-log is missing.
- tests & guards: add unit, integration, Mint runner/report probes, and guard mutation coverage.
@overtrue
overtrue merged commit 6c1c829 into main Nov 27, 2026
34 checks passed
@overtrue
overtrue deleted the p8/1083-mint-sut-5xx-diagnostics branch November 27, 2026 14:28
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