Open awangc opened 1 year ago
As @awangc already pointed out, this is not listed in the "breaking changes" of 0.26.0
which made this also very difficult for me to tackle. Rather it is in https://vector.dev/highlights/2022-08-16-0-24-0-upgrade-guide/#vrl-query-assignment but for me as user, 0.24.0 did not introduce this behavior:
$ for vector_version in 0.23.3 0.24.0 0.25.0 0.26.0; do echo "Running test with vector ${vector_version}:"; docker run --rm -ti -v ".:/opt/vector" "timberio/vector:${vector_version}-alpine" test /opt/vector/issue-15542.yml; done
Running test with vector 0.23.3:
Running tests
test Delete root object changed behavior in 0.26.0 for vector test #15542 ... passed
Running test with vector 0.24.0:
Running tests
test Delete root object changed behavior in 0.26.0 for vector test #15542 ... passed
Running test with vector 0.25.0:
Running tests
test Delete root object changed behavior in 0.26.0 for vector test #15542 ... passed
Running test with vector 0.26.0:
Running tests
2024-03-05T15:19:56.454903Z ERROR vector::unit_test: Failed to execute tests:
Failed to build test 'Delete root object changed behavior in 0.26.0 for vector test #15542':
Transform "test":
error[E642]: parent path segment rejects this mutation
ββ :2:6
β
2 β .log.level = "warn"
β ---- ^^^^^ querying a field of a non-object type is unsupported
β β
β this path resolves to a value of type undefined
β
= try: change parent value to object, before assignment
=
= .log = {}
= .log.level = "warn"
=
= see documentation about error handling at https://errors.vrl.dev/#handling
= see language documentation at https://vrl.dev
= try your code in the VRL REPL, learn more at https://vrl.dev/examples
.
---
transforms:
test:
type: remap
inputs: [not_used]
source: |-
.vector = del(.)
.log.level = "warn"
tests:
- name: 'Delete root object changed behavior in 0.26.0 for vector test #15542'
inputs:
- insert_at: test
type: log
log_fields:
message: Received one event.
outputs:
- extract_from: test
conditions:
- type: vrl
source: |-
assert_eq!(.log.level, "warn", "log level failure")
assert_eq!(.vector.message, "Received one event.", "message failure")
https://github.com/vectordotdev/vrl/issues/118 cleared this up for me.
@JeanMertz Do you know why your feature is not active in 0.24.0 (where it is merged)? Does it make sense to move the docs of this breaking change to https://vector.dev/highlights/2022-11-07-0-26-0-upgrade-guide/?
A note for the community
Problem
In vector 0.25.2, the following test case passes:
but in 0.26.0 it fails with following error message
Configuration
Version
vector 0.26.0 (x86_64-apple-darwin c6b5bc2 2022-12-05)
Debug Output
Example Data
No response
Additional Context
No reference to this behavior was made in the
breaking changes
upgrade guide of the release documentation https://vector.dev/highlights/2022-11-07-0-26-0-upgrade-guide/References
No response