Skip to content

Conversation

@taylor-swanson
Copy link
Contributor

@taylor-swanson taylor-swanson commented Nov 3, 2025

What does this PR do?

  • Add validation rule SVR00006 to verify all ingest pipeline processors have a valid tag (excludes global pipeline on_failure)
  • Add validation to verify all ingest pipeline processor tags are unique (excludes global pipeline on_failure)

Why is it important?

Checklist

Related issues

  • Relates elastic/integration-experience#390

@taylor-swanson taylor-swanson self-assigned this Nov 3, 2025
@taylor-swanson taylor-swanson added the enhancement New feature or request label Nov 3, 2025
@taylor-swanson taylor-swanson force-pushed the feat/validate-unique-tags branch from b2d626a to 53b2e9a Compare November 3, 2025 15:17
@taylor-swanson taylor-swanson force-pushed the feat/validate-unique-tags branch from 8e07ee6 to babead4 Compare November 11, 2025 14:17
- Add validation rule SVR00006 to verify all ingest pipeline processors have a valid tag
- Add validation rule SVR00007 to verify all ingest pipeline processor tags are unique
@taylor-swanson taylor-swanson force-pushed the feat/validate-unique-tags branch from 0e3ba16 to d1c725c Compare November 11, 2025 17:13
@taylor-swanson taylor-swanson marked this pull request as ready for review November 12, 2025 13:29
@taylor-swanson taylor-swanson requested a review from a team as a code owner November 12, 2025 13:29
@taylor-swanson
Copy link
Contributor Author

Hey @elastic/ecosystem @jsoriano, would you be able to give this a review when you have time?

Copy link
Member

@jsoriano jsoriano left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice change, thanks! Added some small suggestions.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for adding this.

errors = append(errors, subErrors...)
}

raw, ok := proc.Attributes["tag"]
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

looking into the pipeline spec

i don't see there the property "tag" defined...

am i right assuming the definition should be here? if so, could we control the required validation version from the json patch rules?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah I noticed that tag wasn't defined there as well. We're also missing all of the required fields for each processor (i.e., the 'rename' processor requires the 'field' property).

In this case, though, tag isn't a required field by elasticsearch, rather, we're requiring it on certain processors in certain situations (only in the processors list, but no the global on_failure handler). For that reason, I wouldn't want to apply the tag enforcement globally.

Copy link
Member

@jsoriano jsoriano Nov 19, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

could we control the required validation version from the json patch rules?

Yes, you are right, it would be better to handle this from the json schema if possible. Though as implemented here it is easier to make it skippable, and to provide better error messages. If brought to the schema we'd need to add rules to code/go/internal/validator/spec.go. Also not sure about how to prevent duplications from the spec. So I am on the fence on this.

Maybe an option would be to use both, validate that there are tags in the spec, and check with a semantic rule that tags are not duplicated.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Also not sure about how to prevent duplications from the spec.

Well, this seems to be easy too: https://json-schema.org/understanding-json-schema/reference/array#uniqueItems

@taylor-swanson wdyt about rewriting this with the spec?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's certainly an interesting idea... How would that work though since tag is nested a bit deeper in the tree compared to the processor itself?

processors:
  - set:
      tag: tag_1
  - set:
      tag: tag_2

It ends of being array.object.object to get down to tag.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You are right, it would be complex to check unique items in different objects... I guess this part would still need to be in code.

- Change pointers to values in processor slices
- Remove validation bypass code for duplicate tags
- Mention that global on_failure processors are excluded from tag check
@taylor-swanson
Copy link
Contributor Author

Hey @jsoriano, @teresaromero, just checking to see if there are any other issues with this PR. Thanks!

teresaromero
teresaromero previously approved these changes Dec 1, 2025
@elasticmachine
Copy link

💚 Build Succeeded

History

cc @taylor-swanson

@taylor-swanson
Copy link
Contributor Author

Hey @jsoriano, @teresaromero, I had to resolve merge conflicts and looks like it cleared the review, so will need another approval, thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants