← Back to Pull requests

Capture WebFront diagnostic context at emission [#70] #80

Closed
unknown closed this pull request without merging on Oct 01, 2026 15:03 UTC
View on GitHub
unknown unknown commented on Oct 01, 2026 12:53 UTC
Author

Summary

Capture WebFront's connection and call context explicitly at emission through a nestable, thread-local ContextScope. Each producer binds its structured writer to its own SPSC ring, which owns the fields before connection teardown. TransportConsumer and RingSinkAdapter preserve the context for every diagnostic destination.

Encode component directly, WebLinkId in correlationId, and direction plus CallId in operationId (cpp-js: / js-cpp:). Refuse identifiers beyond the 32/32/40-byte envelope and preserve UTF-8 message truncation. tryWrite() returns structured admission results; legacy void calls expose them through lastWriteOutcome(). Diagnostic snapshots remain copy- and move-assignable.

infoHex() captures the caller's source location for both message and dump and returns HexWriteOutcome with separate admission/truncation results. The structured dump remains bounded to 160 bytes, with explicit truncation flags. The summary retains truncation from either admitted record and the first refusal. Enabled legacy text callbacks receive complete diagnostics even when structured admission is refused, including when only the hex message fits in the ring. Existing call syntax, debug caller locations, callback handles and portable ASCII dump rendering are preserved.

Document outside-call context, counter reuse and the additional discriminator needed for longer-lived correlation, asynchronous entry points, ring ownership, partial dump admission, writer exception/cleanup contracts and transport feedback suppression. This remains a test-only WebFront adoption reference; formatting and binding may allocate. ADR-003 remains Proposed and audit admission stays separate.

Closes #70.

Verification

  • Clang 21.1.8 / libc++ and GCC 16.1.0 builds with examples and tests enabled.

  • Full Clang CTest suite: 117/117 passed, including source/install governed-core consumers and the original pinned WebFront LoggerTests.cpp.

  • Focused WebFront/TextLogger regressions: 9/9 passed on both compilers.

  • Scenarios cover all seven ADR-003 Decision 6 events, connection teardown before drain, two transports, field limits, refusal ordering, UTF-8 truncation, saturation, nested/outside-call scopes, thread isolation, all legacy severities and hex records.

  • New hex regressions verify both records' caller file/line, explicit truncation of a four-row dump with complete legacy output, preservation of message truncation when the dump fits, partial/full-ring admission, independent text delivery and disabled-call filtering.

  • clang-format 21 repository check: passed. clang-tidy 21: changed bridge and spec translation units passed explicit analysis. The earlier repository analysis also verified the unchanged units.

  • GitHub matrix checks will revalidate the latest commit.
  • <!-- This is an auto-generated comment: release notes by coderabbit.ai -->

    Summary by CodeRabbit

    New Features
    Added WebFront logging support for scoped context, structured diagnostic records, and write outcomes. Logs can include component and call information, with oversized identifiers and truncated messages reported explicitly.
    Added support for routing diagnostic records to a configured writer while retaining legacy text logging behavior.
    Documentation
    Added guidance on context scopes, record delivery, ring constraints, and logging behavior. The reference implementation does not use WebFront in production; ADR-003 remains proposed.
    Tests
    * Added coverage for context capture, nested scopes, limits, delivery, and thread isolation.

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

    Diff: 458 lines (+343 / -115) across 5 files Reviewer: AM-L Review duration: 130m
    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 #80"
    general weight: 0.35
    Reviewers
    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%