[#7] Tests de caractérisation de LogLevel avant renommage #26
All Vouch review confidence checks passed
Residual risk 0.18 = Change Risk (0.45) × (1 − Review Confidence (0.60)).
Review depth and reviewer attention state are adequate.
Model 1 · Change Risk (XGBoost)
Score: 0.45 · 434 lines diff across 5 files
Model 2 · Review Depth (DistilBERT)
Depth Score: 0.17 · 1 substantive comment(s)
Model 3 · Review Timing & Attention
Session adequacy: 100% · Reviewer familiarity: 35%
Bedrock Claude 3 · Risk Narration
(disconnected)
Groq Risk Narration
AWS Bedrock is currently disconnected. Generate high-confidence PR triage narration on-demand using Groq.
Model 1 · Change Risk Attribution
SHAP Weights
Diff Size
diff_size
0.363
Shallow Review Depth
shallow_review_depth
0.289
Real PR Conversation Timeline
1 comments
"Review active on #26"
general
weight: 0.35
AM-L
Summary
tests/spec/LogLevelSpec.cpp, registered intests/CMakeLists.txt, pinsmddlog::LogLevel's current, observable behavior before #16 renames its enumerators (TRACE...AUDIT→Trace...Audit), so that PR can be verified as an identifier-only change: these same scenarios should pass after the rename with only theLogLevel::spellings in this file changing.Closes #15.
Nine new scenarios, grouped by the ticket's checklist
std::uint8_t) and relative order, viastd::to_underlyingand direct comparison - the basis every min-level filter relies on.toString()for all seven levels + the"UNKNOWN"fallback for an out-of-range value;fromString()for all seven canonical strings + theINFOfallback for an unrecognized (or empty) string; thetoString()/fromString()round trip.getColorCode()for all seven levels (checked against the documented ANSI sequences and for mutual distinctness) + the reset fallback for an out-of-range value, andgetResetColorCode().isComplianceLevel()'s threshold atWARN.log()(notlogAudit(), whose bypass policy is already covered inAuditPolicySpec.cpp) - complementsFilteringSpec.cpp's single-threshold coverage.ConsoleSink's actual stdout/stderr routing (captured by redirectingstd::cout/std::cerrper level via a small RAII helper,StdStreamCapture, that restores both streams unconditionally) and its formatted output rendering the level in uppercase ("[INFO]").Two things found while writing these, recorded rather than fixed
A characterization test pins current behavior, it doesn't correct it:
ConsoleSink's stderr-routing condition islevel >= ERROR, which also coversAUDIT(the highest level) - not just "ERROR and FATAL" as its constructor's doc comment says. The scenario asserts the actual condition and documents the discrepancy in itsThen()description.ConsoleSink's own default minimum level isINFO(Sink(core::LogLevel::INFO)in its constructor), soTRACE/DEBUGare silently dropped byshouldLog()before reaching either stream. Fixed by explicitly lowering the sink's minimum level toTRACEin that scenario, to isolate stdout/stderr routing from that separately-characterized filtering behavior.Verification
-
ninja-gcc(gcc 16.1.0): 37/37 pass.-
ninja-clang(Clang 21.1.8): 38/38 pass (this preset also runsbuild.cache.namedModuleIntegrity).- All nine new scenarios register as individual CTest entries via
cmake/MddlogTestDiscovery.cmake.clang-tidy --checks='-,readability-identifier-naming'reports no warnings on the new file.clang-format-21; idempotent (--dry-run --Werrorclean on a second pass).Test plan
cmake --preset ninja-gcc/ninja-clang+ctest: build and full suite pass on both, including 9 new scenarios.ctest -N).clang-tidy --checks='-*,readability-identifier-naming'clean on the new file.clang-format-21 --dry-run --Werror: idempotent.