← Back to Pull requests

[#7] Analyse clang-tidy reproductible en CI et couverture des modules documentée #30

Closed
unknown closed this pull request without merging on Sep 23, 2026 18:09 UTC
View on GitHub
unknown unknown commented on Sep 23, 2026 15:57 UTC
Author

Summary


  • scripts/run-clang-tidy.sh: single entry point, local and CI. Requires clang-tidy major 21 (checked at run time, version logged), a configured and built Clang preset (named-module BMIs are mandatory), and a compile_commands.json entry for every file in scope. Findings are promoted to errors; any tool failure, empty scope or unanalysed file fails. Nothing is reported green unless it ran.

  • Report (version, units analysed vs expected, .cppm units covered, clang-diagnostic-error count) goes to the log and GITHUB_STEP_SUMMARY.

  • clang-build.yml installs clang-tidy-21 and runs it after Build in the job that already has the Clang 21 build.

  • Scope: include/mddlog/*/.cppm, tests/spec/.cpp, examples/.cpp; tests/framework/.hpp is analysed through the specs that include it.

  • The command, version, scope and module limitations are documented: the text is supplied to #17 / PR #28, which owns the CONTRIBUTING.md rewrite (merge #28, #29 and this PR together).
  • Closes #19.

    Measured coverage


    First full run, clang-tidy 21.1.8 (Ubuntu 21.1.8-6ubuntu1, same build as clang++-21): clang-diagnostic-error: 0 — named modules analyse fine against the matching Clang preset — and 77 unique findings (427 raw diagnostics, mostly RecordingSink.hpp repeated per including spec). After this PR: 18/18 translation units clean, .cppm interface units 7/7.
    Limitation (also rejected up front by the script): a GCC compile_commands.json, or a clang-tidy of another LLVM major, cannot read the Clang BMIs (module 'std' not found, "built from a different branch").

    Findings: fixed or justified (no blanket disables)


  • Fixed: lock_guard → scoped_lock (24); [[nodiscard]] ×3; std::erase_if; LogRecord::level gets a default member initializer (the defaulted ctor left it uninitialised — a real latent bug); special-member declarations on LogStatistics/Log/ConsoleSink/StdStreamCapture; named constant for ConsoleSink's byte estimate; include guard instead of #pragma once in RecordingSink.hpp; reserve before thread loops; DeliverySpec uses std::from_chars instead of sscanf and widens before multiplying.

  • Targeted NOLINT(check): reason: exported using declarations in mddlog.cppm (they are the API); the intentionally empty flush catch; main() in examples/SpecMain; the deliberately out-of-range LogLevel cast in LogLevelSpec.cpp.

  • Documented exclusion: tests/.clang-tidy and examples/.clang-tidy (InheritParentConfig) turn off only the two magic-number checks (scenario data are literals); include/ keeps them.
  • Test plan


  • clang-tidy 21.1.8: 18/18 units clean, 0 clang-diagnostic-error.

  • Guard rails: no clang-tidy-21 → error; clang-tidy 20 → "expected 21"; the run failed with 17/18 units before the fixes (findings promoted to errors).

  • ninja-gcc 37/37, ninja-clang 38/38; clang-format-21 clean.

  • Linux Clang Build workflow green on this PR (first CI run with the new step).
  • <!-- This is an auto-generated comment: release notes by coderabbit.ai -->

    Summary by CodeRabbit

    Developer Improvements
    Log records now default to the Info level, and the compiler can warn when certain query results are ignored.
    Console sinks can no longer be copied or moved, helping prevent unintended duplication.
    Quality Checks
    The Linux Clang build now includes an additional static analysis check covering library, test, and example code.
    * Test message parsing now validates numeric fields more strictly.

    <!-- end of auto-generated comment: release notes by coderabbit.ai -->

    Diff: 458 lines (+343 / -115) across 5 files Reviewer: ambroise-leclerc Review duration: 131m
    All Vouch review confidence checks passed
    Residual risk 0.18 = Change Risk (0.46) × (1 − Review Confidence (0.60)). Review depth and reviewer attention state are adequate.
    Model 1 · Change Risk (XGBoost)
    Score: 0.46 · 458 lines diff across 5 files
    0.46
    Model 2 · Review Depth (DistilBERT)
    Depth Score: 0.17 · 1 substantive comment(s)
    0.17
    Model 3 · Review Timing & Attention
    Session adequacy: 100% · Reviewer familiarity: 35%
    60%
    Bedrock Claude 3 · Risk Narration
    (disconnected)
    Groq
    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.367
    Shallow Review Depth shallow_review_depth
    0.289
    Real PR Conversation Timeline
    1 comments
    "Review active on #30"
    general weight: 0.35
    Assignees
    Unassigned
    Labels
    risk: low confidence: 60.5% reviewed
    Vouch Risk Breakdown
    AI-powered review risk analysis
    Change Risk
    Change Risk · Model 1 (XGBoost)
    Predicted defect probability (0.00–1.00) based on diff churn, modified sensitive files, and author risk history.
    Score: 45.5% (MEDIUM) · Higher = larger blast radius
    45.5%
    Review Confidence
    Review Confidence · Models 2 & 3
    Scrutiny score (0.00–1.00) combining DistilBERT semantic review depth with reviewer familiarity and session dwell time.
    Score: 60.5% · Lower = rushed or shallow review
    60.5%
    Residual Risk
    Residual Risk · Core Equation
    Residual = Change × (1 − Confidence)
    Unmitigated risk surviving review. ≥ 0.65 triggers an automated re-queue to protect production.
    Score: 18.0% · Safe to merge
    18.0%