Skip to content

Preserve literal : null in frontmatter scripts - #79906

Merged
pelikhan merged 7 commits into
mainfrom
copilot/fix-compiler-null-removal
Nov 22, 2026
Merged

pelikhan merged 7 commits into
mainfrom
copilot/fix-compiler-null-removal

Conversation

@pelikhan

@pelikhan pelikhan commented Nov 21, 2026 •

Copy link
Copy Markdown
Collaborator

The compiler stripped trailing : null from serialized frontmatter without distinguishing YAML mapping values from text inside run: blocks. This silently corrupted JSON heredocs in generated workflows.

  • YAML serialization: Format nulls on YAML mapping nodes instead of rewriting serialized text. Empty triggers still render as workflow_dispatch:, and script text is left untouched by null formatting.
  • Regression coverage: Check that steps and post-steps preserve the heredoc and that empty trigger formatting stays unchanged.
steps:
  - run: |
      cat <<'EOF'
      {
        "a": null,
        "b": null
      }
      EOF

pelikhan and others added 3 commits November 21, 2026 22:06
Co-authored-by: copilot-swe-agent[bot] <[email protected]>
Co-authored-by: copilot-swe-agent[bot] <[email protected]>
@pelikhan pelikhan changed the title [WIP] Fix compiler stripping null in frontmatter steps Preserve literal : null in frontmatter scripts Nov 21, 2026
@pelikhan
pelikhan marked this pull request as ready for review November 21, 2026 22:15
Copilot AI adaptive review requested due to automatic review settings November 21, 2026 22:15
@github-actions

github-actions Bot commented Nov 21, 2026 •

Copy link
Copy Markdown
Contributor

✅ Test Quality Sentinel completed test quality analysis.

Test Quality Sentinel

Outcome: reported_no_action

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.

🧪 Test quality analysis by Test Quality Sentinel · copilot · routed: haiku55 xhigh · ~1 AIC · ⌖ ~2 AIC · ⊞ 7.2K · ◷

@github-actions

github-actions Bot commented Nov 21, 2026 •

Copy link
Copy Markdown
Contributor

✅ PR Specification Reviewer completed successfully!

PR Specification Reviewer

Outcome: reported_action

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.

Generated by PR Specification Reviewer for #79906 · copilot · gpt56 · ~2 AIC · ⌖ ~2 AIC · ⊞ 1.7K · ◷

@github-actions

github-actions Bot commented Nov 21, 2026 •

Copy link
Copy Markdown
Contributor

✅ PR Code Quality Reviewer completed the code quality review.

PR Code Quality Reviewer

Outcome: reported_action

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.

🔎 Code quality review by PR Code Quality Reviewer · copilot · gpt56 · ~2 AIC · ⌖ ~1 AIC · ⊞ 1.6K · ◷

@github-actions

github-actions Bot commented Nov 21, 2026 •

Copy link
Copy Markdown
Contributor

🧠 Matt Pocock Skills Reviewer has completed the skills-based review. ✅

🧠 Reviewed using Matt Pocock's skills by Matt Pocock Skills Reviewer · copilot · routed: haiku55 xhigh · ~9 AIC · ⌖ ~2 AIC · ⊞ 6.6K · ◷

@github-actions

github-actions Bot commented Nov 21, 2026 •

Copy link
Copy Markdown
Contributor

✅ Ponytail Reviewer completed successfully!

Ponytail Reviewer

Outcome: reported_no_action

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.

Generated by Ponytail Reviewer for #79906 · codex · routed: gpt61 medium · ~4 AIC · ⌖ ~1 AIC · ⊞ 185 · ◷

@github-actions github-actions Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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

@github-actions

Copy link
Copy Markdown
Contributor

Comment Memory

Peek at saved memory (spec-review-history)
{"id":"ldg-424f3ebc-86a4-4743-966c-9d5f686e1d18","parents":[],"payload":{"id":"ldg-95dfdfa2-f571-4250-b4eb-87061b8f7abb","operation":"append","value":{"finding_count":0,"head_sha":"e783289b4be32dde5a91c29899267943c60d7867","outcome":"aligned"}},"sha":"sha256:f02bcd0b6ac2488c8f21e677d80fe5a881fdb714110904c25fe1106d3422d953","timestamp":"2026-11-21T22:22:50.747Z","type":"ledger_append","version":1}
History

@github-actions

Copy link
Copy Markdown
Contributor

Comment Memory

Peek at saved memory (review-history)
{"id":"ldg-cd5248de-1b17-4e55-a760-3f73dda88f89","parents":[],"payload":{"id":"ldg-94fa63bc-423e-4c73-98a8-28984b95134c","operation":"append","value":{"finding_count":0,"head_sha":"e783289b4be32dde5a91c29899267943c60d7867","outcome":"no_findings"}},"sha":"sha256:a598380f92c44187f08945cbbd23f46f0f1970a15eaca1a9d7f4b0c7c0fe1574","timestamp":"2026-11-21T22:23:30.506Z","type":"ledger_append","version":1}
History

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🔵 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 steps and post-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)

@github-actions github-actions Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🧠 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

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[/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.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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) {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[/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.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Added a named implicit-mapping-null serializer at the extraction call sites in 96df92b.

Comment thread pkg/workflow/yaml_options.go Outdated
if !ok || entry.IsFlowStyle {
continue
}
if value, ok := entry.Value.(*ast.NullNode); ok {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Renamed the local to nullNode in 96df92b.

Comment thread pkg/workflow/yaml_test.go
yamlv3 "go.yaml.in/yaml/v3"
)

func TestExtractTopLevelYAMLSectionPreservesNullInScripts(t *testing.T) {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[/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.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Added sequence, step env/with, and flow-style null coverage in 96df92b; the flow test also exposed and fixes incorrect flow mapping output.

@gh-aw-bot

Copy link
Copy Markdown
Collaborator

@copilot

🍳 A little prep to help this PR along! Copilot assignment requested for the following outstanding work:

  1. Update this branch with the latest main using make merge-main, resolving any conflicts and preserving the intended changes.
  2. Review (pkg/workflow/frontmatter_extraction_yaml.go:111): address unresolved feedback - Review comment
  3. Review (pkg/workflow/yaml_options.go:30): address unresolved feedback - Review comment
  4. Review (pkg/workflow/yaml_options.go:44): address unresolved feedback - Review comment
  5. Review (pkg/workflow/yaml_test.go:13): address unresolved feedback - Review comment

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"
}

Generated by 👨🍳 PR Sous Chef · pi · routed: haiku55 xhigh · ~4 AIC · ⌖ ~2 AIC · ⊞ 7K · ◷
Comment /souschef to run again

gh-aw-bot and others added 3 commits November 21, 2026 23:00
Co-authored-by: copilot-swe-agent[bot] <[email protected]>
Co-authored-by: copilot-swe-agent[bot] <[email protected]>

Copilot AI commented Nov 21, 2026

Copy link
Copy Markdown
Contributor

@copilot

🍳 A little prep to help this PR along! Copilot assignment requested for the following outstanding work:...

Merged main and addressed the four review threads in 96df92b. Focused tests and Go lint pass. Workflow recompilation was blocked by npm feed DNS; the final gate also reports existing custom-linter findings. CodeQL timed out.

Copilot AI requested a review from gh-aw-bot November 21, 2026 23:24
@pelikhan
pelikhan merged commit 0808956 into main Nov 22, 2026
68 checks passed
@pelikhan
pelikhan deleted the copilot/fix-compiler-null-removal branch November 22, 2026 00:12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Compiler strips null at the end of any line in frontmatter steps:, corrupting run: scripts

4 participants