fix(test): anchor docs fence-parity regex to line start#1319
Merged
tamirdresher merged 1 commit intoJun 15, 2026
Merged
Conversation
The fence-parity check used /\\\/g which matched triple-backticks anywhere in file content — including inside table cells and inline code spans that document fence syntax itself. Reproducer: docs/src/content/docs/features/skill-security-scanner.md L69 contains a table cell that shows the fence-syntax escape with four-backtick quoting (\\\\ \\\ \\\\). The old regex matched 3 backtick-triples from that one cell plus 2 from the real fenced bash block at L82/L91 = 5 total (odd) → failing parity check. Fix: anchor both regexes to line start with /^\\\/gm so only real fence delimiters (at column 0) are counted or matched. - Line-count check: /\\\/g → /^\\\/gm - Block-extraction regex: /\\\[\s\S]*?\\\/g → /^\\\[\s\S]*?^\\\/gm This unblocks PRs bradygaster#1316, bradygaster#1317, bradygaster#1234 which are all failing CI on dev. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Contributor
🟢 Impact Analysis — PR #1319Risk tier: 🟢 LOW 📊 Summary
🎯 Risk Factors
📦 Modules Affectedtests (1 file)
This report is generated automatically for every PR. See #733 for details. |
Contributor
🛫 PR Readiness Check
PR Scope: 🔧 Infrastructure
|
| Status | Check | Details |
|---|---|---|
| ✅ | Single commit | 1 commit — clean history |
| ✅ | Not in draft | Ready for review |
| ❌ | Branch up to date | dev is 1 commit(s) ahead — rebase recommended |
| ❌ | Copilot review | No Copilot review yet — it may still be processing |
| ✅ | Changeset present | No source files changed — changeset not required |
| ✅ | Scope clean | No .squad/ or docs/proposals/ files |
| ✅ | No merge conflicts | No merge conflicts |
| ✅ | Copilot threads resolved | No Copilot review threads |
| ❌ | CI passing | 7 check(s) still running |
Files Changed (1 file, +6 −2)
| File | +/− |
|---|---|
test/docs-build.test.ts |
+6 −2 |
Total: +6 −2
This check runs automatically on every push. Fix any ❌ items and push again.
See CONTRIBUTING.md and PR Requirements for details.
Contributor
There was a problem hiding this comment.
Pull request overview
This PR adjusts the markdown fence-parity and code-block extraction logic in test/docs-build.test.ts to reduce false positives caused by matching triple backticks inside inline code/table cells.
Changes:
- Anchors the fence-count regex to line start.
- Anchors the code-block extraction regex to line start to avoid forming phantom single-line “blocks” from inline backticks.
Comment on lines
+155
to
+157
| // Anchor to line-start so inline/table backticks (e.g. documenting fence syntax) | ||
| // are not counted as real fence delimiters. | ||
| const fenceCount = (content.match(/^```/gm) || []).length; |
Comment on lines
+172
to
+174
| // Anchor both opening and closing fences to line-start so inline | ||
| // backtick usage inside table cells or prose does not form phantom blocks. | ||
| const codeBlocks = readFile(file).match(/^```[\s\S]*?^```/gm) || []; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
The fence-parity check in est/docs-build.test.ts used /\/g which matched triple-backticks anywhere in file content — including inside table cells and inline code spans that document fence syntax itself. This caused false positives on legitimate documentation.
Root cause
docs/src/content/docs/features/skill-security-scanner.md line 69 contains a Markdown table cell that shows the fence-syntax escape using four-backtick quoting:
| Inside a fenced code block (````) | Suppressed ... |`
The old regex matched 3 triple-backtick occurrences from that single table cell (the two four-backtick spans each contain a triple-backtick match, plus the standalone
` in the middle), plus 2 from the real fenced bash block at L82/L91 = 5 total (odd) → failing parity check.The second assertion (�lock.split('\n').length).toBeGreaterThan(1)) also failed as a cascade — the over-matching regex formed phantom single-line "code blocks" that failed the line-count check.
Fix
Anchor both regexes to line start with /^`/gm so only real fence delimiters (at column 0) are counted or matched:
//g→/^/gm/[\s\S]?/g→/^[\s\S]?^/gmValidation
Both failing tests now pass locally (
px vitest run test/docs-build.test.ts):
✓ Docs Structure Validation > Markdown Files > all code blocks are properly fenced (even count of)✓ Docs Structure Validation > Code Example Validation > code blocks contain language specification or valid content
`
Impact
This unblocks PRs #1316, #1317, #1234 which are all blocked on the red CI on dev. The most recent failing CI run on dev: https://github.com/bradygaster/squad/actions/runs/27525511648