RHCLOUD-49576: Add Lightwell instant email template for java_remediated - #4794
Conversation
Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
📝 WalkthroughWalkthroughAdds Lightwell email template registration, rendering, shared header and footer conditions, documentation, and Quarkus tests for package, release, CVE, severity, link, branding, and preference content. ChangesLightwell email rendering
Estimated code review effort: 3 (Moderate) | ~20 minutes Sequence Diagram(s)sequenceDiagram
participant TemplateService
participant Lightwell
participant LightwellEmailBody
participant InsightsEmailBody
TemplateService->>Lightwell: register templatesMap
Lightwell->>LightwellEmailBody: resolve Java Remediated email template
LightwellEmailBody->>InsightsEmailBody: include shared email layout
InsightsEmailBody-->>LightwellEmailBody: render conditional header and footer
Possibly related PRs
Suggested reviewers: 🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✨ Finishing Touches🧪 Generate unit tests (beta)
Comment |
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In
`@common-template/src/main/resources/templates/email/Lightwell/lightwellDefaultEmailBody.html`:
- Around line 72-78: Update the Lightwell footer link in
lightwellDefaultEmailBody.html to use the user-preferences notifications URL
with the environment, bundle, and application parameters. In
TestLightwellTemplate.java, extend the rendered-email assertion to verify this
destination in addition to the existing link label.
🪄 Autofix
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Enterprise
Run ID: ca5d59fc-5aa8-4831-be06-8aa398d4bb85
📒 Files selected for processing (5)
common-template/src/main/java/com/redhat/cloud/notifications/qute/templates/TemplateService.javacommon-template/src/main/java/com/redhat/cloud/notifications/qute/templates/mapping/Lightwell.javacommon-template/src/main/resources/templates/email/Common/insightsEmailBody.htmlcommon-template/src/main/resources/templates/email/Lightwell/lightwellDefaultEmailBody.htmlcommon-template/src/test/java/email/TestLightwellTemplate.java
|
❌ Performance Tests failed
Tests run: InsightsNotificationswebhook_runner · InsightsNotificationsgw_runner · InsightsNotificationsemail_runner 📊 Performance ResultsInsightsNotificationsemail_runner
InsightsNotificationswebhook_runner
InsightsNotificationsgw_runner
|
Switch CVE severity rendering to a dedicated severity field, cache the repeated events-count lookup, sync the Secure base template with the same header/footer override hooks, and document the new mapping class. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Move package_name/package_link from a per-release "meta" object up to the event payload, since they're the same for every release of a given package. Update the template loops to use explicit aliases (event, release, releaseName, cve) instead of the shadowed default "it", and adjust the test fixtures to match the new payload shape. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
There was a problem hiding this comment.
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️ Outside diff range comments (1)
common-template/src/main/resources/templates/email/Lightwell/lightwellDefaultEmailBody.html (1)
3-6: 🎯 Functional Correctness | 🟡 Minor | ⚡ Quick winAdd decorative
altattributes to the non-MSO severity icons.The visible severity text already labels each icon. Add
alt=""to each non-MSO<img>so assistive technology does not announce a non-descriptive image. Update the test to assert the non-MSO icon markup. The current assertions only pass because the MSO fallback images havealttext.
common-template/src/main/resources/templates/email/Lightwell/lightwellDefaultEmailBody.html#L3-L6: addalt=""to each severity-tag image.common-template/src/test/java/email/TestLightwellTemplate.java#L126-L133: assert that each rendered non-MSO severity image hasalt="".🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@common-template/src/main/resources/templates/email/Lightwell/lightwellDefaultEmailBody.html` around lines 3 - 6, The non-MSO severity icons in renderLowTag, renderModerateTag, renderImportantTag, and renderCriticalTag need decorative alt attributes. Add alt="" to each image, and update TestLightwellTemplate.java lines 126-133 to assert each rendered non-MSO severity image includes alt="".
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Outside diff comments:
In
`@common-template/src/main/resources/templates/email/Lightwell/lightwellDefaultEmailBody.html`:
- Around line 3-6: The non-MSO severity icons in renderLowTag,
renderModerateTag, renderImportantTag, and renderCriticalTag need decorative alt
attributes. Add alt="" to each image, and update TestLightwellTemplate.java
lines 126-133 to assert each rendered non-MSO severity image includes alt="".
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Enterprise
Run ID: 6e0b87e1-13ed-4f96-be3e-e2b3e319b39f
📒 Files selected for processing (4)
common-template/src/main/resources/templates/email/Lightwell/lightwellDefaultEmailBody.htmlcommon-template/src/main/resources/templates/email/Secure/Common/insightsEmailBody.htmlcommon-template/src/test/java/email/TestLightwellTemplate.javadocs/template-guidelines.md
|
❌ Performance Tests failed
Tests run: InsightsNotificationswebhook_runner · InsightsNotificationsgw_runner · InsightsNotificationsemail_runner 📊 Performance ResultsInsightsNotificationsemail_runner
InsightsNotificationswebhook_runner
InsightsNotificationsgw_runner
|
Summary
Implements the Qute instant email template for the Lightwell bundle's
java_remediatedevent type, per RHCLOUD-49576 (part of the RHCLOUD-49566 epic).lightwellDefaultEmailBody.html, rendering the list of remediated packages/releases/CVEs (with severity badges) from the event payload.Lightwell.javamapping class registering the template for thelightwell/lightwellbundle/app, and wires it intoTemplateService.Common/insightsEmailBody.htmlwith arenderHeaderTitletoggle and acontent-footerinsertion point, needed by the Lightwell template's custom header/footer.TestLightwellTemplatecovering: multi-package rendering, singular vs. plural wording, the full severity matrix (low/moderate/important/critical), the events-counter badge, the CTA button, and both footer variants (ignore_user_preferencestrue/false).Note: the same template is used for both
java_remediatedand the upcomingpython_remediatedevent type — it's mapped at the application level (Lightwell.templatesMap) rather than per-event-type, since the payload/rendering is identical for both. This mapping can be revisited if the event types diverge later.Test plan
./mvnw validate -pl :notifications-common-template(checkstyle)./mvnw test -pl :notifications-common-template -Dtest=TestLightwellTemplate(5/5 passing)🤖 Generated with Claude Code
Linked Json payload is:
Summary by CodeRabbit
New Features
Bug Fixes
Documentation
Tests