Skip to content

[codex] Mermaid diagrams WCAG 2.2 AA contrast sweep#987

Merged
ashleyshaw merged 5 commits into
developfrom
docs/mermaid-colour-contrast-sweep
Jun 18, 2026
Merged

[codex] Mermaid diagrams WCAG 2.2 AA contrast sweep#987
ashleyshaw merged 5 commits into
developfrom
docs/mermaid-colour-contrast-sweep

Conversation

@ashleyshaw

@ashleyshaw ashleyshaw commented Jun 18, 2026

Copy link
Copy Markdown
Member

Mermaid diagrams WCAG 2.2 AA contrast sweep

Linked issues

Closes #986

Summary

  • Add missing accTitle and accDescr headers to every Mermaid diagram in the repository.
  • Update Mermaid guidance, prompt, workflows, and validation scripts to enforce WCAG 2.2 AA-friendly contrast.
  • Expand validation coverage so syntax, accessibility, and colour contrast are checked across the repo.

Changelog

Changed

  • Added repo-wide Mermaid accessibility headers and contrast-safe palette enforcement.
  • Extended Mermaid validation and repair scripts to scan all markdown files.
  • Updated Mermaid documentation, prompt, and workflow guidance to match the new standards.

Fixed

  • Removed low-contrast Mermaid styling and unreadable white-on-light combinations.
  • Closed the remaining accessibility gaps in generated Mermaid reports.

Added

  • New Mermaid colour contrast validator for WCAG 2.2 AA checks.

Removed

  • None.

Risk Assessment

Risk Level: Low

Potential Impact: Documentation-only changes to Mermaid rendering and validation behaviour.

Mitigation Steps:

  • Ran full Mermaid syntax, accessibility, and contrast validation.
  • Used an approved accessible palette with explicit text and stroke colours.
  • Kept the change scoped to documentation, validation, and workflow support files.

How to Test

Prerequisites

  • Node.js dependencies installed with npm ci.

Test Steps

  1. Run npm run validate:mermaid.
  2. Confirm the syntax and accessibility reports complete without errors.
  3. Confirm the contrast validator reports zero errors and zero warnings.

Expected Results

  • All Mermaid diagrams remain readable on light backgrounds.
  • All diagrams have accTitle and accDescr.
  • Contrast validation passes with no findings.

Edge Cases to Verify

  • Archive and report markdown files still validate.
  • Mermaid style and classDef declarations keep explicit fill, color, and stroke values.
  • Generated Mermaid reports remain compliant.

Checklist (Global DoD / PR)

  • All AC met and demonstrated
  • Tests added/updated (unit/E2E as appropriate)
  • Docs/readme/changelog updated (if user-facing)
  • Risk assessment completed above
  • Testing instructions provided above

@github-actions

github-actions Bot commented Jun 18, 2026

Copy link
Copy Markdown
Contributor

✅ Template check passed after update. Thanks for fixing the PR description.

@coderabbitai

coderabbitai Bot commented Jun 18, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

Warning

Review limit reached

@ashleyshaw, we couldn't start this review because you've reached your PR review rate limit.

More reviews will be available in 41 minutes and 54 seconds. Learn how PR review limits work.

Your organization has run out of usage credits. Purchase more credits in the billing tab to continue.

⌛ How to resolve this issue?

After more reviews become available, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based credits.

🚦 How do rate limits work?

CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan refill rate.

For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, the refill rate gradually slows as usage increases. The highest same-day bursts are limited more strictly.

Please see our Fair Usage Limits Policy for further information.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Repository YAML (base), Organization UI (inherited)

Review profile: CHILL

Plan: Pro

Run ID: 8aa337ed-abb3-4145-9bfe-d16eae29579c

📥 Commits

Reviewing files that changed from the base of the PR and between 5b582f6 and b0ad014.

⛔ Files ignored due to path filters (1)
  • .github/reports/mermaid-diagram-accessibility-spreadsheet.csv is excluded by !**/*.csv
📒 Files selected for processing (30)
  • .github/ISSUE_TEMPLATE/README.md
  • .github/README.md
  • .github/instructions/.archive/frontmatter.instructions.md
  • .github/instructions/.archive/tests.instructions.md
  • .github/prompts/update-mermaid-diagrams.prompt.md
  • .github/reports/mermaid-accessibility-report.md
  • .github/reports/mermaid-validation-report.md
  • .github/reports/mermaid/colour-contrast-report-2026-06-18.md
  • .github/reports/mermaid/diagram-validation-2025-12-11.md
  • .github/workflows/meta.yml
  • .github/workflows/readme-audit.yml
  • .github/workflows/readme-update.yml
  • .vscode/README.md
  • CHANGELOG.md
  • CONTRIBUTING.md
  • README.md
  • docs/AGENT_CREATION.md
  • docs/HUSKY_PRECOMMITS.md
  • instructions/automation.instructions.md
  • instructions/documentation-formats.instructions.md
  • instructions/linting.instructions.md
  • instructions/mermaid.instructions.md
  • instructions/quality-assurance.instructions.md
  • package.json
  • profile/README.md
  • scripts/README.md
  • scripts/fix-mermaid-diagrams.js
  • scripts/validation/validate-mermaid-accessibility.js
  • scripts/validation/validate-mermaid-colour-contrast.js
  • scripts/validation/validate-mermaid-syntax.js
📝 Walkthrough

Walkthrough

A repository-wide Mermaid WCAG 2.2 AA compliance pass: introduces a new colour-contrast validator script, expands all three Mermaid validation scripts to cover all *.md/*.mdx files, wires them into package.json and CI workflows, rewrites the fixer script to auto-apply an approved palette and accTitle/accDescr, updates the Mermaid instructions to v2.0, and applies the resulting accessibility and palette changes across all documentation files.

Changes

Mermaid WCAG 2.2 AA Accessibility & Contrast Sweep

Layer / File(s) Summary
Mermaid v2.0 standards and prompt update
instructions/mermaid.instructions.md, .github/prompts/update-mermaid-diagrams.prompt.md
mermaid.instructions.md rewritten to v2.0 with WCAG 2.2 AA compliance rules, an approved colour palette table, a required accTitle/accDescr header block, emoji constraints, and explicit validation/update process. The prompt is updated to reference the new standard, validation commands, and a concrete fix/rerun workflow.
New colour-contrast validator
scripts/validation/validate-mermaid-colour-contrast.js, .github/reports/mermaid/colour-contrast-report-2026-06-18.md
New Node.js CLI script validates WCAG 2.2 AA contrast ratios for all fill/color pairs in Mermaid style/classDef declarations, generates a timestamped Markdown report, and exits non-zero on any errors. Initial report confirms zero errors across the repo.
Expand existing validators to all Markdown/MDX
scripts/validation/validate-mermaid-syntax.js, scripts/validation/validate-mermaid-accessibility.js
Both scripts switch from README-only discovery to globSync("**/*.{md,mdx}", ...), add mindmap to recognised diagram types, and update generated report file-list output accordingly.
Fixer script: scope expansion and palette rewrite
scripts/fix-mermaid-diagrams.js
Scope expanded from README-only to all *.md/*.mdx files. Adds PALETTE and FILL_TO_ROLE constants for role-based colour remapping, rewriteColourDeclaration() to rewrite style/classDef lines, and a per-block pipeline that prepends accTitle and appends accDescr when absent.
package.json and CI workflow wiring
package.json, .github/workflows/readme-audit.yml, .github/workflows/readme-update.yml
Adds validate:mermaid-contrast script, updates validate:mermaid to chain all three validators, consolidates validate:all. readme-audit.yml gains a contrast scope option, replaces placeholder shell checks with npm run commands, and adds a check-contrast job. readme-update.yml uses updated script paths and adds a contrast step.
accTitle/accDescr added to instruction and documentation files
instructions/automation.instructions.md, instructions/documentation-formats.instructions.md, instructions/linting.instructions.md, instructions/quality-assurance.instructions.md, CONTRIBUTING.md, docs/AGENT_CREATION.md, docs/HUSKY_PRECOMMITS.md, .github/instructions/.archive/*
accTitle and accDescr metadata added to Mermaid diagrams across all instruction and documentation files. documentation-formats.instructions.md also gains an expanded colour-coding example using the approved palette.
Approved colour palette applied to all README/diagram files
README.md, .github/README.md, .github/ISSUE_TEMPLATE/README.md, profile/README.md, scripts/README.md, tests/README.md, .vscode/README.md
classDef/style colour values replaced with the approved WCAG-compliant palette across all README and diagram files.
Regenerated validation and accessibility reports
.github/reports/mermaid-accessibility-report.md, .github/reports/mermaid-validation-report.md, .github/reports/mermaid/diagram-validation-2025-12-11.md
Accessibility report updated to 60 diagrams at 100% compliance; validation report updated to 45 diagrams all valid; existing diagram-validation report gains accTitle/accDescr in its example snippet.

Estimated code review effort

🎯 4 (Complex) | ⏱️ ~60 minutes

Possibly related PRs

  • lightspeedwp/.github#536: Introduces readme-update.yml to add accTitle/accDescr and update Mermaid blocks — the same workflow this PR further modifies to use the new fixer script path and contrast validation step.
  • lightspeedwp/.github#696: Modifies validate-mermaid-accessibility.js behaviour and regenerates mermaid-accessibility-report.md based on accTitle/accDescr compliance, directly overlapping with this PR's expanded scope.
  • lightspeedwp/.github#982: Repository-wide colour-contrast sweep with validator and report wiring that directly overlaps with the contrast validator and related fixer/prompt/report changes in this PR.

Suggested labels

area:a11y, area:ci, area:documentation, area:scripts, priority:normal, status:needs-review, lang:js, lang:md, lang:json, lang:yaml, type:maintenance, meta:needs-changelog

Suggested reviewers

  • krugazul
🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Title check ✅ Passed The PR title '[codex] Mermaid diagrams WCAG 2.2 AA contrast sweep' accurately summarises the main change—a comprehensive accessibility and contrast update for all Mermaid diagrams across the repository.
Description check ✅ Passed The PR description is largely complete, covering objectives, changelog, risk assessment, and testing instructions. However, the description section of the template was not used; instead, the author provided a custom summary structure.
Linked Issues check ✅ Passed All four acceptance criteria from issue #986 are met: diagrams now include accTitle/accDescr, styling uses an approved accessible palette, validation scripts comprehensively cover syntax/accessibility/contrast, and workflows/documentation reflect the updated Mermaid rules.
Out of Scope Changes check ✅ Passed All changes remain squarely within scope—Mermaid diagram accessibility updates, validation enhancements, and supporting documentation/workflow changes directly address issue #986 objectives with no unrelated modifications.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch docs/mermaid-colour-contrast-sweep

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@github-actions

Copy link
Copy Markdown
Contributor

Metadata governance

@coderabbitai coderabbitai Bot requested a review from krugazul June 18, 2026 15:33

@gemini-code-assist gemini-code-assist 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.

Code Review

This pull request introduces WCAG 2.2 AA colour contrast validation for Mermaid diagrams across the repository. Key changes include adding a new colour contrast validation script, updating the automatic diagram fixer to apply the approved palette, and expanding the accessibility and syntax validators to scan all markdown files instead of just READMEs. The review feedback highlights two important improvements for the contrast validation script: stripping Mermaid comments before parsing style declarations to prevent false positives, and verifying that paths passed to the script are files rather than directories to avoid potential crashes.

Important

The consumer version of Gemini Code Assist on GitHub is being sunset. Starting June 18, 2026, new organization installations will be blocked, and all code review activity will officially cease on July 17, 2026.
For more details on the timeline and next steps, please review the Help Documentation.

Comment on lines +146 to +149
for (let i = 0; i < lines.length; i++) {
const line = lines[i];
const match = line.match(/^\s*(style|classDef)\s+(\S+)\s+(.+)/);
if (!match) continue;

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.

medium

Mermaid style and classDef declarations can contain comments starting with %%. If a comment contains keywords like fill: or color:, it can interfere with the regex matching and cause false positives or incorrect parsing. Stripping comments before parsing ensures only active style properties are validated.

Suggested change
for (let i = 0; i < lines.length; i++) {
const line = lines[i];
const match = line.match(/^\s*(style|classDef)\s+(\S+)\s+(.+)/);
if (!match) continue;
for (let i = 0; i < lines.length; i++) {
const line = lines[i];
const cleanLine = line.split("%%")[0];
const match = cleanLine.match(/^\\s*(style|classDef)\\s+(\\S+)\\s+(.+)/);
if (!match) continue;

? relPath
: path.join(ROOT, relPath);

if (!fs.existsSync(filePath)) continue;

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.

medium

If a directory path is passed to --changed-files=, fs.existsSync will return true, but fs.readFileSync will throw an EISDIR error and crash the script. Adding a check to ensure the path is a file prevents potential crashes.

Suggested change
if (!fs.existsSync(filePath)) continue;
if (!fs.existsSync(filePath) || !fs.statSync(filePath).isFile()) continue;

@coderabbitai coderabbitai Bot added area:a11y Accessibility-focused work area:ci Build and CI pipelines area:documentation Docs & guides area:scripts Scripts & tooling lang:js JavaScript/TypeScript lang:json JSON config/content lang:md Markdown content/docs lang:yaml YAML config meta:needs-changelog Requires a changelog entry before merge priority:normal Default priority status:needs-review Awaiting code review type:maintenance Maintenance labels Jun 18, 2026
@ashleyshaw ashleyshaw force-pushed the docs/mermaid-colour-contrast-sweep branch from 5b582f6 to 66dce1f Compare June 18, 2026 15:35
@ashleyshaw ashleyshaw enabled auto-merge (squash) June 18, 2026 15:36
@github-actions

github-actions Bot commented Jun 18, 2026

Copy link
Copy Markdown
Contributor

🎨 Mermaid Diagram Validation

✅ All Mermaid diagram checks passed.

Check Result
✅ Syntax (diagram type, direction, bracket matching) Passed
✅ Accessibility (accTitle / accDescr present) Passed
✅ Colour contrast (WCAG 2.2 AA ≥ 4.5:1) Passed

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 5b582f6c7f

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

# This is a placeholder for actual validation logic
}
done
run: npm run validate:mermaid-syntax

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P1 Badge Install npm deps in Mermaid audit jobs

This now invokes the Node validator, but this job (and the parallel accessibility/contrast jobs) only runs setup-node with npm caching; it never installs the repo dependencies. On a fresh runner the scripts import glob from devDependencies, while the setup-node cache does not provide node_modules (setup-node docs), so dispatching scope: syntax, accessibility, contrast, or all fails before any Mermaid checks run. Add npm ci in each validation job or run these checks in the existing audit job after its install.

Useful? React with 👍 / 👎.

const ROOT = path.join(__dirname, "../../");

const README_FILES = globSync("**/README.md", {
const MARKDOWN_FILES = globSync("**/*.{md,mdx}", {

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge Keep hidden Markdown in syntax validation

This new repository-wide glob omits dot: true, so glob skips Markdown under hidden directories. That leaves the Mermaid syntax job checking 45 diagrams while the new accessibility/contrast validators check 60, missing .github/README.md, .github/ISSUE_TEMPLATE/README.md, .vscode/README.md, and report diagrams; syntax errors in those hidden docs will still pass validate:mermaid-syntax. Add dot: true here as the other Mermaid validators do.

Useful? React with 👍 / 👎.

- name: Run Mermaid diagram fixes
if: ${{ env.UPDATE_SCOPE == 'all' || env.UPDATE_SCOPE == 'mermaid' }}
run: node .github/scripts/fix-mermaid-diagrams.js
run: node scripts/fix-mermaid-diagrams.js

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge Run the fixer as an ES module or .cjs

With this workflow now calling scripts/fix-mermaid-diagrams.js, the step reaches a file under the root package, which declares "type": "module"; that file still starts with CommonJS require, so node scripts/fix-mermaid-diagrams.js throws ReferenceError: require is not defined before making any Mermaid fixes. Because this step is continue-on-error, the workflow can proceed and report success without applying the intended accessibility/colour updates.

Useful? React with 👍 / 👎.

@github-actions github-actions Bot added type:documentation Documentation area:dependencies Composer/npm dependency work labels Jun 18, 2026
@ashleyshaw ashleyshaw force-pushed the docs/mermaid-colour-contrast-sweep branch from 7780972 to a76b620 Compare June 18, 2026 15:37
@ashleyshaw ashleyshaw force-pushed the docs/mermaid-colour-contrast-sweep branch from a76b620 to 52fbc6a Compare June 18, 2026 15:37
@github-actions github-actions Bot removed the type:maintenance Maintenance label Jun 18, 2026

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

Actionable comments posted: 11

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (3)
.github/workflows/readme-audit.yml (2)

91-101: ⚠️ Potential issue | 🟠 Major | ⚡ Quick win

Validator jobs run before dependencies are installed.

These jobs execute npm run validate:*, but there is no npm ci step in the shown job setup. That can fail immediately on module imports (for example glob).

Suggested patch
       - name: Set up Node.js
         uses: actions/setup-node@v4
         with:
           node-version: "18"
           cache: "npm"
+      - name: Install dependencies
+        run: npm ci

Also applies to: 118-120, 136-137

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In @.github/workflows/readme-audit.yml around lines 91 - 101, The
readme-audit.yml workflow is missing a dependency installation step before
running validation commands. Add an `npm ci` step between the "Set up Node.js"
step and the "Validate Mermaid diagrams" step (and apply the same fix to the
other affected validation jobs mentioned at lines 118-120 and 136-137). This
ensures that npm dependencies like glob are installed before any npm run
validate commands are executed, preventing immediate module import failures
during validation.

82-138: ⚠️ Potential issue | 🟠 Major | ⚡ Quick win

Add explicit least-privilege permissions for these jobs.

Nice workflow expansion overall — now let’s lock token scope down explicitly (read-only by default, elevate only where truly needed).

Suggested patch
   validate-syntax:
     name: Validate Mermaid Syntax
     runs-on: ubuntu-latest
+    permissions:
+      contents: read
@@
   check-accessibility:
     name: Check WCAG Compliance
     runs-on: ubuntu-latest
+    permissions:
+      contents: read
@@
   check-contrast:
     name: Check Mermaid Colour Contrast
     runs-on: ubuntu-latest
+    permissions:
+      contents: read

As per coding guidelines, GitHub Actions workflows should use least-privilege permissions and default to read-only.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In @.github/workflows/readme-audit.yml around lines 82 - 138, The three jobs
validate-syntax, check-accessibility, and check-contrast are missing explicit
least-privilege permissions blocks. Add a permissions section to each job
setting contents to read, since these jobs only perform read operations on the
repository (checking out code and running validation scripts without modifying
anything). This follows the principle of defaulting to read-only access and only
elevating permissions where truly needed.

Sources: Coding guidelines, Linters/SAST tools

scripts/fix-mermaid-diagrams.js (1)

142-159: ⚠️ Potential issue | 🟠 Major | ⚡ Quick win

Broaden metadata detection to avoid duplicate accTitle/accDescr entries

Quick gremlin on Line 142 and Line 157: the fixer only detects accTitle: / accDescr:. Valid forms like accTitle My title and accDescr { ... } are treated as missing, so duplicate accessibility fields can be injected.

Suggested patch
-    if (!nextDiagram.includes("accTitle:")) {
+    const hasAccTitle =
+      /(?:^|\n)\s*accTitle(?:\s*[:=]|\s+)/m.test(nextDiagram);
+    if (!hasAccTitle) {
       const firstLine = nextDiagram.split("\n")[0];
@@
-    if (!nextDiagram.includes("accDescr:")) {
+    const hasAccDescr =
+      /(?:^|\n)\s*accDescr(?:\s*[:=]|\s*{|\s+)/m.test(nextDiagram);
+    if (!hasAccDescr) {
       nextDiagram = `${nextDiagram}\naccDescr: Detailed diagram`;
       modified = true;
     }
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@scripts/fix-mermaid-diagrams.js` around lines 142 - 159, The accessibility
metadata detection is too narrow - the includes() checks for "accTitle:" and
"accDescr:" on lines 142 and 157 only match one specific format, but mermaid
allows alternative formats like "accTitle My title" (without colon) and
"accDescr { ... }" (with braces). Broaden both detection checks to match any
occurrence of the metadata field name itself rather than just the colon-suffixed
variants, so that existing accessibility metadata in alternative formats is
properly detected and duplicate entries are not injected. Consider using regex
or multiple include checks to catch all valid variations of these fields.
🧹 Nitpick comments (1)
.github/workflows/readme-audit.yml (1)

88-90: ⚡ Quick win

Harden checkout steps by disabling credential persistence.

For pure validation jobs, set persist-credentials: false on actions/checkout to reduce accidental token exposure paths.

Suggested patch
       - name: Checkout repository
         uses: actions/checkout@v4
+        with:
+          persist-credentials: false

As per coding guidelines, workflow security checks should include safe secret handling and minimised credential exposure.

Also applies to: 109-111, 127-129

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In @.github/workflows/readme-audit.yml around lines 88 - 90, The
actions/checkout@v4 steps in the readme-audit workflow do not disable credential
persistence, increasing the risk of accidental token exposure. Add the
`persist-credentials: false` configuration parameter to all three instances of
the actions/checkout@v4 step (the one at the specified location and the two
additional instances noted in the comment) to minimize credential exposure
during the validation job execution, as per security guidelines for pure
validation workflows.

Sources: Coding guidelines, Linters/SAST tools

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In @.github/reports/mermaid-accessibility-report.md:
- Line 3: Update the description text in the accessibility report to reflect the
current number of diagrams being audited. Change "all 24 Mermaid diagrams" to
"all 60 Mermaid diagrams" in the description field to ensure consistency between
the documentation and the actual audit scope. This simple numeric update will
prevent confusion about the audit coverage.
- Line 35: In the mermaid-accessibility-report.md file, locate the heading "##
Files Analyzed" and change the spelling from "Analyzed" (US English) to
"Analysed" (UK English) to comply with the repository's documentation standards
that require UK English spelling throughout all markdown and text files.

In @.github/reports/mermaid-validation-report.md:
- Line 3: Update the description field in the frontmatter at line 3 of the
mermaid-validation-report.md file. The current description states the validation
results are "for repository README files" but the report scope has expanded to
cover all Markdown and MDX files across the repository. Replace the
README-specific wording with text that accurately reflects the repo-wide scope
of the validation audit.
- Line 24: In the mermaid-validation-report.md file, change the section heading
"## Files Analyzed" to "## Files Analysed" to comply with UK English spelling
standards as required by the project's coding guidelines for markdown files.
This ensures consistency with other UK English terms used throughout the
documentation.

In @.github/workflows/readme-update.yml:
- Around line 70-74: The "Validate Mermaid colour contrast" step currently has
continue-on-error set to true, which allows the workflow to pass even when the
npm run validate:mermaid-contrast command fails. Remove the continue-on-error:
true line from this step to make the contrast validation blocking, ensuring that
non-compliant Mermaid diagrams will cause the workflow to fail and prevent the
commit from proceeding.

In `@instructions/mermaid.instructions.md`:
- Line 16: The instructions at line 16 claim that the validation workflow
"enforces the accessibility and syntax rules automatically," but this is
inaccurate. The provided validator and fixer snippets only enforce the presence
of `accTitle` and `accDescr` attributes without enforcing their proper placement
within the `---` header wrapper block format or preventing duplicate inline
declarations. Revise the claim on line 16 to accurately reflect what is actually
enforced by the current tooling, or update the validator/fixer snippets to fully
enforce header-block placement and duplicate-inline constraints. The same
accuracy issue applies to the rules mentioned around lines 68-71, so update
those as well to match the actual enforcement behavior.
- Around line 38-47: The outer fenced code blocks use triple backticks which can
conflict with the inner mermaid code blocks that also use triple backticks,
causing the outer block to terminate prematurely in Markdown renderers. Change
all outer fences from triple backticks (```text) to four backticks (````text) to
properly contain the inner mermaid blocks with their triple backticks. Apply
this change to all occurrences where mermaid examples are nested within text
fences throughout the document, including multiple instances.
- Around line 14-224: The mermaid.instructions.md file does not follow the
required instruction file template structure. Restructure the file to follow the
mandated pattern: start with a Role section, then add Overview, General Rules,
Detailed Guidance, Examples, Validation, and References/Cross-References
sections. Consolidate existing content like "When to Include a Diagram",
"Required Structure", "Diagram Types", "Colour Palette", "Theme Initialisation",
"Emoji in Node Labels", and "Layout and Clarity" into the appropriate sections
(most should fall under General Rules and Detailed Guidance). Ensure the
Validation section includes the npm commands already present. Add a new
References/Cross-References section at the end to link to related documentation
or files.
- Around line 4-11: The frontmatter in the mermaid.instructions.md file is
missing three canonical metadata keys required for all instructions/** files.
Add the missing keys file_type, domain, and stability to the frontmatter
section. The file_type should indicate this is an instruction file, domain
should categorize the subject area (likely "documentation" or "diagrams"), and
stability should indicate the maturity level of the instruction. Ensure all keys
in the canonical pattern (file_type, version, last_updated, owners, tags,
status, domain, stability) are present in the frontmatter block.

In `@scripts/validation/validate-mermaid-colour-contrast.js`:
- Around line 154-161: The validator currently extracts and stores only `fill`
and `color` properties but does not parse or validate the `stroke` property,
which is required as part of the documented fill+color+stroke triple. Extend the
regex matching logic in the section where fillMatch and colorMatch are defined
to also extract the stroke value using a similar pattern. Then update the
validation logic (referenced in the "Also applies to" range at lines 170-225) to
enforce that all three properties (fill, color, and stroke) must be present
together before marking a node as valid, rather than allowing partial matches to
pass validation.
- Around line 176-177: When parseColour(fill) or parseColour(color) returns a
falsy value (indicating an invalid or unsupported color), instead of silently
returning with no issues reported, add an issue entry to the issues array
describing that the color value is invalid or unsupported. This fix should be
applied in two places: when fillHex is falsy after calling parseColour(fill),
and when colorHex is falsy after calling parseColour(color) around the code
region mentioned as also applying to lines 212-214. Each case should push a
descriptive issue object to the issues array before returning it, rather than
returning early with no warnings about the unparseable color values.

---

Outside diff comments:
In @.github/workflows/readme-audit.yml:
- Around line 91-101: The readme-audit.yml workflow is missing a dependency
installation step before running validation commands. Add an `npm ci` step
between the "Set up Node.js" step and the "Validate Mermaid diagrams" step (and
apply the same fix to the other affected validation jobs mentioned at lines
118-120 and 136-137). This ensures that npm dependencies like glob are installed
before any npm run validate commands are executed, preventing immediate module
import failures during validation.
- Around line 82-138: The three jobs validate-syntax, check-accessibility, and
check-contrast are missing explicit least-privilege permissions blocks. Add a
permissions section to each job setting contents to read, since these jobs only
perform read operations on the repository (checking out code and running
validation scripts without modifying anything). This follows the principle of
defaulting to read-only access and only elevating permissions where truly
needed.

In `@scripts/fix-mermaid-diagrams.js`:
- Around line 142-159: The accessibility metadata detection is too narrow - the
includes() checks for "accTitle:" and "accDescr:" on lines 142 and 157 only
match one specific format, but mermaid allows alternative formats like "accTitle
My title" (without colon) and "accDescr { ... }" (with braces). Broaden both
detection checks to match any occurrence of the metadata field name itself
rather than just the colon-suffixed variants, so that existing accessibility
metadata in alternative formats is properly detected and duplicate entries are
not injected. Consider using regex or multiple include checks to catch all valid
variations of these fields.

---

Nitpick comments:
In @.github/workflows/readme-audit.yml:
- Around line 88-90: The actions/checkout@v4 steps in the readme-audit workflow
do not disable credential persistence, increasing the risk of accidental token
exposure. Add the `persist-credentials: false` configuration parameter to all
three instances of the actions/checkout@v4 step (the one at the specified
location and the two additional instances noted in the comment) to minimize
credential exposure during the validation job execution, as per security
guidelines for pure validation workflows.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Repository YAML (base), Organization UI (inherited)

Review profile: CHILL

Plan: Pro

Run ID: e58fccc6-6e29-426e-970e-235adb63d73e

📥 Commits

Reviewing files that changed from the base of the PR and between ec159b9 and 5b582f6.

⛔ Files ignored due to path filters (1)
  • .github/reports/mermaid-diagram-accessibility-spreadsheet.csv is excluded by !**/*.csv
📒 Files selected for processing (29)
  • .github/ISSUE_TEMPLATE/README.md
  • .github/README.md
  • .github/instructions/.archive/frontmatter.instructions.md
  • .github/instructions/.archive/tests.instructions.md
  • .github/prompts/update-mermaid-diagrams.prompt.md
  • .github/reports/mermaid-accessibility-report.md
  • .github/reports/mermaid-validation-report.md
  • .github/reports/mermaid/colour-contrast-report-2026-06-18.md
  • .github/reports/mermaid/diagram-validation-2025-12-11.md
  • .github/workflows/readme-audit.yml
  • .github/workflows/readme-update.yml
  • .vscode/README.md
  • CONTRIBUTING.md
  • README.md
  • docs/AGENT_CREATION.md
  • docs/HUSKY_PRECOMMITS.md
  • instructions/automation.instructions.md
  • instructions/documentation-formats.instructions.md
  • instructions/linting.instructions.md
  • instructions/mermaid.instructions.md
  • instructions/quality-assurance.instructions.md
  • package.json
  • profile/README.md
  • scripts/README.md
  • scripts/fix-mermaid-diagrams.js
  • scripts/validation/validate-mermaid-accessibility.js
  • scripts/validation/validate-mermaid-colour-contrast.js
  • scripts/validation/validate-mermaid-syntax.js
  • tests/README.md
📜 Review details
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (2)
  • GitHub Check: Mergify Merge Protections
  • GitHub Check: Summary
🧰 Additional context used
📓 Path-based instructions (18)
**/*.{md,markdown,txt,instructions.md}

📄 CodeRabbit inference engine (CLAUDE.md)

Language: Use UK English throughout (optimise, organisation, colour, behaviour).

Files:

  • instructions/linting.instructions.md
  • tests/README.md
  • CONTRIBUTING.md
  • scripts/README.md
  • instructions/quality-assurance.instructions.md
  • profile/README.md
  • instructions/automation.instructions.md
  • README.md
  • docs/HUSKY_PRECOMMITS.md
  • docs/AGENT_CREATION.md
  • instructions/documentation-formats.instructions.md
  • instructions/mermaid.instructions.md
**/*.instructions.md

📄 CodeRabbit inference engine (CLAUDE.md)

**/*.instructions.md: Do not create instruction files with a 'references' frontmatter field; use inline links or footer sections instead.
Instruction files must follow the pattern: frontmatter + role declaration + Overview + General Rules + Detailed Guidance + Examples + Validation + References.

Files:

  • instructions/linting.instructions.md
  • instructions/quality-assurance.instructions.md
  • instructions/automation.instructions.md
  • instructions/documentation-formats.instructions.md
  • instructions/mermaid.instructions.md
**/*.md

📄 CodeRabbit inference engine (AGENTS.md)

All documentation must follow Markdown formatting standards and include YAML frontmatter as specified in instructions/documentation-formats.instructions.md

Files:

  • instructions/linting.instructions.md
  • tests/README.md
  • CONTRIBUTING.md
  • scripts/README.md
  • instructions/quality-assurance.instructions.md
  • profile/README.md
  • instructions/automation.instructions.md
  • README.md
  • docs/HUSKY_PRECOMMITS.md
  • docs/AGENT_CREATION.md
  • instructions/documentation-formats.instructions.md
  • instructions/mermaid.instructions.md
instructions/**

⚙️ CodeRabbit configuration file

instructions/**: Review portable instruction files:

  • Verify frontmatter follows the canonical pattern (file_type, version, last_updated, owners, tags, status, domain, stability).
  • Flag any references: frontmatter field — prohibited by CLAUDE.md.
  • Confirm the file has: Overview, General Rules, Detailed Guidance, Examples, Validation, and Cross-References sections.
  • Check that language is UK English throughout.

Files:

  • instructions/linting.instructions.md
  • instructions/quality-assurance.instructions.md
  • instructions/automation.instructions.md
  • instructions/documentation-formats.instructions.md
  • instructions/mermaid.instructions.md
**/tests/*.*

⚙️ CodeRabbit configuration file

**/tests/*.*: Review all test files:

  • All test files must have a header (purpose, author, date, related files).
  • Use clear, descriptive test names and logical structure.
  • Include both positive and negative test cases.
  • Be discoverable from the main agent/test index.
  • Pass all style checks and linting.

Files:

  • tests/README.md
**/*.{php,js,ts,jsx,tsx}

📄 CodeRabbit inference engine (CLAUDE.md)

**/*.{php,js,ts,jsx,tsx}: Follow WordPress Coding Standards for PHP files, ESLint/Prettier for JS/TS files, and PHPCS/WPCS for PHP files.
Security: Validate all input, escape all output, use nonces, never commit secrets.

Files:

  • scripts/validation/validate-mermaid-accessibility.js
  • scripts/validation/validate-mermaid-syntax.js
  • scripts/fix-mermaid-diagrams.js
  • scripts/validation/validate-mermaid-colour-contrast.js
**/*.{js,ts,jsx,tsx,html}

📄 CodeRabbit inference engine (CLAUDE.md)

Performance: Avoid unnecessary JS, defer/lazy-load where possible, prefer native blocks.

Files:

  • scripts/validation/validate-mermaid-accessibility.js
  • scripts/validation/validate-mermaid-syntax.js
  • scripts/fix-mermaid-diagrams.js
  • scripts/validation/validate-mermaid-colour-contrast.js
**/*.{php,js,ts}

📄 CodeRabbit inference engine (CLAUDE.md)

Do not enqueue editor-only WordPress assets on the front end (and vice versa).

Files:

  • scripts/validation/validate-mermaid-accessibility.js
  • scripts/validation/validate-mermaid-syntax.js
  • scripts/fix-mermaid-diagrams.js
  • scripts/validation/validate-mermaid-colour-contrast.js
**/*.{php,js,css,html}

📄 CodeRabbit inference engine (AGENTS.md)

Follow WordPress Coding Standards (CSS, HTML, JavaScript, PHP) and inline-documentation standards at all times

Files:

  • scripts/validation/validate-mermaid-accessibility.js
  • scripts/validation/validate-mermaid-syntax.js
  • scripts/fix-mermaid-diagrams.js
  • scripts/validation/validate-mermaid-colour-contrast.js
**/*.{js,ts,jsx,tsx}

📄 CodeRabbit inference engine (AGENTS.md)

JavaScript and TypeScript files must follow linting standards defined in instructions/languages.instructions.md, including JSDoc documentation

Files:

  • scripts/validation/validate-mermaid-accessibility.js
  • scripts/validation/validate-mermaid-syntax.js
  • scripts/fix-mermaid-diagrams.js
  • scripts/validation/validate-mermaid-colour-contrast.js
**/*.{js,ts}

⚙️ CodeRabbit configuration file

**/*.{js,ts}: Review JavaScript/TypeScript:

  • Ensure code is linted and follows project style guides.
  • Check for dead code, unused variables, and clear function naming.
  • Validate accessibility and performance optimisations.
  • Ensure tests are isolated and do not depend on external state.
  • Check for descriptive test names and clear test structure.

Files:

  • scripts/validation/validate-mermaid-accessibility.js
  • scripts/validation/validate-mermaid-syntax.js
  • scripts/fix-mermaid-diagrams.js
  • scripts/validation/validate-mermaid-colour-contrast.js
**/.github/workflows/*.yml

⚙️ CodeRabbit configuration file

**/.github/workflows/*.yml: Review GitHub Actions workflows for this governance repo:

  • Security: check for least-privilege permissions (use permissions: at job level, default to read-only).
  • Secret handling: ensure secrets are passed via env vars, not interpolated directly into run: steps to prevent injection.
  • Action pinning: prefer SHA-pinned actions over mutable tags (e.g. actions/checkout@v4 is acceptable; SHA pins are better).
  • No pull_request_target with untrusted code execution unless explicitly justified.
  • Avoid storing sensitive outputs as unmasked step outputs.
  • Check for reusable workflow patterns and matrix strategies where appropriate.
  • Validate on: triggers: ensure branch/path filters are present to avoid unnecessary runs.
  • Confirm workflows are documented, DRY, and maintainable.
  • Ensure agent-triggered workflows use workflow_dispatch with defined inputs.

Files:

  • .github/workflows/readme-update.yml
  • .github/workflows/readme-audit.yml
**/docs/**/*.md

⚙️ CodeRabbit configuration file

**/docs/**/*.md: Review documentation files:

  • Ensure markdown is linted and formatted per project style guides.
  • Flag illogical folder structures, file naming, or misplaced content.
  • Confirm documentation is up to date, accurate, and cross-referenced.
  • Ensure accessibility (heading hierarchy, alt text for images, UK English).

Files:

  • docs/HUSKY_PRECOMMITS.md
  • docs/AGENT_CREATION.md
.github/prompts/**

⚙️ CodeRabbit configuration file

.github/prompts/**: Prefer concise, actionable reviews. Respect documented style precedence. Link suggested fixes.

Files:

  • .github/prompts/update-mermaid-diagrams.prompt.md
**/.github/prompts/*.md

⚙️ CodeRabbit configuration file

**/.github/prompts/*.md: Review all prompt files:

  • Check for clear instructions, examples, and checklist sections.
  • Ensure each file has correct YAML frontmatter.
  • Confirm the file is referenced in the prompts index.
  • Validate structure, naming, and documentation.

Files:

  • .github/prompts/update-mermaid-diagrams.prompt.md
**/.github/ISSUE_TEMPLATE/*.md

⚙️ CodeRabbit configuration file

**/.github/ISSUE_TEMPLATE/*.md: Review issue template files:

  • Ensure valid markdown syntax, logical structure, and clear instructions.
  • Validate YAML frontmatter for required fields (title, description, labels).
  • Check for accessibility (clear headings, no ambiguous language).
  • Confirm templates reference related documentation.

Files:

  • .github/ISSUE_TEMPLATE/README.md
**/*.{json,yaml,yml}

📄 CodeRabbit inference engine (AGENTS.md)

JSON and YAML files must follow formatting and validation standards defined in instructions/languages.instructions.md

Files:

  • package.json
**/package.json

⚙️ CodeRabbit configuration file

**/package.json: Review package.json:

  • Check for security vulnerabilities and outdated packages.
  • Ensure scripts are documented with clear, descriptive names.
  • Validate semantic versioning and proper version pinning.
  • Confirm devDependencies vs dependencies separation.
  • Ensure scripts follow org standards (lint, test, build, format).

Files:

  • package.json
🪛 LanguageTool
.github/prompts/update-mermaid-diagrams.prompt.md

[uncategorized] ~20-~20: The official name of this software platform is spelled with a capital “H”.
Context: ... colour contrast checks - Workflow: .github/workflows/readme-audit.yml and `.githu...

(GITHUB)


[uncategorized] ~20-~20: The official name of this software platform is spelled with a capital “H”.
Context: ....github/workflows/readme-audit.ymland.github/workflows/readme-update.yml` - audit an...

(GITHUB)


[style] ~83-~83: Would you like to use the Oxford spelling “Organization”? The spelling ‘Organisation’ is also correct.
Context: ... ❌ Failed, ⚠️ Warning, 🌐 External, 🏛️ Organisation, 🧪 Tests, 🔒 Protected ### 5. Conte...

(OXFORD_SPELLING_Z_NOT_S)


[formatting] ~111-~111: Consider inserting a comma after ‘yet’ to make the sentence clearer.
Context: ...`` 4. If a documentation file does not yet contain a diagram, only add one when th...

(IF_CLAUSE_COMMA)

instructions/mermaid.instructions.md

[misspelling] ~24-~24: This word is normally spelled as one.
Context: ... when the documentation describes: - A multi-step process or workflow - Component relatio...

(EN_COMPOUNDS_MULTI_STEP)


[uncategorized] ~30-~30: Possible missing comma found.
Context: ...dule Do not force a diagram into a file where a simple list or paragraph is cle...

(AI_HYDRA_LEO_MISSING_COMMA)


[style] ~132-~132: Would you like to use the Oxford spelling “Initialization”? The spelling ‘Initialisation’ is also correct.
Context: ...alone to convey meaning. --- ## Theme Initialisation Use a theme init block only when there...

(OXFORD_SPELLING_Z_NOT_S)


[style] ~166-~166: Would you like to use the Oxford spelling “Organization”? The spelling ‘Organisation’ is also correct.
Context: ... service | 🌐 | [🌐 External API] | | Organisation | 🏛️ | [🏛️ .github Hub] | | Tests |...

(OXFORD_SPELLING_Z_NOT_S)


[uncategorized] ~166-~166: The official name of this software platform is spelled with a capital “H”.
Context: ...External API]| | Organisation | 🏛️ |[🏛️ .github Hub]| | Tests | 🧪 |[🧪 Test Suite]...

(GITHUB)


[uncategorized] ~230-~230: The official name of this software platform is spelled with a capital “H”.
Context: ...ast.js) - Colour contrast validator - [.github/workflows/readme-audit.yml](../.github/...

(GITHUB)


[uncategorized] ~230-~230: The official name of this software platform is spelled with a capital “H”.
Context: ...or - .github/workflows/readme-audit.yml - Audit wor...

(GITHUB)


[uncategorized] ~231-~231: The official name of this software platform is spelled with a capital “H”.
Context: .../readme-audit.yml) - Audit workflow - [.github/workflows/readme-update.yml](../.github...

(GITHUB)


[uncategorized] ~231-~231: The official name of this software platform is spelled with a capital “H”.
Context: ...w - .github/workflows/readme-update.yml - Update w...

(GITHUB)

🪛 zizmor (1.25.2)
.github/workflows/readme-audit.yml

[warning] 82-101: overly broad permissions (excessive-permissions): default permissions used due to no permissions: block

(excessive-permissions)


[warning] 127-128: credential persistence through GitHub Actions artifacts (artipacked): does not set persist-credentials: false

(artipacked)


[warning] 121-137: overly broad permissions (excessive-permissions): default permissions used due to no permissions: block

(excessive-permissions)


[error] 128-128: unpinned action reference (unpinned-uses): action is not pinned to a hash (required by blanket policy)

(unpinned-uses)


[error] 131-131: unpinned action reference (unpinned-uses): action is not pinned to a hash (required by blanket policy)

(unpinned-uses)

🔇 Additional comments (25)
instructions/documentation-formats.instructions.md (2)

502-518: 💤 Low value

Minor wording refinement: "Colour" already used in guidance text.

Line 502 correctly uses UK English "colours" in the prose. The colour values in the classDef declarations (lines 513–514) appear to follow the approved palette pattern (e.g., fill:#dcfce7,color:#14532d,stroke:#14532d`` for success). This aligns with the WCAG 2.2 AA approved palette referenced in the PR objectives.


404-405: LGTM!

Also applies to: 419-420, 433-434, 455-456, 476-477, 547-548

instructions/automation.instructions.md (1)

81-82: LGTM!

Also applies to: 669-670

instructions/linting.instructions.md (1)

105-106: LGTM!

Also applies to: 141-142

instructions/quality-assurance.instructions.md (1)

80-96: LGTM!

Also applies to: 377-378

CONTRIBUTING.md (1)

33-34: LGTM!

docs/AGENT_CREATION.md (1)

111-112: LGTM!

Also applies to: 149-151, 185-186, 218-219, 308-309, 353-354, 405-406, 478-479, 528-529

docs/HUSKY_PRECOMMITS.md (1)

119-120: LGTM!

.github/instructions/.archive/frontmatter.instructions.md (1)

86-87: LGTM!

.github/instructions/.archive/tests.instructions.md (1)

87-94: LGTM!

Also applies to: 99-115, 180-195

.github/reports/mermaid/diagram-validation-2025-12-11.md (1)

282-290: LGTM!

README.md (2)

127-217: 💤 Low value

Acclamation to the colour palette update! 🎨

The repository architecture diagram receives all the accessibility love—accTitle and accDescr properly positioned, and the approved WCAG 2.2 AA colour palette applied consistently. The diagram legibility remains excellent across all node types.

One tiny finesse: lines 228-229 and 351-352 show slightly different accDescr formatting styles (inline vs. block). Whilst both render correctly, standardising to a single format (inline, as most diagrams use) would improve consistency across the entire file. Not blocking, but worth a future polish pass!

Source: Coding guidelines


170-180: LGTM!

Also applies to: 250-254, 296-300, 411-414

.github/README.md (1)

64-123: 💤 Low value

Brilliant accessibility enhancements across the .github hub documentation! 🌟

All three diagrams now sport proper accTitle and accDescr metadata, and the WCAG 2.2 AA colour palette is applied with consistent contrast ratios. The diagrams remain visually engaging whilst remaining accessible to all users.

One stylistic note: You'll notice some diagrams use inline accDescr: "..." format (lines 216, 266) whilst others use the block format accDescr { ... } (lines 71-73). Both are valid Mermaid syntax, but standardising to one format across all files in the PR would improve consistency. The inline format is more compact; the block format is clearer for longer descriptions. Current state isn't a blocker, but worth a polish pass across the repository-wide changes.

Also applies to: 215-235, 265-323, 406-461

.github/ISSUE_TEMPLATE/README.md (1)

48-79: LGTM!

profile/README.md (2)

34-71: LGTM!

Also applies to: 95-129, 148-202, 225-244


301-308: ⚡ Quick win

Spot of duplication in the footer! 🎯

The lovely "Made with 💚 by LightSpeedWP" footer message appears three times consecutively (lines 301–308). This looks unintentional—likely a copy-paste artifact from a previous edit. A quick trim to a single instance would tidy things up nicely. Not blocking the Mermaid changes, but worth a quick fix if you're passing through.

scripts/README.md (1)

31-64: LGTM!

Also applies to: 401-425

tests/README.md (2)

72-105: LGTM!

Also applies to: 198-221, 225-260


370-379: ⚡ Quick win

Treble footer alert! 📋

Same footer duplication spotted here—"Built by 🧱 LightSpeedWP..." appears three times consecutively (lines 370–379). Appears to be a systematic issue across multiple README files in this PR. A quick trim to a single instance would restore polish. Likely a find-and-replace artifact, but worth a final pass to catch these.

.github/prompts/update-mermaid-diagrams.prompt.md (1)

4-122: LGTM!

.github/reports/mermaid/colour-contrast-report-2026-06-18.md (1)

1-43: LGTM!

package.json (1)

108-113: LGTM!

scripts/validation/validate-mermaid-syntax.js (1)

3-3: LGTM!

Also applies to: 16-24, 36-36, 61-61, 190-190, 280-280

scripts/validation/validate-mermaid-accessibility.js (1)

3-3: LGTM!

Also applies to: 16-24, 50-50, 136-140, 273-273

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

Caution

Inline review comments failed to post. This is likely due to GitHub's internal server error or limits when posting large numbers of comments. If you are seeing this consistently it is likely a permissions issue. Please check "Moderation" -> "Code review limits" under your organization settings.

Actionable comments posted: 11

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (3)
.github/workflows/readme-audit.yml (2)

91-101: ⚠️ Potential issue | 🟠 Major | ⚡ Quick win

Validator jobs run before dependencies are installed.

These jobs execute npm run validate:*, but there is no npm ci step in the shown job setup. That can fail immediately on module imports (for example glob).

Suggested patch
       - name: Set up Node.js
         uses: actions/setup-node@v4
         with:
           node-version: "18"
           cache: "npm"
+      - name: Install dependencies
+        run: npm ci

Also applies to: 118-120, 136-137

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In @.github/workflows/readme-audit.yml around lines 91 - 101, The
readme-audit.yml workflow is missing a dependency installation step before
running validation commands. Add an `npm ci` step between the "Set up Node.js"
step and the "Validate Mermaid diagrams" step (and apply the same fix to the
other affected validation jobs mentioned at lines 118-120 and 136-137). This
ensures that npm dependencies like glob are installed before any npm run
validate commands are executed, preventing immediate module import failures
during validation.

82-138: ⚠️ Potential issue | 🟠 Major | ⚡ Quick win

Add explicit least-privilege permissions for these jobs.

Nice workflow expansion overall — now let’s lock token scope down explicitly (read-only by default, elevate only where truly needed).

Suggested patch
   validate-syntax:
     name: Validate Mermaid Syntax
     runs-on: ubuntu-latest
+    permissions:
+      contents: read
@@
   check-accessibility:
     name: Check WCAG Compliance
     runs-on: ubuntu-latest
+    permissions:
+      contents: read
@@
   check-contrast:
     name: Check Mermaid Colour Contrast
     runs-on: ubuntu-latest
+    permissions:
+      contents: read

As per coding guidelines, GitHub Actions workflows should use least-privilege permissions and default to read-only.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In @.github/workflows/readme-audit.yml around lines 82 - 138, The three jobs
validate-syntax, check-accessibility, and check-contrast are missing explicit
least-privilege permissions blocks. Add a permissions section to each job
setting contents to read, since these jobs only perform read operations on the
repository (checking out code and running validation scripts without modifying
anything). This follows the principle of defaulting to read-only access and only
elevating permissions where truly needed.

Sources: Coding guidelines, Linters/SAST tools

scripts/fix-mermaid-diagrams.js (1)

142-159: ⚠️ Potential issue | 🟠 Major | ⚡ Quick win

Broaden metadata detection to avoid duplicate accTitle/accDescr entries

Quick gremlin on Line 142 and Line 157: the fixer only detects accTitle: / accDescr:. Valid forms like accTitle My title and accDescr { ... } are treated as missing, so duplicate accessibility fields can be injected.

Suggested patch
-    if (!nextDiagram.includes("accTitle:")) {
+    const hasAccTitle =
+      /(?:^|\n)\s*accTitle(?:\s*[:=]|\s+)/m.test(nextDiagram);
+    if (!hasAccTitle) {
       const firstLine = nextDiagram.split("\n")[0];
@@
-    if (!nextDiagram.includes("accDescr:")) {
+    const hasAccDescr =
+      /(?:^|\n)\s*accDescr(?:\s*[:=]|\s*{|\s+)/m.test(nextDiagram);
+    if (!hasAccDescr) {
       nextDiagram = `${nextDiagram}\naccDescr: Detailed diagram`;
       modified = true;
     }
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@scripts/fix-mermaid-diagrams.js` around lines 142 - 159, The accessibility
metadata detection is too narrow - the includes() checks for "accTitle:" and
"accDescr:" on lines 142 and 157 only match one specific format, but mermaid
allows alternative formats like "accTitle My title" (without colon) and
"accDescr { ... }" (with braces). Broaden both detection checks to match any
occurrence of the metadata field name itself rather than just the colon-suffixed
variants, so that existing accessibility metadata in alternative formats is
properly detected and duplicate entries are not injected. Consider using regex
or multiple include checks to catch all valid variations of these fields.
🧹 Nitpick comments (1)
.github/workflows/readme-audit.yml (1)

88-90: ⚡ Quick win

Harden checkout steps by disabling credential persistence.

For pure validation jobs, set persist-credentials: false on actions/checkout to reduce accidental token exposure paths.

Suggested patch
       - name: Checkout repository
         uses: actions/checkout@v4
+        with:
+          persist-credentials: false

As per coding guidelines, workflow security checks should include safe secret handling and minimised credential exposure.

Also applies to: 109-111, 127-129

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In @.github/workflows/readme-audit.yml around lines 88 - 90, The
actions/checkout@v4 steps in the readme-audit workflow do not disable credential
persistence, increasing the risk of accidental token exposure. Add the
`persist-credentials: false` configuration parameter to all three instances of
the actions/checkout@v4 step (the one at the specified location and the two
additional instances noted in the comment) to minimize credential exposure
during the validation job execution, as per security guidelines for pure
validation workflows.

Sources: Coding guidelines, Linters/SAST tools

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In @.github/reports/mermaid-accessibility-report.md:
- Line 3: Update the description text in the accessibility report to reflect the
current number of diagrams being audited. Change "all 24 Mermaid diagrams" to
"all 60 Mermaid diagrams" in the description field to ensure consistency between
the documentation and the actual audit scope. This simple numeric update will
prevent confusion about the audit coverage.
- Line 35: In the mermaid-accessibility-report.md file, locate the heading "##
Files Analyzed" and change the spelling from "Analyzed" (US English) to
"Analysed" (UK English) to comply with the repository's documentation standards
that require UK English spelling throughout all markdown and text files.

In @.github/reports/mermaid-validation-report.md:
- Line 3: Update the description field in the frontmatter at line 3 of the
mermaid-validation-report.md file. The current description states the validation
results are "for repository README files" but the report scope has expanded to
cover all Markdown and MDX files across the repository. Replace the
README-specific wording with text that accurately reflects the repo-wide scope
of the validation audit.
- Line 24: In the mermaid-validation-report.md file, change the section heading
"## Files Analyzed" to "## Files Analysed" to comply with UK English spelling
standards as required by the project's coding guidelines for markdown files.
This ensures consistency with other UK English terms used throughout the
documentation.

In @.github/workflows/readme-update.yml:
- Around line 70-74: The "Validate Mermaid colour contrast" step currently has
continue-on-error set to true, which allows the workflow to pass even when the
npm run validate:mermaid-contrast command fails. Remove the continue-on-error:
true line from this step to make the contrast validation blocking, ensuring that
non-compliant Mermaid diagrams will cause the workflow to fail and prevent the
commit from proceeding.

In `@instructions/mermaid.instructions.md`:
- Line 16: The instructions at line 16 claim that the validation workflow
"enforces the accessibility and syntax rules automatically," but this is
inaccurate. The provided validator and fixer snippets only enforce the presence
of `accTitle` and `accDescr` attributes without enforcing their proper placement
within the `---` header wrapper block format or preventing duplicate inline
declarations. Revise the claim on line 16 to accurately reflect what is actually
enforced by the current tooling, or update the validator/fixer snippets to fully
enforce header-block placement and duplicate-inline constraints. The same
accuracy issue applies to the rules mentioned around lines 68-71, so update
those as well to match the actual enforcement behavior.
- Around line 38-47: The outer fenced code blocks use triple backticks which can
conflict with the inner mermaid code blocks that also use triple backticks,
causing the outer block to terminate prematurely in Markdown renderers. Change
all outer fences from triple backticks (```text) to four backticks (````text) to
properly contain the inner mermaid blocks with their triple backticks. Apply
this change to all occurrences where mermaid examples are nested within text
fences throughout the document, including multiple instances.
- Around line 14-224: The mermaid.instructions.md file does not follow the
required instruction file template structure. Restructure the file to follow the
mandated pattern: start with a Role section, then add Overview, General Rules,
Detailed Guidance, Examples, Validation, and References/Cross-References
sections. Consolidate existing content like "When to Include a Diagram",
"Required Structure", "Diagram Types", "Colour Palette", "Theme Initialisation",
"Emoji in Node Labels", and "Layout and Clarity" into the appropriate sections
(most should fall under General Rules and Detailed Guidance). Ensure the
Validation section includes the npm commands already present. Add a new
References/Cross-References section at the end to link to related documentation
or files.
- Around line 4-11: The frontmatter in the mermaid.instructions.md file is
missing three canonical metadata keys required for all instructions/** files.
Add the missing keys file_type, domain, and stability to the frontmatter
section. The file_type should indicate this is an instruction file, domain
should categorize the subject area (likely "documentation" or "diagrams"), and
stability should indicate the maturity level of the instruction. Ensure all keys
in the canonical pattern (file_type, version, last_updated, owners, tags,
status, domain, stability) are present in the frontmatter block.

In `@scripts/validation/validate-mermaid-colour-contrast.js`:
- Around line 154-161: The validator currently extracts and stores only `fill`
and `color` properties but does not parse or validate the `stroke` property,
which is required as part of the documented fill+color+stroke triple. Extend the
regex matching logic in the section where fillMatch and colorMatch are defined
to also extract the stroke value using a similar pattern. Then update the
validation logic (referenced in the "Also applies to" range at lines 170-225) to
enforce that all three properties (fill, color, and stroke) must be present
together before marking a node as valid, rather than allowing partial matches to
pass validation.
- Around line 176-177: When parseColour(fill) or parseColour(color) returns a
falsy value (indicating an invalid or unsupported color), instead of silently
returning with no issues reported, add an issue entry to the issues array
describing that the color value is invalid or unsupported. This fix should be
applied in two places: when fillHex is falsy after calling parseColour(fill),
and when colorHex is falsy after calling parseColour(color) around the code
region mentioned as also applying to lines 212-214. Each case should push a
descriptive issue object to the issues array before returning it, rather than
returning early with no warnings about the unparseable color values.

---

Outside diff comments:
In @.github/workflows/readme-audit.yml:
- Around line 91-101: The readme-audit.yml workflow is missing a dependency
installation step before running validation commands. Add an `npm ci` step
between the "Set up Node.js" step and the "Validate Mermaid diagrams" step (and
apply the same fix to the other affected validation jobs mentioned at lines
118-120 and 136-137). This ensures that npm dependencies like glob are installed
before any npm run validate commands are executed, preventing immediate module
import failures during validation.
- Around line 82-138: The three jobs validate-syntax, check-accessibility, and
check-contrast are missing explicit least-privilege permissions blocks. Add a
permissions section to each job setting contents to read, since these jobs only
perform read operations on the repository (checking out code and running
validation scripts without modifying anything). This follows the principle of
defaulting to read-only access and only elevating permissions where truly
needed.

In `@scripts/fix-mermaid-diagrams.js`:
- Around line 142-159: The accessibility metadata detection is too narrow - the
includes() checks for "accTitle:" and "accDescr:" on lines 142 and 157 only
match one specific format, but mermaid allows alternative formats like "accTitle
My title" (without colon) and "accDescr { ... }" (with braces). Broaden both
detection checks to match any occurrence of the metadata field name itself
rather than just the colon-suffixed variants, so that existing accessibility
metadata in alternative formats is properly detected and duplicate entries are
not injected. Consider using regex or multiple include checks to catch all valid
variations of these fields.

---

Nitpick comments:
In @.github/workflows/readme-audit.yml:
- Around line 88-90: The actions/checkout@v4 steps in the readme-audit workflow
do not disable credential persistence, increasing the risk of accidental token
exposure. Add the `persist-credentials: false` configuration parameter to all
three instances of the actions/checkout@v4 step (the one at the specified
location and the two additional instances noted in the comment) to minimize
credential exposure during the validation job execution, as per security
guidelines for pure validation workflows.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Repository YAML (base), Organization UI (inherited)

Review profile: CHILL

Plan: Pro

Run ID: e58fccc6-6e29-426e-970e-235adb63d73e

📥 Commits

Reviewing files that changed from the base of the PR and between ec159b9 and 5b582f6.

⛔ Files ignored due to path filters (1)
  • .github/reports/mermaid-diagram-accessibility-spreadsheet.csv is excluded by !**/*.csv
📒 Files selected for processing (29)
  • .github/ISSUE_TEMPLATE/README.md
  • .github/README.md
  • .github/instructions/.archive/frontmatter.instructions.md
  • .github/instructions/.archive/tests.instructions.md
  • .github/prompts/update-mermaid-diagrams.prompt.md
  • .github/reports/mermaid-accessibility-report.md
  • .github/reports/mermaid-validation-report.md
  • .github/reports/mermaid/colour-contrast-report-2026-06-18.md
  • .github/reports/mermaid/diagram-validation-2025-12-11.md
  • .github/workflows/readme-audit.yml
  • .github/workflows/readme-update.yml
  • .vscode/README.md
  • CONTRIBUTING.md
  • README.md
  • docs/AGENT_CREATION.md
  • docs/HUSKY_PRECOMMITS.md
  • instructions/automation.instructions.md
  • instructions/documentation-formats.instructions.md
  • instructions/linting.instructions.md
  • instructions/mermaid.instructions.md
  • instructions/quality-assurance.instructions.md
  • package.json
  • profile/README.md
  • scripts/README.md
  • scripts/fix-mermaid-diagrams.js
  • scripts/validation/validate-mermaid-accessibility.js
  • scripts/validation/validate-mermaid-colour-contrast.js
  • scripts/validation/validate-mermaid-syntax.js
  • tests/README.md
📜 Review details
🔇 Additional comments (25)
instructions/documentation-formats.instructions.md (2)

502-518: 💤 Low value

Minor wording refinement: "Colour" already used in guidance text.

Line 502 correctly uses UK English "colours" in the prose. The colour values in the classDef declarations (lines 513–514) appear to follow the approved palette pattern (e.g., fill:#dcfce7,color:#14532d,stroke:#14532d`` for success). This aligns with the WCAG 2.2 AA approved palette referenced in the PR objectives.


404-405: LGTM!

Also applies to: 419-420, 433-434, 455-456, 476-477, 547-548

instructions/automation.instructions.md (1)

81-82: LGTM!

Also applies to: 669-670

instructions/linting.instructions.md (1)

105-106: LGTM!

Also applies to: 141-142

instructions/quality-assurance.instructions.md (1)

80-96: LGTM!

Also applies to: 377-378

CONTRIBUTING.md (1)

33-34: LGTM!

docs/AGENT_CREATION.md (1)

111-112: LGTM!

Also applies to: 149-151, 185-186, 218-219, 308-309, 353-354, 405-406, 478-479, 528-529

docs/HUSKY_PRECOMMITS.md (1)

119-120: LGTM!

.github/instructions/.archive/frontmatter.instructions.md (1)

86-87: LGTM!

.github/instructions/.archive/tests.instructions.md (1)

87-94: LGTM!

Also applies to: 99-115, 180-195

.github/reports/mermaid/diagram-validation-2025-12-11.md (1)

282-290: LGTM!

README.md (2)

127-217: 💤 Low value

Acclamation to the colour palette update! 🎨

The repository architecture diagram receives all the accessibility love—accTitle and accDescr properly positioned, and the approved WCAG 2.2 AA colour palette applied consistently. The diagram legibility remains excellent across all node types.

One tiny finesse: lines 228-229 and 351-352 show slightly different accDescr formatting styles (inline vs. block). Whilst both render correctly, standardising to a single format (inline, as most diagrams use) would improve consistency across the entire file. Not blocking, but worth a future polish pass!

Source: Coding guidelines


170-180: LGTM!

Also applies to: 250-254, 296-300, 411-414

.github/README.md (1)

64-123: 💤 Low value

Brilliant accessibility enhancements across the .github hub documentation! 🌟

All three diagrams now sport proper accTitle and accDescr metadata, and the WCAG 2.2 AA colour palette is applied with consistent contrast ratios. The diagrams remain visually engaging whilst remaining accessible to all users.

One stylistic note: You'll notice some diagrams use inline accDescr: "..." format (lines 216, 266) whilst others use the block format accDescr { ... } (lines 71-73). Both are valid Mermaid syntax, but standardising to one format across all files in the PR would improve consistency. The inline format is more compact; the block format is clearer for longer descriptions. Current state isn't a blocker, but worth a polish pass across the repository-wide changes.

Also applies to: 215-235, 265-323, 406-461

.github/ISSUE_TEMPLATE/README.md (1)

48-79: LGTM!

profile/README.md (2)

34-71: LGTM!

Also applies to: 95-129, 148-202, 225-244


301-308: ⚡ Quick win

Spot of duplication in the footer! 🎯

The lovely "Made with 💚 by LightSpeedWP" footer message appears three times consecutively (lines 301–308). This looks unintentional—likely a copy-paste artifact from a previous edit. A quick trim to a single instance would tidy things up nicely. Not blocking the Mermaid changes, but worth a quick fix if you're passing through.

scripts/README.md (1)

31-64: LGTM!

Also applies to: 401-425

tests/README.md (2)

72-105: LGTM!

Also applies to: 198-221, 225-260


370-379: ⚡ Quick win

Treble footer alert! 📋

Same footer duplication spotted here—"Built by 🧱 LightSpeedWP..." appears three times consecutively (lines 370–379). Appears to be a systematic issue across multiple README files in this PR. A quick trim to a single instance would restore polish. Likely a find-and-replace artifact, but worth a final pass to catch these.

.github/prompts/update-mermaid-diagrams.prompt.md (1)

4-122: LGTM!

.github/reports/mermaid/colour-contrast-report-2026-06-18.md (1)

1-43: LGTM!

package.json (1)

108-113: LGTM!

scripts/validation/validate-mermaid-syntax.js (1)

3-3: LGTM!

Also applies to: 16-24, 36-36, 61-61, 190-190, 280-280

scripts/validation/validate-mermaid-accessibility.js (1)

3-3: LGTM!

Also applies to: 16-24, 50-50, 136-140, 273-273

🛑 Comments failed to post (11)
.github/reports/mermaid-accessibility-report.md (2)

3-3: ⚠️ Potential issue | 🟡 Minor | ⚡ Quick win

Align the description with the current diagram count

Line 3 still says "all 24 Mermaid diagrams", but this report now records 60. Tiny text mismatch, big audit confusion later.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In @.github/reports/mermaid-accessibility-report.md at line 3, Update the
description text in the accessibility report to reflect the current number of
diagrams being audited. Change "all 24 Mermaid diagrams" to "all 60 Mermaid
diagrams" in the description field to ensure consistency between the
documentation and the actual audit scope. This simple numeric update will
prevent confusion about the audit coverage.

35-35: ⚠️ Potential issue | 🟡 Minor | ⚡ Quick win

Switch heading to UK English spelling

Line 35 uses "Analyzed"; please use "Analysed" to match repo language standards.

As per coding guidelines, **/*.{md,markdown,txt,instructions.md} requires UK English throughout (e.g., “optimise, organisation, colour, behaviour”).

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In @.github/reports/mermaid-accessibility-report.md at line 35, In the
mermaid-accessibility-report.md file, locate the heading "## Files Analyzed" and
change the spelling from "Analyzed" (US English) to "Analysed" (UK English) to
comply with the repository's documentation standards that require UK English
spelling throughout all markdown and text files.

Source: Coding guidelines

.github/reports/mermaid-validation-report.md (2)

3-3: ⚠️ Potential issue | 🟡 Minor | ⚡ Quick win

Update scope wording in frontmatter description

Line 3 still says results are for repository README files, but this report now audits a repo-wide Markdown/MDX set. The description should match the actual scope.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In @.github/reports/mermaid-validation-report.md at line 3, Update the
description field in the frontmatter at line 3 of the
mermaid-validation-report.md file. The current description states the validation
results are "for repository README files" but the report scope has expanded to
cover all Markdown and MDX files across the repository. Replace the
README-specific wording with text that accurately reflects the repo-wide scope
of the validation audit.

24-24: ⚠️ Potential issue | 🟡 Minor | ⚡ Quick win

Use UK spelling in the section heading

Line 24 uses "Files Analyzed"; please use "Files Analysed" for consistency with UK English standards.

As per coding guidelines, **/*.{md,markdown,txt,instructions.md} requires UK English throughout (e.g., “optimise, organisation, colour, behaviour”).

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In @.github/reports/mermaid-validation-report.md at line 24, In the
mermaid-validation-report.md file, change the section heading "## Files
Analyzed" to "## Files Analysed" to comply with UK English spelling standards as
required by the project's coding guidelines for markdown files. This ensures
consistency with other UK English terms used throughout the documentation.

Source: Coding guidelines

.github/workflows/readme-update.yml (1)

70-74: ⚠️ Potential issue | 🟠 Major | ⚡ Quick win

Make contrast validation blocking before commit/push

Line 73 currently lets contrast validation fail softly, which means non-compliant Mermaid updates can still sail through and be committed. For a WCAG gate, this should fail hard.

Suggested patch
       - name: Validate Mermaid colour contrast
         if: ${{ env.UPDATE_SCOPE == 'all' || env.UPDATE_SCOPE == 'mermaid' }}
         run: npm run validate:mermaid-contrast
-        continue-on-error: true
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

      - name: Validate Mermaid colour contrast
        if: ${{ env.UPDATE_SCOPE == 'all' || env.UPDATE_SCOPE == 'mermaid' }}
        run: npm run validate:mermaid-contrast
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In @.github/workflows/readme-update.yml around lines 70 - 74, The "Validate
Mermaid colour contrast" step currently has continue-on-error set to true, which
allows the workflow to pass even when the npm run validate:mermaid-contrast
command fails. Remove the continue-on-error: true line from this step to make
the contrast validation blocking, ensuring that non-compliant Mermaid diagrams
will cause the workflow to fail and prevent the commit from proceeding.
instructions/mermaid.instructions.md (4)

4-11: ⚠️ Potential issue | 🟠 Major | ⚡ Quick win

Frontmatter is missing canonical instruction metadata keys.

Quick compliance win: this header should include the canonical file_type, domain, and stability keys for instructions/** files.

Suggested patch
 description: "Design, accessibility, colour contrast, and validation standards for Mermaid diagrams across the repository"
+file_type: "instruction"
 scope: "repo-local"
 version: "v2.0"
 last_updated: "2026-06-18"
 owners: ["LightSpeed Team"]
 tags: ["mermaid", "diagrams", "documentation", "a11y", "wcag", "colour-contrast", "visuals", "architecture"]
 applyTo: ["**/*.md", "**/*.mdx"]
 status: "active"
+domain: "documentation"
+stability: "stable"

As per coding guidelines, instructions/** must use the canonical frontmatter pattern (file_type, version, last_updated, owners, tags, status, domain, stability).

📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

description: "Design, accessibility, colour contrast, and validation standards for Mermaid diagrams across the repository"
file_type: "instruction"
scope: "repo-local"
version: "v2.0"
last_updated: "2026-06-18"
owners: ["LightSpeed Team"]
tags: ["mermaid", "diagrams", "documentation", "a11y", "wcag", "colour-contrast", "visuals", "architecture"]
applyTo: ["**/*.md", "**/*.mdx"]
status: "active"
domain: "documentation"
stability: "stable"
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@instructions/mermaid.instructions.md` around lines 4 - 11, The frontmatter in
the mermaid.instructions.md file is missing three canonical metadata keys
required for all instructions/** files. Add the missing keys file_type, domain,
and stability to the frontmatter section. The file_type should indicate this is
an instruction file, domain should categorize the subject area (likely
"documentation" or "diagrams"), and stability should indicate the maturity level
of the instruction. Ensure all keys in the canonical pattern (file_type,
version, last_updated, owners, tags, status, domain, stability) are present in
the frontmatter block.

Source: Coding guidelines


14-224: ⚠️ Potential issue | 🟠 Major | ⚡ Quick win

Instruction file structure does not follow the required template headings.

This file currently uses custom section names, but **/*.instructions.md requires an explicit pattern: role declaration + Overview + General Rules + Detailed Guidance + Examples + Validation + References/Cross-References.

As per coding guidelines, instruction files must follow the mandated section pattern and include a references/cross-references section.

🧰 Tools
🪛 LanguageTool

[misspelling] ~24-~24: This word is normally spelled as one.
Context: ... when the documentation describes: - A multi-step process or workflow - Component relatio...

(EN_COMPOUNDS_MULTI_STEP)


[uncategorized] ~30-~30: Possible missing comma found.
Context: ...dule Do not force a diagram into a file where a simple list or paragraph is cle...

(AI_HYDRA_LEO_MISSING_COMMA)


[style] ~132-~132: Would you like to use the Oxford spelling “Initialization”? The spelling ‘Initialisation’ is also correct.
Context: ...alone to convey meaning. --- ## Theme Initialisation Use a theme init block only when there...

(OXFORD_SPELLING_Z_NOT_S)


[style] ~166-~166: Would you like to use the Oxford spelling “Organization”? The spelling ‘Organisation’ is also correct.
Context: ... service | 🌐 | [🌐 External API] | | Organisation | 🏛️ | [🏛️ .github Hub] | | Tests |...

(OXFORD_SPELLING_Z_NOT_S)


[uncategorized] ~166-~166: The official name of this software platform is spelled with a capital “H”.
Context: ...External API]| | Organisation | 🏛️ |[🏛️ .github Hub]| | Tests | 🧪 |[🧪 Test Suite]...

(GITHUB)

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@instructions/mermaid.instructions.md` around lines 14 - 224, The
mermaid.instructions.md file does not follow the required instruction file
template structure. Restructure the file to follow the mandated pattern: start
with a Role section, then add Overview, General Rules, Detailed Guidance,
Examples, Validation, and References/Cross-References sections. Consolidate
existing content like "When to Include a Diagram", "Required Structure",
"Diagram Types", "Colour Palette", "Theme Initialisation", "Emoji in Node
Labels", and "Layout and Clarity" into the appropriate sections (most should
fall under General Rules and Detailed Guidance). Ensure the Validation section
includes the npm commands already present. Add a new References/Cross-References
section at the end to link to related documentation or files.

Source: Coding guidelines


16-16: ⚠️ Potential issue | 🟠 Major | 🏗️ Heavy lift

“Automatically enforced” is stricter than current tooling behaviour.

Line 16/rules imply header-block placement and duplicate-inline constraints are enforced, but the provided validator/fixer snippets only enforce presence of accTitle/accDescr and can inject them without the --- header wrapper. That can produce false confidence in compliance.

Also applies to: 68-71

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@instructions/mermaid.instructions.md` at line 16, The instructions at line 16
claim that the validation workflow "enforces the accessibility and syntax rules
automatically," but this is inaccurate. The provided validator and fixer
snippets only enforce the presence of `accTitle` and `accDescr` attributes
without enforcing their proper placement within the `---` header wrapper block
format or preventing duplicate inline declarations. Revise the claim on line 16
to accurately reflect what is actually enforced by the current tooling, or
update the validator/fixer snippets to fully enforce header-block placement and
duplicate-inline constraints. The same accuracy issue applies to the rules
mentioned around lines 68-71, so update those as well to match the actual
enforcement behavior.

38-47: ⚠️ Potential issue | 🟡 Minor | ⚡ Quick win

Nested fenced examples should use four-backtick outer fences.

Using triple backticks for both outer (text) and inner (mermaid) fences can terminate the outer block early in Markdown renderers.

Suggested patch
-```text
+````text
 ```mermaid
 ---
 accTitle: Short accessible title (max 80 chars)
 accDescr: Single-sentence description for simple diagrams
 ---
 flowchart LR
     ...

-```
+````

</details>

As per coding guidelines, all Markdown documentation must follow formatting standards.






Also applies to: 51-64

<details>
<summary>🤖 Prompt for AI Agents</summary>

Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In @instructions/mermaid.instructions.md around lines 38 - 47, The outer fenced
code blocks use triple backticks which can conflict with the inner mermaid code
blocks that also use triple backticks, causing the outer block to terminate
prematurely in Markdown renderers. Change all outer fences from triple backticks
(```text) to four backticks (````text) to properly contain the inner mermaid
blocks with their triple backticks. Apply this change to all occurrences where
mermaid examples are nested within text fences throughout the document,
including multiple instances.


</details>

<!-- fingerprinting:phantom:poseidon:hawk -->

<!-- cr-comment:v1:28bf85f315ebbf58ace4ce51 -->

_Source: Coding guidelines_

<!-- This is an auto-generated comment by CodeRabbit -->

</blockquote></details>
<details>
<summary>scripts/validation/validate-mermaid-colour-contrast.js (2)</summary><blockquote>

154-161: _⚠️ Potential issue_ | _🟠 Major_ | _⚡ Quick win_

**The validator does not enforce the required `fill` + `color` + `stroke` triple.**

Current parsing/validation checks `fill` and `color` only. Declarations with `fill` but missing `stroke` still pass, which drifts from the documented standard.

<details>
<summary>Suggested patch</summary>

```diff
-    const colorMatch = props.match(/(?<!-)\bcolor\s*:\s*([^,;\s]+)/i);
+    const colorMatch = props.match(/(?<!-)\bcolor\s*:\s*([^,;\s]+)/i);
+    const strokeMatch = props.match(/(?<!-)\bstroke\s*:\s*([^,;\s]+)/i);
@@
       fill: fillMatch ? fillMatch[1].trim() : null,
       color: colorMatch ? colorMatch[1].trim() : null,
+      stroke: strokeMatch ? strokeMatch[1].trim() : null,
@@
-  const { kind, nodeId, fill, color } = styleDecl;
+  const { kind, nodeId, fill, color, stroke } = styleDecl;
@@
+  if (!stroke) {
+    issues.push({
+      level: "error",
+      message: `${kind} "${nodeId}": fill ${fill} is missing explicit stroke:.`,
+    });
+  }
```
</details>






Also applies to: 170-225

<details>
<summary>🤖 Prompt for AI Agents</summary>

```
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@scripts/validation/validate-mermaid-colour-contrast.js` around lines 154 -
161, The validator currently extracts and stores only `fill` and `color`
properties but does not parse or validate the `stroke` property, which is
required as part of the documented fill+color+stroke triple. Extend the regex
matching logic in the section where fillMatch and colorMatch are defined to also
extract the stroke value using a similar pattern. Then update the validation
logic (referenced in the "Also applies to" range at lines 170-225) to enforce
that all three properties (fill, color, and stroke) must be present together
before marking a node as valid, rather than allowing partial matches to pass
validation.
```

</details>

<!-- fingerprinting:phantom:poseidon:hawk -->

<!-- cr-comment:v1:eb9221c6c2ed2d18d4a4ce81 -->

<!-- This is an auto-generated comment by CodeRabbit -->

---

176-177: _⚠️ Potential issue_ | _🟠 Major_ | _⚡ Quick win_

**Unsupported/invalid colour values currently pass silently.**

If `fill` or `color` cannot be parsed, the validator returns no issue, which can hide real contrast problems.

<details>
<summary>Suggested patch</summary>

```diff
   const fillHex = parseColour(fill);
-  if (!fillHex) return issues;
+  if (!fillHex) {
+    issues.push({
+      level: "error",
+      message: `${kind} "${nodeId}": unsupported fill colour "${fill}". Use hex or a supported named colour.`,
+    });
+    return issues;
+  }
@@
   const colorHex = parseColour(color);
-  if (!colorHex) return issues;
+  if (!colorHex) {
+    issues.push({
+      level: "error",
+      message: `${kind} "${nodeId}": unsupported text colour "${color}". Use hex or a supported named colour.`,
+    });
+    return issues;
+  }
```
</details>






Also applies to: 212-214

<details>
<summary>🤖 Prompt for AI Agents</summary>

```
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@scripts/validation/validate-mermaid-colour-contrast.js` around lines 176 -
177, When parseColour(fill) or parseColour(color) returns a falsy value
(indicating an invalid or unsupported color), instead of silently returning with
no issues reported, add an issue entry to the issues array describing that the
color value is invalid or unsupported. This fix should be applied in two places:
when fillHex is falsy after calling parseColour(fill), and when colorHex is
falsy after calling parseColour(color) around the code region mentioned as also
applying to lines 212-214. Each case should push a descriptive issue object to
the issues array before returning it, rather than returning early with no
warnings about the unparseable color values.
```

</details>

<!-- fingerprinting:phantom:poseidon:hawk -->

<!-- cr-comment:v1:f158f77818003f4608e4fe91 -->

<!-- This is an auto-generated comment by CodeRabbit -->

</blockquote></details>

</blockquote></details>

<!-- This is an auto-generated comment by CodeRabbit for review status -->

@github-actions

github-actions Bot commented Jun 18, 2026

Copy link
Copy Markdown
Contributor

🔍 Reviewer Summary for PR #987

CI Status:success
Files changed: 31
Risk Distribution: 3 critical, 11 high, 0 medium, 17 low

Recommendations

  • ⚠️ 3 critical-risk file(s) modified (workflows, secrets)
  • ⚠️ Security-sensitive files modified (review carefully)
  • ⚠️ Large deletion detected (>500 lines removed)

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

Labels

area:a11y Accessibility-focused work area:ci Build and CI pipelines area:dependencies Composer/npm dependency work area:documentation Docs & guides area:scripts Scripts & tooling lang:js JavaScript/TypeScript lang:json JSON config/content lang:md Markdown content/docs lang:yaml YAML config meta:needs-changelog Requires a changelog entry before merge priority:normal Default priority status:needs-review Awaiting code review type:documentation Documentation

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Mermaid diagrams: WCAG 2.2 AA contrast sweep

1 participant