Repository navigation
[markdown] Add tool/update_spec_tests.dart and sync GFM 0.29.0.gfm.13 spec stats - #2666
Conversation
… spec stats
- Add `tool/update_spec_tests.dart` and `parseSpecExamples` in `tool/stats_lib.dart` to fetch the latest released `commonmark/commonmark-spec` (`0.31.2`) and `github/cmark-gfm` (`0.29.0.gfm.13`) `spec.txt` files directly from GitHub, regenerate `tool/*_tests.json`, and run `tool/stats.dart --update-files`.
- Fix `tool/stats.dart` so `--flavor gfm` is not overwritten when `--update-files` is omitted.
- Move custom non-spec extension cases out of generated `test/gfm/strikethrough_extension.unit` and `test/gfm/disallowed_raw_html_extension.unit` into `test/extensions/strikethrough.unit` and `test/extensions/disallowed_raw_html.unit`.
- Add `test/stats_test.dart` to verify `parseSpecExamples` and ensure `test/{common_mark,gfm}/*.unit` and `tool/*_stats.json` stay in sync with `tool/*_tests.json`.
PR Health
Coverage
|
| File | Coverage |
|---|---|
| pkgs/markdown/tool/stats.dart | 💔 Not covered |
| pkgs/markdown/tool/stats_lib.dart | 💔 Not covered |
| pkgs/markdown/tool/update_shared.dart | 💔 Not covered |
| pkgs/markdown/tool/update_spec_tests.dart | 💔 Not covered |
This check for test coverage is informational (issues shown here will not fail the PR).
This check can be disabled by tagging the PR with skip-coverage-check.
License Headers ✔️
// Copyright (c) 2026, the Dart project authors. Please see the AUTHORS file
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.
| Files |
|---|
| no missing headers |
All source files should start with a license header.
Unrelated files missing license headers
| Files |
|---|
| pkgs/html/test/differential_test.dart |
| pkgs/html/test/dom_parsing_test.dart |
| pkgs/html/test/mxss_test.dart |
| pkgs/html/test/noah_ark_clause_limit_test.dart |
This check can be disabled by tagging the PR with skip-license-check.
Breaking changes ✔️
| Package | Change | Current Version | New Version | Needed Version | Looking good? |
|---|---|---|---|---|---|
| markdown | Non-Breaking | 7.3.1 | 7.4.1-wip | 7.4.1-wip | ✔️ |
This check can be disabled by tagging the PR with skip-breaking-check.
Unused Dependencies ✔️
| Package | Status |
|---|---|
| markdown | ✔️ All dependencies utilized correctly. |
For details on how to fix these, see dependency_validator.
This check can be disabled by tagging the PR with skip-unused-dependencies-check.
API leaks ✔️
The following packages contain symbols visible in the public API, but not exported by the library. Export these symbols or remove them from your publicly visible API.
| Package | Leaked API symbol | Leaking sources |
|---|
This check can be disabled by tagging the PR with skip-leaking-check.
There was a problem hiding this comment.
Code Review
This pull request automates the retrieval and updating of CommonMark and GitHub Flavored Markdown (GFM) spec tests by introducing an automated update script, adding synchronization tests, and updating documentation. The code review feedback highlights several critical areas for improvement to ensure robustness: adding a required User-Agent header to GitHub API requests to prevent 403 errors, implementing defensive checks against malformed spec files to avoid cryptic range errors, safely handling potential null values from API responses, and refining test parsing logic to prevent type errors and incorrect string slicing.
- Extract `_findExampleBounds` in `tool/stats_lib.dart` to throw a descriptive `FormatException` when an example is missing its `.` separator or closing fence. - Type `statsLevelByHeader` as `Map<String, String?>` and guard `colonIndex == -1` in `test/stats_test.dart`.
srawlins
left a comment
There was a problem hiding this comment.
Looks good, thanks for the update!
Roll `tools_rev` to c1471db9c0fead64394eab4834d0fb640403b42a and replace `dartdev`'s duplicate `_isRunningOnBot` implementation with `Analytics.isBot` from `package:unified_analytics`, which ignores falsy `CI` and `BOT` environment values (`false`, `0`, empty). Rolling `package:unified_analytics` also defaults `Analytics.agent` to `AiAgent.detectAgentName(Platform.environment)` for SDK tools such as `analysis_server` and `dtd` when `agent` is omitted, and tightens `AiAgent.cursor` detection. tools (https://github.com/dart-lang/tools/compare/350bde5..c1471db): c1471db9 Fri Oct 16 09:35:21 2026 -0700 Kevin Moore [unified_analytics] Fix Cursor agent check, default agent & add isBot (dart-lang/tools#2687) 2d0d09a1 Fri Oct 16 15:37:59 2026 +0000 Phil Quitslund [unified_analytics] Prepare for 8.1.0 release (dart-lang/tools#2684) 7ea42bf6 Thu Oct 15 11:13:58 2026 -0700 Kallen Tu Add Event.migrateEvent for the dart migrate tool. (dart-lang/tools#2682) 4eaf46ba Wed Oct 14 18:18:45 2026 +0000 Kevin Moore [markdown] Fix LinkParser edge cases and BlockParser retreat loop (dart-lang/tools#2631) 03f7124a Wed Oct 14 11:15:00 2026 -0700 Kevin Moore [markdown] Add tool/update_spec_tests.dart and sync GFM 0.29.0.gfm.13 spec stats (dart-lang/tools#2666) e0c90075 Tue Oct 13 16:16:23 2026 -0700 Morgan :) [code_builder] publish 4.13.0 (dart-lang/tools#2663) Fixes #64594 Fixes #64591 TEST=pkg/dartdev/test/analytics_test.dart Change-Id: I71026772917d60df2ef144cc5527be9002f087f6 Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/565421 Commit-Queue: Kevin Moore <[email protected]> Reviewed-by: Keerti Parthasarathy <[email protected]>
Replace the manual Python spec-dump workflow with
tool/update_spec_tests.dart, sync GFM spec tests to0.29.0.gfm.13(andFenced code blocksstats), and move custom extension test cases totest/extensions/sodart tool/stats.dart --update-filesis idempotent and enforced intest/stats_test.dart.