Skip to content

Serialize workflow names and generated run names as YAML scalars - #76903

Merged
lpcox merged 3 commits into
mainfrom
copilot/serialize-yaml-names
Nov 11, 2026
Merged

lpcox merged 3 commits into
mainfrom
copilot/serialize-yaml-names

Conversation

Copilot AI commented Nov 11, 2026 •

Copy link
Copy Markdown
Contributor

Workflow names were interpolated into double-quoted YAML without escaping, allowing quotes and line breaks to corrupt generated mappings. The same defect affected default run-name values and workflow-name metadata.

  • Scalar serialization

    • Use %q consistently across all three emitters, preserving special characters and supported display-name expressions.
    • Leave explicit run-name handling unchanged.
    name: "Example \"quoted\" workflow"
    run-name: "Example \"quoted\" workflow"
  • Regression coverage

    • Parse generated lock files and assert exact scalar values and unchanged top-level keys.
    • Cover quotes, backslashes, LF/CRLF, Unicode, controls, punctuation, and Markdown headings—with and without explicit run-name.
    • Verify field-specific rejection errors neither create nor overwrite lock files.

Co-authored-by: lpcox <15877973+lpcox@users.noreply.github.com>
Copilot AI changed the title [WIP] Fix serialization of workflow and run names as YAML scalars Serialize workflow names and generated run names as YAML scalars Nov 11, 2026
Copilot AI requested a review from lpcox November 11, 2026 16:35
@pelikhan
pelikhan marked this pull request as ready for review November 11, 2026 16:51
Copilot AI adaptive review requested due to automatic review settings November 11, 2026 16:51
@github-actions

Copy link
Copy Markdown
Contributor

🧠 Matt Pocock Skills Reviewer is reviewing this pull request using Matt Pocock's engineering skills...

@github-actions

github-actions Bot commented Nov 11, 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.

Generated from Test Quality Sentinel · routed: haiku55 xhigh · ~1 AIC · ⌖ ~2 AIC · ◇ ~1 AIC · ⊞ 7.2K · ◷

🧪 Test quality analysis by Test Quality Sentinel

@github-actions

github-actions Bot commented Nov 11, 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.

Generated from PR Code Quality Reviewer · gpt56 · ~3 AIC · ⌖ ~1 AIC · ◇ ~1 AIC · ⊞ 1.6K · ◷

🔎 Code quality review by PR Code Quality Reviewer

@github-actions

github-actions Bot commented Nov 11, 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 from Ponytail Reviewer · routed: gpt61 medium · ~4 AIC · ⌖ ~1 AIC · ◇ ~1 AIC · ⊞ 181 · ◷

Generated by Ponytail Reviewer for #76903

@github-actions

This comment has been minimized.

@github-actions

github-actions Bot commented Nov 11, 2026 •

Copy link
Copy Markdown
Contributor

✅ PR Specification Reviewer completed successfully!

Generated by PR Specification Reviewer for #76903

@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 PR head 2ee680b82bd45add3e8f3c464df967961073f0ad against specs/compiler-threat-detection-spec.md §5.1.3 / CTR-019, including the native Actions scalar-serialization requirement (line 396), plus the changed compiler and regression-test paths. The %q changes preserve YAML structure and the added coverage is aligned with the contract; no specification synchronization is warranted. An initial inline concern about the Unicode test literal was corrected after direct inspection; the source uses valid \u0085 syntax. No tests were run per static-review constraints.

Generated by PR Specification Reviewer for #76903 · copilot · gpt50 · ~2 AIC · ⌖ ~1 AIC · ⊞ 1.6K
Comment /review-specs to run again

{name: "document boundary", value: "Example\n---\nname: injected"},
{name: "tabs", value: "Example\tworkflow"},
{name: "controls", value: "Example\x00\a\b\v\f\x1b\x7f workflow"},
{name: "Unicode line breaks", value: "Example\u0085next\u2028line\u2029paragraph"},

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 new regression case is not valid Go: \u0085 is interpreted as a Unicode escape only when written as \u0085 in the source, but this line currently contains the invalid \^E escape in the PR patch/working tree context. Please verify the literal compiles (for example, use \u0085) before merging; otherwise the added test prevents the package from building.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Verified the checked-out source uses the valid Go escape \u0085; go test ./pkg/workflow -run '^TestCompileWorkflowNameScalars$' -count=1 passes. No source change was needed.

