Skip to content

fix(stdlib): validate tdef against runtime value and fix incorrect type_defs#1823

Draft
thomasqueirozb wants to merge 2 commits into
mainfrom
type-def-fixes
Draft

fix(stdlib): validate tdef against runtime value and fix incorrect type_defs#1823
thomasqueirozb wants to merge 2 commits into
mainfrom
type-def-fixes

Conversation

@thomasqueirozb

Copy link
Copy Markdown
Member

Summary

The test_function! macro now validates that the declared tdef is actually a superset of the kind of the runtime want value. This catches cases where type_def() returns a type too narrow to cover all values the function can produce.

The validation exposed real bugs across many stdlib functions, all of which are fixed here:

  • merge: deep merge now correctly includes fields from both objects (previously lost to's sub-object fields)
  • round: type_def() now returns float for float inputs, integer for integer inputs (was always integer)
  • xxhash: type_def() now returns bytes | integer (was bytes-only, but XXH32/64/3-64 return integers)
  • parse_tokens: array unknown type now includes null
  • pop / slice: use resolve_constant to compute the exact output type when inputs are literals
  • parse_regex / parse_regex_all: when numeric_groups=false (default), numeric-index capture groups are excluded from the type
  • parse_syslog, parse_apache_log, parse_aws_alb_log, parse_aws_vpc_flow_log, parse_common_log, parse_nginx_log, parse_influxdb, parse_xml: field types corrected and optional fields marked with | undefined

Change Type

  • Bug fix
  • New feature
  • Non-functional (chore, refactoring, docs)
  • Performance

Is this a breaking change?

  • Yes
  • No

How did you test this PR?

Full cargo test -p vrl --lib passes (1846 tests, 0 failures).

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

References

NA

JakubOnderka and others added 2 commits June 12, 2026 18:23
…parse_regex/parse_regex_all (#1811)

* perf(stdlib): pre-compute capture info and use index-based lookup in parse_regex/parse_regex_all

* changelog: add fragment for #1811
@thomasqueirozb thomasqueirozb added the no-changelog Changes in this PR do not need user-facing explanations in the release changelog label Jun 15, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

no-changelog Changes in this PR do not need user-facing explanations in the release changelog

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants