Skip to content

[CLD-1503]: refactor(cld/runtime): export input yaml parsing functions from pipeline/input package#870

Merged
graham-chainlink merged 1 commit intomainfrom
ggoh/refactor-durable-pipeline-yaml-input
Mar 19, 2026
Merged

[CLD-1503]: refactor(cld/runtime): export input yaml parsing functions from pipeline/input package#870
graham-chainlink merged 1 commit intomainfrom
ggoh/refactor-durable-pipeline-yaml-input

Conversation

@graham-chainlink
Copy link
Collaborator

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

@changeset-bot
Copy link

changeset-bot bot commented Mar 18, 2026

🦋 Changeset detected

Latest commit: d10f9e4

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package
Name Type
chainlink-deployments-framework Minor

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) {
Copy link
Collaborator Author

@graham-chainlink graham-chainlink Mar 18, 2026

Choose a reason for hiding this comment

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

because of the modular command refactor, these tests are duplicated in yaml_test.go. So this can be removed.

Copy link
Collaborator Author

@graham-chainlink graham-chainlink Mar 18, 2026

Choose a reason for hiding this comment

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

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) {
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

test engine will be using this exported method

@graham-chainlink graham-chainlink marked this pull request as ready for review March 18, 2026 06:47
@graham-chainlink graham-chainlink requested a review from a team as a code owner March 18, 2026 06:47
Copilot AI review requested due to automatic review settings March 18, 2026 06:47
Copy link
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 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/input functions 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 BuildChangesetInputJSON introduces important formatting/validation behavior (notably large-integer preservation in ConvertToJSONSafe and chainOverrides validation), 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 invalid chainOverrides values/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.

Copy link
Collaborator Author

@graham-chainlink graham-chainlink Mar 18, 2026

Choose a reason for hiding this comment

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

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) {
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

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
@graham-chainlink graham-chainlink force-pushed the ggoh/refactor-durable-pipeline-yaml-input branch from 2314a94 to d10f9e4 Compare March 18, 2026 06:58
@cl-sonarqube-production
Copy link

Quality Gate failed Quality Gate failed

Failed conditions
52.5% Coverage on New Code (required ≥ 80%)

See analysis details on SonarQube

@graham-chainlink graham-chainlink added this pull request to the merge queue Mar 19, 2026
Merged via the queue into main with commit c8456cb Mar 19, 2026
20 of 21 checks passed
@graham-chainlink graham-chainlink deleted the ggoh/refactor-durable-pipeline-yaml-input branch March 19, 2026 04:24
github-merge-queue bot pushed a commit that referenced this pull request Mar 19, 2026
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>
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.

3 participants