{name: "document boundary", value: "Example\n---\nname: injected"},
{name: "tabs", value: "Example\tworkflow"},
{name: "controls", value: "Example\x00\a\b\v\f\x1b\x7f workflow"},
{name: "Unicode line breaks", value: "Example\u0085next\u2028line\u2029paragraph"},

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.

Correction: direct inspection of the checked-out file shows the literal is \u0085, which is valid Go. The preceding concern was based on escaped diff rendering and is withdrawn; no compilation issue is present here.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Confirmed: the source literal is valid Go and the focused regression test passes.

@github-actions

Copy link
Copy Markdown
Contributor

Comment Memory

Peek at saved memory (pr-code-quality-reviewer)
reviewed_at: 2026-11-11T16:57:00Z
review_event: REQUEST_CHANGES
top_themes:
  - regression test contains invalid Go escape and blocks package compilation
files_reviewed:
  - pkg/workflow/compiler_yaml.go
  - pkg/workflow/compiler_yaml_step_lifecycle.go
  - pkg/workflow/tools.go
  - pkg/workflow/yaml_encoding_test.go
comment_count: 1

Note

This comment is managed by comment memory.

Expand the saved memory block to view or edit the persistent context for this thread.
Edit only the text inside the backtick fences; workflow metadata and the footer are regenerated automatically.

Learn more about comment memory

🔎 Code quality review by PR Code Quality Reviewer · copilot · gpt50 · ~3 AIC · ⌖ ~1 AIC · ⊞ 1.6K · ◷
Comment /review to run again

@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.

Found one blocking issue: the new regression test contains an invalid Go escape and prevents the package from compiling. The production quoting changes were otherwise not flagged in this static review. Tests were not executed per review instructions.

🔎 Code quality review by PR Code Quality Reviewer · copilot · gpt50 · ~3 AIC · ⌖ ~1 AIC · ⊞ 1.6K
Comment /review to run again

{name: "document boundary", value: "Example\n---\nname: injected"},
{name: "tabs", value: "Example\tworkflow"},
{name: "controls", value: "Example\x00\a\b\v\f\x1b\x7f workflow"},
{name: "Unicode line breaks", value: "Example\u0085next\u2028line\u2029paragraph"},

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.

This test file does not compile because the Unicode line breaks case contains the invalid Go escape \^E, so the regression suite cannot run at all.

💡 Fix the test literal

Use a valid Go escape for the intended control character (for example \x1e or \u001e), or remove the stray backslash before ^E; then run the package tests to verify the YAML cases.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

The current source uses valid \u0085 syntax, not \^E; the focused regression test passes. No source change was needed.

@github-actions

Copy link
Copy Markdown
Contributor

🏗️ Design Decision Gate — ADR Required

This PR makes significant changes to core business logic (more than 100 new lines in pkg/) but does not have a linked Architecture Decision Record (ADR).

📄 Draft ADR committed: docs/adr/76903-serialize-workflow-names-as-yaml-scalars.md. Review and complete it before merging.

🔒 This PR cannot merge until an ADR is linked in the PR body.

📋 What to do next
  1. Review the draft ADR committed to your branch. It was generated from the PR diff.

  2. Complete the missing sections: add context the gate could not infer, confirm the rationale, and confirm the alternatives you actually considered. escapeForYAMLDoubleQuoted is a close alternative, and the Alternatives section should address it.

  3. Commit the finalized ADR to docs/adr/ on your branch.

  4. Reference the ADR in this PR body by adding a line such as:

    ADR: ADR-76903: Serialize Workflow Names as Go-Quoted YAML Scalars (link unavailable: invalid HTTPS URL)

Once an ADR is linked in the PR body, this gate will re-run and verify the implementation matches the decision.

🔍 Evidence
  • The PR body references Fixes #76901. The linked issue has no ADR content.
  • No file under docs/adr/ is added or changed by this PR. ADR-71803 uses %q for a different decision, so it does not cover this one.
  • Trigger: no implementation label, and 133 added lines under pkg/ (threshold 100, default directories, no .design-gate.yml).
  • Inferred decision: emit the workflow name, the default run-name, and GH_AW_INFO_WORKFLOW_NAME as %q double-quoted YAML scalars instead of manual "%s" quoting.
📋 Michael Nygard ADR Format Reference

An ADR must contain these four sections to be considered complete:

  • Context: What is the problem? What forces are at play?
  • Decision: What did you decide? Why?
  • Alternatives Considered: What else could have been done?
  • Consequences: What are the trade-offs (positive and negative)?

All ADRs are stored in docs/adr/ as Markdown files numbered by PR number, for example 76903-...md.

🏗️ ADR gate enforced by Design Decision Gate 🏗️ · pi · routed: haiku55 xhigh · ~4 AIC · ⌖ ~2 AIC · ⊞ 8.5K · ◷
Comment /review to run again

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.

🟢 Approval recommended

No active review issues are identified for the change to escape workflow names during YAML serialization.

No open issues 🎉

What changed in this PR

This PR fixes YAML serialization of workflow names in the gh-aw compiler, addressing #76901 by escaping values rather than manually wrapping them in quotes.

Changes:

  • Use %q for workflow names, default run names, and workflow-name metadata.
  • Preserve existing handling of explicit run-name values.
  • Add regression tests for special-character round trips, unchanged top-level mappings, and lock-file preservation when non-scalar names are rejected.
File Description
pkg/​workflow/​yaml_encoding_test.go Adds scalar round-trip and rejection regression tests.
pkg/​workflow/​tools.go Escapes generated default run names.
pkg/​workflow/​compiler_yaml.go Escapes the top-level workflow name.
pkg/​workflow/​compiler_yaml_step_lifecycle.go Escapes workflow-name metadata.

Review effort: Balanced (auto)

@lpcox

lpcox commented Nov 11, 2026

Copy link
Copy Markdown
Collaborator

@copilot address this feedback #76903 (review)

Copilot AI commented Nov 11, 2026

Copy link
Copy Markdown
Contributor Author

Found one blocking issue: the new regression test contains an invalid Go escape and prevents the package from compiling. The production quoting changes were otherwise not flagged in this static review...

The current test literal is valid Go (\u0085), and the focused regression test passes: go test ./pkg/workflow -run '^TestCompileWorkflowNameScalars$' -count=1. No code change was needed.

@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/yaml_encoding_test.go:166): address unresolved feedback - Review comment
  3. Review (pkg/workflow/yaml_encoding_test.go:166): address unresolved feedback - Review comment
  4. Review (pkg/workflow/yaml_encoding_test.go:166): 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": "21c755d7b5ce0f8617b52d5db5b09160708cfba7",
  "kind": "requested",
  "schema_version": "1",
  "state": "c46e91dfaec1215270fc78773c3cda8861db29ba8f868540cd18ff6f6807cad4",
  "work": [
    "14c47a4e4c230cefc41d14f3d8f90e396c58406ee140cc723440fd225d7ac7e6",
    "37869aa8b680d16802633c48a257be226aecda64a772840d7529d2a7b343338f",
    "56efcd95dba7c91d1f6e3beb2d676b2c92e9ee9c1dca91b6f39c0a891d574109"
  ],
  "workflow": "pr-sous-chef"
}

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

Copilot AI commented Nov 11, 2026

Copy link
Copy Markdown
Contributor Author

@copilot

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

make merge-main fetched main and completed successfully; origin/main is already the merge base of this branch, so no additional merge commit was needed. The referenced Go literal is valid (\u0085), and the focused regression test passes.

Copilot AI requested a review from gh-aw-bot November 11, 2026 17:49
@lpcox
lpcox merged commit 781075c into main Nov 11, 2026
76 checks passed
@lpcox
lpcox deleted the copilot/serialize-yaml-names branch November 11, 2026 18:07
@github-actions

Copy link
Copy Markdown
Contributor

🎉 This pull request is included in a new release.

Release: v1.2.3

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.

Serialize workflow names and generated run names as YAML scalars

4 participants