[Observability:Streams] Child stream input validation#242581
[Observability:Streams] Child stream input validation#242581couvq merged 32 commits intoelastic:mainfrom
Conversation
|
/ci |
780867a to
b51e9ea
Compare
|
/ci |
6873ed5 to
5b37da3
Compare
|
/ci |
|
Pinging @elastic/obs-onboarding-team (Team:obs-onboarding) |
x-pack/platform/plugins/shared/streams/server/lib/streams/client.ts
Outdated
Show resolved
Hide resolved
6ca2248 to
9ebbf27
Compare
|
Should the |
@gbamparop I Asked the EUI team about this off thread (slack), I think it would make sense to disable the button here but want to make sure it aligns with any UX patterns they have. I couldn't find anything specific to this use case on the EUI doc site. |
I think it makes sense to disable any save or update button when there is a validation error, otherwise we are making a backend call and relying on the backend validation to reject the request. Since we also disable it when there is a |
|
@couvq Sorry edited your comment instead of quoting it 😅.
We can probably rely on the custom validation we have to show the error message, otherwise the user won't know why no more typing is allowed. |
Cool that makes sense, I can remove that as part of this change as well 👍. Also the messages are shown as help messages in the current state. Should these be error messages instead? |
I remember I had this discussion with Marco before and we decided on keeping the length messages as help ones not error. Lets keep it this way for now unless the Design team says otherwise |
1db4d2b to
035e8e3
Compare
|
@elasticmachine merge upstream |
9de461d to
526e706
Compare
8c31752 to
fa3911d
Compare
rStelmach
left a comment
There was a problem hiding this comment.
LGTM!
Tested locally and everything works as expected ✨
Left two small nits
...ams_app/public/components/data_management/stream_detail_routing/new_routing_stream_entry.tsx
Outdated
Show resolved
Hide resolved
...ms_app/public/components/data_management/stream_detail_routing/edit_routing_stream_entry.tsx
Outdated
Show resolved
Hide resolved
474d1ef to
849da0f
Compare
💚 Build Succeeded
Metrics [docs]Public APIs missing comments
Async chunks
Page load bundle
Unknown metric groupsAPI count
ESLint disabled line counts
Total ESLint disabled count
History
|
|
@couvq sorry for commenting here after the PR is merged, just came across an issue that seems somehow related. Where empty space child names are allowed, and invalid state for the name is maintained after cancellation. Might be worth checking and opening a separate bug ticket if you managed to reproduce it as well. Screen.Recording.2025-12-29.at.13.14.47.mov |
I was able to reproduce as well, I think we need to trim the input value and do an empty check on that. I'll create a bug ticket for it 👍 |
|
Looks like there cannot be any spaces, so we could do a check for that as well Screen.Recording.2026-01-05.at.9.13.36.AM.mov |
|
Follow up issue created here for space issue #247825 |
## 🍒 Summary This change adds comprehensive input validation for stream names to prevent Elasticsearch errors when users create streams with invalid names (uppercase characters, spaces, or special characters). Closes elastic/observability-error-backlog#450 Follow-up of #242581 , patching a couple more cases and centralizing the validation ## 🛠️ Changes - Created a shared `validateStreamName()` function in `common/constants.ts` that validates: - Non-empty names - Max length of 200 characters - Lowercase only (no uppercase characters) - No special characters: `"`, `\`, `*`, `,`, `/`, `<`, `>`, `?`, `|`, or spaces - Added validation for the stream's own name in `WiredStream.doValidateUpsertion()` (was only validating child stream names before) - Added validation for the stream's own name in `ClassicStream.doValidateUpsertion()` (had no name validation at all before) - Refactored existing child stream routing validation to use the shared helper - Added 13 API integration tests covering various invalid stream name scenarios ## 🎙️ Prompts - "implement stream name validation checking for lowercase, no spaces, and no special characters" - "add API integration tests for stream name validation in wired and classic streams" 🤖 This pull request was assisted by Cursor --------- Co-authored-by: Cursor <cursoragent@cursor.com> Co-authored-by: kibanamachine <42973632+kibanamachine@users.noreply.github.com>


Closes #242254
Closes #243566
Closes https://github.com/elastic/streams-program/issues/623
Closes https://github.com/elastic/observability-error-backlog/issues/318
Closes https://github.com/elastic/observability-error-backlog/issues/319
Description
This PR addresses missing input validation and error handling for the child/fork stream UIs and APIs, as well as a performance bug associated with the child stream input. Below is a summary of the cases this PR handles:
Note about what was causing the performance issue and the fix for it:
onChangefunction passed to the<StreamNameFormRow />component was being triggered on every key press. TheonChangefunctions passed to the component updated contexts within the routing state machine and since thePreviewPanelcomponent read the entire snapshot of state from the routing state machine, it caused thePreviewTablecomponent to rerender along with all of its preview data, this caused the input to lag as React has to rerender the preview table along with the input and anything else that reads the routing state. I resolved this by having the component hook manage a local state, and debouncing what was passed to theonChangeso that it would only get called after 300ms of inactivity. This way only the input is rerendered on key press, with theonChangecausing downstream rerendering only after a period of inactivity. Now the input is snappy when typing and the client side validation happens quickly, even when data is rendered in the preview table.Screen recording (works the same on manual and AI suggestion inputs)
Screen.Recording.2025-12-01.at.2.28.01.PM.mov