fix(value): preserve values when insertion paths are invalid #2080
All Vouch review confidence checks passed
Residual risk 0.19 = Change Risk (0.48) × (1 − Review Confidence (0.60)).
Review depth and reviewer attention state are adequate.
Model 1 · Change Risk (XGBoost)
Score: 0.48 · 505 lines diff across 6 files
Model 2 · Review Depth (DistilBERT)
Depth Score: 0.17 · 1 substantive comment(s)
Model 3 · Review Timing & Attention
Session adequacy: 100% · Reviewer familiarity: 35%
Bedrock Claude 3 · Risk Narration
(disconnected)
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.373
Shallow Review Depth
shallow_review_depth
0.289
Real PR Conversation Timeline
1 comments
"Review active on #2080"
general
weight: 0.35
pront
<!--
We recommend conforming to conventional commit spec for PR titles:
https://www.conventionalcommits.org/en/v1.0.0/
<type>(<scope>)!: <description>
type= chore, enhancement, feat, fix, docs, revert!= OPTIONAL: signals a breaking changescope= Optional whentypeis "chore" or "docs"description= short description of the changeExamples:
enhancement(file source): Add
sortoption to sort discovered filesfeat(new source): Initial
statsdsourcefix(file source): Fix a bug discovering new files
chore(external docs): Clarify
batch_sizeoption-->
Summary
Prevent
Value::insertfrom modifying existing data when a path containsBorrowedSegment::Invalid.Recursive insertion now distinguishes an invalid path from a successful insertion with no previous value. Replacement objects and arrays are installed only after recursive insertion succeeds. The public
Option<Value>API is unchanged: invalid paths still returnNone. This avoids an additional path-validation pass or cloning the original value.Update the invalid-path compatibility test introduced in #2044: five cases intentionally change from preserving partial mutations to preserving the original value. Add coverage for forward/backward array growth, nested array-element replacement, and invalid segments followed by more segments. The other compatibility tests remain unchanged.
This addresses the Rust API reproducer in #2070; a trigger through an ordinary VRL program or Vector configuration has not been established. Changing the public return type is outside this PR's scope.
<!-- Please provide a brief summary about what this PR does.
This should help the reviewers give feedback faster and with higher quality. -->
How did you test this PR?
Reproduced the original issue before the fix using a standalone crate with only the
valuefeature enabled. The preservation assertion failed before the fix and passed afterward. The updated regression test was also observed failing before the implementation change.After resolving the conflict with upstream's
ObjectMapchange, all 103 value-library tests, the doctest, focused Clippy, formatting, and changelog validation passed:All 45 benchmark smoke cases passed before the upstream update; they were not rerun afterward. Full
make all, all-feature validation, and comparative performance benchmarks were not run. Current focused checks emit unused-dependency manifest warnings forserde_yaml_ngandua-parser.<!-- Please describe your testing plan here.
Providing this information upfront will facilitate a smoother review process. -->
Does this PR include user-facing changes?
our guidelines.
Added
changelog.d/invalid-insert-preserves-value.fix.md.Checklist
run
dd-rust-license-tool writeand commit the changes. More details here.No dependency or license-file changes.
References
Closes #2070.
Related: #2044; https://github.com/vectordotdev/vector/issues/21213 (separate return-type/API discussion).
<!-- Please list any issues closed by this PR. -->
<!--
-->
<!-- Any other issues or PRs relevant to this PR? Feel free to list them here. -->