Validate the examples that follow an unvalidated language fence - #2580
Conversation
There was a problem hiding this comment.
🟢 Approval recommended
The focused extraction fix has no unresolved review issues.
Pull request overview
Updates documentation extraction so unsupported-language fences correctly consume pending validation skips.
Changes:
- Tracks unvalidated fenced code blocks.
- Prevents pending skips from affecting later validated examples.
File summaries
| File | Description |
|---|---|
scripts/docs-validation/extract.ts |
Prevents validation skips from leaking past unsupported-language fences. |
Review details
- Files reviewed: 1/1 changed files
- Comments generated: 0
- Review effort level: Balanced
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
SteveSandersonMS
left a comment
There was a problem hiding this comment.
Manually reproduced the bug this fixes: reverted extract.ts to main and re-ran the extraction/validation pipeline — the pending-skip directive leaked past unvalidated fences (e.g. rust), silently dropping examples from type-checking (confirmed against the plugin-directories.md example added in #2581, which depends on this fix). The tracked-fence fix is minimal and correctly scoped. Approving.
db62ae3 to
822febb
Compare
SteveSandersonMS
left a comment
There was a problem hiding this comment.
Confirmed the fix: reproduced the skip-leak bug by diffing extraction output on main vs. this branch (typescript 189→191, csharp 56→57, matching the PR body), and ran real validation (validate:ts: 191/191 pass, validate:cs: 57/57 pass) to confirm the newly-included examples actually type-check. Minimal, single-file fix that reuses the existing hidden-block-skip-reset pattern. Rebased onto latest main to pick up the unrelated SourceLink vulnerability fix (#2587) that was blocking the C# check.
Closing a docs-validate hidden block sets a pending skip so the visible copy is not validated twice. A fence whose language has no validator, such as rust, was never recognized as a code block, so it never consumed that skip and the next validated block absorbed it instead. Signed-off-by: 1fanwang <1fannnw@gmail.com>
822febb to
be66936
Compare
Why
A maintainer who wraps an example in
<!-- docs-validate: hidden -->is asking for that example to be type-checked. For three examples in this repository, it silently was not, and nothing reported a problem. The most visible one is the trusted host-bundled block in the plugin directories guide, which carries those markers for exactly that reason.Closing a hidden block sets a pending skip so the visible copy that follows is not validated twice. A fence whose language has no validator,
rustamong them, was never recognized as a code block at all, so it never consumed that pending skip. The flag survived and the next validated block absorbed it instead.Rust examples appear in nine feature guides, usually as the last language tab before the next section, so any example following one is exposed. Before this change those three blocks were extracted and discarded. After it they are checked like every other example, and a broken one would fail the build.
What changed
Fences in languages that have no validator are now tracked and consume a pending skip when they close, so the directive can no longer reach past its intended target.
Testing Done
Three previously discarded examples are now extracted and validated:
The two TypeScript ones pass locally. The C# one needs a .NET toolchain I do not have, so CI covers it.
Raw logs: extraction before and after