Skip to content

beholder: inject emitter in remote executable ClientRequest (Phase 3) - #23972

Merged
kalverra merged 3 commits into
developfrom
DX-5066/parallel-00c-remote-exec
Oct 23, 2026
Merged

kalverra merged 3 commits into
developfrom
DX-5066/parallel-00c-remote-exec

Conversation

@kalverra

@kalverra kalverra commented Oct 12, 2026 •

Copy link
Copy Markdown
Collaborator

Why

Remote executable ClientRequest read beholder.GetEmitter() and durableemitter.GlobalEmit directly when emitting its transmission-schedule event, serializing the test that asserts on it. This PR injects both sinks from boot config instead, so callers and tests can supply their own.

Notes

  • Defaults stay late-bound: with no option, the request resolves beholder.GlobalEmitter() (which delegates at emit time) and durableemitter.GlobalEmit, so production emission is unchanged.
  • The injected durable func is the same durableemitter instance Setup installs globally, so events are not emitted twice.
  • NewLauncher is now variadic (opts ...LauncherOption) rather than taking another positional arg; boot passes capabilities.WithDurableEmit.

Changes

Durable sink flow, request construction to emit:

flowchart LR
  B[cre.Opts.DurableEmit]:::new -->|"capabilities.WithDurableEmit"| L[NewLauncher]:::new
  L -->|"executable.WithDurableEmit"| C[NewClient]:::new
  C -->|Execute| R[NewClientExecuteRequest]:::new
  R -->|clientRequestConfig| E[emitTransmissionScheduleEvent]:::new
  E -->|nil default| G[beholder.GlobalEmitter / durableemitter.GlobalEmit]
  classDef new fill:#d4f8d4,stroke:#2da44e
Loading
ClientRequestOption targets a small config struct
  • Options configure clientRequestConfig instead of a throwaway ClientRequest; the struct flows into newClientRequest and emitTransmissionScheduleEvent.
  • NewClientExecuteRequest keeps its existing call sites: options are variadic.
“Executes full schedule” test now runs in parallel
  • Swaps the process-global beholdertest.NewObserver for an injected NewRecorder, so parallel siblings cannot cross-talk.
  • Test_Client_Execute_InjectsDurableEmit asserts the client forwards its durable func, and starts the client via servicetest.Run so cleanup joins the request goroutines.

Requires

#23971 (workflows/events Emitter pattern and chainlink-common bump)

Supports

#23973 (meters layer)

Deployment Validation Steps

Run a node with remote capabilities and confirm transmission-schedule events still reach beholder; no schema or entity changes expected.

@kalverra
kalverra requested review from a team as code owners October 12, 2026 17:49
@kalverra
kalverra added this pull request to stack #23974 October 12, 2026 17:49
@github-actions

github-actions Bot commented Oct 12, 2026 •

Copy link
Copy Markdown
Contributor

✅ No conflicts with other open PRs targeting develop

@github-actions

Copy link
Copy Markdown
Contributor

I see you updated files related to core. Please run make gocs in the root directory to add a changeset as well as in the text include at least one of the following tags:

  • #added For any new functionality added.
  • #breaking_change For any functionality that requires manual action for the node to boot.
  • #bugfix For bug fixes.
  • #changed For any change to the existing functionality.
  • #db_update For any feature that introduces updates to database schema.
  • #deprecation_notice For any upcoming deprecation functionality.
  • #internal For changesets that need to be excluded from the final changelog.
  • #nops For any feature that is NOP facing and needs to be in the official Release Notes for the release.
  • #removed For any functionality/config that is removed.
  • #updated For any functionality that is updated.
  • #wip For any change that is not ready yet and external communication about it should be held off till it is feature complete.

@trunk-io

trunk-io Bot commented Oct 12, 2026 •

Copy link
Copy Markdown

Static Badge   Static Badge   Static Badge

View Full Report ↗︎ ⋅ Docs

