Skip to content

VRL Target methods should be infallible #186

Open
@fuchsnj

Description

@fuchsnj

A note for the community

  • Please vote on this issue by adding a 👍 reaction to the original issue to help the community and maintainers prioritize this request
  • If you are interested in working on this issue or have submitted a pull request, please leave a comment

Use Cases

Today, the Target trait has 4 methods.

    fn target_insert(...) -> Result<(), String>;
    fn target_get(...) -> Result<Option<&Value>, String>;
    fn target_get_mut(...) -> Result<Option<&mut Value>, String>;
    fn target_remove(...) -> Result<Option<Value>, String>;

All four of these are fallible, however none of the implementations should actually be able to fail at runtime. The VRL type system expects these to always succeed, so any failures can result in invalid type definitions. All of these functions should be modified to be infallible.

There are some places these can still fail at runtime, but the errors are just silently ignored. This is mostly around metrics insertion. This can be solved by adding more compile-time type information to move the errors to compile-time (such as defining "assignable types" and only allowing assignments that match the correct type)

Version

0.23.0

Metadata

Metadata

Assignees

No one assigned

    Labels

    type: bugA code related bugtype: enhancementA value-adding code change that enhances its existing functionalityvrl: compilerChanges to the compilervrl: typedefChanges to the type system

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions