Skip to content

fix: expose is_visible in IncidentDto for workflow conditions#6282

Merged
shahargl merged 1 commit into
keephq:mainfrom
alpar:fix/incident-is-visible-dto
Apr 24, 2026
Merged

fix: expose is_visible in IncidentDto for workflow conditions#6282
shahargl merged 1 commit into
keephq:mainfrom
alpar:fix/incident-is-visible-dto

Conversation

@alpar
Copy link
Copy Markdown
Contributor

@alpar alpar commented Apr 23, 2026

Problem

{{ incident.is_visible }} resolves to an empty string in workflow if-conditions, even though the database has is_visible = t. This causes actions to be incorrectly skipped.

Reported in #6279.

Root Cause

The is_visible field exists on the database Incident model but was not included in IncidentDto. The from_db_incident() method maps many fields but skipped is_visible, so when the workflow engine renders {{ incident.is_visible }}, Mustache finds an empty value.

Notably, the similar boolean flags is_candidate and is_predicted are already exposed in the DTO — is_visible was just missed when it was introduced.

Fix

Add is_visible to IncidentDto and its serialization methods, following the exact same pattern as is_predicted and is_candidate:

  1. Add is_visible: bool = True field to IncidentDto
  2. Include is_visible=db_incident.is_visible in from_db_incident()
  3. Include is_visible=self.is_visible in to_db_incident() for round-trip consistency

Testing

Added two unit tests:

  • test_incident_dto_is_visible_from_db: verifies from_db_incident() correctly maps is_visible for both True and False values
  • test_incident_dto_is_visible_to_db: verifies to_db_incident() preserves is_visible

Closes #6279

The is_visible field exists on the database Incident model but was
missing from IncidentDto, causing {{ incident.is_visible }} to resolve
to an empty string in workflow if-conditions.

Add is_visible to IncidentDto, from_db_incident(), and to_db_incident()
for round-trip consistency, matching the existing pattern used by
is_predicted and is_candidate.

Closes keephq#6279
@dosubot dosubot Bot added size:XS This PR changes 0-9 lines, ignoring generated files. Bug Something isn't working labels Apr 23, 2026
@alpar
Copy link
Copy Markdown
Contributor Author

alpar commented Apr 23, 2026

Hi @shahargl, CI green — ready for review when you get a chance. Thanks!

Copy link
Copy Markdown
Member

@shahargl shahargl left a comment

Choose a reason for hiding this comment

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

Lgtm

@dosubot dosubot Bot added the lgtm This PR has been approved by a maintainer label Apr 24, 2026
@shahargl shahargl merged commit 256b07e into keephq:main Apr 24, 2026
5 checks passed
@github-actions
Copy link
Copy Markdown
Contributor

🎊 Well done @alpar! Two PRs merged already! 🎉🥳

With your second PR, you're on a roll, and your contributions are already making a difference. 🌟
Looking forward to seeing even more contributions from you. See you in Slack https://slack.keephq.dev 🚀

wsimon1982 pushed a commit to wsimon1982/keep that referenced this pull request May 12, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Bug Something isn't working lgtm This PR has been approved by a maintainer size:XS This PR changes 0-9 lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[🐛 Bug]: {{ incident.is_visible }} is empty in if condition for workflow.triggers.type: incident

2 participants