-
Notifications
You must be signed in to change notification settings - Fork 142
Fix yaml formatting in config-remote-sync #4468
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
| + interval: 2 | ||
| unit: DAYS | ||
| - unit: DAYS | ||
| + pause_status: UNPAUSED |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This case was previously incorrectly formatted in Flow style, I updated the test to capture this (see test behavior before the fix dd609e4)
|
Commit: d05c9b8
17 interesting tests: 7 KNOWN, 7 SKIP, 2 flaky, 1 RECOVERED
Top 50 slowest tests (at least 2 minutes):
|
go.mod
Outdated
| require github.com/google/jsonschema-go v0.4.2 // MIT | ||
|
|
||
| require gopkg.in/yaml.v3 v3.0.1 // indirect | ||
| require gopkg.in/yaml.v3 v3.0.1 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you use go.yaml.in/yaml/v3 instead?
See #4353.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Updated
| team: data-eng | ||
| - | ||
| # Flow-style formatting (should be preserved) | ||
| parameters: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
They are omitted from the output, expected?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We show here not the full config but the diff between old config and new. So it is just a confusing snippet from the unified diff output
In reality, these lines are unchanged, but there is an empty-line deletion on line 42 (separate issue, will be addressed later), and this # Flow-style formatting (should be preserved) part is just brought here as viewing context
| return | ||
| } | ||
|
|
||
| clearFlowStyleNodes(current) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is it worth having a yaml.Node walker based on structpath?
This function looks generalizable.
OK if not worth it right now.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Probably not worth it, I'd like this to be only a temporary solution. I think a better fix will be to do the following (from the PR description):
TODO: A good alternative is to remove parent nodes during the Resolve phase, when all of their keys/items are removed, but this is a separate task and needs to be tested for edge cases. I'll clean up this fix if the parent removal is a valid option
For now, I wanted to quickly fix it now to avoid weird diff entries, but later I think it makes sense to investigate it
|
Commit: 3e07780
26 interesting tests: 11 RECOVERED, 8 flaky, 5 SKIP, 1 KNOWN, 1 FAIL
Top 50 slowest tests (at least 2 minutes):
|
Changes
Fix cases where the config-remote-sync command formats nodes in Flow style
Why
It happens when a neighbor node is removed during sync, and new fields are then added to the same parent. Empty nodes can't be expressed in block style, therefore, yaml patcher falls back to using Flow formatting, which is then inherited by created child nodes
TODO: A good alternative is to remove parent nodes during the Resolve phase, when all of their keys/items are removed, but this is a separate task and needs to be tested for edge cases. I'll clean up this fix if the parent removal is a valid option
Tests
Added acceptance tests