Skip to content

Use bootstrap.JobSpec in apps and devenv.#1007

Merged
winder merged 10 commits intomainfrom
will/bootstrap-job-spec
Apr 13, 2026
Merged

Use bootstrap.JobSpec in apps and devenv.#1007
winder merged 10 commits intomainfrom
will/bootstrap-job-spec

Conversation

@winder
Copy link
Copy Markdown
Collaborator

@winder winder commented Apr 8, 2026

Convert VerifierJobSpec and ExecutorJobSpec to a generic bootstrap.JobSpec that can be used on all app types.

This will simplify the AccessorRegistry by avoiding generics with config types and allowing shared config handling.

@winder winder force-pushed the will/bootstrap-job-spec branch from 1e1ba22 to 08e0c50 Compare April 8, 2026 19:04
Comment on lines -95 to +94
GeneratedJobSpecs []string `toml:"-"`
GeneratedJobSpecs []bootstrap.JobSpec `toml:"-"`
Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Strong types allow the compiler to help detect incompatible parameters.
It also avoids superfluous calls to marshal/unmarshal the same string.

Comment on lines +582 to +590
// TODO: Use bootstrap.JobSpec in CLD to avoid this conversion here
var executorSpec ExecutorJobSpec
{
_, err = toml.Decode(job.Spec, &executorSpec)
if err != nil {
return nil, fmt.Errorf("failed to decode verifier job spec for %s: %w", exec.ContainerName, err)
}
executorJobSpecs[exec.ContainerName] = executorSpec.ToBootstrapJobSpec()
}
Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Allow the devenv to use bootstrap.JobSpec unconditionally by converting away from the other type immediately after calling ccipOffchain.GetJob.

Comment on lines +728 to +734
// TODO: Use bootstrap.JobSpec in CLD to avoid this conversion here
var verifierJobSpec VerifierJobSpec
if _, err := toml.Decode(job.Spec, &verifierJobSpec); err != nil {
return nil, fmt.Errorf("failed to decode verifier job spec for %s: %w", ver.ContainerName, err)
}

allJobSpecs = append(allJobSpecs, verifierJobSpec.ToBootstrapJobSpec())
Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same as above, allow the devenv to use bootstrap.JobSpec unconditionally by converting away from the other type immediately after calling ccipOffchain.GetJob.

chainsel.FamilyEVM,
deprecatedCreateAccessorFactory),
bootstrap.WithLogLevel[commit.JobSpec](zapcore.InfoLevel),
bootstrap.WithLogLevel[bootstrap.JobSpec](zapcore.InfoLevel),
Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Standalone mode now uses bootstrap.JobSpec for all JD-Mode apps, I'll be able to remove generics in a followup PR.

// blockchain.Info for EVM). Strict decode is applied: any unknown key in the config
// (including under blockchain_infos.<selector>) causes an error.
func LoadConfigWithBlockchainInfos[T any](spec JobSpec) (*Config, chainaccess.Infos[T], error) {
func LoadConfigWithBlockchainInfos[T any](cfg string) (*Config, chainaccess.Infos[T], error) {
Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It should be possible to remove all references to BlockchainInfos from the "library" apps in a followup.

@winder winder changed the title Will/bootstrap job spec Use bootstrap.JobSpec in apps and devenv. Apr 9, 2026
@winder winder force-pushed the will/bootstrap-job-spec branch from 31184fb to a801144 Compare April 13, 2026 16:59
@github-actions
Copy link
Copy Markdown

Code coverage report:

Package main will/bootstrap-job-spec diff
github.com/smartcontractkit/chainlink-ccv/aggregator 48.46% 48.44% -0.02%
github.com/smartcontractkit/chainlink-ccv/bootstrap 42.35% 42.35% +0.00%
github.com/smartcontractkit/chainlink-ccv/cli 65.13% 65.13% +0.00%
github.com/smartcontractkit/chainlink-ccv/cmd 0.00% 0.00% +0.00%
github.com/smartcontractkit/chainlink-ccv/common 50.74% 50.74% +0.00%
github.com/smartcontractkit/chainlink-ccv/executor 45.74% 45.74% +0.00%
github.com/smartcontractkit/chainlink-ccv/indexer 37.46% 37.46% +0.00%
github.com/smartcontractkit/chainlink-ccv/integration 47.97% 47.97% +0.00%
github.com/smartcontractkit/chainlink-ccv/pkg 38.00% 38.00% +0.00%
github.com/smartcontractkit/chainlink-ccv/pricer 0.00% 0.00% +0.00%
github.com/smartcontractkit/chainlink-ccv/protocol 65.19% 65.19% +0.00%
github.com/smartcontractkit/chainlink-ccv/verifier 32.43% 32.43% +0.00%

@winder winder marked this pull request as ready for review April 13, 2026 18:37
@winder winder requested review from a team and skudasov as code owners April 13, 2026 18:37
Copilot AI review requested due to automatic review settings April 13, 2026 18:37
@winder winder added this pull request to the merge queue Apr 13, 2026
@github-merge-queue github-merge-queue bot removed this pull request from the merge queue due to failed status checks Apr 13, 2026
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR standardizes JD job spec handling by replacing app-specific VerifierJobSpec / ExecutorJobSpec types with a shared bootstrap.JobSpec, so bootstrapped services can consume a consistent outer spec while keeping per-app config in AppConfig.

Changes:

  • Introduces bootstrap.JobSpec and updates executor/verifier bootstrapped service factories to accept it.
  • Refactors executor/verifier config loaders to decode directly from the inner config string (spec.AppConfig) instead of app-specific job spec wrappers.
  • Updates devenv job generation/proposal flow to convert legacy job specs into bootstrap.JobSpec and inject blockchain_infos into AppConfig.

Reviewed changes

Copilot reviewed 13 out of 13 changed files in this pull request and generated 3 comments.

Show a summary per file
File Description
bootstrap/job.go Adds the shared bootstrap.JobSpec type used across bootstrapped apps.
verifier/pkg/commit/load.go Changes config loading API to accept inner TOML config string.
verifier/pkg/commit/load_test.go Updates tests to call the new config loading signature.
verifier/pkg/commit/job.go Removes verifier-specific job spec wrapper type.
verifier/cmd/servicefactory.go Switches verifier bootstrap factory to bootstrap.JobSpec and reads spec.AppConfig.
verifier/cmd/committee/main.go Updates bootstrap runner options to use bootstrap.JobSpec.
executor/load.go Changes config loading API to accept inner TOML config string.
executor/job.go Removes executor-specific job spec wrapper type.
cmd/executor/servicefactory.go Switches executor bootstrap factory to bootstrap.JobSpec and reads spec.AppConfig.
build/devenv/services/executor/base.go Updates job spec rebuilding to operate on bootstrap.JobSpec and rewrite AppConfig.
build/devenv/services/committeeverifier/base.go Updates verifier job spec rebuilding to operate on bootstrap.JobSpec and rewrite AppConfig.
build/devenv/environment.go Updates job spec generation/proposal plumbing to use bootstrap.JobSpec and introduces conversion helpers.
integration/pkg/accessors/evm/evm_source_reader.go Adds raw message bytes to decode-failure log fields.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

{
md, err := toml.Decode(job.Spec, &executorSpec)
if err != nil {
return nil, fmt.Errorf("failed to decode verifier job spec for %s: %w", exec.ContainerName, err)
Copy link

Copilot AI Apr 13, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The returned error message says "failed to decode verifier job spec" but this code path is decoding an executor job spec. This makes troubleshooting confusing; update the error text to refer to the executor job spec (and keep terminology consistent with the surrounding errors).

Suggested change
return nil, fmt.Errorf("failed to decode verifier job spec for %s: %w", exec.ContainerName, err)
return nil, fmt.Errorf("failed to decode executor job spec for %s: %w", exec.ContainerName, err)

Copilot uses AI. Check for mistakes.
L.Warn().
Str("spec", job.Spec).
Str("undecoded fields", fmt.Sprintf("%v", md.Undecoded())).
Msg("Undecoded fields in executor job spec")
Copy link

Copilot AI Apr 13, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This warning message is emitted while decoding a verifier job spec, but the log text says "Undecoded fields in executor job spec". Update the log message to reference the verifier job spec so on-call/debugging can attribute the problem correctly.

Suggested change
Msg("Undecoded fields in executor job spec")
Msg("Undecoded fields in verifier job spec")

Copilot uses AI. Check for mistakes.
Comment on lines 226 to 228
if err != nil {
r.lggr.Errorw("Failed to decode message", "error", err)
r.lggr.Errorw("Failed to decode message", "error", err, "rawMessage", event.EncodedMessage)
continue // to next message
Copy link

Copilot AI Apr 13, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Logging the full raw encoded message bytes on decode failure can significantly bloat logs and may leak sensitive payloads. Consider logging a safe representation instead (e.g., length + a truncated hex prefix or a hash) to keep diagnostics useful without dumping the entire message.

Copilot uses AI. Check for mistakes.
@winder winder added this pull request to the merge queue Apr 13, 2026
Merged via the queue into main with commit ed1b008 Apr 13, 2026
33 of 36 checks passed
@winder winder deleted the will/bootstrap-job-spec branch April 13, 2026 19:03
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.

5 participants