Skip to content

feat(router): report delivery payload for 296 delivered-with-warning - #7213

Merged
ItsSudip merged 3 commits into
release/1.81.xfrom
feature/int-6637-rudder-server-add-delivery-payload-for-success-scenario-in
Jul 28, 2026
Merged

ItsSudip merged 3 commits into
release/1.81.xfrom
feature/int-6637-rudder-server-add-delivery-payload-for-success-scenario-in

Conversation

@ItsSudip

@ItsSudip ItsSudip commented Jul 24, 2026 •

Copy link
Copy Markdown
Member

🔒 Scanned for secrets using gitleaks 8.28.0

Description

On the router's success path, postStatusOnResponseQ reported the router input payload (JobT.EventPayload) to reporting for every status code — the success branch hardcoded payload: inputPayload, so the transformed body actually sent to the destination was never available to reporting. (The payload local derived from reportJobsdbPayload is only consumed by the failure branch.)

For the 296 "Delivered with Warning" outcome, the Events tab needs to show what was actually delivered, not the input event. This PR reports destinationJob.Message for 296 only.

Changes

  • utils/types: add DeliveredWithWarningCode = 296 alongside the existing FilterEventCode / SuppressEventCode constants, so the status code isn't a magic number.
  • router/worker.go: in the success branch of postStatusOnResponseQ, report destinationJob.Message instead of the input payload when the status is 296, and set payloadStage=delivery on the status so reporting can tell the sample is the delivery body rather than the input event.
  • router/handle.go, router/handle_lifecycle.go: add store296DeliveryPayload, a reloadable per-destType bool (default true) mirroring the existing reportJobsdbPayload. Flipping it off reverts delivery-payload reporting without disabling the warnings feature — the warning status and the destination's response body are unaffected.

Scope

The behaviour change is strictly limited to respStatusCode == 296. 200, the filter code (298), and the failure path are unchanged — the new value is computed in a separate successPayload local rather than reusing the reportJobsdbPayload-driven payload, so 200-success behaviour is untouched even when that flag is false.

Testing

New TestPostStatusOnResponseQ296DeliveryPayload covers: 296 → delivery body + payloadStage=delivery; 200 → input payload with no marker; 296 with the kill-switch off → input payload; filter code → still Filtered with input payload; empty delivery body on 296 → empty, no panic. go build ./..., go vet, and the full TestRouter suite pass.

Linear Ticket

https://linear.app/rudderstack/issue/INT-6637/rudder-server-add-delivery-payload-for-success-scenario-in-reporting

Security

  • The code changed/added as part of this pull request won't create any security issues with how the software is being used.

@codecov

codecov Bot commented Jul 24, 2026 •

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 80.15%. Comparing base (cf89256) to head (ba77781).
⚠️ Report is 3 commits behind head on release/1.81.x.

Additional details and impacted files
@@                Coverage Diff                 @@
##           release/1.81.x    #7213      +/-   ##
==================================================
+ Coverage           79.68%   80.15%   +0.46%     
==================================================
  Files                 596      599       +3     
  Lines               66477    66833     +356     
==================================================
+ Hits                52975    53572     +597     
+ Misses              10368    10117     -251     
- Partials             3134     3144      +10     

☔ 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.

Comment thread router/handle.go Resolved
Comment thread router/handle_lifecycle.go Resolved
Comment thread router/handle_lifecycle.go Resolved
Comment thread router/worker.go Resolved
Comment thread router/worker.go Resolved
Comment thread router/worker_test.go Resolved
Comment thread router/worker_test.go Resolved
Comment thread router/worker_test.go Resolved
Comment thread router/worker.go Outdated
// For 296 (Delivered with Warning) report the transformed delivery body actually sent to
// the destination, so the warnings UX can surface it. Gated by a per-destType opt-in flag
// (default off); every other success code keeps reporting the router input payload unchanged.
responsePayload := inputPayload

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.

responsePayload -> payload

@ItsSudip
ItsSudip requested a review from itsmihir July 27, 2026 09:29
ItsSudip added 3 commits July 28, 2026 11:25
On the success path the router reported the router input payload for every
status code, so the transformed body actually sent to the destination was
never available to reporting. The Events tab needs that body for 296
(Delivered with Warning) to show what was really delivered.

Report destinationJob.Message instead of the input payload when the status
is 296, and mark the status with payloadStage=delivery so reporting can
tell the sample is the delivery body rather than the input event.

Scoped strictly to 296 and gated by store296DeliveryPayload, a reloadable
per-destType kill-switch (default on) that reverts payload storage without
disabling the warnings feature. All other status codes are unchanged.

INT-6637

Co-Authored-By: Claude Opus 4.8 <[email protected]>

🔒 Scanned for secrets using gitleaks 8.28.0
- rename store296DeliveryPayload -> storeDeliveredWithWarningPayload
  (field, config key, and test) so the flag reads by intent, not status code
- default the flag to false: delivery-payload reporting is opt-in per destType
- rename success-branch local successPayload -> responsePayload
- drop the empty-delivery-body test case: a 296 always carries a delivered
  body, so the removed assertion could never fail

INT-6637

Co-Authored-By: Claude Opus 4.8 <[email protected]>

🔒 Scanned for secrets using gitleaks 8.28.0
- rename success-branch local responsePayload -> payload
- note why non-296 success responses omit a payloadStage marker

INT-6637

Co-Authored-By: Claude Opus 4.8 <[email protected]>

🔒 Scanned for secrets using gitleaks 8.28.0
@ItsSudip
ItsSudip force-pushed the feature/int-6637-rudder-server-add-delivery-payload-for-success-scenario-in branch from 09137ab to ba77781 Compare July 28, 2026 06:00
@ItsSudip
ItsSudip changed the base branch from master to release/1.81.x July 28, 2026 06:00
@ItsSudip
ItsSudip merged commit a5e3159 into release/1.81.x Jul 28, 2026
76 checks passed
@ItsSudip
ItsSudip deleted the feature/int-6637-rudder-server-add-delivery-payload-for-success-scenario-in branch July 28, 2026 07:24
ItsSudip added a commit that referenced this pull request Jul 28, 2026
…-gate-logic-to-update-296-status-code-to

Resolve conflicts from INT-6637 (PR #7213) landing in release/1.81.x:
- utils/types: single DeliveredWithWarningCode constant (both PRs added it)
- router/handle.go: keep both storeDeliveredWithWarningPayload and
  supportsDeliveredWithWarnings fields
- router/worker_test.go: keep both PRs' test functions

Co-Authored-By: Claude Opus 4.8 <[email protected]>

🔒 Scanned for secrets using gitleaks 8.28.0
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