← Back to Pull requests

perf(regexp): hoist constant MustCompile calls on hot paths to package level #57299

Open
louis-cqrl opened this pull request with 65 lines diff across 9 files
View on GitHub
louis-cqrl louis-cqrl commented on Oct 01, 2026 13:17 UTC
Author

What does this PR do?


Hoists constant-pattern regexp.MustCompile / regexp.MustCompilePOSIX calls to package-level vars — but only on hot paths: functions that run many times or compile inside loops. 13 hoists across 9 files.

Motivation


Compiling a constant regexp on every call wastes CPU on hot paths. An earlier revision of this PR hoisted all ~111 such sites repo-wide, but reviewers noted that hoisting in once-run functions forces unconditional package-init compilation even when the feature is disabled, for no runtime benefit. This revision keeps only the genuinely hot-path hoists and reverts the once-run ones.

Describe how you validated your changes


  • dda inv test --targets=./pkg/config/utils/ — 88 tests pass

  • gofmt clean on all touched files

  • CI lint + ebpf gates green
  • Additional Notes


    Companion linter PR #57310 adds a loop-scoped regexphoist rule to guard against future in-loop constant compiles.

    Diff: 65 lines (+37 / -28) across 9 files Reviewer: ichinaski Review duration: 76833m
    All Vouch review confidence checks passed
    Residual risk 0.12 = Change Risk (0.47) × (1 − Review Confidence (0.75)). Review depth and reviewer attention state are adequate.
    Model 1 · Change Risk (XGBoost)
    Score: 0.47 · 65 lines diff across 9 files
    0.47
    Model 2 · Review Depth (DistilBERT)
    Depth Score: 0.64 · 5 substantive comment(s)
    0.64
    Model 3 · Review Timing & Attention
    Session adequacy: 100% · Reviewer familiarity: 50%
    75%
    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.251
    Real PR Conversation Timeline
    25 items
    github-actions[bot] github-actions[bot] commented on Oct 01, 2026 13:20 UTC
    Reviewer

    AI review by Codex (OpenAI) - workflow run

    patch is correct. The regexp patterns and compilation modes are preserved, and the shared compiled expressions are used safely. No actionable regressions found. Validation was limited to static review; tests were not run.

    dd-octo-sts[bot] dd-octo-sts[bot] commented on Oct 01, 2026 13:30 UTC
    Bot

    Benchmarks

    Benchmark execution time: 2026-10-02 08:44:46

    Comparing candidate commit 67872e8c727de1475760d32f8e6b7bae642ead19 in PR branch louis-cqrl/regexp-hoist-prod with baseline commit 5421b65ebfa64e03993af8ded783766380e36e6e in branch main.

    📊 Benchmarking dashboard

    Found 0 performance improvements and 0 performance regressions! Performance is the same for 3 metrics, 0 unstable metrics.

    <details>
    <summary><h3>Explanation</h3></summary>

    This is an A/B test comparing a candidate commit's performance against that of a baseline commit. Performance changes are noted in the tables below as:

    🟩 = significantly better candidate vs. baseline
    🟥 = significantly worse candidate vs. baseline

    We compute a confidence interval (CI) over the relative difference of means between metrics from the candidate and baseline commits, considering the baseline as the reference.

    If the CI is entirely outside the configured SIGNIFICANT_IMPACT_THRESHOLD (or the deprecated UNCONFIDENCE_THRESHOLD), the change is considered significant.

    Feel free to reach out to #apm-benchmarking-platform on Slack if you have any questions.

    <details>
    <summary><h4>More details about the CI and significant changes</h4></summary>

    You can imagine this CI as a range of values that is likely to contain the true difference of means between the candidate and baseline commits.

    CIs of the difference of means are often centered around 0%, because often changes are not that big:

    ---------------------------------(------|---^--------)-------------------------------->
                                  -0.6%    0%  0.3%     +1.2%
                                     |          |        |
             lower bound of the CI --'          |        |
    sample mean (center of the CI) -------------'        |
             upper bound of the CI ----------------------'
    

    As described above, a change is considered significant if the CI is entirely outside the configured SIGNIFICANT_IMPACT_THRESHOLD (or the deprecated UNCONFIDENCE_THRESHOLD).

    For instance, for an execution time metric, this confidence interval indicates a significantly worse performance:

    ----------------------------------------|---------|---(---------^---------)---------->
                                           0%        1%  1.3%      2.2%      3.1%
                                                      |   |         |         |
           significant impact threshold --------------'   |         |         |
                          lower bound of CI --------------'         |         |
           sample mean (center of the CI) --------------------------'         |
                          upper bound of CI ----------------------------------'
    

    </details>

    </details>

    datadog-prod-us1-6[bot] datadog-prod-us1-6[bot] commented on Oct 01, 2026 13:40 UTC
    Bot

    🎯 Code Coverage (<a target='_blank' href='https://app.datadoghq.com/ci/code-coverage/github.com%2Fdatadog%2Fdatadog-agent/pull-requests/57299'>details</a>)<br>• <strong><span title="Percentage of modified executable lines covered by tests in this PR">Patch Coverage</span></strong>: 62.50%<br>• <strong><span title="Percentage of all executable lines covered by tests in the entire codebase">Overall Coverage</span></strong>: 56.99% <span title="Change in overall coverage compared to the base branch">(-1.54%)</span><br>

    <sub>
    This comment will be updated automatically if new data arrives. <br />
    🔗 Commit SHA: 420c8d7 | <a href="https://docs.datadoghq.com/integrations/guide/source-code-integration/#pr-comments">Docs</a> | Give us <a href="https://dd.enterprise.slack.com/archives/C07E3U2QRMM">feedback</a>!
    </sub>

    dd-octo-sts[bot] dd-octo-sts[bot] commented on Oct 01, 2026 13:53 UTC
    Bot

    Files inventory check summary

    File checks results against ancestor 3061e3e9:

    Results for datadog-agent_7.85.0~devel.git.715.420c8d7.pipeline.142657881-1_amd64.deb:


    No change detected

    Results for datadog-iot-agent_7.85.0~devel.git.715.420c8d7.pipeline.142657881-1_amd64.deb:


    No change detected

    dd-octo-sts[bot] dd-octo-sts[bot] commented on Oct 01, 2026 14:04 UTC
    Bot

    Static quality checks

    ✅ Please find below the results from static quality gates
    Comparison made with ancestor 3061e3e9ed1bfeb4df9819ca317d793178aae42f
    📊 Static Quality Gates Dashboard
    🔗 SQG Job
    SOME SIZE DELTAS ARE N/A (ANCESTOR METRICS NOT YET AVAILABLE). RETRY JOB

    <details open>
    <summary>Successful checks</summary>

    Info

    ||Quality gate|Change|Size (prev → curr → max)|
    |--|--|--|--|
    |✅|agent_deb_amd64|N/A|N/A → 782.913 → 785.980|
    |✅|agent_deb_amd64_fips|N/A|N/A → 717.283 → 719.210|
    |✅|agent_heroku_amd64|N/A|N/A → 317.613 → 323.180|
    |✅|agent_msi|N/A|N/A → 652.540 → 668.830|
    |✅|agent_rpm_amd64|N/A|N/A → 782.896 → 785.950|
    |✅|agent_rpm_amd64_fips|N/A|N/A → 717.267 → 719.210|
    |✅|agent_rpm_arm64|N/A|N/A → 753.791 → 757.920|
    |✅|agent_rpm_arm64_fips|N/A|N/A → 693.562 → 696.980|
    |✅|agent_suse_amd64|N/A|N/A → 782.896 → 785.950|
    |✅|agent_suse_amd64_fips|N/A|N/A → 717.267 → 719.210|
    |✅|agent_suse_arm64|N/A|N/A → 753.791 → 757.920|
    |✅|agent_suse_arm64_fips|N/A|N/A → 693.562 → 696.980|
    |✅|docker_agent_amd64|N/A|N/A → 839.198 → 843.560|
    |✅|docker_agent_arm64|N/A|N/A → 834.723 → 841.880|
    |✅|docker_agent_jmx_amd64|N/A|N/A → 1030.068 → 1034.470|
    |✅|docker_agent_jmx_arm64|N/A|N/A → 1014.373 → 1021.570|
    |✅|docker_cws_instrumentation_amd64|N/A|N/A → 7.439 → 8.400|
    |✅|docker_cws_instrumentation_arm64|N/A|N/A → 6.877 → 7.110|
    |✅|docker_dogstatsd_amd64|N/A|N/A → 39.414 → 40.440|
    |✅|docker_dogstatsd_arm64|N/A|N/A → 37.503 → 38.580|
    |✅|docker_host_profiler_amd64|N/A|N/A → 308.055 → 319.490|
    |✅|docker_host_profiler_arm64|N/A|N/A → 319.275 → 330.690|
    |✅|dogstatsd_deb_amd64|N/A|N/A → 30.157 → 31.220|
    |✅|dogstatsd_deb_arm64|N/A|N/A → 28.165 → 29.590|
    |✅|dogstatsd_rpm_amd64|N/A|N/A → 30.157 → 31.220|
    |✅|dogstatsd_suse_amd64|N/A|N/A → 30.157 → 31.220|
    |✅|iot_agent_deb_amd64|N/A|N/A → 46.599 → 47.550|
    |✅|iot_agent_deb_arm64|N/A|N/A → 43.220 → 44.220|
    |✅|iot_agent_deb_armhf|N/A|N/A → 44.045 → 45.020|
    |✅|iot_agent_rpm_amd64|N/A|N/A → 46.600 → 47.550|
    |✅|iot_agent_suse_amd64|N/A|N/A → 46.599 → 47.550|
    |✅|docker_cluster_agent_amd64|N/A|N/A → 213.655 → 213.700|
    |✅|docker_cluster_agent_arm64|N/A|N/A → 226.600 → 226.660|

    </details>

    cit-pr-commenter-54b7da[bot] cit-pr-commenter-54b7da[bot] commented on Oct 01, 2026 15:02 UTC
    Bot

    Regression Detector

    Regression Detector Results

    Metrics dashboard
    Target profiles
    Job ID: 66cfd8cd-a786-40b7-a7b4-5ea2e8c8b26f

    Baseline: 3061e3e9ed1bfeb4df9819ca317d793178aae42f
    Comparison: 67872e8c727de1475760d32f8e6b7bae642ead19
    [Diff](3061e3e9ed1bfeb4df9819ca317d793178aae42f...67872e8c727de1475760d32f8e6b7bae642ead19)

    Optimization Goals: ✅ No significant changes detected

    <details>
    <summary><h2>
    Fine details of change detection per experiment
    </h2></summary>

    | perf | experiment | goal | Δ mean % | Δ mean % CI | trials | links |
    |------|---------------------------------------------|--------------------|----------|----------------|--------|-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
    | ➖ | quality_gate_metrics_logs | memory utilization | +1.02 | [+0.79, +1.25] | 1 | Logs bounds checks dashboard |
    | ➖ | dsd_uds_client_drop_detector_cpu | % cpu utilization | +0.24 | [-0.28, +0.76] | 1 | Logs |
    | ➖ | quality_gate_security_mean_fs_load | memory utilization | +0.10 | [+0.06, +0.14] | 1 | Logs bounds checks dashboard |
    | ➖ | quality_gate_security_no_fs_load | memory utilization | +0.06 | [-0.02, +0.13] | 1 | Logs bounds checks dashboard |
    | ➖ | quality_gate_idle_all_features | memory utilization | +0.04 | [-0.02, +0.09] | 1 | Logs bounds checks dashboard |
    | ➖ | quality_gate_security_idle | memory utilization | -0.05 | [-0.09, -0.01] | 1 | Logs bounds checks dashboard |
    | ➖ | quality_gate_idle | memory utilization | -0.08 | [-0.12, -0.04] | 1 | Logs bounds checks dashboard |
    | ➖ | dsd_uds_10mb_3k_timestamped_contexts_cpu | % cpu utilization | -0.15 | [-0.40, +0.09] | 1 | Logs |
    | ➖ | python_openmetrics | % cpu utilization | -0.22 | [-0.89, +0.46] | 1 | Logs bounds checks dashboard |
    | ➖ | quality_gate_private_action_runner | memory utilization | -0.32 | [-0.45, -0.19] | 1 | Logs bounds checks dashboard |
    | ➖ | dsd_uds_10mb_3k_timestamped_contexts_memory | memory utilization | -0.46 | [-0.67, -0.24] | 1 | Logs |
    | ➖ | quality_gate_logs | % cpu utilization | -1.85 | [-2.72, -0.98] | 1 | Logs bounds checks dashboard |
    </details>

    <details>
    <summary><h2>
    Bounds Checks: ✅ Passed
    </h2></summary>

    | perf | experiment | bounds_check_name | replicates_passed | observed_value | links |
    |------|------------------------------------|-----------------------|-------------------|-----------------------|------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
    | ✅ | python_openmetrics | checks_execution_time | 10/10 | 78.15 ≤ 100 | bounds checks dashboard |
    | ✅ | python_openmetrics | cpu_usage | 10/10 | 1341.84 ≤ 1500 | bounds checks dashboard |
    | ✅ | python_openmetrics | memory_usage | 10/10 | 4.35GiB ≤ 4.75GiB | bounds checks dashboard |
    | ✅ | quality_gate_idle | intake_connections | 10/10 | 4 ≤ 5 | bounds checks dashboard |
    | ✅ | quality_gate_idle | memory_usage | 10/10 | 176.06MiB ≤ 181MiB | bounds checks dashboard |
    | ✅ | quality_gate_idle | total_bytes_received | 10/10 | 753.36KiB ≤ 819.20KiB | bounds checks dashboard |
    | ✅ | quality_gate_idle_all_features | intake_connections | 10/10 | 2 ≤ 5 | bounds checks dashboard |
    | ✅ | quality_gate_idle_all_features | memory_usage | 10/10 | 468.33MiB ≤ 542MiB | bounds checks dashboard |
    | ✅ | quality_gate_idle_all_features | total_bytes_received | 10/10 | 1.12MiB ≤ 1.25MiB | bounds checks dashboard |
    | ✅ | quality_gate_logs | intake_connections | 10/10 | 19 ≤ 40 | bounds checks dashboard |
    | ✅ | quality_gate_logs | memory_usage | 10/10 | 213.14MiB ≤ 228MiB | bounds checks dashboard |
    | ✅ | quality_gate_logs | missed_bytes | 10/10 | 0B = 0B | bounds checks dashboard |
    | ✅ | quality_gate_logs | total_bytes_received | 10/10 | 263.48MiB ≤ 292MiB | bounds checks dashboard |
    | ✅ | quality_gate_metrics_logs | cpu_usage | 10/10 | 352.75 ≤ 2000 | bounds checks dashboard |
    | ✅ | quality_gate_metrics_logs | intake_connections | 10/10 | 19 ≤ 40 | bounds checks dashboard |
    | ✅ | quality_gate_metrics_logs | memory_usage | 10/10 | 413.55MiB ≤ 455MiB | bounds checks dashboard |
    | ✅ | quality_gate_metrics_logs | missed_bytes | 10/10 | 0B = 0B | bounds checks dashboard |
    | ✅ | quality_gate_metrics_logs | total_bytes_received | 10/10 | 0.94GiB ≤ 1.04GiB | bounds checks dashboard |
    | ✅ | quality_gate_private_action_runner | memory_usage | 10/10 | 72.59MiB ≤ 75MiB | bounds checks dashboard |
    | ✅ | quality_gate_security_idle | cpu_usage | 10/10 | 28.06 ≤ 100 | bounds checks dashboard |
    | ✅ | quality_gate_security_idle | memory_usage | 10/10 | 327.70MiB ≤ 357MiB | bounds checks dashboard |
    | ✅ | quality_gate_security_mean_fs_load | cpu_usage | 10/10 | 61.35 ≤ 200 | bounds checks dashboard |
    | ✅ | quality_gate_security_mean_fs_load | memory_usage | 10/10 | 303.23MiB ≤ 337MiB | bounds checks dashboard |
    | ✅ | quality_gate_security_no_fs_load | cpu_usage | 10/10 | 22.52 ≤ 100 | bounds checks dashboard |
    | ✅ | quality_gate_security_no_fs_load | memory_usage | 10/10 | 313.00MiB ≤ 348MiB | bounds checks dashboard |
    </details>

    <details>
    <summary><h2>
    Explanation
    </h2></summary>

    Confidence level: 90.00%
    Effect size tolerance: |Δ mean %| ≥ 5.00%

    Performance changes are noted in the perf column of each table:

    ✅ = significantly better comparison variant performance
    ❌ = significantly worse comparison variant performance
    ➖ = no significant change in performance

    A regression test is an A/B test of target performance in a repeatable rig, where "performance" is measured as "comparison variant minus baseline variant" for an optimization goal (e.g., ingress throughput). Due to intrinsic variability in measuring that goal, we can only estimate its mean value for each experiment; we report uncertainty in that value as a 90.00% confidence interval denoted "Δ mean % CI".

    For each experiment, we decide whether a change in performance is a "regression" -- a change worth investigating further -- if all of the following criteria are true:

    1. Its estimated |Δ mean %| ≥ 5.00%, indicating the change is big enough to merit a closer look.

    2. Its 90.00% confidence interval "Δ mean % CI" does not contain zero, indicating that if our statistical model is accurate*, there is at least a 90.00% chance there is a difference in performance between baseline and comparison variants.

    3. Its configuration does not mark it "erratic".
    </details>

    CI Pass/Fail Decision

    ✅ Passed. All Quality Gates passed.

  • quality_gate_private_action_runner, bounds check memory_usage: 10/10 replicas passed. Gate passed.

  • quality_gate_idle, bounds check total_bytes_received: 10/10 replicas passed. Gate passed.

  • quality_gate_idle, bounds check memory_usage: 10/10 replicas passed. Gate passed.

  • quality_gate_idle, bounds check intake_connections: 10/10 replicas passed. Gate passed.

  • quality_gate_security_mean_fs_load, bounds check memory_usage: 10/10 replicas passed. Gate passed.

  • quality_gate_security_mean_fs_load, bounds check cpu_usage: 10/10 replicas passed. Gate passed.

  • quality_gate_idle_all_features, bounds check total_bytes_received: 10/10 replicas passed. Gate passed.

  • quality_gate_idle_all_features, bounds check memory_usage: 10/10 replicas passed. Gate passed.

  • quality_gate_idle_all_features, bounds check intake_connections: 10/10 replicas passed. Gate passed.

  • quality_gate_metrics_logs, bounds check memory_usage: 10/10 replicas passed. Gate passed.

  • quality_gate_metrics_logs, bounds check cpu_usage: 10/10 replicas passed. Gate passed.

  • quality_gate_metrics_logs, bounds check intake_connections: 10/10 replicas passed. Gate passed.

  • quality_gate_metrics_logs, bounds check total_bytes_received: 10/10 replicas passed. Gate passed.

  • quality_gate_metrics_logs, bounds check missed_bytes: 10/10 replicas passed. Gate passed.

  • quality_gate_security_idle, bounds check cpu_usage: 10/10 replicas passed. Gate passed.

  • quality_gate_security_idle, bounds check memory_usage: 10/10 replicas passed. Gate passed.

  • quality_gate_security_no_fs_load, bounds check cpu_usage: 10/10 replicas passed. Gate passed.

  • quality_gate_security_no_fs_load, bounds check memory_usage: 10/10 replicas passed. Gate passed.

  • quality_gate_logs, bounds check missed_bytes: 10/10 replicas passed. Gate passed.

  • quality_gate_logs, bounds check intake_connections: 10/10 replicas passed. Gate passed.

  • quality_gate_logs, bounds check memory_usage: 10/10 replicas passed. Gate passed.

  • quality_gate_logs, bounds check total_bytes_received: 10/10 replicas passed. Gate passed.
  • github-actions[bot] github-actions[bot] commented on Oct 05, 2026 07:56 UTC
    Reviewer

    AI review by Codex (OpenAI) - workflow run

    patch is correct. No actionable regressions found. Regex patterns and compilation modes are preserved, and the shared instances introduce no identified mutation or initialization hazards. Tests were not run in the read-only environment.

    ichinaski ichinaski approved these changes on Oct 05, 2026 07:58 UTC
    Approved Reviewer

    Approved these changes.

    pgimalac pgimalac commented on code on Oct 05, 2026 07:58 UTC
    Code Review
    pkg/util/scrubber/default.go:1

    I'm a little worried that this moves the cost (cpu and memory usage) to anything which imports the package even without using it, but the scrubber should always be initialized anyway so should be fine

    pgimalac pgimalac approved these changes on Oct 05, 2026 07:58 UTC
    Approved Reviewer

    Approved these changes.

    gjulianm gjulianm commented on code on Oct 05, 2026 07:58 UTC
    Code Review
    pkg/gpu/probe.go:1
    @@ -407,7 +413,7 @@ func (p *Probe) CollectConsumedEvents(ctx context.Context, count int) ([][]byte,
     // split in a separate function to make it easier to test
     func getCudaLibraryAttacherRule() *uprobes.AttachRule {
     	return &uprobes.AttachRule{
    -		LibraryNameRegex: regexp.MustCompile(`lib(cudart|nd4jcuda)\.so`),
    +		LibraryNameRegex: cudaLibraryRegex,

    I am thinking a bit more about this and I am not sure if moving all entries to the package level is a good idea. For example, in this case, this function gets called only once, and only when the GPU monitoring module is initialized. This PR would force the regex to always get compiled even if it's not used.

    Stanislas167 Stanislas167 approved these changes on Oct 05, 2026 08:17 UTC
    Approved Reviewer

    Approved these changes.

    lavigne958 lavigne958 approved these changes on Oct 05, 2026 08:31 UTC
    Approved Reviewer

    Approved these changes.

    Pierre-L42 Pierre-L42 approved these changes on Oct 05, 2026 08:34 UTC
    Approved Reviewer

    Approved these changes.

    chouetz chouetz approved these changes on Oct 05, 2026 08:55 UTC
    Approved Reviewer

    Agree with the change overall and I think the comments from Pierre & Guillermo make sense, the move can be suboptimal sometimes, you might want to consider it.

    victorsprengel victorsprengel approved these changes on Oct 05, 2026 12:40 UTC
    Approved Reviewer

    Approved these changes.

    s-alad s-alad approved these changes on Oct 05, 2026 13:57 UTC
    Approved Reviewer

    Approved these changes.

    kovagsm kovagsm approved these changes on Oct 05, 2026 15:56 UTC
    Approved Reviewer

    Approved these changes.

    brycekahle brycekahle approved these changes on Oct 05, 2026 16:57 UTC
    Approved Reviewer

    Note: this can be a memory de-optimization in cases where a codepath is either not used or isn't inside any kind of a loop. Now any code which imports the package will pay the cpu/memory cost of regex compilation at init time.

    san-jos san-jos approved these changes on Oct 06, 2026 07:57 UTC
    Approved Reviewer

    Approved these changes.

    YoannGh YoannGh approved these changes on Oct 06, 2026 09:39 UTC
    Approved Reviewer

    Approved these changes.

    sar-shah sar-shah approved these changes on Oct 13, 2026 18:34 UTC
    Approved Reviewer

    Approved these changes.

    dplepage-dd dplepage-dd approved these changes on Nov 04, 2026 18:02 UTC
    Approved Reviewer

    Approved these changes.

    dd-octo-sts[bot] dd-octo-sts[bot] commented on Nov 19, 2026 22:10 UTC
    Bot

    This pull request has been automatically marked as stale because it has not had activity in the past 15 days.

    It will be closed in 30 days if no further activity occurs. If this pull request is still relevant, adding a comment or pushing new commits will keep it open. Also, you can always reopen the pull request if you missed the window.

    Thank you for your contributions!

    Reviewers
    Assignees
    louis-cqrl louis-cqrl
    Labels
    risk: low confidence: 75.1% 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: 46.8% (MEDIUM) · Higher = larger blast radius
    46.8%
    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: 75.1% · Lower = rushed or shallow review
    75.1%
    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: 11.7% · Safe to merge
    11.7%