Skip to content

Count inline <CodeSnippet> code in the Snipsync coverage report - #5808

Merged
Duncanma merged 2 commits into
mainfrom
duncan/snipsync-coverage-codesnippet
Nov 24, 2026
Merged

Duncanma merged 2 commits into
mainfrom
duncan/snipsync-coverage-codesnippet

Conversation

@Duncanma

@Duncanma Duncanma commented Nov 24, 2026 •

Copy link
Copy Markdown
Contributor

Part of #5105.

What this changes

Quickstart pages show code with the <CodeSnippet> component (src/components/Quickstart/SetupSteps). yarn report:snipsync-coverage only read fenced blocks. Code written into the element as a template literal ({`...`}) or plain text was never counted. So if a quickstart moved off Snipsync and back to inline code, the numbers didn't change.

bin/code-blocks.js now also reads <CodeSnippet> elements:

  • Code written into the element counts as a hand-written block in the element's language. The block has component: 'CodeSnippet'.
  • A <CodeSnippet> whose children are a Snipsync block is left to the fence parser, so it still counts as synced.
  • A <CodeSnippet> inside a fenced block or a comment is ignored, as fenced code there already is.

readme/UTILITIES.md and the report's PR-comment footnote describe the change.

Effect on the numbers (main at 90db179)

Before After
SDK languages 61.9% (25,768 of 41,608) 61.8% (25,768 of 41,692)
All languages 53.4% (26,635 of 49,922) 52.9% (26,635 of 50,360)
develop/go 98.2% (80 inline) 96.3% (164 inline)

The 84 new SDK lines are the three Go files written inline on the Go Standalone Activities quickstart. They're the only SDK-language <CodeSnippet> elements on main. #5803 moves them to Snipsync. Measured with this change, that PR takes develop/go from 96.3% to 98.3%, where before it showed only +0.1 points.

The all-languages total gains 438 lines from 168 elements: 157 bash, 4 xml, 2 toml, 1 json, 1 groovy, and the 3 go.

Testing

  • node --test bin/*.test.js: 435 pass, including 6 new cases covering multi-line and one-line children, indentation and escapes, Snipsync children, and elements inside a fence or a comment.
  • I extracted every <CodeSnippet> in docs/. The parser found all 168 elements with a language, none came out empty, and each reported line number matches the first line of code. The extracted XML on docs/develop/php/set-up.mdx keeps its indentation.

Quickstart pages show code with the <CodeSnippet> component. Code written
into the element as a template literal or plain text wasn't counted, so a
quickstart that moved off Snipsync back to inline code left the numbers
unchanged. Count it as hand-written code in the element's language. A
<CodeSnippet> whose children are a Snipsync block is still read by the
fence parser and counts as synced.
@Duncanma
Duncanma requested a review from a team as a code owner November 24, 2026 17:20
Copilot AI balanced review requested due to automatic review settings November 24, 2026 17:20
@vercel

vercel Bot commented Nov 24, 2026 •

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated
temporal-documentation Ready Ready Preview Nov 24, 2026 8:20pm UTC

Request Review

@github-actions

Copy link
Copy Markdown
Contributor

📖 Docs PR preview links

This PR does not change any pages in /docs. If you make updates, links to the modified pages will appear here.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🟢 Approval recommended

No active review issues are recorded for the inline CodeSnippet coverage changes.

No open issues 🎉

What changed in this PR

Extends Snipsync coverage reporting to count inline Quickstart <CodeSnippet> code, making migrations to and from synced samples visible in coverage totals. Supports #5105 and makes the impact of #5803 measurable.

Changes:

  • Counts inline <CodeSnippet> children as hand-written code while preserving synced fence handling.
  • Adds six tests for extraction, exclusions, and coverage totals.
  • Updates utility documentation and the report’s PR-comment footnote.
File Description
readme/​UTILITIES.md Explains how inline and synced <CodeSnippet> content affects coverage.
bin/​report-snipsync-coverage.test.js Adds extraction and coverage tests for <CodeSnippet> elements.
bin/​report-snipsync-coverage.js Updates report comments and the generated coverage footnote.
bin/​code-blocks.js Extracts inline <CodeSnippet> code and records component metadata.

Review effort: Balanced

@Duncanma
Duncanma enabled auto-merge (squash) November 24, 2026 18:44
@Duncanma
Duncanma merged commit 8058589 into main Nov 24, 2026
12 checks passed
@Duncanma
Duncanma deleted the duncan/snipsync-coverage-codesnippet branch November 24, 2026 20:20

This branch was successfully deployed

1 active deployment
Preview — 03e7abaa Deployed Nov 24, 2026 by vercel[bot]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants