Skip to content

Add templates for scheduler#4306

Merged
gwenneg merged 7 commits intoRedHatInsights:masterfrom
dehort:add_scheduler_templates_1
Apr 14, 2026
Merged

Add templates for scheduler#4306
gwenneg merged 7 commits intoRedHatInsights:masterfrom
dehort:add_scheduler_templates_1

Conversation

@dehort
Copy link
Copy Markdown
Contributor

@dehort dehort commented Apr 6, 2026

Adding templates for scheduler

Starting out pretty simple to test things out

Summary by CodeRabbit

  • New Features
    • Added scheduler notifications: in-app drawer markdown messages and HTML emails for export completed, job failed, and job failed+paused events. Notifications surface job name/ID, include links to job details and export downloads, conditionally show error details, and provide guidance when a job is auto-paused. Three new scheduler notification types are available.

@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai bot commented Apr 6, 2026

Note

Reviews paused

It looks like this branch is under active development. To avoid overwhelming you with review comments due to an influx of new commits, CodeRabbit has automatically paused this review. You can configure this behavior by changing the reviews.auto_review.auto_pause_after_reviewed_commits setting.

Use the following commands to manage reviews:

  • @coderabbitai resume to resume automatic reviews.
  • @coderabbitai review to trigger a single review.

Use the checkboxes below for quick actions:

  • ▶️ Resume reviews
  • 🔍 Trigger review
📝 Walkthrough

Walkthrough

Added scheduler support to Console: new scheduler constants and three exported template identifiers, plus six new template mappings and six new template files (drawer and email variants) for export-complete, job-failed, and job-failed-paused notifications.

Changes

Cohort / File(s) Summary
Console mapping
common-template/src/main/java/com/redhat/cloud/notifications/qute/templates/mapping/Console.java
Added scheduler constants (SCHEDULER_APP_NAME, SCHEDULER_FOLDER_NAME, SCHEDULER_EXPORT_COMPLETE, SCHEDULER_JOB_FAILED, SCHEDULER_JOB_FAILED_PAUSED) and extended templatesMap with six scheduler template entries mapping drawer/email identifiers to scheduler markdown/html template paths.
Scheduler drawer templates
common-template/src/main/resources/templates/drawer/Scheduler/exportCompleteBody.md, common-template/src/main/resources/templates/drawer/Scheduler/jobFailedBody.md, common-template/src/main/resources/templates/drawer/Scheduler/jobFailedPausedBody.md
Added three drawer Markdown templates that reference {action.context.job_name} for export-complete, job-failed, and job-failed-paused notifications.
Scheduler email templates
common-template/src/main/resources/templates/email/Scheduler/exportCompleteEmailBody.html, common-template/src/main/resources/templates/email/Scheduler/jobFailedEmailBody.html, common-template/src/main/resources/templates/email/Scheduler/jobFailedPausedEmailBody.html
Added three HTML email templates that include email/Common/insightsEmailBody, set header/title to “Scheduler - Console”, link to job/export URLs via ${environment.url} and action.context fields, and conditionally render error messages when provided.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

Poem

🐇 I hopped to add a scheduler hum,
Templates placed where alerts come from.
Drawer whispers, email bells,
Job names, links, and tiny tells.
A rabbit nods: notifications done.

🚥 Pre-merge checks | ✅ 3
✅ Passed checks (3 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title accurately summarizes the main change: adding new template files for the scheduler feature across multiple template types.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ 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 and usage tips.

@github-actions
Copy link
Copy Markdown
Contributor

github-actions bot commented Apr 6, 2026

SC Environment Impact Assessment

Overall Impact: 🟢 LOW

View full report

Summary

  • Total Issues: 6
  • 🟢 Low: 6

Detailed Findings

🟢 LOW Impact

Environment configuration change detected

  • File: common-template/src/main/resources/templates/drawer/Scheduler/exportCompleteBody.md
  • Category: environment_config
  • Details:
    • Found environment in common-template/src/main/resources/templates/drawer/Scheduler/exportCompleteBody.md at line 1
  • Recommendation: Review environment-specific settings to ensure SC Environment is properly configured.

Environment configuration change detected

  • File: common-template/src/main/resources/templates/drawer/Scheduler/jobFailedBody.md
  • Category: environment_config
  • Details:
    • Found environment in common-template/src/main/resources/templates/drawer/Scheduler/jobFailedBody.md at line 1
  • Recommendation: Review environment-specific settings to ensure SC Environment is properly configured.

Environment configuration change detected

  • File: common-template/src/main/resources/templates/drawer/Scheduler/jobFailedPausedBody.md
  • Category: environment_config
  • Details:
    • Found environment in common-template/src/main/resources/templates/drawer/Scheduler/jobFailedPausedBody.md at line 1
  • Recommendation: Review environment-specific settings to ensure SC Environment is properly configured.

Environment configuration change detected

  • File: common-template/src/main/resources/templates/email/Scheduler/exportCompleteEmailBody.html
  • Category: environment_config
  • Details:
    • Found environment in common-template/src/main/resources/templates/email/Scheduler/exportCompleteEmailBody.html at line 10
    • Found environment in common-template/src/main/resources/templates/email/Scheduler/exportCompleteEmailBody.html at line 11
    • Found environment in common-template/src/main/resources/templates/email/Scheduler/exportCompleteEmailBody.html at line 14
  • Recommendation: Review environment-specific settings to ensure SC Environment is properly configured.

Environment configuration change detected

  • File: common-template/src/main/resources/templates/email/Scheduler/jobFailedEmailBody.html
  • Category: environment_config
  • Details:
    • Found environment in common-template/src/main/resources/templates/email/Scheduler/jobFailedEmailBody.html at line 10
    • Found environment in common-template/src/main/resources/templates/email/Scheduler/jobFailedEmailBody.html at line 18
  • Recommendation: Review environment-specific settings to ensure SC Environment is properly configured.

Environment configuration change detected

  • File: common-template/src/main/resources/templates/email/Scheduler/jobFailedPausedEmailBody.html
  • Category: environment_config
  • Details:
    • Found environment in common-template/src/main/resources/templates/email/Scheduler/jobFailedPausedEmailBody.html at line 10
    • Found environment in common-template/src/main/resources/templates/email/Scheduler/jobFailedPausedEmailBody.html at line 21
  • Recommendation: Review environment-specific settings to ensure SC Environment is properly configured.

Required Actions

  • Review all findings above
  • Verify SC Environment compatibility for all detected changes
  • Update deployment documentation if needed
  • Coordinate with ROSA Core team or deployment timeline

This assessment was automatically generated. Please review carefully and consult with the ROSA Core team for critical/high impact changes.

@dehort dehort force-pushed the add_scheduler_templates_1 branch from d5638ed to f70f3de Compare April 6, 2026 20:38
Copy link
Copy Markdown
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 4

🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In
`@common-template/src/main/java/com/redhat/cloud/notifications/qute/templates/mapping/Console.java`:
- Around line 96-102: The scheduler template entries use the undefined constant
TASK_APP_NAME; replace TASK_APP_NAME with the correct constant
SCHEDULER_APP_NAME in the TemplateDefinition calls for the scheduler templates
(entries that reference SCHEDULER_EXPORT_COMPLETE, SCHEDULER_JOB_FAILED, and
SCHEDULER_JOB_FAILED_PAUSED) so each entry like entry(new
TemplateDefinition(DRAWER, BUNDLE_NAME, TASK_APP_NAME,
SCHEDULER_EXPORT_COMPLETE), ...) becomes entry(new TemplateDefinition(DRAWER,
BUNDLE_NAME, SCHEDULER_APP_NAME, SCHEDULER_EXPORT_COMPLETE), ...) and likewise
for the EMAIL_BODY/DRAWER pairs using SCHEDULER_FOLDER_NAME.

In
`@common-template/src/main/resources/templates/drawer/Scheduler/jobFailedBody.md`:
- Line 1: The message in the template jobFailedBody.md is malformed because the
opening parenthesis before {action.context.job_name} is not closed; update the
text so the placeholder is wrapped with matching parentheses (i.e., change "A
scheduled export ({action.context.job_name} has failed" to include a closing ')'
after {action.context.job_name}) to produce "A scheduled export
({action.context.job_name}) has failed". Ensure you edit the template string
containing {action.context.job_name} (the placeholder) so parentheses are
balanced.

In
`@common-template/src/main/resources/templates/email/Scheduler/jobFailedEmailBody.html`:
- Around line 6-7: The email template's title currently reads "Scheduler export
completed" inside the content-title block, which is incorrect for a failure
notification; update the title text within the content-title element to a
failure-accurate string such as "Scheduler export failed" (or similar) so it
matches the failure body text in the jobFailedEmailBody.html template.

In
`@common-template/src/main/resources/templates/email/Scheduler/jobFailedPausedEmailBody.html`:
- Around line 6-7: The email template's title text is incorrect: in
Scheduler/jobFailedPausedEmailBody.html the content-title block currently reads
"Scheduler export completed" but this template is for a failed-and-paused
notification; update the content-title text to a clear failure message (e.g.,
"Scheduler export failed and paused" or "Scheduler export failed — job paused")
so the title matches the template purpose and downstream consumers like the
email subject/header reflect the failure state.
🪄 Autofix (Beta)

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: Pro

Run ID: 246f7104-0016-4575-90e2-606f687a2d76

📥 Commits

Reviewing files that changed from the base of the PR and between 0f79fc8 and f70f3de.

📒 Files selected for processing (7)
  • common-template/src/main/java/com/redhat/cloud/notifications/qute/templates/mapping/Console.java
  • common-template/src/main/resources/templates/drawer/Scheduler/exportCompleteBody.md
  • common-template/src/main/resources/templates/drawer/Scheduler/jobFailedBody.md
  • common-template/src/main/resources/templates/drawer/Scheduler/jobFailedPausedBody.md
  • common-template/src/main/resources/templates/email/Scheduler/exportCompleteEmailBody.html
  • common-template/src/main/resources/templates/email/Scheduler/jobFailedEmailBody.html
  • common-template/src/main/resources/templates/email/Scheduler/jobFailedPausedEmailBody.html

Comment thread common-template/src/main/resources/templates/drawer/Scheduler/jobFailedBody.md Outdated
@dehort dehort force-pushed the add_scheduler_templates_1 branch 4 times, most recently from 7305f8c to cf63a58 Compare April 7, 2026 15:59
Copy link
Copy Markdown
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

♻️ Duplicate comments (1)
common-template/src/main/resources/templates/email/Scheduler/jobFailedPausedEmailBody.html (1)

5-7: ⚠️ Potential issue | 🟡 Minor

Make the title explicitly include the paused state.

Line 6 says “Scheduler job failed”, but this template communicates failed and paused. Please make the title state match the body to avoid ambiguous notification labeling.

Proposed update
 {`#content-title`}
-    Scheduler job failed
+    Scheduler job failed and paused
 {/content-title}
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In
`@common-template/src/main/resources/templates/email/Scheduler/jobFailedPausedEmailBody.html`
around lines 5 - 7, The template title block {`#content-title`} currently reads
"Scheduler job failed" but the body indicates the job is both failed and paused;
update the title inside the {`#content-title`} ... {/content-title} tags to
explicitly state the paused state (e.g., "Scheduler job failed and paused" or
similar), ensuring the new wording matches the template body wording and tone.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Duplicate comments:
In
`@common-template/src/main/resources/templates/email/Scheduler/jobFailedPausedEmailBody.html`:
- Around line 5-7: The template title block {`#content-title`} currently reads
"Scheduler job failed" but the body indicates the job is both failed and paused;
update the title inside the {`#content-title`} ... {/content-title} tags to
explicitly state the paused state (e.g., "Scheduler job failed and paused" or
similar), ensuring the new wording matches the template body wording and tone.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: 0b328692-75cd-495d-be97-4c082eaea817

📥 Commits

Reviewing files that changed from the base of the PR and between f70f3de and cf63a58.

📒 Files selected for processing (7)
  • common-template/src/main/java/com/redhat/cloud/notifications/qute/templates/mapping/Console.java
  • common-template/src/main/resources/templates/drawer/Scheduler/exportCompleteBody.md
  • common-template/src/main/resources/templates/drawer/Scheduler/jobFailedBody.md
  • common-template/src/main/resources/templates/drawer/Scheduler/jobFailedPausedBody.md
  • common-template/src/main/resources/templates/email/Scheduler/exportCompleteEmailBody.html
  • common-template/src/main/resources/templates/email/Scheduler/jobFailedEmailBody.html
  • common-template/src/main/resources/templates/email/Scheduler/jobFailedPausedEmailBody.html
✅ Files skipped from review due to trivial changes (3)
  • common-template/src/main/resources/templates/drawer/Scheduler/exportCompleteBody.md
  • common-template/src/main/resources/templates/drawer/Scheduler/jobFailedBody.md
  • common-template/src/main/resources/templates/drawer/Scheduler/jobFailedPausedBody.md
🚧 Files skipped from review as they are similar to previous changes (1)
  • common-template/src/main/java/com/redhat/cloud/notifications/qute/templates/mapping/Console.java

@dehort
Copy link
Copy Markdown
Contributor Author

dehort commented Apr 7, 2026

/retest

@dehort dehort requested review from g-duval and gwenneg April 8, 2026 12:29
@dehort dehort force-pushed the add_scheduler_templates_1 branch from cf63a58 to 86a7b2d Compare April 8, 2026 12:36
Copy link
Copy Markdown
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 2

🧹 Nitpick comments (2)
common-template/src/main/resources/templates/email/Scheduler/jobFailedPausedEmailBody.html (1)

9-9: Unused payload variable.

The payload variable is assigned but never referenced. Consider removing it if not needed.

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In
`@common-template/src/main/resources/templates/email/Scheduler/jobFailedPausedEmailBody.html`
at line 9, The template defines a local variable "payload" via "{`#let`
payload=action.events[0].payload}" but never uses it; remove that unused "{`#let`
payload=action.events[0].payload}" line (or alternatively reference "payload"
where intended) to eliminate the dead variable and avoid template lint warnings;
locate the declaration in the Scheduler/jobFailedPausedEmailBody.html template
and delete or replace it accordingly.
common-template/src/main/resources/templates/email/Scheduler/jobFailedEmailBody.html (1)

9-9: Unused payload variable.

The payload variable is assigned but never referenced in this template. Consider removing it if not needed.

Suggested fix
 {`#content-body`}
-{`#let` payload=action.events[0].payload}
     <p style="{body-section-p-style}">
         The <a style="{body-section-underline-link-style}" href="{environment.url}/insights/jobs/{action.context.job_id}" target="_blank">{action.context.job_name}</a> scheduled job has failed.
     </p>
@@ -15,7 +14,6 @@
     <p style="{body-section-p-style}">
         <strong>Error:</strong> {action.context.error_message}
     </p>
     {/if}
-{/let}
 {/content-body}
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In
`@common-template/src/main/resources/templates/email/Scheduler/jobFailedEmailBody.html`
at line 9, The template defines a local variable payload via "{`#let`
payload=action.events[0].payload}" but never uses it; remove that unused
declaration (the "{`#let` payload=action.events[0].payload}" line) from the
jobFailedEmailBody.html template so there is no unused variable, or if intended
to be used, replace references to action.events[0].payload with payload in the
template (update uses in the template to reference payload instead of the long
path).
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In
`@common-template/src/main/resources/templates/email/Scheduler/jobFailedEmailBody.html`:
- Line 11: Update the jobFailedEmailBody.html template so the scheduled job link
label uses the job's name instead of the export id: replace the placeholder
{action.context.export_id} with {action.context.job_name} in the anchor text
that points to /insights/jobs/{action.context.job_id}, ensuring the link text
matches exportCompleteEmailBody.html's use of {action.context.job_name}.

In
`@common-template/src/main/resources/templates/email/Scheduler/jobFailedPausedEmailBody.html`:
- Line 11: The link label in jobFailedPausedEmailBody.html currently displays
{action.context.export_id} but should show the job name for consistency; update
the anchor text inside the line containing the href to use
{action.context.job_name} instead of {action.context.export_id} (the URL can
remain {environment.url}/insights/jobs/{action.context.job_id}), matching the
behavior in jobFailedEmailBody.html and exportCompleteEmailBody.html.

---

Nitpick comments:
In
`@common-template/src/main/resources/templates/email/Scheduler/jobFailedEmailBody.html`:
- Line 9: The template defines a local variable payload via "{`#let`
payload=action.events[0].payload}" but never uses it; remove that unused
declaration (the "{`#let` payload=action.events[0].payload}" line) from the
jobFailedEmailBody.html template so there is no unused variable, or if intended
to be used, replace references to action.events[0].payload with payload in the
template (update uses in the template to reference payload instead of the long
path).

In
`@common-template/src/main/resources/templates/email/Scheduler/jobFailedPausedEmailBody.html`:
- Line 9: The template defines a local variable "payload" via "{`#let`
payload=action.events[0].payload}" but never uses it; remove that unused "{`#let`
payload=action.events[0].payload}" line (or alternatively reference "payload"
where intended) to eliminate the dead variable and avoid template lint warnings;
locate the declaration in the Scheduler/jobFailedPausedEmailBody.html template
and delete or replace it accordingly.
🪄 Autofix (Beta)

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: Pro

Run ID: 7a14c3ef-a3e8-450b-b960-d09d4ee2870b

📥 Commits

Reviewing files that changed from the base of the PR and between cf63a58 and 86a7b2d.

📒 Files selected for processing (7)
  • common-template/src/main/java/com/redhat/cloud/notifications/qute/templates/mapping/Console.java
  • common-template/src/main/resources/templates/drawer/Scheduler/exportCompleteBody.md
  • common-template/src/main/resources/templates/drawer/Scheduler/jobFailedBody.md
  • common-template/src/main/resources/templates/drawer/Scheduler/jobFailedPausedBody.md
  • common-template/src/main/resources/templates/email/Scheduler/exportCompleteEmailBody.html
  • common-template/src/main/resources/templates/email/Scheduler/jobFailedEmailBody.html
  • common-template/src/main/resources/templates/email/Scheduler/jobFailedPausedEmailBody.html
✅ Files skipped from review due to trivial changes (3)
  • common-template/src/main/resources/templates/drawer/Scheduler/jobFailedBody.md
  • common-template/src/main/resources/templates/drawer/Scheduler/jobFailedPausedBody.md
  • common-template/src/main/resources/templates/drawer/Scheduler/exportCompleteBody.md
🚧 Files skipped from review as they are similar to previous changes (1)
  • common-template/src/main/java/com/redhat/cloud/notifications/qute/templates/mapping/Console.java

@dehort dehort force-pushed the add_scheduler_templates_1 branch from 86a7b2d to e0a4bb6 Compare April 9, 2026 03:01
Copy link
Copy Markdown
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 1

🧹 Nitpick comments (3)
common-template/src/main/resources/templates/email/Scheduler/jobFailedEmailBody.html (1)

9-9: Remove unused payload variable.

The payload variable is declared but never referenced in the template body. Consider removing it to keep the code clean.

♻️ Proposed cleanup
 {`#content-body`}
-{`#let` payload=action.events[0].payload}
     <p style="{body-section-p-style}">
         The <a style="{body-section-underline-link-style}" href="{environment.url}/insights/jobs/{action.context.job_id}" target="_blank">{action.context.job_name}</a> scheduled job has failed.
     </p>
     {`#if` action.context.error_message}
     <p style="{body-section-p-style}">
         <strong>Error:</strong> {action.context.error_message}
     </p>
     {/if}
-{/let}
 {/content-body}
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In
`@common-template/src/main/resources/templates/email/Scheduler/jobFailedEmailBody.html`
at line 9, Remove the unused template variable declaration "{`#let`
payload=action.events[0].payload}" from the template since `payload` is never
referenced; locate the let binding in the Scheduler jobFailedEmailBody.html
template (the "{`#let` payload=...}" line) and delete it to keep the template
clean and avoid unused variable warnings, then run template lint/tests to
confirm no other references exist.
common-template/src/main/resources/templates/email/Scheduler/jobFailedPausedEmailBody.html (1)

9-9: Remove unused payload variable.

The payload variable is declared but never referenced in the template body. Consider removing it to keep the code clean.

♻️ Proposed cleanup
 {`#content-body`}
-{`#let` payload=action.events[0].payload}
     <p style="{body-section-p-style}">
         The <a style="{body-section-underline-link-style}" href="{environment.url}/insights/jobs/{action.context.job_id}" target="_blank">{action.context.job_name}</a> scheduled job has failed and been automatically paused.
     </p>
     {`#if` action.context.error_message}
     <p style="{body-section-p-style}">
         <strong>Error:</strong> {action.context.error_message}
     </p>
     {/if}
     <p style="{body-section-p-style}">
         The scheduled job has been paused to prevent further failures. Please review and resolve the issue before resuming the scheduled job.
     </p>
-{/let}
 {/content-body}
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In
`@common-template/src/main/resources/templates/email/Scheduler/jobFailedPausedEmailBody.html`
at line 9, The template defines an unused local variable payload via the
expression "let payload=action.events[0].payload" which is never referenced;
remove that declaration from the template (the "{`#let`
payload=action.events[0].payload}" line) so the template no longer creates the
unused symbol and stays clean.
common-template/src/main/resources/templates/email/Scheduler/exportCompleteEmailBody.html (1)

11-12: Add rel="noopener noreferrer" to external links.

Both links use target="_blank" but lack the rel="noopener noreferrer" attribute. While modern browsers automatically apply noopener behavior, explicitly adding this attribute is a security best practice that prevents the new page from accessing window.opener and protects against potential tabnabbing attacks.

🔒 Proposed fix to add rel attribute
     <p style="{body-section-p-style}">
-        The <a style="{body-section-underline-link-style}" href="{environment.url}/insights/jobs/{action.context.job_id}" target="_blank">{action.context.job_name}</a> scheduled export has completed successfully.
-        <a style="{body-section-underline-link-style}" href="{environment.url}/api/exports/v1/exports/{action.context.export_id}" target="_blank">Download exported data</a>.
+        The <a style="{body-section-underline-link-style}" href="{environment.url}/insights/jobs/{action.context.job_id}" target="_blank" rel="noopener noreferrer">{action.context.job_name}</a> scheduled export has completed successfully.
+        <a style="{body-section-underline-link-style}" href="{environment.url}/api/exports/v1/exports/{action.context.export_id}" target="_blank" rel="noopener noreferrer">Download exported data</a>.
     </p>
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In
`@common-template/src/main/resources/templates/email/Scheduler/exportCompleteEmailBody.html`
around lines 11 - 12, The two anchor elements in the
exportCompleteEmailBody.html template (the link to
insights/jobs/{action.context.job_id} and the link to
/api/exports/v1/exports/{action.context.export_id}) use target="_blank" but lack
rel="noopener noreferrer"; update both <a> tags in exportCompleteEmailBody.html
to include rel="noopener noreferrer" so new tabs cannot access window.opener and
to mitigate tabnabbing risks.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In
`@common-template/src/main/resources/templates/email/Scheduler/exportCompleteEmailBody.html`:
- Line 9: The template defines an unused local binding "{`#let`
payload=action.events[0].payload}" which is never referenced; remove that line
to eliminate the unused `payload` variable and leave the rest of the template
intact so rendering is unchanged.

---

Nitpick comments:
In
`@common-template/src/main/resources/templates/email/Scheduler/exportCompleteEmailBody.html`:
- Around line 11-12: The two anchor elements in the exportCompleteEmailBody.html
template (the link to insights/jobs/{action.context.job_id} and the link to
/api/exports/v1/exports/{action.context.export_id}) use target="_blank" but lack
rel="noopener noreferrer"; update both <a> tags in exportCompleteEmailBody.html
to include rel="noopener noreferrer" so new tabs cannot access window.opener and
to mitigate tabnabbing risks.

In
`@common-template/src/main/resources/templates/email/Scheduler/jobFailedEmailBody.html`:
- Line 9: Remove the unused template variable declaration "{`#let`
payload=action.events[0].payload}" from the template since `payload` is never
referenced; locate the let binding in the Scheduler jobFailedEmailBody.html
template (the "{`#let` payload=...}" line) and delete it to keep the template
clean and avoid unused variable warnings, then run template lint/tests to
confirm no other references exist.

In
`@common-template/src/main/resources/templates/email/Scheduler/jobFailedPausedEmailBody.html`:
- Line 9: The template defines an unused local variable payload via the
expression "let payload=action.events[0].payload" which is never referenced;
remove that declaration from the template (the "{`#let`
payload=action.events[0].payload}" line) so the template no longer creates the
unused symbol and stays clean.
🪄 Autofix (Beta)

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: Pro

Run ID: 7a76f84c-31c9-46ab-aca9-0caab0ca20db

📥 Commits

Reviewing files that changed from the base of the PR and between 86a7b2d and e0a4bb6.

📒 Files selected for processing (7)
  • common-template/src/main/java/com/redhat/cloud/notifications/qute/templates/mapping/Console.java
  • common-template/src/main/resources/templates/drawer/Scheduler/exportCompleteBody.md
  • common-template/src/main/resources/templates/drawer/Scheduler/jobFailedBody.md
  • common-template/src/main/resources/templates/drawer/Scheduler/jobFailedPausedBody.md
  • common-template/src/main/resources/templates/email/Scheduler/exportCompleteEmailBody.html
  • common-template/src/main/resources/templates/email/Scheduler/jobFailedEmailBody.html
  • common-template/src/main/resources/templates/email/Scheduler/jobFailedPausedEmailBody.html
✅ Files skipped from review due to trivial changes (3)
  • common-template/src/main/resources/templates/drawer/Scheduler/exportCompleteBody.md
  • common-template/src/main/resources/templates/drawer/Scheduler/jobFailedBody.md
  • common-template/src/main/resources/templates/drawer/Scheduler/jobFailedPausedBody.md
🚧 Files skipped from review as they are similar to previous changes (1)
  • common-template/src/main/java/com/redhat/cloud/notifications/qute/templates/mapping/Console.java

@dehort dehort force-pushed the add_scheduler_templates_1 branch from e0a4bb6 to 1f30101 Compare April 9, 2026 03:09
Copy link
Copy Markdown
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

🧹 Nitpick comments (2)
common-template/src/main/resources/templates/email/Scheduler/jobFailedEmailBody.html (1)

9-11: LGTM! Link implementation fixed.

The previously flagged issue where the link text incorrectly used {action.context.export_id} has been successfully fixed to use {action.context.job_name}, maintaining consistency with other scheduler templates.

Optional: Add rel="noopener" for security best practice

Consider adding rel="noopener" to the link for defense-in-depth security:

-        The <a style="{body-section-underline-link-style}" href="{environment.url}/insights/jobs/{action.context.job_id}" target="_blank">{action.context.job_name}</a> scheduled job has failed.
+        The <a style="{body-section-underline-link-style}" href="{environment.url}/insights/jobs/{action.context.job_id}" target="_blank" rel="noopener">{action.context.job_name}</a> scheduled job has failed.

This prevents the new page from accessing window.opener, though the risk is minimal for internal console links.

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In
`@common-template/src/main/resources/templates/email/Scheduler/jobFailedEmailBody.html`
around lines 9 - 11, The anchor in jobFailedEmailBody.html uses
{environment.url}/insights/jobs/{action.context.job_id} and currently opens in a
new tab; add rel="noopener" to the <a> element for the job link (the anchor
wrapping {action.context.job_name}) to prevent the opened page from accessing
window.opener and improve security.
common-template/src/main/resources/templates/email/Scheduler/jobFailedPausedEmailBody.html (1)

5-7: Consider mentioning "paused" in the title for clarity.

