fix(lua): truncate fractional numbers in timestamp fields #2066
All Vouch review confidence checks passed
Residual risk 0.16 = Change Risk (0.40) × (1 − Review Confidence (0.60)).
Review depth and reviewer attention state are adequate.
Model 1 · Change Risk (XGBoost)
Score: 0.40 · 289 lines diff across 3 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.339
Shallow Review Depth
shallow_review_depth
0.289
Real PR Conversation Timeline
1 comments
"Review active on #2066"
general
weight: 0.35
pront
Summary
Since the mlua 0.12 upgrade (#2040), a Lua timestamp with a fractional field fails to convert. mlua 0.11 truncated these values.
For example, this Vector Lua script worked before and now fails with
number → u32: out of range, so the log is dropped:This PR restores the old behavior.
table_to_timestampnow reads its fields through a privateLuaInt<T>wrapper that truncates fractional numbers toward zero before converting, including numeric strings. Out-of-range and non-numeric values are still rejected.This unblocks vectordotdev/vector#27241. No changelog, because the mlua 0.12 upgrade has not been released.
How did you test this PR?
Two new tests in
src/value/value/lua.rs:| Input | Expected |
| --- | --- |
|
nanosec = 1e9 / 3|2020-03-15T18:37:08.333333333Z||
sec = 8.9,nanosec = '333333333.9'|2020-03-15T18:37:08.333333333Z|| The script above (
os.date('!*t', ...)and thennanosec = 1e9 / 3) |2020-03-15T18:37:08.333333333Z||
nanosec = -1.5| Error |cargo test --features lua --lib: all 1,988 tests pass.cargo clippy --all-features --all-targets: no new warnings.Vector compatibility (advisory)is expected to fail until vectordotdev/vector#27241 merges, because Vectormasterstill uses mlua 0.11.Does this PR include user-facing changes?
our guidelines.
Checklist
run
dd-rust-license-tool writeand commit the changes. More details here.References