Skip to content

[yamllint-fixer] fix(workflow): reduce yamllint noise in generated lock files (16 → 3)#45372

Merged
pelikhan merged 4 commits into
mainfrom
fix/yamllint-trailing-spaces-blank-lines-886438b1b9b48448
Jul 14, 2026
Merged

[yamllint-fixer] fix(workflow): reduce yamllint noise in generated lock files (16 → 3)#45372
pelikhan merged 4 commits into
mainfrom
fix/yamllint-trailing-spaces-blank-lines-886438b1b9b48448

Conversation

@github-actions

@github-actions github-actions Bot commented Jul 14, 2026

Copy link
Copy Markdown
Contributor

Generated by PR Description Updater for #45372 · 47.7 AIC · ⌖ 4.26 AIC · ⊞ 4.7K ·

…ed YAML

Extend normalizeBlankLines so the final lock-file assembly also trims
trailing spaces/tabs from content lines and caps consecutive blank lines
at two. Previously it only cleared whitespace-only lines, leaving
trailing-spaces on embedded shell/GraphQL/JS scripts and prompt heredoc
content, plus over-long blank runs, which yamllint flagged.

Trailing whitespace is never significant in the block scalars gh-aw
emits, so this changes no runtime behaviour. Reduces yamllint warnings on
generated *.lock.yml from 16 to 3 (all remaining are comments-indentation).

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@pelikhan pelikhan marked this pull request as ready for review July 14, 2026 07:02
Copilot AI review requested due to automatic review settings July 14, 2026 07:02
@github-actions

github-actions Bot commented Jul 14, 2026

Copy link
Copy Markdown
Contributor Author

PR Code Quality Reviewer completed the code quality review.

@github-actions

github-actions Bot commented Jul 14, 2026

Copy link
Copy Markdown
Contributor Author

Design Decision Gate 🏗️ completed the design decision gate check.

No ADR enforcement needed: PR #45372 does not have the 'implementation' label and has only 44 new lines of code in business logic directories (threshold: 100).

@github-actions

github-actions Bot commented Jul 14, 2026

Copy link
Copy Markdown
Contributor Author

Test Quality Sentinel completed test quality analysis.

@github-actions

github-actions Bot commented Jul 14, 2026

Copy link
Copy Markdown
Contributor Author

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

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.

Pull request overview

Reduces yamllint warnings in generated workflow lock files through final-pass whitespace normalization.

Changes:

  • Trims trailing whitespace and caps blank-line runs.
  • Adds normalization tests.
  • Regenerates the WASM golden fixture.
Show a summary per file
File Description
pkg/workflow/compiler_yaml.go Expands YAML whitespace normalization.
pkg/workflow/compiler_yaml_test.go Tests the expanded behavior.
pkg/workflow/testdata/TestWasmGolden_CompileFixtures/smoke-copilot.golden Reflects normalized trailing whitespace.

Review details

Tip

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

  • Files reviewed: 2/3 changed files
  • Comments generated: 2
  • Review effort level: Medium

// Trim trailing whitespace from every line. On whitespace-only lines this
// yields an empty line; on content lines it strips trailing spaces/tabs that
// yamllint flags as trailing-spaces.
trimmed := strings.TrimRight(line, " \t")
Comment thread pkg/workflow/compiler_yaml.go Outdated
Comment on lines +363 to +366
if blankRun < maxConsecutiveBlankLines {
b.WriteByte('\n')
blankRun++
}

@github-actions github-actions Bot left a comment

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.

Clean, well-scoped fix. The TrimRight approach correctly preserves leading indentation while stripping trailing whitespace, the blank-run cap logic is correct, and the new test cases cover all changed behaviours. Golden file delta confirms no semantic change. LGTM.

🧵 Reviewed using Impeccable skills by Impeccable Skills Reviewer · 11.7 AIC · ⌖ 4.92 AIC · ⊞ 4.8K

@github-actions github-actions Bot mentioned this pull request Jul 14, 2026

@github-actions github-actions Bot left a comment

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.

Skills-Based Review 🧠

Applied /tdd and /diagnosing-bugs — approving with minor test-quality suggestions.

📋 Key Themes & Highlights

Key Themes

  • Root cause fixed: normalizeBlankLines now trims trailing whitespace from all lines, not just whitespace-only ones — the correct fix rather than a symptom workaround.
  • Constant is well-named: maxConsecutiveBlankLines makes the policy explicit and directly ties to the yamllint rule it satisfies.
  • Test coverage added: 6 new table-driven cases cover both new behaviours.
  • Minor: one test name is misleading and two cases overlap in intent (see inline comments).

Positive Highlights

  • ✅ Clean single-responsibility change: one function, one responsibility extended
  • ✅ Golden file delta confirms zero semantic impact
  • blankRun reset on non-blank line is correctly placed after lastNonBlankEnd update
  • ✅ PR description is thorough and includes before/after metrics

🧠 Reviewed using Matt Pocock's skills by Matt Pocock Skills Reviewer · 21.9 AIC · ⌖ 4.52 AIC · ⊞ 6.6K
Comment /matt to run again

Comment thread pkg/workflow/compiler_yaml_test.go Outdated
{"single non-blank line", "key: value\n", "key: value\n"},
{"multiple trailing blank lines", "a\n\n\n\n", "a\n"},
{"only whitespace lines", " \n \n", "\n"},
{"content-line trailing spaces trimmed", "key: value \n", "key: value\n"},

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.

[/tdd] Test name "interior trailing spaces preserved content" is misleading — it reads as if trailing spaces are being kept, but the assertion shows they are trimmed.

💡 Suggested rename
{"indentation preserved when trailing spaces trimmed", "  foo: bar  \n", "  foo: bar\n"},

The intent (leading whitespace untouched, trailing whitespace removed) should be readable from the test name itself, per /tdd spec-naming conventions.

@copilot please address this.

Comment thread pkg/workflow/compiler_yaml_test.go Outdated
{"only whitespace lines", " \n \n", "\n"},
{"content-line trailing spaces trimmed", "key: value \n", "key: value\n"},
{"content-line trailing tabs trimmed", "a\t\nb\n", "a\nb\n"},
{"interior trailing spaces preserved content", " foo: bar \n", " foo: bar\n"},

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.

[/tdd] Two test cases (long interior blank run capped at two and three interior blanks capped at two) both test runs > 2 blanks and are redundant. Replace with one boundary case and one over-boundary case per /tdd boundary-testing discipline.

💡 Cleaner table
{"two interior blanks kept (at limit)", "a\n\n\nb\n", "a\n\n\nb\n"},
{"three interior blanks capped to two", "a\n\n\n\nb\n", "a\n\n\nb\n"},

This makes the boundary explicit and removes the redundant five-blank case.

@copilot please address this.

@github-actions github-actions Bot left a comment

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.

REQUEST_CHANGES — two critical correctness bugs must be resolved before merge

normalizeBlankLines operates on the raw assembled YAML string with no YAML structural awareness. Both new behaviours — trailing whitespace trimming and blank-line capping — silently corrupt YAML literal block scalar content.

Blocking issues

1. Trailing whitespace stripping inside block scalars (line 354) — Covered by existing thread. Inside a run: | step, every line is scalar content per YAML 1.2. Shell \ continuations, Markdown hard-breaks, and any intentional trailing whitespace are silently removed.

2. Blank-run cap corrupts block scalar bodies (line 366) — Covered by existing thread. Three or more consecutive blank lines inside a run: | step are valid content; collapsing them to two changes runtime behavior, contradicting the PR description.

3. Missing round-trip test — No test constructs a real YAML document with a literal block scalar, passes it through normalizeBlankLines, and asserts the parsed scalar value is unchanged. Both regressions above are undetected by CI.

🔎 Code quality review by PR Code Quality Reviewer · 30.6 AIC · ⌖ 4.48 AIC · ⊞ 5.4K
Comment /review to run again

Comment thread pkg/workflow/compiler_yaml_test.go Outdated
{"only whitespace lines", " \n \n", "\n"},
{"content-line trailing spaces trimmed", "key: value \n", "key: value\n"},
{"content-line trailing tabs trimmed", "a\t\nb\n", "a\nb\n"},
{"interior trailing spaces preserved content", " foo: bar \n", " foo: bar\n"},

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.

No round-trip test validates that block-scalar content survives normalization. All new test cases use abstract strings — none verify that a real YAML document with a literal block scalar (e.g. run: |) emerges with an unchanged parsed scalar value.

💡 Suggested fix

Add a table-driven case that constructs a YAML string with a literal block scalar containing trailing spaces and 3+ consecutive blank lines, passes it through normalizeBlankLines, parses both the original and result with a YAML library (e.g. gopkg.in/yaml.v3), and asserts the scalar value is bit-for-bit identical. Without this, the correctness claim in the comment at compiler_yaml.go:318 is structurally untested and any regression in block-scalar handling will go undetected.

// Example skeleton:
input := "jobs:\n  build:\n    steps:\n      - run: |\n          echo hello   \n\n\n\n          echo world\n"
output := normalizeBlankLines(input)
// Parse both with yaml.v3 and compare the run: scalar value

@github-actions

Copy link
Copy Markdown
Contributor Author

🧪 Test Quality Sentinel Report

Test Quality Score: 100/100 — Excellent

Analyzed 6 test(s): 6 design, 0 implementation, 0 violation(s).

📊 Metrics (6 tests)
Metric Value
Analyzed 6 (Go: 6, JS: 0)
✅ Design 6 (100%)
⚠️ Implementation 0 (0%)
Edge/error coverage 6 (100%)
Duplicate clusters 0
Inflation No (test +6 lines, prod +36 lines → 0.17:1)
🚨 Violations 0
Test File Classification Issues
content-line trailing spaces trimmed compiler_yaml_test.go:1806 design_test none
content-line trailing tabs trimmed compiler_yaml_test.go:1807 design_test none
interior trailing spaces preserved content compiler_yaml_test.go:1808 design_test none
long interior blank run capped at two compiler_yaml_test.go:1809 design_test none
three interior blanks capped at two compiler_yaml_test.go:1810 design_test none
two interior blanks preserved compiler_yaml_test.go:1811 design_test none

Verdict

Passed. 0% implementation tests (threshold: 30%). Six table-driven rows directly exercise the new behavioral contracts (trailing-whitespace trimming and blank-line capping), covering boundary cases (2-blank preserved, 3→2 capped, large run capped, trailing spaces, tabs, indented content). No violations, no inflation, no mocks.

Warning

Firewall blocked 1 domain

The following domain was blocked by the firewall during workflow execution:

  • awmgmcpg

To allow these domains, add them to the network.allowed list in your workflow frontmatter:

network:
  allowed:
    - defaults
    - "awmgmcpg"

See Network Configuration for more information.

🧪 Test quality analysis by Test Quality Sentinel · 27.8 AIC · ⌖ 10.3 AIC · ⊞ 6.8K ·
Comment /review to run again

@github-actions github-actions Bot left a comment

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.

✅ Test Quality Sentinel: 100/100. 0% implementation tests (threshold: 30%).

@pelikhan

Copy link
Copy Markdown
Collaborator

@copilot run pr-finisher skill

Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
@gh-aw-bot

Copy link
Copy Markdown
Collaborator

@copilot please run the pr-finisher skill, address unresolved review comments, and rerun checks once the branch is up to date.

Generated by 👨‍🍳 PR Sous Chef · 10.1 AIC · ⌖ 6.64 AIC · ⊞ 7.5K ·
Comment /souschef to run again

Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>

Copilot AI commented Jul 14, 2026

Copy link
Copy Markdown
Contributor

Skills-Based Review 🧠

Applied /tdd and /diagnosing-bugs — approving with minor test-quality suggestions....

Addressed in 44ab9c3. The TestNormalizeBlankLines table now uses clearer names, removes the redundant long-run case, and adds a real block-scalar round-trip regression test alongside the structural-YAML cases.

REQUEST_CHANGES — two critical correctness bugs must be resolved before merge

normalizeBlankLines operates on the raw assembled YAML string with no YAML structural awareness. Both new behavio...

Fixed in 44ab9c3. normalizeBlankLines is now block-scalar-aware, so literal/folded scalar payloads keep their original non-blank lines and blank-run counts, and pkg/workflow/compiler_yaml_test.go now has a round-trip run: | regression test.

@pelikhan pelikhan merged commit 60831d0 into main Jul 14, 2026
29 checks passed
@pelikhan pelikhan deleted the fix/yamllint-trailing-spaces-blank-lines-886438b1b9b48448 branch July 14, 2026 08:32
Copilot stopped work on behalf of pelikhan due to an error July 14, 2026 08:32
Copilot AI requested a review from pelikhan July 14, 2026 08:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants