Fix safe-outputs body:null parsing to enable field updates#15129
Fix safe-outputs body:null parsing to enable field updates#15129
Conversation
Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
There was a problem hiding this comment.
Pull request overview
This PR fixes the parsing of body: null configurations in safe-outputs update entity handlers. Previously, null values were parsed as nil pointers, which relied on downstream default handling. Now, null values are explicitly treated as true during parsing, maintaining backward compatibility while making the behavior more explicit and consistent.
Changes:
- Modified
parseUpdateEntityBoolFieldto treat null values astrueinFieldParsingBoolValuemode for backward compatibility - Updated test expectations to verify that null values result in non-nil pointers set to
true - Regenerated lock files to reflect consistent handler configurations with explicit
allow_body: true
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 |
|---|---|
| pkg/workflow/update_entity_helpers.go | Added nil check in FieldParsingBoolValue case to return &true instead of nil; updated documentation to clarify nil-as-true behavior |
| pkg/workflow/update_entity_helpers_test.go | Updated test to expect non-nil pointer with true value when parsing nil in BoolValue mode |
| pkg/workflow/update_issue_test.go | Updated backward compatibility test to verify nil values parse as &true |
| pkg/workflow/data/action_pins.json | Added actions/setup-go@v5 pin discovered during recompilation |
| .github/workflows/ci-doctor.lock.yml | Added explicit allow_body: true in handler config |
| .github/workflows/sub-issue-closer.lock.yml | Added explicit allow_body: true in handler config |
| .github/workflows/workflow-health-manager.lock.yml | Added explicit allow_body: true in handler config |
Comments suppressed due to low confidence (1)
pkg/workflow/update_entity_helpers.go:206
- The comment incorrectly states that
FieldParsingBoolValueis "Used by body/footer fields in all update entities". This is inaccurate:
update-issue: body, footer ✓update-pull-request: title, body (not just body/footer)update-discussion: footer only (body uses KeyExistence)update-release: footer only (no body field)
The comment should accurately describe which fields use this mode.
// FieldParsingBoolValue mode: Field's boolean value determines if it can be updated.
// Special case: nil values are treated as true for backward compatibility.
// Used by body/footer fields in all update entities.
FieldParsingBoolValue
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| // 2. **Bool Value Mode** (for body/footer fields in all entities): | ||
| // Fields are enabled based on explicit boolean values. | ||
| // Special case: null values are treated as true for backward compatibility: | ||
| // ```yaml | ||
| // update-issue: | ||
| // body: true # Explicitly enable body updates | ||
| // body: false # Explicitly disable body updates | ||
| // body: null # Treated as true (backward compatibility) | ||
| // body: # Same as null, treated as true | ||
| // update-pull-request: | ||
| // title: true # Can update title | ||
| // body: false # Cannot update body | ||
| // title: true # Can update title | ||
| // body: false # Cannot update body | ||
| // ``` |
There was a problem hiding this comment.
The documentation incorrectly states that FieldParsingBoolValue mode is used for "body/footer fields in all entities". However, this is not accurate:
update-issueuses it for: body, footer (correct)update-pull-requestuses it for: title, body (not just body/footer)update-discussionuses it for: footer only (body uses KeyExistence mode)update-releaseuses it for: footer only (no body field)
The documentation should be updated to accurately reflect which fields use this mode, or use a more general description like "certain update fields that support explicit true/false configuration".
This issue also appears on line 203 of the same file.
parseUpdateEntityBoolFieldreturnednilforbody: nullconfigurations, causing the field to be treated as disabled. The parser now treats YAML null values as explicit enablement (true) inFieldParsingBoolValuemode.Changes
FieldParsingBoolValuecase to return&truefor backward compatibilityTestUpdateIssueBodyNullBackwardCompatibilityandTestParseUpdateEntityBoolFieldto expect non-nil pointerBehavior
Applies to body/footer fields in
update-issue,update-pull-request,update-discussion, andupdate-release.Technical Details
Original prompt
💬 We'd love your input! Share your thoughts on Copilot coding agent in our 2 minute survey.