Repository navigation
Preserve literal : null in frontmatter scripts - #79906
Conversation
Co-authored-by: copilot-swe-agent[bot] <[email protected]>
Co-authored-by: copilot-swe-agent[bot] <[email protected]>
Co-authored-by: copilot-swe-agent[bot] <[email protected]>
: null in frontmatter scripts
|
✅ Test Quality Sentinel completed test quality analysis. Test Quality SentinelOutcome: The agent completed and reported no action. A no-op output alone does not verify that all required work was completed or that publication was possible. Agent messages are omitted from this comment. The category uses structured run status, not interpretation of agent prose.
|
|
✅ PR Specification Reviewer completed successfully! PR Specification ReviewerOutcome: The agent completed and reported one or more actions. The no-op output is a completion signal, not a claim that no action was taken. Agent messages are omitted from this comment. The category uses structured run status, not interpretation of agent prose.
|
|
✅ PR Code Quality Reviewer completed the code quality review. PR Code Quality ReviewerOutcome: The agent completed and reported one or more actions. The no-op output is a completion signal, not a claim that no action was taken. Agent messages are omitted from this comment. The category uses structured run status, not interpretation of agent prose.
|
|
🧠 Matt Pocock Skills Reviewer has completed the skills-based review. ✅
|
|
✅ Ponytail Reviewer completed successfully! Ponytail ReviewerOutcome: The agent completed and reported no action. A no-op output alone does not verify that all required work was completed or that publication was possible. Agent messages are omitted from this comment. The category uses structured run status, not interpretation of agent prose.
|
There was a problem hiding this comment.
Review summary
No actionable correctness, performance, or security issues found in the changed lines. The AST-based null handling addresses the script corruption case while preserving literal block content. Review was static; tests were not run per review protocol.
🔎 Code quality review by PR Code Quality Reviewer · copilot · gpt50 · ~2 AIC · ⌖ ~1 AIC · ⊞ 1.6K
Comment /review to run again
Comment MemoryPeek at saved memory (spec-review-history)History |
Comment MemoryPeek at saved memory (review-history)History |
There was a problem hiding this comment.
🔵 Needs a closer look
The workflow dependency locks and compiler-wide frontmatter reserialization introduce cross-cutting compatibility, operational, and multiline-preservation effects that require broader review.
No open issues 🎉
What changed in this PR
This PR fixes #79303 by preserving literal : null text in frontmatter scripts when gh-aw compiles workflows into GitHub Actions YAML.
Changes:
- Format actual YAML mapping nulls during serialization instead of rewriting serialized text.
- Add regression coverage for heredocs in
stepsandpost-steps, while preserving empty trigger formatting. - Update two generated workflows to use hash-verified PageIndex dependencies and include the requirements file in cache hashing.
| File | Description |
|---|---|
pkg/workflow/yaml_test.go |
Tests script preservation and empty trigger formatting. |
pkg/workflow/yaml_options.go |
Adds node-based formatting for mapping nulls. |
pkg/workflow/frontmatter_extraction_yaml.go |
Uses node-based null formatting and removes text cleanup. |
.github/workflows/spec-librarian.lock.yml |
Updates PageIndex installation and cache hashing. |
.github/workflows/daily-doc-updater.lock.yml |
Updates PageIndex installation and cache hashing. |
Review effort: Balanced (adaptive)
There was a problem hiding this comment.
🧠 Reviewed using Matt Pocock's skills by Matt Pocock Skills Reviewer · copilot · routed: haiku55 xhigh · ~9 AIC · ⌖ ~2 AIC · ⊞ 6.6K
Comment /matt to run again
| // GitHub Actions treats `workflow_dispatch:` and `workflow_dispatch: null` identically | ||
| yamlStr = CleanYAMLNullValues(yamlStr) | ||
|
|
||
| // Clean up quoted keys - replace "key": with key: at the start of a line |
There was a problem hiding this comment.
[/codebase-design] With this call removed, CleanYAMLNullValues in yaml.go and its yamlNullPattern regex have no production callers. They are still exported, covered by TestCleanYAMLNullValues, and listed in pkg/workflow/README.md. Either delete them with the test and the README row, or document why the helper stays. A whole-document : null regex is the bug this PR fixes, so keeping it available invites reuse.
@copilot please address this.
There was a problem hiding this comment.
Removed the unused regex helper, its tests, and README entry in 96df92b.
| return marshalYAML(value, false, options...) | ||
| } | ||
|
|
||
| func marshalYAML(value any, implicitMappingNulls bool, options ...yaml.EncodeOption) ([]byte, error) { |
There was a problem hiding this comment.
[/codebase-design] implicitMappingNulls bool changes the output shape, and call sites pass a bare true or false, which hides intent. Consider a named option, or a separate function such as marshalYAMLWithImplicitNulls, so each call site says what it does.
@copilot please address this.
There was a problem hiding this comment.
Added a named implicit-mapping-null serializer at the extraction call sites in 96df92b.
| if !ok || entry.IsFlowStyle { | ||
| continue | ||
| } | ||
| if value, ok := entry.Value.(*ast.NullNode); ok { |
There was a problem hiding this comment.
The value, ok := entry.Value.(*ast.NullNode) line shadows the value any parameter inside the loop. It works, but a reader can mistake it for the function input. Rename it, for example to nullNode.
@copilot please address this.
| yamlv3 "go.yaml.in/yaml/v3" | ||
| ) | ||
|
|
||
| func TestExtractTopLevelYAMLSectionPreservesNullInScripts(t *testing.T) { |
There was a problem hiding this comment.
[/tdd] The test covers steps, post-steps, and an empty on mapping. It does not cover the cases the new code handles specially: sequence nulls (kept as null), flow-style mappings (the IsFlowStyle skip), and env or with nulls inside steps. A regression in any of them would pass silently. Add a case for each, starting with a - null list item.
💡 Suggested test
for _, tc := range []struct{ name, yaml, want string }{
{"sequence null kept", "steps:\n - with:\n list: [null]\n", "- null"},
} { /* compile and assert tc.want appears in extractTopLevelYAMLSection output */ }@copilot please address this.
There was a problem hiding this comment.
Added sequence, step env/with, and flow-style null coverage in 96df92b; the flow test also exposed and fixes incorrect flow mapping output.
|
🍳 A little prep to help this PR along! Copilot assignment requested for the following outstanding work:
Keeping the changes focused; human review and CI get the final taste test. No merging or CI triggering. Structured data{
"completed_task": 0,
"head": "e783289b4be32dde5a91c29899267943c60d7867",
"kind": "requested",
"schema_version": "1",
"state": "ceebf4fd41f65deaa0aece4c4aaaa43fb9025b9d0199e768b402a0ccfb85096c",
"work": [
"83bd93b53757f7c875f400a26dc69145b5ba5dee90c5bee95ce4bd6ca7f8a3e7",
"893eb18e56b9d617b30ff6bba632f6ce1bfedd04f35cdf2c66a93fb5f61042ef",
"b08256f0406048651db251b6367fb05b691e4df7da86565bfd384cb23df2bbeb",
"d228a88e308f0853e679de293c02bbebd303e6b13828c96bd223562febefd908"
],
"workflow": "pr-sous-chef"
}
|
…null-removal Co-authored-by: copilot-swe-agent[bot] <[email protected]>
Co-authored-by: copilot-swe-agent[bot] <[email protected]>
Co-authored-by: copilot-swe-agent[bot] <[email protected]>
Merged |
The compiler stripped trailing
: nullfrom serialized frontmatter without distinguishing YAML mapping values from text insiderun:blocks. This silently corrupted JSON heredocs in generated workflows.workflow_dispatch:, and script text is left untouched by null formatting.stepsandpost-stepspreserve the heredoc and that empty trigger formatting stays unchanged.nullat the end of any line in frontmattersteps:, corruptingrun:scripts #79303