Skip to content

ui: make silence creator and comment optional - #5471

Merged
SoloJacobs merged 3 commits into
prometheus:mainfrom
neoLsH:silence-form-optional-creator-comment
Aug 28, 2026
Merged

ui: make silence creator and comment optional#5471
SoloJacobs merged 3 commits into
prometheus:mainfrom
neoLsH:silence-form-optional-creator-comment

Conversation

@neoLsH

@neoLsH neoLsH commented Aug 25, 2026

Copy link
Copy Markdown
Contributor

Pull Request Checklist

  • Please list all open issue(s) discussed with maintainers related to this change
  • Is this a new Receiver integration?
    • I have already tried to use the Webhook Receiver Integration and 3rd party integrations before adding this new Receiver Integration
  • Is this a bugfix?
    • I have added tests that can reproduce the bug which pass with this bugfix applied
  • Is this a new feature?
    • I have added tests that test the new feature's functionality
  • Does this change affect performance?
    • I have provided benchmarks comparison that shows performance is improved or is not degraded
    • I have added new benchmarks if required or requested by maintainers
  • Is this a breaking change?
    • My changes do not break the existing cluster messages
    • My changes do not break the existing api
  • I have added/updated the required documentation
  • I have signed-off my commits
  • I will follow best practices for contributing to this project

Which user-facing changes does this PR introduce?

The API already accepts silences without a createdBy or a comment (see TestValidateSilence, where a valid silence carries neither), but the web UI rejected the silence form unless both fields were filled in. This made it impossible to create a silence from the UI that the API itself happily accepts.

This change drops the client-side non-empty validation for the Creator and Comment fields so the form matches the API, labels both fields as "(Optional)", and removes the now-unused stringNotEmpty helper. Matchers, start/end time and duration are still validated as before.

Verified locally with make test in ui/app (elm-format, elm-review and the elm-test suite all pass, including new toSilence/validateForm tests) and a full UI build.

[ENHANCEMENT] ui: The silence form no longer requires a creator and a comment, matching the API. #5471

The API already accepts silences without a creator or a comment, but the
web UI rejected the form unless both fields were filled. Drop the
client-side non-empty validation so the form matches the API, label the
fields as optional, and remove the now-unused stringNotEmpty helper.

Signed-off-by: neoLsH <43921685+neoLsH@users.noreply.github.com>
@neoLsH
neoLsH requested a review from a team as a code owner August 25, 2026 17:35
Signed-off-by: neoLsH <43921685+neoLsH@users.noreply.github.com>
@coderabbitai

coderabbitai Bot commented Aug 25, 2026

Copy link
Copy Markdown

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro Plus

Run ID: 0a151fc5-60e7-43dd-b913-ed05ca93b6a6

📥 Commits

Reviewing files that changed from the base of the PR and between 17462d1 and 445717b.

📒 Files selected for processing (1)
  • CHANGELOG.md
🚧 Files skipped from review as they are similar to previous changes (1)
  • CHANGELOG.md

Included review availability: Your plan provides up to 8 included reviews per hour; 7 remain after this review.


📝 Walkthrough

Walkthrough

The silence form no longer requires creator or comment values. Matcher and time validation remain required. Tests cover empty and populated fields and invalid times.

Changes

Silence form validation

Layer / File(s) Summary
Silence validation and conversion
ui/app/src/Utils/FormValidation.elm, ui/app/src/Views/SilenceForm/Types.elm, ui/app/src/Views/SilenceForm/Updates.elm
Removed non-empty validation for creator and comment. toSilence now uses their current values. Matcher and time parsing remain required.
Optional fields and regression coverage
ui/app/src/Views/SilenceForm/Views.elm, ui/app/tests/SilenceForm.elm, CHANGELOG.md
Marked creator and comment as optional, stopped field-specific validation, and added tests for empty values, populated values, missing matchers, and invalid times. The changelog records the enhancement.

Estimated code review effort: 2 (Simple) | ~10 minutes

Merge Risk: ⚪ Minimal · up to 44571

