Skip to content

build/devenv: serialize raw phased output map, version-aware load#1140

Draft
winder wants to merge 1 commit into
will/devenv-tomlfrom
will/devenv-phased-no-cfg
Draft

build/devenv: serialize raw phased output map, version-aware load#1140
winder wants to merge 1 commit into
will/devenv-tomlfrom
will/devenv-phased-no-cfg

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

The phased devenv (--env-mode phased) previously reconstructed a transitional *Cfg from the component runtime's output map via hand-written sync blocks. This PR removes that bridge: NewPhasedEnvironment now serializes the raw accumulated output map directly, and LoadOutput[Cfg] switches on a version marker to decode either format. Adding a new serialized output no longer requires touching a central mapping — a component just publishes a public key.

What changed

  • NewPhasedEnvironment returns the raw accumulated map and writes the output file via storePhasedOutput, which strips runtime-only keys (any key prefixed with _) and serializes the rest. The schema version is re-published as a public key so the file starts with version = N.
  • Component output keys reclassified into public (serialized) vs. _-private (runtime-only, stripped):
    • protocol_contracts: _cldf → cldf, _topology → environment_topology (consumers in executor/committeeccv updated).
    • committeeccv: shared_tls_certs → _shared_tls_certs (consumer in indexer updated).
    • jd stays public (needed for future job proposals); JDInfrastructure.OffchainClient (a live gRPC client) is tagged toml:"-" so the section serializes cleanly while keeping jd_output + node_id_map.
  • LoadOutput[Cfg] is now version-aware — a single dispatch point that all readers (NewLibFromCCVEnv and the ~18 direct LoadOutput[ccv.Cfg] test call sites) funnel through:
    • version absent/0 → existing strict Cfg decode (legacy/monolith).
    • version == 1 → lenient decode of the raw map + derive aggregator/indexer endpoint maps from each launched service's Out.
    • any other version → error.
  • env.toml drops its version key so monolith output stays at 0 and routes to the legacy decoder.

Why

  • Removes the fragile, hand-maintained *Cfg reconstruction in the phased path.
  • Establishes a clear "public key vs. _-private runtime key" convention owned by each component.
  • Keeps the output-file contract backward compatible: no reader signatures or call sites change, because the version dispatch lives inside LoadOutput.

Compatibility / risk

  • Legacy (monolith) output and all its readers are unchanged.
  • Phased output keys are a raw component dump; the phased decode is intentionally lenient and ignores keys Cfg doesn't model (e.g. the aggregators/verifiers plurals).

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

NewPhasedEnvironment now serializes the raw accumulated component
hand-built PhasedOutput, and re-emits the schema version as a public
key. LoadOutput[Cfg] switches on that version: absent/0 keeps the
strict legacy Cfg decode, while version 1 leniently decodes the
phased map and derives the aggregator/indexer endpoint maps — so all
existing readers and NewLibFromCCVEnv are unchanged.

Components now own their public output keys: protocol_contracts emits
cldf and environment_topology, while shared TLS certs become a private
"_"-key. jd stays public, with JDInfrastructure.OffchainClient marked
toml:"-" so the live client is skipped but the JD output and node IDs
persist for future job proposals. env.toml drops its version key so
monolith output stays at 0.
@winder winder force-pushed the will/devenv-phased-no-cfg branch from 4304da6 to e9dc852 Compare May 29, 2026 20:45
@github-actions
Copy link
Copy Markdown

Code coverage report:

Package will/devenv-toml will/devenv-phased-no-cfg 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.69% 37.67% -0.02%
github.com/smartcontractkit/chainlink-ccv/integration 45.84% 45.84% +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.75% 63.75% +0.00%
github.com/smartcontractkit/chainlink-ccv/verifier 34.48% 34.48% +0.00%
Total 46.50% 46.40% -0.10%

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.

1 participant