You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
[Streams 🌊] Prevent stream partition names from messing up required hierarchy prefix (#241158)
Closes [#576](elastic/streams-program#576)
## Summary
When partitioning a wired stream, each partition has restrictions in
their name by which they must keep the name of their parent partition(s)
keeping the hierarchy separated by dots in each level.
While server-side the restriction is properly enforced, the input we're
rendering at UI level does not enforce this restriction. Instead it
allows users to alter and/or remove the required prefix. Even if an
error message will be presented should the name not meet the
requirements, it still isn't an ideal UX given the input does allow you
to alter the prefix without clearly stating it shouldn't be modified.
This PR introduces some fixes to address the issue
## UI
### Partition Creation
During creation, the stream name input has now been split into 2
sections. The fixed prefix part of the partition name is now rendered in
a prepend section for the input, making it non editable. The child part
of the name remains as a regular text input allowing users to name the
new partition however they wish to, but keeping the prefix restrictions.
https://github.com/user-attachments/assets/cbf6df0f-47ee-4959-ad6b-a77da78605a4
### Partition Update
During update, editing the name is not allowed. However, to keep visual
consistency, the prefix will still be separated and rendered as a
prepend. The input will not be editable, but it has been updated from
using `disabled` into using `readOnly`.
<img width="1000" height="411" alt="Screenshot 2025-10-29 at 16 20 31"
src="https://github.com/user-attachments/assets/660f22fd-550c-463c-b9a4-d5b219ce361c"
/>
## Gotchas
### Prefix Truncation
Given the nesting nature of partitions, the prefix can become too long
to be fully render while keeping enough space for the partition name
input. Generally, we try to render at most 25 prefix characters.
Anything above that will be truncated. In the case of narrow screens,
the prefix prepend will never be larger than half the total size of the
stream name input, regardless of characters, so anything that doesn't
fit in this limitation will also be truncated.
<img width="993" height="416" alt="Screenshot 2025-10-29 at 16 26 14"
src="https://github.com/user-attachments/assets/2a4d910a-7fd2-4614-ab40-b6ae2e05d56f"
/>
### Invalid partition names
As we've seen before, each partition is composed of a prefix with the
name of it's ancestor streams plus the partition name itself. The way we
handle nesting in the prefix is by separating each partition name from
it's predecessors with a dot. These dots are added automatically by the
system when creating partitions and the hierarchy *must* be kept in the
name, otherwise the backend will reject the partition creation.
At UI level, we didn't enforce this restriction before which could lead
users to attempt to create a partition with dots on the name, only to be
met with an error description that can be confusing.
<img width="333" height="208" alt="Screenshot 2025-10-30 at 17 02 05"
src="https://github.com/user-attachments/assets/8382b474-ed68-4ca0-b778-79799b2b55af"
/>
Notice how the error states that the parent stream and a dot must be
included, which the name `log.child.child` name does satisfy. At no
point is it explicit that partition names cannot contain dots
Instead on relaying on the server side error, this PR introduces
validation at UI level in order to display a user friendly error message
letting them know that dots cannot be used in partition names.
<img width="993" height="431" alt="Screenshot 2025-10-30 at 16 54 28"
src="https://github.com/user-attachments/assets/c9ba3144-fc9f-4b6c-b5f1-3ec1aa103b2a"
/>
Copy file name to clipboardExpand all lines: x-pack/platform/plugins/shared/streams_app/public/components/data_management/stream_detail_routing/edit_routing_stream_entry.tsx
+1-1Lines changed: 1 addition & 1 deletion
Original file line number
Diff line number
Diff line change
@@ -30,7 +30,7 @@ export function EditRoutingStreamEntry({
Copy file name to clipboardExpand all lines: x-pack/platform/plugins/shared/streams_app/public/components/data_management/stream_detail_routing/state_management/stream_routing_state_machine/stream_routing_state_machine.ts
+8-2Lines changed: 8 additions & 2 deletions
Original file line number
Diff line number
Diff line change
@@ -8,7 +8,7 @@ import type { MachineImplementationsFrom, ActorRefFrom } from 'xstate5';
Copy file name to clipboardExpand all lines: x-pack/platform/plugins/shared/streams_app/public/components/data_management/stream_detail_routing/stream_name_form_row.tsx
Copy file name to clipboardExpand all lines: x-pack/platform/plugins/shared/streams_app/test/scout/ui/tests/data_management/data_routing/create_routing_rules.spec.ts
Copy file name to clipboardExpand all lines: x-pack/platform/plugins/shared/streams_app/test/scout/ui/tests/data_management/data_routing/edit_routing_rules.spec.ts
Copy file name to clipboardExpand all lines: x-pack/platform/plugins/shared/streams_app/test/scout/ui/tests/data_management/data_routing/error_handling.spec.ts
Copy file name to clipboardExpand all lines: x-pack/platform/plugins/shared/streams_app/test/scout/ui/tests/data_management/data_routing/routing_data_preview.spec.ts
0 commit comments