amit-momin
amit-momin previously approved these changes Oct 20, 2026
@kalverra kalverra added complexity:low pr-triage: low complexity risk:low pr-triage: low risk and removed risk:low pr-triage: low risk complexity:medium pr-triage: medium complexity review-tier:2 labels Oct 20, 2026
@kalverra

kalverra commented Oct 20, 2026 •

Copy link
Copy Markdown
Collaborator Author

PR Triage · Risk Medium · Complexity Low

Suggests 1 approval, including one from an owner. Suggested reviewers: @bolekk, @jmank88.

Level Why
Risk Medium core/services/cre/cre.go is a hotspot: 16.09 recent commits in 90d (cut 8.21) and max function cognitive complexity 51 (limit 15)
Complexity Low No metric or rule reached a threshold

Start Review Here

  1. core/services/cre/cre.go:407-536 Services.newRegistrySyncer — hotspot file · function complexity 25
  2. core/capabilities/remote/executable/request/client_request.go:127-163 NewClientExecuteRequest — logic added 3 · function complexity 5
  3. core/capabilities/launcher.go:131-202 NewLauncher — logic added 1 · function complexity 7
  4. core/capabilities/remote/executable/client.go:86-99 NewClient — logic added 1 · function complexity 1
Visualizations

Score map

flowchart LR
  R["Risk: Medium"]
  rs["1 signal → floor Medium"]
  s0["hotspot core/services/cre/cre.go"] --> rs
  rs --> R
  C["Complexity: Low"]
  cn["no rule or threshold applied"] --> C
  RT["Suggests 1 approval · one from an owner"]
  R --> RT
  classDef low fill:#dafbe1,stroke:#1a7f37,color:#1f2328;
  classDef medium fill:#fff8c5,stroke:#9a6700,color:#1f2328;
  classDef high fill:#ffebe9,stroke:#cf222e,color:#1f2328;
  class R medium;
  class C low;
Loading

Change shape

pie title Change shape
    "Tests" : 558
    "Source" : 572
Loading

— distributed across 6 files

Files: 6 changed
File Risk Complexity Why
core/capabilities/launcher.go Low Low
core/capabilities/remote/executable/client.go Low Low
core/capabilities/remote/executable/client_test.go Low Low
core/capabilities/remote/executable/request/client_request.go Low Low
core/capabilities/remote/executable/request/client_request_test.go Low Low
core/services/cre/cre.go Low Low
Why these reviewers
Reviewer Share Last commit
@bolekk 25% 2026-10-22
@jmank88 16% 2026-08-25

Others who know this code: amit-momin 12%, dhaidashenko 10%, cedric-cordenier 6%.

Ranked by commits to the changed files in the 360 days before the head commit; newer commits count more. Requested everyone with at least 20% of the score, up to 4. Added 1 reviewer below that to reach 2 reviewers. Excluded the PR author, @kalverra. Considered only current members of the repository's organization, excluding 1 candidate.

Metrics and policy
Metric PR value Scale Medium at High at
logic added (cognitive delta) 5 [██░░░░│░░░░░░░░░░░░│] 15 45
syntax change (AST delta) 1,130 [██████████████░░░░░│] 1,600 —
new code size (Kolmogorov delta) 1,076 [█████████████░░░░░░│] 1,600 —
most complex function (max function cognitive complexity) 54 [███████████████░░░░│] 70 70

Risk signals: change spread ○ · subsystems ○ · hotspot ● · blast radius ○ · author familiarity ○ · floor Medium

pr-triage v0.0.0-20261022163026-983b86af43a2+dirty · policy d03c412


What is this? · How is this calculated?

