Repository navigation
Commit f667c1d
fix(scripts): parse a
Fixes #10943
Clause-②: no — a docs-census strength change on repository tooling; no
published contract, accept set or public surface changes (a contract
review is still owed for the README fence retag)
## What changes
This executes ruling **A** on objectui#10943: the maintainer's 「同意」 on
2026-09-28, recorded in the card's ruling comment `5869344478`. The
existing carriage census `scripts/check-doc-expression-carriage.mjs` now
holds `json` and `jsonc` fences to different contracts:
- **`json`**: parsed by `parseJsonFence`, imported from
`scripts/check-skill-examples.mjs` and not copied. That function is
`JSON.parse` and nothing else. No tolerance, no object-body retry and no
multi-document split applies.
- **`jsonc`**: unchanged. It keeps the four tolerances (comments, raw
newlines in strings, trailing commas, elisions) and the object-body
retry. The fences the blind-spot measurement reads (the languages the
census does not judge) stay on that same tolerant path.
- **Unparsed entries**: each one now carries the file, the fence's
opening line, its language and the parse error. The CLI prints the two
kinds apart. For `json` it prints the ruled remedy, 「retag as `jsonc` if
the example needs comments or trailing commas」. For `jsonc` it keeps the
old `sanitizeFence` remedy (H3). The CLI and the pin both print this
text from `UNPARSED_PRESCRIPTIONS`, so the two cannot drift apart.
- **Posture**: the CLI still exits 0 on anything it reads in a page.
What goes red is the EXISTING pin, 'has no blind spot on the corpus it
ships against'. It still asserts `census.unparsed` is empty, and a
non-JSON `json` fence now lands on that list. This adds no new script,
workflow, test file or gate. The ruling's non-generalisation also holds:
the `jsonc` tolerance list is not widened, and no other fence language
gains a parse check.
- **Header docblock** (H4): the parse-surface section no longer says the
tolerances apply to `json`. A new section records the ruling, the
posture above and the import mechanics. The exit-code line also names a
missing contract as an instrument failure.
### Why the import is a guarded dynamic `import()`, not a static one
This was measured, not assumed. `check-skill-examples.mjs` imports
`typescript` and `check-doc-snippet-types.mjs` at load. With a static
import, the orphan pin ('is LOUD when the instrument itself is broken')
runs the gate with no install. The gate then dies at module link with
`ERR_MODULE_NOT_FOUND` for `typescript`, and the probe counted 0
occurrences of the asserted 'A failure, not a skip' line.
So the census loads the module with one `const` declaration holding an
`import()` whose rejection settles into an `error` field. A top-level
`try` is refused by `check:entry-guard` as a statement that runs on
import. `requireJsonContract()` raises the held error inside the CLI's
existing instrument check. A one-off probe (renderer and installed spec
present, `check-skill-examples.mjs` absent) exits 1 with that line.
Cost: the census now loads `typescript` at start. Measured start times
were about 0.2 s for the census `--self-test` and about 0.45 to 0.53 s
to import `check-skill-examples.mjs`.
### The surface under strict `json`, measured before any change (H2)
- **Population**: the census's own `scanFences` over its whole surface.
That surface is imported from `check:doc-types` and printed as
`content/docs, apps/*/docs, packages/*/README.md and README.md`, so it
is not `content/docs` alone.
- **Verdict**: `parseJsonFence(body, 'json')`.
- **Controls in the same run**: a valid body was accepted, a trailing
comma was rejected, and a comment was rejected.
- **Result**: exactly one `json` fence failed. It is the VS Code
settings example under 「⚙️ Configuration」 in
`packages/vscode-extension/README.md`, which uses `//` comments because
VS Code settings files are JSONC. The README's other `json` fence (the
「Example Schema」 one) already parses strictly. No fence was simply
broken, so there is no docs bug to report.
- **Re-derive**: `node scripts/check-doc-expression-carriage.mjs` on
this branch prints the per-language row and names any unparsed fence.
### The retag in `packages/vscode-extension/README.md` (for the contract
review)
This is a published-docs prose change, and it is the smallest one
available. One info string changes from `json` to `jsonc` on the
Configuration fence, and the body bytes are unchanged. `git diff` over
the file shows 1 line out and 1 line in. The site page
`content/docs/utilities/vscode-extension.mdx` already tags its settings
example `jsonc`, so the README now agrees with it. The other gates that
read that fence's tag are green: `check:doc-fences` and
`check:doc-types` (see Evidence).
### `CONTRIBUTING.md`: one sentence this change made false
Its `json`-fence convention paragraph said 「Nothing enforces it for
`content/docs` today」 and called whether a gate should block such a
fence 「the open decision objectui#10943」. After this change, both
statements are wrong. The sentence now names the census, the pin and the
fact that the tolerances apply to `jsonc` only. json doc fence strictly with parseJsonFence (objectui#10943) (#10985)1 parent a097316 commit f667c1d
4 files changed
Lines changed: 308 additions & 29 deletions
File tree
- packages/vscode-extension
- scripts
- __tests__
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
427 | 427 | | |
428 | 428 | | |
429 | 429 | | |
430 | | - | |
| 430 | + | |
431 | 431 | | |
432 | 432 | | |
433 | 433 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
122 | 122 | | |
123 | 123 | | |
124 | 124 | | |
125 | | - | |
| 125 | + | |
126 | 126 | | |
127 | 127 | | |
128 | 128 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
21 | 21 | | |
22 | 22 | | |
23 | 23 | | |
| 24 | + | |
24 | 25 | | |
25 | 26 | | |
26 | 27 | | |
27 | 28 | | |
28 | 29 | | |
29 | 30 | | |
| 31 | + | |
| 32 | + | |
30 | 33 | | |
31 | 34 | | |
32 | 35 | | |
| |||
35 | 38 | | |
36 | 39 | | |
37 | 40 | | |
| 41 | + | |
38 | 42 | | |
39 | 43 | | |
40 | 44 | | |
| |||
194 | 198 | | |
195 | 199 | | |
196 | 200 | | |
197 | | - | |
| 201 | + | |
| 202 | + | |
| 203 | + | |
198 | 204 | | |
199 | 205 | | |
200 | 206 | | |
| |||
290 | 296 | | |
291 | 297 | | |
292 | 298 | | |
| 299 | + | |
| 300 | + | |
| 301 | + | |
| 302 | + | |
| 303 | + | |
| 304 | + | |
| 305 | + | |
| 306 | + | |
| 307 | + | |
| 308 | + | |
| 309 | + | |
| 310 | + | |
| 311 | + | |
| 312 | + | |
| 313 | + | |
| 314 | + | |
| 315 | + | |
| 316 | + | |
| 317 | + | |
| 318 | + | |
| 319 | + | |
| 320 | + | |
| 321 | + | |
| 322 | + | |
| 323 | + | |
| 324 | + | |
| 325 | + | |
| 326 | + | |
| 327 | + | |
| 328 | + | |
| 329 | + | |
| 330 | + | |
| 331 | + | |
| 332 | + | |
| 333 | + | |
| 334 | + | |
| 335 | + | |
| 336 | + | |
| 337 | + | |
| 338 | + | |
| 339 | + | |
| 340 | + | |
| 341 | + | |
| 342 | + | |
| 343 | + | |
| 344 | + | |
| 345 | + | |
| 346 | + | |
| 347 | + | |
| 348 | + | |
| 349 | + | |
| 350 | + | |
| 351 | + | |
| 352 | + | |
| 353 | + | |
| 354 | + | |
| 355 | + | |
| 356 | + | |
| 357 | + | |
| 358 | + | |
| 359 | + | |
| 360 | + | |
| 361 | + | |
| 362 | + | |
| 363 | + | |
| 364 | + | |
| 365 | + | |
| 366 | + | |
| 367 | + | |
| 368 | + | |
| 369 | + | |
| 370 | + | |
| 371 | + | |
| 372 | + | |
| 373 | + | |
| 374 | + | |
| 375 | + | |
| 376 | + | |
| 377 | + | |
| 378 | + | |
| 379 | + | |
| 380 | + | |
| 381 | + | |
| 382 | + | |
| 383 | + | |
| 384 | + | |
| 385 | + | |
| 386 | + | |
| 387 | + | |
| 388 | + | |
| 389 | + | |
| 390 | + | |
| 391 | + | |
| 392 | + | |
| 393 | + | |
| 394 | + | |
| 395 | + | |
| 396 | + | |
| 397 | + | |
| 398 | + | |
| 399 | + | |
| 400 | + | |
| 401 | + | |
| 402 | + | |
| 403 | + | |
| 404 | + | |
| 405 | + | |
| 406 | + | |
| 407 | + | |
| 408 | + | |
| 409 | + | |
293 | 410 | | |
294 | 411 | | |
295 | 412 | | |
| |||
520 | 637 | | |
521 | 638 | | |
522 | 639 | | |
| 640 | + | |
| 641 | + | |
| 642 | + | |
| 643 | + | |
| 644 | + | |
| 645 | + | |
| 646 | + | |
523 | 647 | | |
524 | 648 | | |
525 | | - | |
526 | | - | |
527 | | - | |
528 | | - | |
529 | | - | |
530 | | - | |
| 649 | + | |
| 650 | + | |
| 651 | + | |
| 652 | + | |
| 653 | + | |
| 654 | + | |
| 655 | + | |
| 656 | + | |
531 | 657 | | |
532 | 658 | | |
533 | 659 | | |
| |||
693 | 819 | | |
694 | 820 | | |
695 | 821 | | |
696 | | - | |
| 822 | + | |
| 823 | + | |
| 824 | + | |
697 | 825 | | |
698 | 826 | | |
699 | 827 | | |
| |||
0 commit comments