Skip non-matching siblings in dyn wildcard visits#5511
Open
simonfaltum wants to merge 2 commits into
Open
Conversation
Co-authored-by: Isaac
Contributor
Approval status: pending
|
Collaborator
|
Commit: 1154623
22 interesting tests: 15 SKIP, 7 KNOWN
Top 29 slowest tests (at least 2 minutes):
|
Co-authored-by: Isaac
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Why
Found during a full-repo review of the CLI. When a wildcard pattern visits a map or sequence, a single element that cannot be traversed aborts the whole transform. For example, a bundle where one job has an empty
tasks:block failsbundle validatewith a cryptic error, and the remaining valid jobs are never processed:This is inconsistent with
MapByPattern, which already treats nil values as "no match" at the top level.Changes
Before, the wildcard visitors in
libs/dyn/pattern.goskipped a sibling only on a missing key or an out-of-bounds index; now they also skip siblings whose value is nil or not the collection kind the pattern expects, so the remaining siblings are still processed. Errors returned by the visit callback itself still abort the transform, and fixed path components applied to mismatched kinds still error as before.anyKeyComponent.visitandanyIndexComponent.visituse a newisNoMatchErrorhelper that extends the skipped set withcannotTraverseNilError,expectedMapError, andexpectedSequenceError.bundle validatenow succeeds and fully processes both jobs.Test plan
libs/dyncovering nil and wrong-kind siblings under*and[*], and callback error propagationacceptance/bundle/validate/empty_tasks, passing for both terraform and direct engines (failed with the error above before the fix)go test ./libs/dyn/...andgo test ./bundle/config/..../task fmt-q,./task lint-q,./task checksThis pull request and its description were written by Isaac.