Skip to content

Add libs/capability: reflection-driven capability runner - #751

Draft
cedric-cordenier wants to merge 1 commit into
mainfrom
cedric_libs-capability
Draft

Add libs/capability: reflection-driven capability runner#751
cedric-cordenier wants to merge 1 commit into
mainfrom
cedric_libs-capability

Conversation

@cedric-cordenier

Copy link
Copy Markdown
Contributor

What

Adds libs/capability, an in-progress replacement for the libs/standalone bootstrapper (spiked on cedric_configWithOwner). A capability binary's main reduces to one line:

func main() { capability.Run(ctx, trigger.NewCron) }

Run reads the constructor's parameter list by reflection and builds what it asks for (logger, registry, limits factory); config sections are registered on a cobra root with run/embed subcommands. Full design notes, ordering constraints, and known gaps are in libs/capability/AGENTS.md.

Dependencies added

In-repo: only libs/standalone/protohelpers/ui (the debug UI mounted under /debug/capabilities, imported by debugui.go). The rest of the spike branch's new libs (standalone rewrite, ocr, grpcutils, x) are not included.

go.mod: fullstorydev/grpcui, jhump/protoreflect, spf13/cobra; promoted grafana/pyroscope-go and prometheus/client_golang to direct.

⚠️ chainlink-common pin

libs/capability uses registry.Local / registry.Registry / registry.RegisterCapability, which do not exist on chainlink-common main. This PR pins chainlink-common to v0.11.2-0.20260827151019-9853beb3a544, the tip of the unmerged chainlink-common branch rtinianov_configWithOwner (which includes a merge with main). Before this merges, either:

  1. Land the chainlink-common branch first and re-pin to a main pseudo-version, or
  2. Merge this as-is (spike) and re-pin after.

Testing

cd libs
go build ./...                                    # ok
go test ./capability/ -short                      # ok (~3s)
go test ./capability/ -short -race                # ok
go test ./chainconsensus/... ./loopserver/... ./monitoring/... ./testutils/... ./standalone/... -short   # ok — chainlink-common bump breaks nothing

Adds libs/capability, an in-progress replacement for the libs/standalone
bootstrapper where a capability binary's main reduces to:

    capability.Run(ctx, trigger.NewCron)

Run reads the constructor's parameter list by reflection, builds the
dependencies it asks for (logger, registry, limits factory), and hangs
run/embed subcommands off a cobra root. See libs/capability/AGENTS.md.

Its one in-repo dependency, libs/standalone/protohelpers/ui (the debug UI
served under /debug/capabilities), comes along. The rest of the spike
branch's libs (standalone rewrite, ocr, grpcutils, x) is not included.

NOTE: pins chainlink-common to v0.11.2-0.20260827151019-9853beb3a544,
the tip of the unmerged chainlink-common branch rtinianov_configWithOwner,
because registry.Local/registry.Registry/registry.RegisterCapability do
not exist on chainlink-common main yet. That branch should land first and
this pin be updated to a main pseudo-version afterwards.
@github-actions

github-actions Bot commented Sep 9, 2026

Copy link
Copy Markdown
Contributor

👋 cedric-cordenier, 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!

@cl-sonarqube-production

Copy link
Copy Markdown

Quality Gate failed Quality Gate failed

Failed conditions
3 Security Hotspots
0.0% Coverage on New Code (required ≥ 75%)
302 New Critical Issues (required ≤ 0)
D Reliability Rating on New Code (required ≥ A)
17 New Major Issues (required ≤ 5)

See analysis details on SonarQube

Catch issues before they fail your Quality Gate with our IDE extension SonarQube for IDE SonarQube for IDE

Comment on lines +483 to +487
http.SetCookie(w, &http.Cookie{
Name: fanoutCookieName,
Value: base64.RawURLEncoding.EncodeToString(buf),
Path: "/",
})
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.

2 participants