@kalverra
kalverra force-pushed the DX-5066/parallel-00c-remote-exec branch from 8f92ac4 to 4d7402f Compare October 20, 2026 18:30
@kalverra
kalverra force-pushed the DX-5066/parallel-00c-remote-exec branch from 4d7402f to eff98ea Compare October 20, 2026 20:49
@kalverra
kalverra force-pushed the DX-5066/parallel-00c-remote-exec branch from eff98ea to 63d448e Compare October 21, 2026 23:57
@kalverra
kalverra requested review from a team as code owners October 21, 2026 23:57
Base automatically changed from DX-5066/parallel-00b-workflow-events to develop October 22, 2026 16:11
@kalverra
kalverra requested a review from a team as a code owner October 22, 2026 16:11
@kalverra
kalverra force-pushed the DX-5066/parallel-00c-remote-exec branch from 63d448e to b004eb5 Compare October 22, 2026 16:11
- ClientRequest: emitter + durable fields; ClientRequestOption with
  WithEmitter/WithDurableEmit (symmetry with workflows/events);
  NewClientExecuteRequest takes options, defaults nil emitters to the
  late-bound globals before the transmission schedule event is emitted
- client: emitter field + ClientOption/WithEmitter on NewClient (default
  global); Execute passes its emitter to each request; launcher unchanged
- tests: 'Executes full schedule' uses a per-test recorder and t.Parallel;
  last NewObserver in core/ removed
Transmission schedule events still went through durableemitter.GlobalEmit
because the client never accepted a durable func.

- executable.ClientOption gains WithDurableEmit; Execute forwards it to
  request.WithDurableEmit
- launcher.NewLauncher takes the func and gives it to every executable
  client it creates; cre passes the same Opts.DurableEmit used by the
  workflow event emitter
- test asserts the schedule reaches the injected durable sink
@kalverra
kalverra force-pushed the DX-5066/parallel-00c-remote-exec branch from b004eb5 to 50f2f68 Compare October 22, 2026 16:55
@kalverra
kalverra requested a balanced review from Copilot October 22, 2026 16:55

Copilot AI left a comment

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.

🟡 Changes recommended

The new forwarding test needs client lifecycle cleanup to prevent an outbound request goroutine from logging after test completion.

1 open issue
What changed in this PR

Extends the emitter-injection work from #23971 to remote executable requests, preserving late-bound global defaults while allowing transmission-schedule events to use the boot-configured durable emitter.

Changes:

  • Adds emitter options to clients and requests, applied before schedule events are emitted.
  • Threads the durable emitter from CRE through the launcher to remote clients.
  • Uses an isolated recorder for the parallel schedule test and adds durable-forwarding coverage.
File Description
core/​services/​cre/​cre.go Passes the configured durable emitter to the launcher.
core/​capabilities/​remote/​executable/​request/​client_request.go Adds injectable event sinks with global defaults.
core/​capabilities/​remote/​executable/​request/​client_request_test.go Isolates schedule-event recording and enables parallel execution.
core/​capabilities/​remote/​executable/​client.go Forwards client emitter options to requests.
core/​capabilities/​remote/​executable/​client_test.go Adds durable-emitter forwarding coverage.
core/​capabilities/​launcher.go Supplies the durable emitter to remote executable clients.
core/​capabilities/​launcher_test.go Updates launcher construction for the new parameter.
core/​capabilities/​launcher_offchain_method_configs_test.go Updates launcher construction while retaining default emission.

Review effort: Balanced

Comment thread core/capabilities/remote/executable/client_test.go
@cl-sonarqube-production

Copy link
Copy Markdown

@kalverra kalverra added risk:medium pr-triage: medium risk and removed risk:low pr-triage: low risk labels Oct 22, 2026
@kalverra
kalverra enabled stacked auto-merge October 22, 2026 17:45
@kalverra
kalverra added this pull request to the merge queue Oct 23, 2026
Merged via the queue into develop with commit 937d971 Oct 23, 2026
318 of 408 checks passed
@kalverra
kalverra deleted the DX-5066/parallel-00c-remote-exec branch October 23, 2026 18:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

complexity:low pr-triage: low complexity risk:medium pr-triage: medium risk

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants