Skip to content

avoid quoted string at fnresult Field unmarshal#4549

Open
tgzsolt wants to merge 1 commit into
kptdev:mainfrom
nokia:fix-fnresult-unmarshal
Open

avoid quoted string at fnresult Field unmarshal#4549
tgzsolt wants to merge 1 commit into
kptdev:mainfrom
nokia:fix-fnresult-unmarshal

Conversation

@tgzsolt
Copy link
Copy Markdown

@tgzsolt tgzsolt commented May 29, 2026

Desription

After parse fnresout Field with kyaml, Value can be scalar Node and if that happens, unmarshal will create quoted string

Motivation

Test type with roundtrip.RoundTripTestForAPIGroup even correct fuzzer is failing so serialize and deserialize do not give the same object

Copilot AI review requested due to automatic review settings May 29, 2026 15:22
@netlify
Copy link
Copy Markdown

netlify Bot commented May 29, 2026

Deploy Preview for kptdocs ready!

Name Link
🔨 Latest commit bdbbbaa
🔍 Latest deploy log https://app.netlify.com/projects/kptdocs/deploys/6a19af5522e2db0008656581
😎 Deploy Preview https://deploy-preview-4549--kptdocs.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.
🤖 Make changes Run an agent on this branch

To edit notification comments on pull requests, go to your Netlify project configuration.

@dosubot dosubot Bot added size:M This PR changes 30-99 lines, ignoring generated files. bug Something isn't working labels May 29, 2026
Copy link
Copy Markdown
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

Note

Copilot was unable to run its full agentic suite in this review.

This PR refines Field unmarshalling to better handle YAML scalar nodes when extracting currentValue and proposedValue, avoiding stringification overhead and improving nil-safety.

Changes:

  • Renamed local variables from rnode to rNode for consistency with yaml.RNode.
  • Updated parsing for currentValue / proposedValue to use raw scalar values where applicable, with additional nil checks.
  • Preserved existing trimming behavior after value extraction.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines +186 to 195
if currentValue, err := rNode.Pipe(yaml.Lookup("currentValue")); err == nil && currentValue.YNode() != nil {
switch currentValue.YNode().Kind {
case yaml.ScalarNode:
in.CurrentValue = currentValue.YNode().Value
default:
in.CurrentValue, err = currentValue.String()
if err != nil {
return fmt.Errorf("error parsing `field.currentValue`: %v", err)
}
}
Comment on lines +200 to 209
if proposedValue, err := rNode.Pipe(yaml.Lookup("proposedValue")); err == nil && proposedValue.YNode() != nil {
switch proposedValue.YNode().Kind {
case yaml.ScalarNode:
in.ProposedValue = proposedValue.YNode().Value
default:
in.ProposedValue, err = proposedValue.String()
if err != nil {
return fmt.Errorf("error parsing `field.proposedValue`: %v", err)
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working size:M This PR changes 30-99 lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants