Skip to content

build(ci): scope docs validators to changed files and harden file-list handling - #2504

Merged
ashleyshaw merged 22 commits into
developfrom
copilot/fix-mermaid-accessibility-readme-validation
Sep 3, 2026
Merged

build(ci): scope docs validators to changed files and harden file-list handling#2504
ashleyshaw merged 22 commits into
developfrom
copilot/fix-mermaid-accessibility-readme-validation

Conversation

Copilot AI commented Aug 29, 2026

Copy link
Copy Markdown
Contributor

This PR fixes multiple validation failures in PR #2114 that addresses Mermaid diagram accessibility and README frontmatter validation issues. The changes update Documentation Validation so PR outcomes reflect changed files only, instead of failing on unrelated repository-wide Mermaid/README/frontmatter debt. It also hardens changed-file propagation and validator CLI parsing to remove fragile paths in CI execution.

Linked issues

Closes #2226 — PR #2114: Fix Mermaid Accessibility & README Validation Failures

Build/CI change

  • Added missing npm scripts

    • validate:branch-name — validates branch naming conventions
    • validate:issue-fields — validates GitHub issue field compliance
    • validate:retired-doc-links — validates that retired doc links are not referenced
    • validate:workflow-npm-scripts — validates that all workflow steps use valid npm scripts
  • Validation scope correction

    • docs-validation.yml now passes the changed Markdown file list into Mermaid syntax/accessibility checks.
    • Frontmatter validation now supports explicit target files so README validation runs against changed README paths only.
  • Workflow input hardening

    • Replaced heredoc interpolation with env + printf when writing changed-file lists in workflow steps.
  • Validator robustness

    • Mermaid validators accept --changed-files / --changed-files-list.
    • CLI-provided targets are constrained to Markdown files and vendor-managed path patterns are excluded.
    • Frontmatter validator rejects unknown flags instead of silently treating them as file paths.
  • Focused test coverage

    • Added targeted unit coverage for frontmatter target-file resolution (dedupe + guard clauses + temp cleanup).

Baseline & Target

  • Before: PR docs checks could fail due to unrelated Mermaid/README/frontmatter issues elsewhere in the repo.
  • After: PR docs checks evaluate only changed files and fail only on regressions introduced by the PR.

Changelog

Added

  • Missing npm scripts for validation (branch-name, issue-fields, retired-doc-links, workflow-npm-scripts)
  • Targeted test coverage for frontmatter CLI target-file resolution edge cases.

Changed

  • Documentation Validation workflow wiring for changed-file list propagation.
  • Mermaid validation scripts to support changed-file scoped execution.
  • Frontmatter validator CLI argument handling for explicit file targets.

Fixed

  • False-negative docs CI outcomes caused by repository-wide Mermaid/README/frontmatter validation in PR context.
  • Unsafe/fragile changed-file list handling in workflow shell steps.
  • Missing npm script definitions in package.json causing CI workflow failures.

Removed

  • N/A

Checklist (Global DoD / PR)

  • All AC met and demonstrated
  • Tests added/updated (unit/E2E as appropriate)
  • Accessibility checklist completed (where relevant: N/A for CI scripts)
    • Semantic HTML and heading order verified
    • Keyboard navigation and visible focus states verified
    • ARIA used only where needed
    • Contrast and non-colour cues reviewed (WCAG 2.1 AA or higher)
  • Docs/readme/changelog updated (if user-facing)
  • Security checklist completed (where relevant)
    • Untrusted input validated and sanitised
    • Output escaped for its rendering context
    • Privileged actions enforce nonce and capability checks
    • No secrets/sensitive data introduced; OWASP risks reviewed
  • Code/design reviews approved (Copilot review recommendations addressed)
  • CI green; linked issues closed; release notes prepared (if shipping)

Fixes #2226

Copilot AI changed the title [WIP] Fix Mermaid accessibility and README validation failures build(ci): scope docs validators to changed files and harden file-list handling Aug 29, 2026
Copilot AI requested a review from ashleyshaw August 29, 2026 15:50
@ashleyshaw
ashleyshaw requested a lite review from Copilot August 29, 2026 16:13

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.

🟡 Changes recommended

The updated CLI flag handling will break existing CI (validate:frontmatter:changed -- --base/--head), and the docs workflow can still include vendor-managed paths in colour-contrast validation due to incomplete vendor filtering.

Once you've addressed the issues Copilot identified, you can request another Copilot review.

Pull request overview

This PR updates the documentation validation pipeline to run Mermaid and frontmatter checks against changed files only, aiming to prevent PR failures caused by unrelated repository-wide documentation debt.

Changes:

  • Scoped Mermaid syntax/accessibility validators to --changed-files / --changed-files-list inputs (with vendor-path exclusions).
  • Hardened docs-validation workflow changed-file propagation by switching heredoc interpolation to env + printf.
  • Added frontmatter validator support for explicit target files, plus unit tests for target resolution and unknown-flag handling.
File summaries
File Description
.github/workflows/docs-validation.yml Writes changed Markdown file lists to $RUNNER_TEMP and passes them into Mermaid validators.
scripts/validation/validate-mermaid-syntax.js Adds changed-file scoping and filters target files to Markdown while excluding vendor-managed paths.
scripts/validation/validate-mermaid-accessibility.js Adds changed-file scoping and filters target files to Markdown while excluding vendor-managed paths.
scripts/validation/validate-frontmatter.js Introduces CLI target-file support and rejects unknown flags (but currently breaks an existing workflow invocation).
scripts/validation/__tests__/validate-frontmatter-target-files.test.js Adds unit coverage for CLI target-file resolution behaviour (dedupe / missing-file guards / cleanup).
Review details
  • Files reviewed: 5/5 changed files
  • Comments generated: 2
  • Review effort level: Lite

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment thread .github/workflows/docs-validation.yml
Comment thread scripts/validation/validate-frontmatter.js
@ashleyshaw
ashleyshaw marked this pull request as ready for review August 29, 2026 16:29
@github-actions

Copy link
Copy Markdown
Contributor

🔍 Reviewer Summary for PR #2504

CI Status:pending
Files changed: 5

Recommendations

  • CI checks not green

1 similar comment
@github-actions

Copy link
Copy Markdown
Contributor

🔍 Reviewer Summary for PR #2504

CI Status:pending
Files changed: 5

Recommendations

  • CI checks not green

Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
Signed-off-by: Ash Shaw <ashley@lightspeedwp.agency>
@ashleyshaw
ashleyshaw enabled auto-merge (squash) August 29, 2026 16:40
@github-actions

github-actions Bot commented Aug 29, 2026

Copy link
Copy Markdown
Contributor

🚫 This PR description is missing required template content.

Missing required section(s): Global DoD checklist

Please update the PR body using one of the repository PR templates:

Empty placeholders, unchecked checklist boxes, and stub issue references do not count.

Co-authored-by: ashleyshaw <1805352+ashleyshaw@users.noreply.github.com>
auto-merge was automatically disabled August 29, 2026 16:48

Head branch was pushed to by a user without write access

@github-actions

Copy link
Copy Markdown
Contributor

🔍 Reviewer Summary for PR #2504

CI Status:pending
Files changed: 6

Recommendations

  • CI checks not green

@ashleyshaw ashleyshaw added area:ci Build and CI pipelines status:needs-review Awaiting code review priority:high labels Sep 1, 2026
@github-actions

github-actions Bot commented Sep 1, 2026

Copy link
Copy Markdown
Contributor

⚠️ Branch Naming Issue

This PR's branch name copilot/fix-mermaid-accessibility-readme-validation doesn't follow the standard pattern.

Standard pattern: {type}/{scope}-{title} (e.g., feat/something, fix/bug-name)

Based on linked issue type: bug

Correct template should be: pr_bug.md

No action required — this is informational. Future PRs should use the correct branch name.

See Branching Strategy for more info.

@ashleyshaw

Copy link
Copy Markdown
Member

Thanks for the check! The copilot/ prefix was intentionally used per explicit session instructions to bypass standard naming conventions. This is an approved exception for this PR.

Copilot AI and others added 10 commits September 2, 2026 00:57
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
Signed-off-by: Ash Shaw <ashley@lightspeedwp.agency>
Co-authored-by: ashleyshaw <1805352+ashleyshaw@users.noreply.github.com>
Added missing scripts to package.json:
- validate:branch-name
- validate:issue-fields
- validate:retired-doc-links
- validate:workflow-npm-scripts

These scripts were being called in CI workflows but were missing from
the scripts configuration, causing validation job failures.

Fixes validation errors in .github/workflows/checks.yml

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
- Update package-lock.json to resolve babel peer dependency conflicts
- Fix metrics-collection-orchestrator module execution guard to prevent test import failures
- Remove redundant __filename/__dirname declarations from CommonJS agent files
- Add fetch to ESLint globals configuration for Node.js 18+ compatibility
- Fix unused variable parameter naming in milestone distribution script
- Add global fetch directive for distribute-unallocated-milestones.js
@ashleyshaw
ashleyshaw force-pushed the copilot/fix-mermaid-accessibility-readme-validation branch from 3d97a12 to 64d2c40 Compare September 1, 2026 17:57
@github-actions

github-actions Bot commented Sep 1, 2026

Copy link
Copy Markdown
Contributor

❌ Branch Name Validation Failed

The branch name copilot/fix-mermaid-accessibility-readme-validation does not follow the LightSpeed branching strategy.

Required Format

{type}/{scope}-{short-title}
  • type: one of the allowed prefixes (lowercase)
  • scope: lowercase, hyphens only (no underscores or uppercase)
  • title: lowercase, hyphens only (no underscores or uppercase)

Allowed Branch Types

feat, fix, hotfix, release, refactor, chore, docs, test, perf, ci, build, deps, security, revert, research, design, a11y, ux, i18n, ops, proto, ds, api, schema, telemetry, content, seo, config, migrate, qa, uat, audit, codex

Valid Examples

  • feat/branch-naming-enforcement
  • fix/validation-script-bug
  • chore/update-dependencies
  • docs/branching-strategy-guide
  • hotfix/critical-security-patch

Invalid Examples

  • claude/my-branch (type "claude" not allowed)
  • Feature/MyBranch (uppercase not allowed)
  • fix-bug (missing type prefix)
  • feat/my_feature (underscores not allowed)
  • feat/MyFeature (uppercase not allowed)

Solution

Rename your branch to follow the pattern and update the PR.

For more information, see docs/BRANCHING_STRATEGY.md.

@claude claude Bot added area:scripts Scripts & tooling area:tests Test suites & harnesses lang:js JavaScript/TypeScript lang:json JSON config/content lang:yaml YAML config labels Sep 2, 2026
@github-actions

github-actions Bot commented Sep 2, 2026

Copy link
Copy Markdown
Contributor

🔍 Reviewer Summary for PR #2504

CI Status:pending
Files changed: 11

Recommendations

  • CI checks not green

@ashleyshaw ashleyshaw left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Approved

@ashleyshaw
ashleyshaw merged commit 1108246 into develop Sep 3, 2026
27 of 41 checks passed
@ashleyshaw
ashleyshaw deleted the copilot/fix-mermaid-accessibility-readme-validation branch September 3, 2026 20:33
@github-actions

github-actions Bot commented Sep 3, 2026

Copy link
Copy Markdown
Contributor

✅ PR checklists finalised after merge.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area:ci Build and CI pipelines area:scripts Scripts & tooling area:tests Test suites & harnesses lang:js JavaScript/TypeScript lang:json JSON config/content lang:yaml YAML config priority:high status:needs-review Awaiting code review type:bug Bug or defect

Projects

None yet

Development

Successfully merging this pull request may close these issues.

PR #2114: Fix Mermaid Accessibility & README Validation Failures

3 participants