[Streams 🌊] Ensure the members array is unique for GroupStreamDefinitions#210089
Conversation
tonyghiani
left a comment
There was a problem hiding this comment.
Is the runtime parsing step necessary given all these data will be already schema validated on request?
I like having this extension point for transformations on a definition, but wouldn't be enough to have it as a normalizeDefinition and rely on the Typescript types to enforce check the structure?
flash1293
left a comment
There was a problem hiding this comment.
Agree with @tonyghiani s comment that from that point Typescript should be enough to make sure the definition is proper.
Should we fail in this scenario instead of deduping? Not sure what makes more sense, happy to go either way really.
|
@flash1293 @tonyghiani Will the client always be used by the HTTP API? |
At the moment, it should. And even if we need to expose the client to other Kibana plugins by the start contract for server-side usage, they should adhere to the Typescript defined interface for the streams definition. If it's not a requirement now, I'd rather skip this layer of complexity at runtime. |
|
Yeah, I don't think the client needs to provide any correctness guarantees at this point - let's not worry about exposing it internally just yet. In general I feel @miltonhultgren is raising great points about how we can structure our validation code here: https://github.com/elastic/streams-program/discussions/147 |
|
I'll move the transform and checks to the route then. |
💚 Build Succeeded
Metrics [docs]
History
|
|
Starting backport for target branches: 8.x, 9.0 |
…ions (elastic#210089) ## Summary This PR ensures that the `definition.group.members` is a unique array of strings. I introduced a new private function to the StreamsClient called `parseDefinition` that will parse the definition being upserted with the runtime schemas to ensure they are properly formatted. This is also a good extension point for doing any transformations we need. (cherry picked from commit a28e400)
💔 Some backports could not be created
Note: Successful backport PRs will be merged automatically after passing CI. Manual backportTo create the backport manually run: Questions ?Please refer to the Backport tool documentation |
|
@simianhacker as 9.0 feature-froze already, we shouldn't backport any additional streams changes at this point. |
…efinitions (#210089) (#211798) # Backport This will backport the following commits from `main` to `8.x`: - [[Streams 🌊] Ensure the members array is unique for GroupStreamDefinitions (#210089)](#210089) <!--- Backport version: 9.6.6 --> ### Questions ? Please refer to the [Backport tool documentation](https://github.com/sorenlouv/backport) <!--BACKPORT [{"author":{"name":"Chris Cowan","email":"chris@elastic.co"},"sourceCommit":{"committedDate":"2025-02-19T15:37:56Z","message":"[Streams 🌊] Ensure the members array is unique for GroupStreamDefinitions (#210089)\n\n## Summary\n\nThis PR ensures that the `definition.group.members` is a unique array of\nstrings. I introduced a new private function to the StreamsClient called\n`parseDefinition` that will parse the definition being upserted with the\nruntime schemas to ensure they are properly formatted. This is also a\ngood extension point for doing any transformations we need.","sha":"a28e40069fd96ad82bbbde14479b85dc21f88370","branchLabelMapping":{"^v9.1.0$":"main","^v8.19.0$":"8.x","^v(\\d+).(\\d+).\\d+$":"$1.$2"}},"sourcePullRequest":{"labels":["release_note:fix","v9.0.0","backport:version","Feature:Streams","v9.1.0","v8.19.0"],"title":"[Streams 🌊] Ensure the members array is unique for GroupStreamDefinitions","number":210089,"url":"https://github.com/elastic/kibana/pull/210089","mergeCommit":{"message":"[Streams 🌊] Ensure the members array is unique for GroupStreamDefinitions (#210089)\n\n## Summary\n\nThis PR ensures that the `definition.group.members` is a unique array of\nstrings. I introduced a new private function to the StreamsClient called\n`parseDefinition` that will parse the definition being upserted with the\nruntime schemas to ensure they are properly formatted. This is also a\ngood extension point for doing any transformations we need.","sha":"a28e40069fd96ad82bbbde14479b85dc21f88370"}},"sourceBranch":"main","suggestedTargetBranches":["9.0","8.x"],"targetPullRequestStates":[{"branch":"9.0","label":"v9.0.0","branchLabelMappingKey":"^v(\\d+).(\\d+).\\d+$","isSourceBranch":false,"state":"NOT_CREATED"},{"branch":"main","label":"v9.1.0","branchLabelMappingKey":"^v9.1.0$","isSourceBranch":true,"state":"MERGED","url":"https://github.com/elastic/kibana/pull/210089","number":210089,"mergeCommit":{"message":"[Streams 🌊] Ensure the members array is unique for GroupStreamDefinitions (#210089)\n\n## Summary\n\nThis PR ensures that the `definition.group.members` is a unique array of\nstrings. I introduced a new private function to the StreamsClient called\n`parseDefinition` that will parse the definition being upserted with the\nruntime schemas to ensure they are properly formatted. This is also a\ngood extension point for doing any transformations we need.","sha":"a28e40069fd96ad82bbbde14479b85dc21f88370"}},{"branch":"8.x","label":"v8.19.0","branchLabelMappingKey":"^v8.19.0$","isSourceBranch":false,"state":"NOT_CREATED"}]}] BACKPORT--> Co-authored-by: Chris Cowan <chris@elastic.co>
…ions (elastic#210089) ## Summary This PR ensures that the `definition.group.members` is a unique array of strings. I introduced a new private function to the StreamsClient called `parseDefinition` that will parse the definition being upserted with the runtime schemas to ensure they are properly formatted. This is also a good extension point for doing any transformations we need.
Summary
This PR ensures that the
definition.group.membersis a unique array of strings. I introduced a new private function to the StreamsClient calledparseDefinitionthat will parse the definition being upserted with the runtime schemas to ensure they are properly formatted. This is also a good extension point for doing any transformations we need.