Graylog2 / Graylog2/graylog2-server

Stream description inconsistency between Input Wizard and Streams screen

Open
#25,216 2 comments 0 reactions 0 assignees View on GitHub
bug frontend triaged
Dominant language
Java
Stars
8.1k
Forks
1.1k
Avg merge
1d 20h
Merged PRs (30d)
217

Description

## Expected Behavior

When a Stream is created with an empty description, the stored value for the `description` field should be consistent regardless of which UI path was used to create the stream.

## Current Behavior

When creating a Stream with an empty description from the **Streams screen**, the backend receives an empty string `""` for the `description` field. When creating a Stream with an empty description from the **Input Setup Wizard** (Routing step), the `description` field is omitted entirely from the MongoDB document.

## Possible Solution

Update `CreateStreamForm.tsx` to default the `description` initial value to `''` (empty string) instead of `undefined`, matching the behavior of `StreamModal.tsx`.

## Steps to Reproduce (for bugs)

1. Create a Stream from the **Streams screen** (e.g. "test-stream-no-desc-0") and leave the description field empty.
2. Create a Stream from the **Input Setup Wizard** (e.g. "test-stream-no-desc-1") by selecting "Create new stream" in the Routing step and leave the description field empty.
3. Query MongoDB to compare the stored values:
```js
db.streams.find(
{title: {$in: ["test-stream-no-desc-0", "test-stream-no-desc-1"]}},
{title: 1, description: 1}
).forEach(s => {
print(s.title + " → description: " + JSON.stringify(s.description) + " (type: " + typeof s.description + ")")
})
```
4. Observe the output:
```
test-stream-no-desc-0 → description: "" (type: string)
test-stream-no-desc-1 → description: undefined (type: undefined)
```

## Context

The inconsistency originates from different default values used in the two creation forms:

- `StreamModal.tsx` (Streams screen) defaults `description` to `''` (line 71).
- `CreateStreamForm.tsx` (Input Setup Wizard) defaults `description` to `undefined` (line 101), and `useSetupInputMutations.ts` also explicitly sets `description: undefined` (line 41) before spreading the stream object.

When `undefined` is serialized to JSON, the key is omitted entirely, so the backend's `@Nullable` `description` field in `CreateStreamRequest.java` deserializes it as `null`. Jackson then omits `null` values when writing to MongoDB, so the field is absent from the document entirely.

Relevant files:
- `graylog2-web-interface/src/components/streams/StreamModal.tsx`
- `graylog2-web-interface/src/components/inputs/InputSetupWizard/steps/components/CreateStreamForm.tsx`
- `graylog2-web-interface/src/components/inputs/InputSetupWizard/hooks/useSetupInputMutations.ts`
- `graylog2-web-interface/src/hooks/useStreamMutations.ts`

## Your Environment

* Graylog Version: 7.1.0-SNAPSHOT (5bc5da03d2)
* Java Version: 21
* OpenSearch Version: opensearchproject/opensearch:2.19.3
* MongoDB Version: mongo:7.0
* Operating System: macOS 26.3
* Browser version: Chrome 145.0.0.0

## Checklist

- [x] This issue fix need to be backported.
- [ ] Does this issue have **security** implications?

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.