Skip to content

fix(worker): compile actor variables in sent notifications and exclude actor from fan-out fixes NV-8143#11753

Open
jainpawan21 wants to merge 1 commit into
nextfrom
fix/actor-variables-execution-a28b
Open

fix(worker): compile actor variables in sent notifications and exclude actor from fan-out fixes NV-8143#11753
jainpawan21 wants to merge 1 commit into
nextfrom
fix/actor-variables-execution-a28b

Conversation

@jainpawan21

@jainpawan21 jainpawan21 commented Jul 1, 2026

Copy link
Copy Markdown
Member

Summary

Completes the actor variable support started in NV-8143. Dashboard preview already compiled {{actor.*}} variables, but actual notifications did not because the worker bridge execution path omitted actor from the framework event payload.

This PR also tightens actor exclusion so the actor subscriber never receives a notification when triggering to multiple recipients (subscriber array, topic, or broadcast).

Root cause

V2 workflows compile step content via the framework bridge (ExecuteBridgeJob). Preview passed actor into the bridge event, but execution did not:

sequenceDiagram
    participant API as Trigger API
    participant Worker as SendMessage
    participant Bridge as ExecuteBridgeJob
    participant FW as Framework compileControls

    API->>Worker: job with actorId
    Worker->>Worker: buildVariables (includes actor)
    Worker->>Bridge: variables with actor
    Note over Bridge: Previously dropped actor here
    Bridge->>FW: bridge event
    FW->>FW: render {{actor.firstName}}
Loading

Changes

  • execute-bridge-job.usecase.ts: include actor in the bridge event when present in compile context, matching preview behavior.
  • trigger-multicast.usecase.ts: remove actor from direct to subscriber recipients before queueing jobs (topic fan-out already skipped actor).
  • trigger-broadcast.usecase.ts: skip actor during broadcast fan-out.
  • Tests: unit test for actor passthrough in bridge execution; e2e coverage for actor exclusion from single-subscriber multicast and topic + explicit to inclusion.

Verification

  • cd apps/worker && pnpm test -- --grep "ExecuteBridgeJob" — 4 passing
  • cd apps/api && pnpm test -- --grep "TriggerMulticast" — 15 passing

Customer scenario

Trigger with:

{
  "name": "events-update",
  "to": { "subscriberId": "recipient-id" },
  "payload": { "eventName": "John Doe" },
  "actor": "actor-subscriber-01"
}

In-app body sent by {{actor.firstName}} should now render as sent by <actor first name> in the delivered notification.

Slack Thread

Open in Web Open in Cursor 

Greptile Summary

This PR completes actor support for sent notifications and prevents actors from receiving their own fan-out notifications. The main changes are:

  • Forward actor variables into the worker bridge event used for real notification execution.
  • Exclude the actor from direct multicast subscriber recipients before queueing jobs.
  • Skip the actor during broadcast fan-out batching.
  • Update tests for bridge actor passthrough and actor exclusion in direct and topic recipient paths.

Confidence Score: 5/5

The changes are narrowly scoped to actor variable forwarding and actor exclusion in fan-out paths, with no remaining code issues identified.

The touched paths align with the described behavior and include targeted unit and end-to-end coverage for bridge actor passthrough and fan-out exclusion cases.

T-Rex T-Rex Logs

What T-Rex did

  • The bridge actor passthrough was updated to include the full actor object in the bridge event and to set EVENT_HAS_ACTOR to true.
  • The multicast actor exclusion logic was updated to set hasDirectActorDelete to true and to queue only nonActor as the direct subscriber, with topic queues reduced to topicOnly.
  • A dependency build blocker was encountered while trying to run the full API test harness.
  • The head run detected the actor skip implementation and now queues only the other-subscriber, reducing the job count from 2 to 1.

View all artifacts

T-Rex Ran code and verified through T-Rex

Reviews (1): Last reviewed commit: "fix(worker): compile actor variables in ..." | Re-trigger Greptile

…e actor from fan-out fixes NV-8143

Pass actor into the bridge execution event so v2 workflow step content
compiles actor variables (e.g. {{actor.firstName}}) in actual notifications,
not only in dashboard preview.

Also ensure the actor subscriber is never notified when triggering to an
array of subscribers, a topic, or a broadcast fan-out.

Co-authored-by: Pawan Jain <jainpawan21@users.noreply.github.com>
@linear-code

linear-code Bot commented Jul 1, 2026

Copy link
Copy Markdown

NV-8143

@netlify

netlify Bot commented Jul 1, 2026

Copy link
Copy Markdown

Deploy Preview for dashboard-v2-novu-staging canceled.

Name Link
🔨 Latest commit f06304d
🔍 Latest deploy log https://app.netlify.com/projects/dashboard-v2-novu-staging/deploys/6a44b06b1f28b700080b6ad0

@scopsy scopsy marked this pull request as ready for review July 1, 2026 07:41
});

it('should only exclude actor from topic, should send event if actor explicitly included', async () => {
it('should exclude actor even when explicitly included in to recipients', async () => {

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants