Skip to content

build/devenv: toml config updates#1138

Merged
winder merged 6 commits into
mainfrom
will/devenv-toml
Jun 2, 2026
Merged

build/devenv: toml config updates#1138
winder merged 6 commits into
mainfrom
will/devenv-toml

Conversation

@winder
Copy link
Copy Markdown
Collaborator

@winder winder commented May 29, 2026

PR Chain

There are multiple open pull requests that feed into each other:

Description

  • Added version field to phased runtime config — top-level and per-component; validated on startup, missing or mismatched versions error
  • Split env.toml into env.toml (monolith) and env-phased.toml (phased) — the two modes have incompatible config layouts
  • Unified committeeccv config under [committeeccv] and topology under [protocol_contracts.environment_topology]
  • Phased CI smoke test now boots from env-phased.toml

Testing

Checklist

  • Breaking changes documented in changelog (see changelog directory)
  • Cross link related PRs (in this or other repositories)
  • just lint fix - no new lint errors
  • just generate - mocks and protobufs are up to date

@winder winder changed the base branch from will/committeeccv-component to will/committeeccv-next May 29, 2026 14:03
use_legacy_configure_lane = false

## Environment configuration define the topology. Eventually the topology should be the only config that is needed.
[protocol_contracts.environment_topology]
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.

Topology is now nested under the protocol_contracts config.

makramkd
makramkd previously approved these changes Jun 2, 2026
@winder winder force-pushed the will/committeeccv-next branch from 63e3470 to d8b791a Compare June 2, 2026 12:41
Base automatically changed from will/committeeccv-next to main June 2, 2026 14:28
@winder winder dismissed makramkd’s stale review June 2, 2026 14:28

The base branch was changed.

winder added 5 commits June 2, 2026 10:31
env-phased.toml is a copy of env.toml without the monolith-only keys
(cl_nodes_funding_eth, cl_nodes_funding_link, high_availability, [cldf])
that the phased runtime leaves unclaimed. The phased CI smoke test now boots
from it and sets SMOKE_TEST_CONFIG to read its output
(env-phased-out.toml).
NewEnvironmentWithRegistry now reads the top-level version schema marker,
errors if it is missing an integer or is < 1, then logs and strips it so it
is never dispatched to a component or flagged as an unclaimed key.
Consolidates the top-level [[aggregator]]/[[verifier]] keys under a single
[committeeccv] section and moves [environment_topology] under
[protocol_contracts.environment_topology], so each component reads from its
own config section instead of the top-level raw config. Cfg embeds
CommitteeCCVCfg/ProtocolContractsCfg with toml tags so fields still promote,
keeping the ~115 existing in.Aggregator/in.Verifier/in.EnvironmentTopology
call sites unchanged across monolith and e2e tests.
Restricts the nested [committeeccv] / [protocol_contracts.environment_topology]
config layout to env-phased.toml, restoring the original flat top-level layout
([[aggregator]]/[[verifier]]/[environment_topology]) in env.toml and
all -cl/env-one-exec configs so the non-phased monolith integration tests keep
working. Cfg now accepts both shapes — monolith reads the flat fields
unchanged, while NewPhasedEnvironment lifts the nested values into them after
load. Also gives the committeeccv component a single typed Config + one
decodeConfig (replacing the per-field decoders) and drops the redundant
blockchainOutputs phase output in favor of deriving it from blockchains via the
new blockchains.Outputs helper.
Each phased component declares an exported Version constant
(currently 1) and verifies its config's decoded version after
decode via devenvruntime.CheckConfigVersion, with third-party
jd/blockchains configs versioned through a local embed-wrapper.
NewPhasedEnvironment no longer decodes env-phased.toml into the
transitional Cfg type, instead building an empty Cfg from the
component outputs (topology from the runtime _topology), which
drops the dual-layout Cfg and lenient loader.
@winder winder force-pushed the will/devenv-toml branch from 6459776 to e81dc44 Compare June 2, 2026 14:32
Documents the new per-component version fields and the env-phased.toml
split introduced across the last five commits.
@github-actions
Copy link
Copy Markdown

github-actions Bot commented Jun 2, 2026

Code coverage report:

Package main will/devenv-toml Diff
github.com/smartcontractkit/chainlink-ccv/aggregator 49.35% 49.29% -0.06%
github.com/smartcontractkit/chainlink-ccv/bootstrap 54.14% 54.14% +0.00%
github.com/smartcontractkit/chainlink-ccv/cli 65.13% 65.13% +0.00%
github.com/smartcontractkit/chainlink-ccv/cmd 15.54% 15.54% +0.00%
github.com/smartcontractkit/chainlink-ccv/common 56.54% 56.54% +0.00%
github.com/smartcontractkit/chainlink-ccv/executor 45.97% 45.97% +0.00%
github.com/smartcontractkit/chainlink-ccv/indexer 37.67% 37.73% +0.06%
github.com/smartcontractkit/chainlink-ccv/integration 46.13% 46.13% +0.00%
github.com/smartcontractkit/chainlink-ccv/pkg 84.62% 84.62% +0.00%
github.com/smartcontractkit/chainlink-ccv/pricer 0.00% 0.00% +0.00%
github.com/smartcontractkit/chainlink-ccv/protocol 63.06% 63.06% +0.00%
github.com/smartcontractkit/chainlink-ccv/verifier 34.49% 34.49% +0.00%
Total 46.50% 46.50% +0.00%

@winder winder marked this pull request as ready for review June 2, 2026 14:43
@winder winder requested a review from a team as a code owner June 2, 2026 14:43
Copilot AI review requested due to automatic review settings June 2, 2026 14:43
@winder winder requested a review from a team as a code owner June 2, 2026 14:43
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

Updates the phased devenv configuration format by introducing explicit schema versioning and splitting the phased environment TOML into a dedicated env-phased.toml, with CI smoke tests updated to boot from the phased config.

Changes:

  • Added per-component config version fields and centralized exact-match validation via devenvruntime.CheckConfigVersion.
  • Introduced build/devenv/env-phased.toml and adjusted phased environment bootstrapping to stop decoding phased TOML into the legacy Cfg shape.
  • Updated phased smoke test workflow to use env-phased.toml and read env-phased-out.toml via SMOKE_TEST_CONFIG.

Reviewed changes

Copilot reviewed 24 out of 24 changed files in this pull request and generated 4 comments.

Show a summary per file
File Description
changelog/2026-05-29_phased_devenv_toml_versioning.md Documents phased TOML versioning and env-phased.toml split.
build/devenv/services/tokenVerifier.go Adds version field to token verifier service input struct.
build/devenv/services/pricer.go Adds version field to pricer service input struct.
build/devenv/services/indexer.go Adds version field to indexer service input struct.
build/devenv/services/fake.go Adds version field to fake service input struct.
build/devenv/services/executor/base.go Adds version field to executor service input struct.
build/devenv/runtime/version.go Adds CheckConfigVersion helper (exact-match policy).
build/devenv/runtime/version_test.go Adds unit test coverage for CheckConfigVersion.
build/devenv/runtime/environment.go Consumes top-level version and logs it during phased runtime startup.
build/devenv/runtime/environment_test.go Adds tests for consuming/rejecting malformed top-level version.
build/devenv/environment_phased.go Stops decoding phased TOML into Cfg; reconstructs from runtime outputs.
build/devenv/env-phased.toml Adds dedicated phased-mode environment configuration (nested component layout + versions).
build/devenv/components/tokenverifier/component.go Adds component Version constant, config validation, and version checks.
build/devenv/components/protocol_contracts/component.go Adds component Version, validates/decodes nested topology config, and version checks.
build/devenv/components/pricer/component.go Adds component Version and version check during decode.
build/devenv/components/jd/component.go Adds component Version and wraps third-party JD config with version field.
build/devenv/components/indexer/component.go Adds component Version and per-entry version checks.
build/devenv/components/fake/component.go Adds component Version and version check during decode.
build/devenv/components/executor/component.go Adds component Version, switches to blockchains output, and per-entry version checks.
build/devenv/components/committeeccv/version_test.go Adds unit test for committeeccv config version decoding/rejection.
build/devenv/components/committeeccv/component.go Unifies committee config under [committeeccv], adds Version, and updates decode/validation.
build/devenv/components/blockchains/component.go Adds component Version, removes separate blockchainOutputs publication, and adds Outputs() helper.
build/devenv/components/blockchains/component_test.go Updates tests to include per-entry version.
.github/workflows/test-smoke.yaml Updates phased smoke test to use env-phased.toml and phased output path override.

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

Comment on lines +55 to +68
// version is a schema-version marker for the env file, not a component.
// Consume it here so it is never dispatched to a component or reported as
// an unclaimed key.
if v, ok := rawConfig["version"]; ok {
version, ok := v.(int64)
if !ok {
return nil, fmt.Errorf("config key %q must be an integer, got %T", "version", v)
}
if version < 1 {
return nil, fmt.Errorf("config key %q must be >= 1, got %d", "version", version)
}
logger.Info().Int64("version", version).Msg("phased environment config schema version")
delete(rawConfig, "version")
}
Comment on lines +40 to +43
## New: top-level and per-component `version` validation

`env-phased.toml` must declare `version = 1` at the top level; each component section that supports versioning must also declare `version = 1`. Missing or mismatched values produce a clear startup error.

config: env.toml
config: env-phased.toml
flags: --env-mode phased
# env-phased.toml is the base config, so `ccv u` writes env-phased-out.toml.
version = 1
use_legacy_configure_lane = false

## Environment configuration define the topology. Eventually the topology should be the only config that is needed.
@winder winder enabled auto-merge June 2, 2026 15:03
@winder winder added this pull request to the merge queue Jun 2, 2026
@github-merge-queue github-merge-queue Bot removed this pull request from the merge queue due to failed status checks Jun 2, 2026
@winder winder added this pull request to the merge queue Jun 2, 2026
Merged via the queue into main with commit 64bb600 Jun 2, 2026
37 checks passed
@winder winder deleted the will/devenv-toml branch June 2, 2026 15:50
winder added a commit that referenced this pull request Jun 2, 2026
Feedback for #1138

Tighten the phased runtime version check to required exact-match using
CheckConfigVersion, update tests to supply version=1, and add tests for
absent and wrong versions; also fix a stale topology path and grammar
error in env-phased.toml and a ccv command typo in the CI workflow.
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