The silence form now allows empty creator and comment fields while retaining validation for matchers and timing fields, matching the existing API behavior. No actionable merge-blocking risk remains beyond normal checks and review.

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly and concisely describes the main change: making the silence form’s Creator and Comment fields optional.
Description check ✅ Passed The description includes the checklist, linked issue, user-facing change summary, release note, implementation details, test coverage, and verification results. It is complete and relevant.
Linked Issues check ✅ Passed The changes satisfy issue #2998 by removing UI requirements for non-empty Creator and Comment fields while preserving validation for matchers and time fields. The added tests cover empty and populated…
Out of Scope Changes check ✅ Passed The changes remain within scope. They update silence-form validation, labels, related helper usage, tests, and documentation required to align the UI with the API.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check. Docstring coverage is scoped to functions touched by this diff. Analyzed 0 functions across 0…
Full details: Linked Issues check

Explanation

The changes satisfy issue #2998 by removing UI requirements for non-empty Creator and Comment fields while preserving validation for matchers and time fields. The added tests cover empty and populated values.

Full details: Docstring Coverage

Explanation

No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check. Docstring coverage is scoped to functions touched by this diff. Analyzed 0 functions across 0 files. (1 skipped: 1 unsupported.)

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@SoloJacobs
SoloJacobs self-requested a review August 26, 2026 09:36

@SoloJacobs SoloJacobs left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Hmm, the change here clearly does not full-fill #2998 as it was currently intended: The intent being to make Creator and Comment mandatory in the API. However, due to that being a breaking change, we will never change api v2 in that way.

I also don't think asserting that a field should be non-empty in the API is all that helpful: What users really want is that they can trace who silenced what and why.

Currently, the UI is doing a bit of work in that direction: It's a polite reminder that this information is important and useful. So, I think for some organizations this change might be a regression: Somebody might be too lazy to put the information in the UI, but they are probably are not malicious enough to craft an API response, just so they don't have to set the field.

Overall, I'm really undecided whether we should take this patch.

@neoLsH

neoLsH commented Aug 26, 2026

Copy link
Copy Markdown
Contributor Author

Thanks a lot for taking the time to review, and for the thoughtful perspective — this is really helpful for me as a first-time contributor here.

You're right that I hadn't considered the full picture. When I picked up #2998, I focused narrowly on the UI/API consistency aspect, and since making the fields mandatory in api v2 isn't possible (as you pointed out, it would be a breaking change), relaxing the UI looked to me like the remaining way to resolve the inconsistency. I didn't think deeply enough about the role the current validation plays beyond validation — as a nudge that encourages people to leave traceability information ("who silenced what, and why"), which clearly has real value for organizations running Alertmanager in teams. I can see how removing it entirely could be a regression there, and I appreciate you pointing that out.

I'd love to discuss what the best resolution is, and I'm happy to go in whatever direction the maintainers prefer. A few possibilities I can think of, in case any is useful:

  1. Soft hint instead of a hard block — keep creator/comment optional, but show a non-blocking note in the form (e.g. "Consider adding a creator and a comment so others understand why this alert is silenced"). This keeps the nudge while not rejecting a payload the API accepts. I'd be glad to implement this.
  2. Leave the UI as it is and instead close Silence creator and comment is required in the UI but not in the API #2998 as "won't fix", since the API direction is off the table and the UI strictness is arguably a feature, not a bug.
  3. Something else entirely — e.g. pre-filling createdBy from context where available — I'm open to ideas.

Thanks again for the guidance. Just let me know which way you'd like to go, and I'll update (or close) the PR accordingly.

@w0rm

w0rm commented Aug 26, 2026

Copy link
Copy Markdown
Member

It’s kind of strange that the ui check is used as a guardrail for otherwise a valid API request. I think it makes sense to align them one way or another.

Also the non empty check is not doing that much of a job, the user can enter gibberish there to bypass validation.

@SoloJacobs

Copy link
Copy Markdown
Contributor

Hi @neoLsH ,

I appreciate the offer to help, but your PR already has the right shape, we just need to make a decision. I will ask a third maintainer, then we will see :-)

Kind regards

Signed-off-by: neoLsH <43921685+neoLsH@users.noreply.github.com>
@SoloJacobs

Copy link
Copy Markdown
Contributor

This was discussed in the WG meeting. Consensus is:

  • We can take this PR.
  • But the new API/UI will definitely revert back to being more strict about this behaviour.

@SoloJacobs
SoloJacobs merged commit 88142e2 into prometheus:main Aug 28, 2026
8 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Silence creator and comment is required in the UI but not in the API

3 participants