Repository navigation
Backfill MS Learn doc fixes and add validation gate - #685
Conversation
Reconcile Copilot review feedback from MicrosoftDocs/windows-dev-docs-pr
PR #7161 (winapp CLI v0.5.0 docs) back into the source of truth, plus fix
the generator bug and add a hard-fail validator so these classes cannot
recur on future releases.
Source content fixes:
- ui-automation.md: convert the interactive-desktop blockquote to a
[!IMPORTANT] Learn alert
- electron/js-phi-silica.md + electron/phi-silica-addon.md: replace
marketing sample text with neutral instructional text
- electron/js-winml.md: fix the WinML sample link to the Microsoft-hosted
microsoft/electron-on-windows-gallery repo
Front-matter descriptions:
- Add compliant <!-- description: --> markers (115-145 chars, unquoted,
distinct from the title) to 18 mslearn docs that previously defaulted
their description to the page title
- Shorten 2 pre-existing over-length descriptions (README, usage)
- Remove remaining marketing wording ("powerful") from README/phi-silica
CI script fixes:
- port-mslearn-docs.ps1: normalize the guides/index.md heading boundary
so the extracted block no longer emits a stray carriage return
- port-mslearn-docs.ps1: run the new validator at Step 0.5 (fail fast)
- Add scripts/validate-mslearn-docs.ps1: hard-fail on description rules
and banned marketing words; warn on blockquote-as-callout
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Copilot-Session: e0f09fe8-7598-48bb-8ac2-bbe1cff91538
There was a problem hiding this comment.
Pull request overview
Backfills MS Learn documentation fixes and adds source validation before documentation generation.
Changes:
- Adds validation for descriptions, marketing terms, and callout syntax.
- Updates descriptions and neutralizes promotional wording.
- Fixes guide generation formatting and a WinML sample link.
Reviewed changes
Copilot reviewed 23 out of 23 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
scripts/validate-mslearn-docs.ps1 |
Adds MS Learn validation. |
scripts/port-mslearn-docs.ps1 |
Runs validation and fixes heading spacing. |
docs/usage.md |
Shortens description. |
docs/ui-automation.md |
Uses Learn alert syntax. |
docs/README.md |
Revises description and wording. |
docs/guides/tauri.md |
Adds description. |
docs/guides/shell-completion.md |
Adds description. |
docs/guides/rust.md |
Adds description. |
docs/guides/packaging-cli.md |
Adds description. |
docs/guides/flutter.md |
Adds description. |
docs/guides/electron/winml-addon.md |
Adds description. |
docs/guides/electron/setup.md |
Adds description. |
docs/guides/electron/phi-silica-addon.md |
Adds description and neutral sample text. |
docs/guides/electron/packaging.md |
Adds description. |
docs/guides/electron/js-winml.md |
Adds description and fixes sample link. |
docs/guides/electron/js-phi-silica.md |
Adds description and neutral sample text. |
docs/guides/electron/js-notification.md |
Adds description. |
docs/guides/electron/js-file-picker.md |
Adds description. |
docs/guides/electron/index.md |
Adds description. |
docs/guides/electron/cpp-notification-addon.md |
Adds description. |
docs/guides/dotnet.md |
Adds description. |
docs/guides/cpp.md |
Adds description. |
docs/debugging.md |
Adds description. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
- release.yml: stage validate-mslearn-docs.ps1 into the mslearn-source artifact so the Release_MSLearn stage can run the Step 0.5 validation (previously the sibling script was absent and the port step would fail) - validate-mslearn-docs.ps1: compute the display path with Path.GetRelativePath relative to the docs root's parent, so a custom or external -DocsRoot no longer truncates or throws Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Copilot-Session: e0f09fe8-7598-48bb-8ac2-bbe1cff91538
Build Metrics ReportBinary Sizes
Test Results✅ 3719 passed, 4 skipped out of 3723 tests in 652.2s (+36.5s vs. baseline) Test Coverage✅ 94.5% line coverage, 88.6% branch coverage · ✅ no change vs. baseline CLI Startup Time50ms median (x64, Updated 2026-07-27 14:40:03 UTC · commit |
PR Review —
|
| Dimension | Result |
|---|---|
| security | ✓ clean |
| correctness | ✓ clean |
| cli-ux | ⚠ 1 finding (1 dropped after runtime refutation) |
| alternative-solution | ⚠ 1 finding |
| necessity-simplicity | n/a (no new user-facing surface) |
| test-coverage | ⚠ 1 finding |
| docs-and-samples | ⚠ 1 finding |
| packaging | ✓ clean |
| multi-model | ✓ reviewed independently by GPT (gpt-5.6-sol) |
| regression | ✓ port flow runs end-to-end (exit 0, 22 md files) |
| validation | ✓ validator + port run at runtime; critical exit-propagation hypothesis refuted |
Findings
| ID | Location | Domain | Finding |
|---|---|---|---|
| H1 | scripts/validate-mslearn-docs.ps1:49-163 |
test-coverage | New release-gating validator has no tests |
| M1 | scripts/validate-mslearn-docs.ps1:47-122 |
alternative-solution | Duplicates Get-FrontMatter logic in port-mslearn-docs.ps1 |
| L1 | README.md:71 |
docs-and-samples | Root README still says "Many powerful Windows APIs" |
| L2 | scripts/validate-mslearn-docs.ps1:127-129 |
cli-ux | Banned-word errors omit line numbers |
H1 — scripts/validate-mslearn-docs.ps1:49-163 · high · test-coverage
The validator now hard-gates the release porting job but has no Pester tests pinning its rules or exit codes. It works today (ran it: 21 docs, 24 warnings, 0 errors, exit 0; invalid input → exit 1), but a regex regression could silently break releases with no safety net. Multi-model note: GPT pass rated test coverage clean at critical/high severity — severity disputed.
Recommendation: Add a Pester suite with fixture docs covering description bounds, banned words, YAML-special chars, non-fatal callout warnings, and 0/1 exit codes.
M1 — scripts/validate-mslearn-docs.ps1:47-122 · medium · alternative-solution
Description resolution + $YamlSpecialPattern quoting logic is a second copy of Get-FrontMatter (~L277-302 in port-mslearn-docs.ps1); the file header itself says "keep in sync." Two copies will drift.
Recommendation: Extract shared MS Learn metadata constants/helpers into a dot-sourced .ps1 both scripts import.
L1 — README.md:71 · low · docs-and-samples
This PR removed "Many powerful Windows APIs" → "Many Windows APIs" in docs/README.md but left the identical phrase in the root README.md. Root README isn't mslearn-opted so the new gate won't catch it, but it's inconsistent with the PR's marketing-word cleanup.
Recommendation: Reword the root README line to match.
L2 — scripts/validate-mslearn-docs.ps1:127-129 · low · cli-ux
Banned-word errors report file + word but not line number, slowing CI fixes.
Recommendation: Report matching line number(s), like the callout check already does.
Dropped after validation
cli-ux flagged the "Fix the reported issues before porting" message as unreachable (theory: the validator's exit 0 kills the parent host). Refuted at runtime: a child .ps1 calling exit 0 via & only sets $LASTEXITCODE; the parent continues. Independently reproduced by the GPT multi-model pass, and port-mslearn-docs.ps1 ran fully to exit 0 producing 22 md files. Porting is not skipped; the message is reachable.
Coverage notes
- security: No unsafe process launch, no ReDoS in validator regexes,
release.ymlstaging adds no 1ES injection vector, changed URL (github.com/microsoft/electron-on-windows-gallery) returns HTTP 200. - correctness: Validator logic (opt-in window, description resolution, code-fence line preservation, callout off-by-one, exit codes) sound; ran validator + port end-to-end, both exit 0.
- packaging: Both scripts stage into the same
mslearn-source/scriptsdir so$PSScriptRootresolves the validator; port passes stagedmslearn-source/docsas-DocsRoot; no version.json/csproj/npm impact. - docs-and-samples: All 21 mslearn docs satisfy the new gate (115-145 chars, no YAML-special, no banned words, distinct from title).
Zach Teutsch (zateutsch)
left a comment
There was a problem hiding this comment.
Some minor polish comments for your judgement, approving and you can address what you think is necessary.
…t nav Without a toc.yml in the winapp-cli folder, MS Learn renders no nested navigation under the winapp-cli node and pages are only reachable via Related topics. port-mslearn-docs.ps1 now emits toc.yml (overview, commands, debugging, UI Automation, and a Framework guides subtree with an Electron sub-group) from the ported output, warns on any ported page missing from the TOC, and documents the one-time parent dev-tools TOC branch entry needed in windows-dev-docs-pr. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Copilot-Session: 4dbbc822-dea6-43ec-abf8-79897a5635a1
Zach (pr-review) and Copilot review comments on PR #685: - YAML quoting (Copilot validate:54): detect leading block indicators (- / ? ) and other start/end-only indicators, not just always-special chars, so the gate can't approve a description the generator would quote. - Shared helper (Zach M1): extract description/title/topic resolution and YAML quoting into scripts/mslearn-doc-lib.ps1, dot-sourced by both the generator and the validator, removing the duplicated 'keep in sync' logic. - Callout false positive (Copilot validate:143): track whether the current contiguous blockquote opened with an alert marker instead of only checking the previous line, so multi-paragraph [!NOTE] blocks don't warn. - Banned-word line numbers (Zach L2): report offending line number(s). - Validator tests (Zach H1): add scripts/tests/validate-mslearn-docs.Tests.ps1 (Pester 5) covering description bounds, banned words, YAML-unsafe values, callout behaviour, and 0/1 exit codes; wired into build-cli.ps1. - WinML sample link (Copilot js-winml.md): stop promising a not-yet-existing gallery sample; point generically at the Electron on Windows gallery. - Root README marketing word (Zach L1): 'Many powerful Windows APIs' -> 'Many Windows APIs' to match the docs cleanup. - Stage mslearn-doc-lib.ps1 into the release mslearn-source artifact. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Copilot-Session: 4dbbc822-dea6-43ec-abf8-79897a5635a1
…erage) - Format-MsLearnYamlValue (Copilot mslearn-doc-lib.ps1:47): escape backslashes before double quotes so a quoted value such as a Windows path (C:\Windows) is not emitted as invalid double-quoted YAML. - Port test coverage (Copilot port-mslearn-docs.ps1:666): add a Pester Describe that runs port-mslearn-docs.ps1 into a temp output and asserts the toc.yml overview-first ordering, Framework guides/Electron nesting, href coverage of every ported page, no accidental quoting, and a clean guides/index.md heading boundary. Plus a backslash-escaping unit test. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Copilot-Session: 4dbbc822-dea6-43ec-abf8-79897a5635a1
…ester import) - Validator invocation (Copilot port:85): run validate-mslearn-docs.ps1 in a separate 'pwsh -NoProfile -File' process so its exit 1 can't terminate the port script before the LASTEXITCODE check and custom error run. - Title parsing (Copilot port:585): Get-PortedTitle now reuses the shared Get-MsLearnTitle helper instead of re-implementing H1 extraction. - Pester binding (Copilot build-cli.ps1:426): Import-Module the selected v5+ Pester module before calling New-PesterConfiguration/Invoke-Pester. Note: the mslearn-doc-lib.ps1 backslash-escaping comment is a false positive — in PowerShell -replace the replacement ''\\\\'' emits a literal double backslash, so C:\\Windows is correctly escaped (verified: 2 backslashes, and the Pester test asserts it). Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Copilot-Session: 4dbbc822-dea6-43ec-abf8-79897a5635a1
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 28 out of 28 changed files in this pull request and generated no new comments.
Comments suppressed due to low confidence (1)
scripts/port-mslearn-docs.ps1:84
- This pre-generation check never validates pages synthesized later by the port script. In particular,
guides/index.mdis generated with a hard-coded 114-character description at line 480, below this PR's 115-character minimum, so the validator passes while the emitted Learn page still violates the rule. Validate the generated output (including synthesized pages), or apply a shared metadata-validation helper when generating this page, and add a regression test for its front matter.
& pwsh -NoProfile -File $validator -DocsRoot $DocsRoot
What & why
The MS Learn docs at MicrosoftDocs/windows-dev-docs-pr are generated from this repo by
scripts/port-mslearn-docs.ps1. Copilot left review suggestions on the v0.5.0 docs PR (windows-dev-docs-pr#7161). Because that output is regenerated every release, editing the docs PR directly would be overwritten — so these fixes are made at the source of truth here, plus a generator fix and a new validation gate so the same issues can't recur.Source content fixes (reconciling Copilot suggestions)
ui-automation.md: interactive-desktop blockquote →[!IMPORTANT]Learn alertelectron/js-phi-silica.md+electron/phi-silica-addon.md: replaced marketing sample text ("powerful tool…") with neutral instructional textelectron/js-winml.md: fixed the WinML sample link to the Microsoft-hostedmicrosoft/electron-on-windows-galleryFront-matter descriptions
<!-- description: -->markers (115–145 chars, unquoted, distinct from the H1) to 18 mslearn docs that previously defaulted their description to the page titleREADME,usage)CI / generator fixes
port-mslearn-docs.ps1: normalized theguides/index.mdheading boundary so the extracted block no longer emits a stray carriage returnport-mslearn-docs.ps1: runs the new validator at Step 0.5 (fail fast; the releaseRelease_MSLearnstage enforces it for free)scripts/validate-mslearn-docs.ps1: hard-fails on description rules + banned marketing words; warns (non-fatal) on blockquote-as-calloutVerification
ms.date) shows only the 9 intended fixes, no regressionsFollow-up
Regenerated docs are staged on the local
winapp-cli/v0.5.0branch to update PR #7161. Merge this once the next Copilot review on that branch is clean.Update: left-nav TOC (
toc.yml)The winapp CLI node on MS Learn had no nested left-nav — pages were only reachable via Related topics — because the
winapp-clifolder had notoc.ymland the parenthub/apps/toc.ymlnode pointed straight atindex.md.port-mslearn-docs.ps1now generatestoc.yml(Step 7) from the ported output: overview, commands, debugging, UI Automation, and a Framework guides subtree with a nested Electron group. It warns if any ported page is missing from the tree.Rollout (the child TOC alone isn't enough — the parent docs-repo TOC must branch into it): docs PR windows-dev-docs-pr#7187 adds the generated
dev-tools/winapp-cli/toc.ymland points both parenthub/apps/toc.ymlwinapp CLIentries at it (also fixes thewinappCLI→winapp CLIlabel). That PR is nav-only — noms.datechurn, tracks released v0.5.0.Update: review feedback addressed
Addresses the Copilot and pr-review (Zach) comments on this PR:
validate:54) — detect leading block indicators (-/?) and start/end-only indicators, not just always-special chars.scripts/mslearn-doc-lib.ps1, dot-sourced by both the generator and the validator (removes the duplicated "keep in sync" logic).validate:143) — track whether the contiguous blockquote opened with an alert marker, so multi-paragraph[!NOTE]blocks no longer warn.scripts/tests/validate-mslearn-docs.Tests.ps1(Pester 5, 23 tests) covering description bounds, banned words, YAML-unsafe values, callout behaviour, and 0/1 exit codes; wired intobuild-cli.ps1.js-winml.md) — no longer promises a not-yet-existing gallery sample; points generically at the Electron on Windows gallery.mslearn-doc-lib.ps1staged into the releasemslearn-sourceartifact.