← Back to Pull requests

enhancement(path): check field quoting without a regex #2085

Closed
unknown closed this pull request without merging on Nov 30, 2026 19:18 UTC
View on GitHub
unknown unknown commented on Nov 25, 2026 14:08 UTC
Author

Summary

OwnedSegment's Display impl matched every field against a static Regex (^[0-9][a-zA-Z_@][0-9a-zA-Z_@]$) to decide whether it needs quotes. A static Regex has a single cache pool for the whole process: the first thread to use it gets the fast path, and every other thread goes through Pool::get_slow / put_value, which contend on a handful of sharded mutexes. Paths are formatted per event on hot paths (for example in Vector's reduce transform), so this shows up in CPU profiles on multi-core hosts.

This replaces the regex with a byte check that follows the same rules, like serialize_field in the same file already does.

How did you test this PR?

  • Proptest comparing the byte check against the old regex, on an alphabet of each accepted range's end bytes and the bytes just outside them. Mutants that shift a range end or drop the digit-only rule fail it in 5 of 5 runs.

  • Existing round-trip proptests pass.

  • Microbenchmark of the old static Regex::is_match against the new check, 8 typical field names, per call per thread, on a 16-core machine:
  • | threads | regex | byte check |
    |---|---|---|
    | 1 | 26.0 ns | 3.9 ns |
    | 4 | 55.7 ns | 4.0 ns |
    | 8 | 60.8 ns | 4.1 ns |
    | 16 | 129.7 ns | 6.1 ns |

    Does this PR include user-facing changes?

  • Yes. Please add a changelog fragment based on

  • our guidelines.
  • No. A maintainer will apply the "no-changelog" label to this PR.
  • Checklist

  • Our CONTRIBUTING.md is a good starting place.

  • If this PR introduces changes to LICENSE-3rdparty.csv, please

  • run dd-rust-license-tool write and commit the changes. More details here.

    References

  • Related: vectordotdev/vector#27331 (same fix for Vector's field path iterator)
  • Diff: 249 lines (+186 / -63) across 3 files Reviewer: pront Review duration: 7510m
    All Vouch review confidence checks passed
    Residual risk 0.15 = Change Risk (0.39) × (1 − Review Confidence (0.60)). Review depth and reviewer attention state are adequate.
    Model 1 · Change Risk (XGBoost)
    Score: 0.39 · 249 lines diff across 3 files
    0.39
    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.330
    Shallow Review Depth shallow_review_depth
    0.289
    Real PR Conversation Timeline
    1 comments
    "Review active on #2085"
    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: 39.0% (MEDIUM) · Higher = larger blast radius
    39.0%
    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.4% · Safe to merge
    15.4%