โ† Back to Pull requests

๐Ÿฉน fix: treat Vary field names as case-insensitive #4642

Closed
unknown closed this pull request without merging on Sep 06, 2026 16:03 UTC
View on GitHub
unknown unknown commented on Aug 29, 2026 18:23 UTC
Author

Description

Res.Vary() compared field names byte for byte, so Vary("accept") followed by Vary("Accept") (or AutoFormat, which adds Accept) produced Vary: accept, Accept. RFC 9110 Section 5.1 treats field names as case-insensitive.

Vary now dedups with ASCII case folding and keeps the first spelling. Generic Append() stays byte-exact, because those lists are not all field names (Link, Cache-Control). That is documented on Append. Append("Vary", ...) can still list accept and Accept together; use Vary() for this header.

Fixes #4641

Changes introduced

  • headerlist.AppendUniqueFold for case-insensitive list members

  • Res.Vary() uses it; Append() still uses byte-exact AppendUnique

  • Tests for the AutoFormat path, mixed-case calls, and later field lines

  • Append godoc and docs/api/ctx.md note the byte-exact comparison
  • Benchmark

    Review A/B, interleaved -count=8: Ctx_Vary 39.55n ยฑ 4% to 41.20n ยฑ 2% (+4.20%, p=0.000). Allocs unchanged. That is EqualFold vs ==, about 1.65ns.

    Type of change

  • Bug fix (non-breaking change which fixes an issue)
  • Checklist

  • Added or updated unit tests

  • New and existing unit tests pass locally

  • Documentation in /docs/ updated
  • Diff: 153 lines (+114 / -39) across 1 files Reviewer: BitWeaverDev Review duration: 11379m
    All Vouch review confidence checks passed
    Residual risk 0.13 = Change Risk (0.33) ร— (1 โˆ’ Review Confidence (0.60)). Review depth and reviewer attention state are adequate.
    Model 1 ยท Change Risk (XGBoost)
    Score: 0.33 ยท 153 lines diff across 1 files
    0.33
    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.301
    Shallow Review Depth shallow_review_depth
    0.289
    Real PR Conversation Timeline
    1 comments
    "Review active on #4642"
    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: 33.1% (LOW) ยท Higher = larger blast radius
    33.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: 13.1% ยท Safe to merge
    13.1%
    Repository