Skip to content

fix(discord): classify customer template failures as configuration errors - #5751

Merged
shekhar-rudder merged 5 commits into
developfrom
harness/RUD-3442-fix-discord-classify-customer-t-e92fdbdb
Nov 2, 2026
Merged

shekhar-rudder merged 5 commits into
developfrom
harness/RUD-3442-fix-discord-classify-customer-t-e92fdbdb

Conversation

@rudder-devbox

@rudder-devbox rudder-devbox Bot commented Oct 30, 2026

Copy link
Copy Markdown
Contributor

What are the changes introduced in this PR?

Classify compilation and rendering failures in Discord’s customer-configured event, identify, and embed templates as 400 dataValidation configuration errors. Add unit and component regression coverage.

What is the related Linear task?

Resolves RUD-3442

Please explain the objectives of your changes below

Stop retrying events that cannot succeed because of a customer template error, while keeping internal defects distinguishable as 500s.

Any changes to existing capabilities/behaviour, mention the reason & what are the changes ?

Bad configured templates now report an actionable 400 naming the template rather than a retryable 500. Valid output and internally generated fallback error classification are unchanged.

Any new dependencies introduced with this change?

None.

Any new generic utility introduced or modified. Please explain the changes.

Added compileAndRenderUserTemplate to guard Handlebars compilation and rendering of customer-configured templates only.

Any technical or performance related pointers to consider with the change?

No material performance change. Full-corpus secret-path regeneration and byte comparison passed with no artifact diff.

Validation

  • npm run lint — passed.
  • Focused unit tests — 231 passed.
  • Discord, Slack, and Trengo component suites — 12, 8, and 19 tests passed respectively.
  • Source and test TypeScript typechecks, Prettier check, git diff --check, and npm run check:secret-paths — passed.
  • Code-simplify review (reuse, simplification, efficiency, altitude): No simplifications worth making.
  • Live mini verification — skipped. mini ps and mini list exited 0 and showed no running stack or workspace; no live transform request was made. The task designates the passing component tests as sufficient and does not require manual smoke.

⚠️ Known Issues

  • The changed transformer source was not exercised on a live mini stack. No stack was running, so live provenance is unconfirmed; the recorded unit and component suites provide the validation evidence.

Developer checklist

  • My code follows the style guidelines of this project
  • No breaking changes are being introduced.
  • All related docs linked with the PR?
  • All changes manually tested? (automated coverage added; no manual smoke test)
  • Any documentation changes needed with this change? (none)
  • Is the PR limited to 10 file changes?
  • Is the PR limited to one linear task?
  • Are relevant unit and component test-cases added in new readability format?

Reviewer checklist

  • Is the type of change in the PR title appropriate as per the changes?
  • Verified that there are no credentials or confidential data exposed with the changes.

⚠️ Auto-review unresolved

Adversarial self-review surfaced findings that were not auto-fixed. Each carries its disposition — please evaluate before merging.

  • medium: Dynamic partial errors can disclose event values in 400 responses — src/v0/util/index.js:909 — not auto-fixed (iteration budget exhausted)

@rudder-devbox

rudder-devbox Bot commented Oct 30, 2026

Copy link
Copy Markdown
Contributor Author

👋 I'm rudder-devbox. I opened this PR from task RUD-3442.

Mention @devbox or @rudder-devbox and I'll act on it — on a top-level PR comment,
in a review summary, or on an inline comment on the diff. Without a mention I won't see it.

@coderabbitai

coderabbitai Bot commented Oct 30, 2026 •

Copy link
Copy Markdown
Contributor

Important

Review skipped

Auto reviews are disabled on this repository. Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

Run configuration
  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: Repository UI
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: a8d42a31-b779-47e7-8621-5bd265a1027d

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • Trigger review
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

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

The test mocked Handlebars.compile to assert the hardcoded default templates
still surface as 500s, which pins implementation rather than behaviour.
Component cases in processor/data.ts and the util tests cover the change.

Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
@codecov

codecov Bot commented Oct 30, 2026 •

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 92.42%. Comparing base (0f4947b) to head (c44c69c).
⚠️ Report is 4 commits behind head on develop.

Additional details and impacted files
@@           Coverage Diff            @@
##           develop    #5751   +/-   ##
========================================
  Coverage    92.42%   92.42%           
========================================
  Files          741      741           
  Lines        41048    41050    +2     
  Branches      9635     9558   -77     
========================================
+ Hits         37938    37940    +2     
- Misses        2848     2926   +78     
+ Partials       262      184   -78     

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@shekhar-rudder
shekhar-rudder marked this pull request as ready for review November 2, 2026 06:48
Copilot AI balanced review requested due to automatic review settings November 2, 2026 06:48
@shekhar-rudder
shekhar-rudder requested review from a team as code owners November 2, 2026 06:48

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🟡 Changes recommended

Configuration-error responses can still expose event values through raw Handlebars exception text, requiring value-free diagnostics and a dynamic-partial privacy regression test.

1 open issue
What changed in this PR

This PR classifies Discord customer-template compilation and rendering failures as 400 configuration errors to avoid futile retries, while preserving 500 errors for internally generated templates.

Changes:

  • Adds a shared helper for customer-template compilation and rendering.
  • Applies the helper to Discord event, identify, and embed templates.
  • Adds unit and component regression coverage for template failures.
File Description
test/​integrations/​destinations/​discord/​processor/​data.ts Adds failure cases for all four configured template types.
test/​integrations/​destinations/​discord/​common.ts Provides shared event, destination, and error fixtures.
src/​v0/​util/​index.test.js Tests valid rendering, error classification, and parse-excerpt removal.
src/​v0/​util/​index.js Adds and exports the customer-template error wrapper.
src/​v0/​destinations/​discord/​transform.js Wraps configured templates while leaving fallback handling unchanged.

Review effort: Balanced

Comment thread src/v0/util/index.js Resolved
Copilot AI balanced review requested due to automatic review settings November 2, 2026 06:52

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🟡 Changes recommended

Handlebars error messages can still expose sensitive runtime values in 400 responses, and diagnostics do not identify the failing template field.

2 open issues

Review effort: Balanced

Comment thread src/v0/util/index.js Resolved
@rudder-devbox

rudder-devbox Bot commented Nov 2, 2026

Copy link
Copy Markdown
Contributor Author

I couldn’t fix this in the repository. All five live jobs failed in hashicorp/vault-action at “Get Vault Secrets” with ##[error]socket hang up, before any integration test ran. This is a Vault connection failure; the workflow needs its secret service connectivity restored and the failed jobs rerun. No code change was made.

…erTemplate"

This reverts commit fdfa1fc. The label tells customers which of the four
Discord template fields failed to render.

Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
Copilot AI balanced review requested due to automatic review settings November 2, 2026 07:19

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🔵 Needs a closer look

The error helper still forwards arbitrary Handlebars exception text, allowing sensitive event values used as dynamic partial names to leak into 400 responses.

2 open issues

Review effort: Balanced

@sonarqubecloud

sonarqubecloud Bot commented Nov 2, 2026

Copy link
Copy Markdown

@shekhar-rudder
shekhar-rudder merged commit 42b4cd1 into develop Nov 2, 2026
53 checks passed
@shekhar-rudder
shekhar-rudder deleted the harness/RUD-3442-fix-discord-classify-customer-t-e92fdbdb branch November 2, 2026 09:30
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.

3 participants