Skip to content

beholder: inject emitters in jobspec/node_platform/shell (Phase 1) - #23970

Merged
kalverra merged 1 commit into
developfrom
DX-5066/beholder-parallel-01
Oct 19, 2026
Merged

kalverra merged 1 commit into
developfrom
DX-5066/beholder-parallel-01

Conversation

@kalverra

@kalverra kalverra commented Oct 12, 2026 •

Copy link
Copy Markdown
Collaborator

Why

Layer 1 of the beholder emitter-injection stack (DX-5066): jobspec, node_platform, and shell tests asserted on emissions via beholdertest.NewObserver, which swaps the process-global client and blocks t.Parallel(); this PR injects per-test beholdertest.Recorder emitters instead, with late-binding defaults so production behaviour is unchanged.

Notes

  • Bumps chainlink-common to the Phase 0 version providing Recorder / GlobalEmitter / NewLabelerWithEmitter (go.mod).
  • Production changes are late-binding only: NewApplication passes beholder.GlobalEmitter() (resolved at emit time) instead of the construction-time beholder.GetEmitter().
  • TestShell_BeholderLifecycle still installs a real client globally via initGlobalsOnce and never restores it; harmless now that no core test asserts on the global.

Changes

How emitters resolve after this PR:

flowchart LR
  A[NodePlatform / jobspec reporter / Shell] --> E["cfg.Emitter / s.beholderEmitter()"]
  E -->|nil: production| GE["beholder.GlobalEmitter (late-bound)"]:::new
  E -->|injected: test| R[beholdertest.Recorder]:::new
  classDef new fill:#d4f8d4,stroke:#2da44e
Loading
NodePlatform*Config.Emitter fields
  • Both services default a nil Emitter to beholder.GlobalEmitter() at construction; the dead in-loop GetEmitter() fallbacks are deleted.
Shell emits through its own client's emitter
  • beholderEmitter() returns the Shell's configured emitter, else GlobalEmitter(); EmitNodeConfig labels through it, so multiple Shells in one process no longer share the first one pinned as global.
jobspec tests inject a recorder
  • newTestReporter returns the service with its recorder; TestEngine_Execution, emit_test.go, and cl_job_info_test.go drop NewObserver for NewRecorder + t.Parallel().

Merge Danger

Rating Why
Revert 🟡 minor Single commit, but the go.mod bump and new symbols are load-bearing for upstack 23971–23973.
Blast radius 🟢 small Defaults preserve behaviour; only test wiring and late-binding changed.

Requires

chainlink-common#2458 (beholdertest.Recorder, beholder.GlobalEmitter, custmsg.NewLabelerWithEmitter)

Supports

#23971 · #23972 · #23973 (rest of the DX-5066 beholder stack)

Deployment Validation Steps

Run a node locally with telemetry enabled and confirm node config and job info still reach beholder (collector output, or the debug log node configuration emitted through beholder).


Stack created with GitHub Stacks CLI • Give Feedback 💬

@github-actions

Copy link
Copy Markdown
Contributor

👋 kalverra, thanks for creating this pull request!

To help reviewers, please consider creating future PRs as drafts first. This allows you to self-review and make any final changes before notifying the team.

Once you're ready, you can mark it as "Ready for review" to request feedback. Thanks!

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

@github-actions

Copy link
Copy Markdown
Contributor

✅ No conflicts with other open PRs targeting develop

@trunk-io

trunk-io Bot commented Oct 12, 2026 •

Copy link
Copy Markdown

Static Badge   Static Badge   Static Badge

View Full Report ↗︎ ⋅ Docs

bolekk
bolekk previously approved these changes Oct 14, 2026
patrickhuie19
patrickhuie19 previously approved these changes Oct 14, 2026
@kalverra
kalverra force-pushed the DX-5066/beholder-parallel-01 branch from 7f0bed2 to 370b06e Compare October 14, 2026 20:12
@kalverra
kalverra dismissed stale reviews from bolekk and patrickhuie19 via 5a34ee2 October 14, 2026 20:24
@kalverra
kalverra requested a review from a team as a code owner October 14, 2026 20:24
@kalverra
kalverra requested a lite review from Copilot October 14, 2026 20:27

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.

