← Back to Pull requests

Uniformiser la lecture des atomiques dans Sink : .load()/.store() explicites #25

Closed
unknown closed this pull request without merging on Sep 23, 2026 08:46 UTC
View on GitHub
unknown unknown commented on Sep 23, 2026 08:35 UTC
Author

Summary


  • Sink (include/mddlog/sinks/Sink.cppm) stored minLevel/enabled as std::atomic but accessed them through the implicit conversion / operator= in shouldLog(), getMinLevel(), isEnabled(), setMinLevel(), setEnabled(), while core::SimpleLogger's equivalent members already went through explicit .load()/.store().

  • Switched all five to the explicit form.
  • Closes #22.

    One correction to the ticket's own audit


    #22 said Logger's writes were "plain assignment in both classes, only the reads differ" - that turned out to be wrong once I actually checked: SimpleLogger::setEnabled/setMinLevel already use .store(), not =. Since the ticket's stated goal is to align Sink with Logger's actual convention, I fixed the two writes in Sink as well (setMinLevel, setEnabled), not just the three reads originally listed. Same reasoning as the reads: behaviorally identical, but the explicit call makes the atomic access visible at the call site.

    Verification


  • Checked every other std::atomic under include/: Logger's own members, and LogStatistics's five counters in LogRecord.cppm (used from Sink.cppm, RecordingSink.hpp, SinkFailureSpec.cpp, basic_usage.cpp) all already go through .load()/.store()/.fetch_add()/.exchange(). Sink.cppm's minLevel/enabled were the only gap.

  • Documented the convention in CONTRIBUTING.md (new "Atomics" subsection).

  • Full configure/build/ctest cycle on ninja-gcc (gcc 16.1.0): build succeeds, 28/28 SpecLab scenarios pass, unchanged expectations.

  • Reformatted with clang-format-21; idempotent (--dry-run --Werror clean on a second pass).
  • Test plan


  • git grep finds no remaining implicit-conversion read of a std::atomic<...> member under include/.

  • cmake --preset ninja-gcc / ctest --preset ninja-gcc --output-on-failure: build succeeds, 28/28 pass.

  • clang-format-21 --dry-run --Werror: idempotent.
  • <!-- This is an auto-generated comment: release notes by coderabbit.ai -->

    Summary by CodeRabbit

    Documentation
    Added contributor guidance recommending explicit atomic operations when reading or updating atomic values, making these accesses clearer in code.
    Maintenance
    Updated logging settings to use explicit atomic reads and writes. Logging behavior remains unchanged.

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

    Diff: 302 lines (+226 / -76) across 3 files Reviewer: ambroise-leclerc Review duration: 10m
    All Vouch review confidence checks passed
    Residual risk 0.16 = Change Risk (0.40) × (1 − Review Confidence (0.60)). Review depth and reviewer attention state are adequate.
    Model 1 · Change Risk (XGBoost)
    Score: 0.40 · 302 lines diff across 3 files
    0.40
    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.342
    Shallow Review Depth shallow_review_depth
    0.289
    Real PR Conversation Timeline
    1 comments
    "Review active on #25"
    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: 40.1% (MEDIUM) · Higher = larger blast radius
    40.1%
    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: 15.8% · Safe to merge
    15.8%