The title "Scheduler job failed" is accurate, but since this template is specifically for jobs that failed and were automatically paused (as reflected in the filename and body text), adding "and paused" would make the title more specific and help recipients immediately understand the full state.

📝 Optional clarity enhancement
 {`#content-title`}
-    Scheduler job failed
+    Scheduler job failed and paused
 {/content-title}
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In
`@common-template/src/main/resources/templates/email/Scheduler/jobFailedPausedEmailBody.html`
around lines 5 - 7, Update the title in the template's content-title block to
reflect that the job was both failed and paused: change the {`#content-title`}
value in jobFailedPausedEmailBody.html (the content-title block) to a more
specific phrase such as "Scheduler job failed and paused" or "Scheduler job
failed and was paused" so the subject matches the template's intent.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Nitpick comments:
In
`@common-template/src/main/resources/templates/email/Scheduler/jobFailedEmailBody.html`:
- Around line 9-11: The anchor in jobFailedEmailBody.html uses
{environment.url}/insights/jobs/{action.context.job_id} and currently opens in a
new tab; add rel="noopener" to the <a> element for the job link (the anchor
wrapping {action.context.job_name}) to prevent the opened page from accessing
window.opener and improve security.

In
`@common-template/src/main/resources/templates/email/Scheduler/jobFailedPausedEmailBody.html`:
- Around line 5-7: Update the title in the template's content-title block to
reflect that the job was both failed and paused: change the {`#content-title`}
value in jobFailedPausedEmailBody.html (the content-title block) to a more
specific phrase such as "Scheduler job failed and paused" or "Scheduler job
failed and was paused" so the subject matches the template's intent.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: c571c318-8ec2-4a37-8cb8-6a49aa11b78f

📥 Commits

Reviewing files that changed from the base of the PR and between e0a4bb6 and 1f30101.

📒 Files selected for processing (7)
  • common-template/src/main/java/com/redhat/cloud/notifications/qute/templates/mapping/Console.java
  • common-template/src/main/resources/templates/drawer/Scheduler/exportCompleteBody.md
  • common-template/src/main/resources/templates/drawer/Scheduler/jobFailedBody.md
  • common-template/src/main/resources/templates/drawer/Scheduler/jobFailedPausedBody.md
  • common-template/src/main/resources/templates/email/Scheduler/exportCompleteEmailBody.html
  • common-template/src/main/resources/templates/email/Scheduler/jobFailedEmailBody.html
  • common-template/src/main/resources/templates/email/Scheduler/jobFailedPausedEmailBody.html
✅ Files skipped from review due to trivial changes (4)
  • common-template/src/main/resources/templates/drawer/Scheduler/exportCompleteBody.md
  • common-template/src/main/resources/templates/drawer/Scheduler/jobFailedBody.md
  • common-template/src/main/resources/templates/drawer/Scheduler/jobFailedPausedBody.md
  • common-template/src/main/java/com/redhat/cloud/notifications/qute/templates/mapping/Console.java

@gwenneg gwenneg self-assigned this Apr 9, 2026
Comment thread common-template/src/main/resources/templates/drawer/Scheduler/jobFailedBody.md Outdated
Copy link
Copy Markdown
Member

@gwenneg gwenneg left a comment

Choose a reason for hiding this comment

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

Templates are usually tested. We'll need tests before they hit prod. Do you want to take care of it now or later?

@dehort
Copy link
Copy Markdown
Contributor Author

dehort commented Apr 9, 2026

/retest

dehort and others added 6 commits April 13, 2026 13:19
Co-authored-by: Gwenneg Lepage <gwenneg@users.noreply.github.com>
Co-authored-by: Gwenneg Lepage <gwenneg@users.noreply.github.com>
Updating tests to reflect the change above
@dehort dehort force-pushed the add_scheduler_templates_1 branch from ec26235 to 918f89c Compare April 13, 2026 18:19
Copy link
Copy Markdown
Member

@gwenneg gwenneg left a comment

Choose a reason for hiding this comment

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

LGTM

@gwenneg gwenneg merged commit 1f8afb4 into RedHatInsights:master Apr 14, 2026
53 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.

2 participants