[CLD-1503]: refactor(cld/runtime): export input yaml parsing functions from pipeline/input package#870
Conversation
🦋 Changeset detectedLatest commit: d10f9e4 The changes in this PR will be included in the next version bump. This PR includes changesets to release 1 package
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
| require.Equal(t, "200000000000000000111", maxFee.String()) | ||
| } | ||
|
|
||
| func TestFindChangesetInData(t *testing.T) { |
There was a problem hiding this comment.
because of the modular command refactor, these tests are duplicated in yaml_test.go. So this can be removed.
There was a problem hiding this comment.
this file is already deprecated as part of the command modular refactor, i remove the common code that was copied into yaml.go and reference it to reduce the duplication to keep things in sync
| } | ||
|
|
||
| // ParseYAMLBytes parses and validates durable pipeline YAML content. | ||
| func ParseYAMLBytes(yamlData []byte) (*DurablePipelineYAML, error) { |
There was a problem hiding this comment.
test engine will be using this exported method
There was a problem hiding this comment.
Pull request overview
This PR refactors durable pipeline YAML parsing/input-building logic into the engine/cld/pipeline/input package and updates legacy CLI code to reuse the exported helpers, enabling other runtimes (e.g., test runtime) to call the same parsing/building behavior.
Changes:
- Exported and refactored YAML parsing and input-building helpers (
ParseYAMLBytes,BuildChangesetInputJSON, updated error wrapping/call sites). - Updated legacy CLI durable pipeline commands/helpers to call the shared
pipeline/inputfunctions and removed duplicated implementations/tests. - Updated tests to match new function signatures and revised error messages; added a package release note via Changesets.
Reviewed changes
Copilot reviewed 7 out of 7 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
| engine/cld/pipeline/input/yaml.go | Exposes reusable YAML parsing and DURABLE_PIPELINE_INPUT JSON building/setting logic; adjusts error wrapping. |
| engine/cld/pipeline/input/yaml_test.go | Updates tests for new exported function signatures and revised error strings. |
| engine/cld/legacy/cli/commands/durable_pipeline_yaml.go | Replaces legacy YAML parsing/input-building logic with calls into pipeline/input. |
| engine/cld/legacy/cli/commands/durable_pipeline_yaml_test.go | Removes legacy-specific ConvertToJSONSafe number-preservation tests (now owned by shared package). |
| engine/cld/legacy/cli/commands/durable-pipelines_test.go | Updates tests/types to use pipelineinput.DurablePipelineYAML and loosens an error substring expectation. |
| engine/cld/legacy/cli/commands/durable-pipelines_helper.go | Switches YAML node conversion to input.YamlNodeToAny from the shared package. |
| .changeset/smart-files-brake.md | Declares a minor release note for the refactor/export. |
Comments suppressed due to low confidence (1)
engine/cld/pipeline/input/yaml.go:226
- New exported helper
BuildChangesetInputJSONintroduces important formatting/validation behavior (notably large-integer preservation inConvertToJSONSafeandchainOverridesvalidation), but there are no focused tests covering the JSON string output and numeric edge cases (the legacy number-preservation test was removed). Add unit tests that assert the produced JSON and that large integer-like values are emitted as exact integers (not scientific notation), and that invalidchainOverridesvalues/types are handled as expected.
// BuildChangesetInputJSON returns the DURABLE_PIPELINE_INPUT JSON string for changeset data.
func BuildChangesetInputJSON(changesetName string, changesetData any) (string, error) {
changesetMap, ok := changesetData.(map[string]any)
if !ok {
return "", fmt.Errorf("changeset %q is not a valid object", changesetName)
}
payload, payloadExists := changesetMap["payload"]
if !payloadExists {
return "", fmt.Errorf("changeset %q is missing required 'payload' field", changesetName)
}
jsonSafePayload, err := ConvertToJSONSafe(payload)
if err != nil {
return "", fmt.Errorf("failed to convert payload to JSON-safe format: %w", err)
}
chainOverridesRaw, exists := changesetMap["chainOverrides"]
if exists && chainOverridesRaw != nil {
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
There was a problem hiding this comment.
this file will be the main change to review.
| } | ||
|
|
||
| // BuildChangesetInputJSON returns the DURABLE_PIPELINE_INPUT JSON string for changeset data. | ||
| func BuildChangesetInputJSON(changesetName string, changesetData any) (string, error) { |
There was a problem hiding this comment.
Test runtime will use this exported function
…ine/input package In order for test runtime to access yaml parsing methods from the engine, we need to refactor and expose it. JIRA: https://smartcontract-it.atlassian.net/browse/CLD-1503
2314a94 to
d10f9e4
Compare
|
This PR was opened by the [Changesets release](https://github.com/changesets/action) GitHub action. When you're ready to do a release, you can merge this and the packages will be published to npm automatically. If you're not ready to do a release yet, that's fine, whenever you add more changesets to main, this PR will be updated. # Releases ## chainlink-deployments-framework@0.89.0 ### Minor Changes - [#876](#876) [`5d69a79`](5d69a79) Thanks [@ajaskolski](https://github.com/ajaskolski)! - feat: add additional verifiers to evm cmd - [#870](#870) [`c8456cb`](c8456cb) Thanks [@graham-chainlink](https://github.com/graham-chainlink)! - refactor(cld/runtime): export input yaml parsing functions from pipeline/input package --------- Co-authored-by: app-token-issuer-engops[bot] <144731339+app-token-issuer-engops[bot]@users.noreply.github.com>


In order for test runtime to access yaml parsing methods from the engine, we need to refactor and expose it.
JIRA: https://smartcontract-it.atlassian.net/browse/CLD-1503