🟢 Approval recommended

No unresolved review issues were identified.

0 open findings

What changed in this PR

Injects per-test Beholder emitters for jobspec, node-platform, and shell code while preserving production behavior through late-bound global emitters.

Changes:

  • Adds configurable emitter injection.
  • Replaces global observers with parallel-safe recorders.
  • Updates shared dependencies and checksums.
File Description
system-tests/​tests/​go.sum Updates dependency checksums.
system-tests/​tests/​go.mod Updates dependencies.
system-tests/​lib/​go.sum Updates dependency checksums.
system-tests/​lib/​go.mod Updates dependencies.
integration-tests/​load/​go.sum Updates dependency checksums.
integration-tests/​load/​go.mod Updates dependencies.
integration-tests/​go.sum Updates dependency checksums.
integration-tests/​go.mod Updates dependencies.
go.sum Updates dependency checksums.
go.mod Updates shared dependencies.
deployment/​go.sum Updates dependency checksums.
deployment/​go.mod Updates dependencies.
core/​services/​workflows/​v2/​engine_test.go Uses an injected recorder.
core/​services/​nodestatusreporter/​jobspec/​job_spec_reporter_test.go Uses per-test recorders.
core/​services/​nodestatusreporter/​jobspec/​events/​emit_test.go Uses recorder-based assertions.
core/​services/​nodestatusreporter/​jobspec/​cl_job_info_test.go Uses recorder-based assertions.
core/​services/​chainlink/​node_platform.go Adds configurable emitters with global fallback.
core/​services/​chainlink/​node_platform_test.go Injects recorders into tests.
core/​services/​chainlink/​application.go Uses the late-bound global emitter.
core/​scripts/​go.sum Updates dependency checksums.
core/​scripts/​go.mod Updates dependencies.
core/​cmd/​shell_test.go Uses an injected recorder.
core/​cmd/​shell_local.go Resolves the shell-specific emitter.

🧠 Review effort: Lite


💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

@kalverra
kalverra force-pushed the DX-5066/beholder-parallel-01 branch from 5a34ee2 to b40d33b Compare October 14, 2026 20:50
Bump chainlink-common to 3638f2c19d5c (beholder-emitter-injection,
chainlink-common#2458), which adds beholder.GlobalEmitter(),
beholdertest.NewRecorder, and custmsg.NewLabelerWithEmitter.

Production (no behaviour change; defaults now late-bind to the global
client at emit time instead of pinning it at construction):
- jobspec.NewJobSpecReporter (application.go) takes
  beholder.GlobalEmitter() instead of beholder.GetEmitter().
- node_platform: both configs gain an Emitter field, defaulted to
  beholder.GlobalEmitter() in the constructors; the dead in-loop
  nil-fallbacks are removed.
- shell.EmitNodeConfig emits through the shell's own
  BeholderClient.Emitter when set, else beholder.GlobalEmitter().

Tests: inject a per-test beholdertest.Recorder and t.Parallel()
everywhere these components are asserted on:
- jobspec (job_spec_reporter_test, events/emit_test, cl_job_info_test)
- node_platform_test (7 tests)
- TestShell_emitNodeConfig (Shell.BeholderClient wired to a recorder)
- TestEngine_Execution (cfg.BeholderEmitter from a recorder-based
  labeler; requireEventsLabels/requireEventsMessages take a
  *beholdertest.Recorder)

go test -race -count=3 green on the touched packages.
@kalverra
kalverra force-pushed the DX-5066/beholder-parallel-01 branch from b40d33b to 8757db6 Compare October 15, 2026 16:39
@cl-sonarqube-production

Copy link
Copy Markdown

@kalverra
kalverra added this pull request to the merge queue Oct 19, 2026
Merged via the queue into develop with commit de8d725 Oct 19, 2026
308 of 310 checks passed
@kalverra
kalverra deleted the DX-5066/beholder-parallel-01 branch October 19, 2026 15:04
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.

4 participants