docs(react): shrink UNGATED_DOCS by one — the react README's 11 blocks compile (#5174 batch 12) - #7910
Merged
Merged
Conversation
…s compile (#5174 batch 12) `packages/react/README.md` leaves the `check-doc-snippet-types` coverage ledger. All 11 of its `ts`/`tsx` snippets are now compiled, `--strict`, against the packages' built `dist/*.d.ts`: zero `FRAGMENT_MARKER` declarations added, zero `UNGATED_DOCS` entries added, so the ledger hunk is 0 additions / 2 deletions. Seven blocks failed before this change and each is repaired at the document, never by weakening the gate: * `useSchemaContext` taught an API that does not exist. It destructured `data` and `updateData`; the shipped `SchemaRendererContextType` declares `dataSource`, `debug`, `debugFlags` and `apiFetch` and neither of those two names. The example now reads what the context carries and points record data at `useDataScope`, which is the hook that answers it. * The `NON_GRID_ROW_CEILING` block did not parse. Its destructuring statement ended without a semicolon and the next statement opens with `<`, so ASI does not fire and the call is parsed as the left side of a relational expression — a reader who copied the block hit the same five syntax errors the gate did. * The remaining five carried ambient names the page never defined. Those are now `declare const` against the shipped types, following the pattern `packages/data-objectstack/README.md` already uses. Two claims the prose only asserted are now enforced by the compiler: `OBJECT_GRID_BINDING` is annotated `ElementDataSourceMapping`, so a key the block does not read is rejected rather than accepted and dropped, and `notify()`'s severity and displayType literals are checked against the spec unions. Gate strictness is unchanged: the file is touched only inside the `UNGATED_DOCS` object literal, and everything from the `Fence scanning` banner to EOF is byte-identical to `origin/main`. Part of #5174 Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_013uAaxiwgYDybsTNV9xwa1M
…ated-docs-batch12
This was referenced Sep 6, 2026
Contributor
✅ Console Performance Budget
The eager closure is every chunk the entry reaches through static imports — what the browser fetches and parses before the app renders. The entry chunk on its own is a small fraction of it. 📦 Bundle Size Report
Size Limits
|
This was referenced Sep 6, 2026
baozhoutao
marked this pull request as ready for review
September 6, 2026 02:57
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Part of #5174 — batch 12 of the
check-doc-snippet-typesungated-docs ledger burn-down. The card stays open; 25 entries remain after this.packages/react/README.mdleavesUNGATED_DOCSand all 11 of itsts/tsxsnippets now compile,--strict, against the packages' builtdist/*.d.ts. ZeroFRAGMENT_MARKERdeclarations added, zeroUNGATED_DOCSentries added — the ledger hunk isgit diff --numstat0 2, removals only.Ledger and coverage, measured
Both gates —
origin/main's copy and this branch's — were imported side by side and evaluated over the same working tree, so the covered-set delta is attributable to the ledger alone and not to a moving tree.UNGATED_DOCSentriesdeclared fragmentsunmoved means every one of the 11 newly covered blocks earned it by compiling; not one was excused with a marker.Programmatic invariants, printed rather than eyeballed:
Gate strictness is unchanged and proved byte for byte: everything from the
Fence scanningbanner to EOF is identical onorigin/mainand on this branch — 1117 lines, sha25691450911e867d61a6f6945d4ea649c894097252d664c792ea69388f230488d59on both. The gate file is touched only inside theUNGATED_DOCSobject literal.Gate verdict at the final commit
c97bd02cb, exit 0:What was wrong, and what the repairs are
Seven of the 11 blocks failed. Each is repaired at the document, following the shipped types — no type minted, no export added, no block weakened.
1.
useSchemaContexttaught an API that does not exist. The example destructureddataandupdateData. The shippedSchemaRendererContextTypedeclaresdataSource,debug,debugFlagsandapiFetch, and neither of those two names (packages/react/dist/context/SchemaRendererContext.d.ts). That is theTS2339x2half of the ledger entry's own reason, and it reproduces exactly. The example now reads what the context actually carries, and record data is pointed atuseDataScope, which is the hook that answers it. The prose above it changed with the code.2. The
NON_GRID_ROW_CEILINGblock did not parse — and a reader copying it hit the same error. Its destructuring statement ended without a semicolon and the next statement opens with<, so ASI does not fire andapplyNonGridRowCeiling(result)is parsed as the left side of a relational expression: five syntax errors,TS1005x3 andTS1109x2. One semicolon fixes it, with a comment saying why it is load-bearing.3. The remaining five carried ambient names the page never defined. Those are now
declare constagainst the shipped types, following the patternpackages/data-objectstack/README.mdalready uses (DataSourceandQueryParamsfrom@object-ui/types,ApiFetchfrom@object-ui/react), plus the two implicitly-anyparameter lists given real annotations.Two claims the prose only asserted are now enforced by the compiler:
OBJECT_GRID_BINDINGis annotatedElementDataSourceMapping. The paragraph beneath it says a mapping "names ONLY the keys this block reads … a composed value written onto a key the block ignores would be accepted and silently dropped — the defect the binding exists to remove." That is now a compile error rather than a sentence (probe P2).notify()'sseverityanddisplayTypeliterals are checked against the spec unions (probe P1).The ledger entry's reason text was STALE — reported, not reproduced
The entry read
9 undefined-name diagnostic(s) …; plus TS2339x2 — candidate real defects, un-triaged. What actually reproduced at the branch point was 8 undefined-name plus 4 implicit-any, and — the part the reason does not mention at all — 1 parse failure with 5 diagnostics, in theNON_GRID_ROW_CEILINGblock that objectui#7210 added after the reason was written. TheTS2339x2half reproduced exactly. A ledger reason is a snapshot of a document that keeps moving; this one had drifted, and the drift is recorded here rather than copied forward.The labelled-block-statement trap: the negative, stated
Checked per block. Absent from this document, in the strong form: not one of the 11 blocks is a brace-wrapped object literal at all — every block opens with an
importstatement or aconstdestructuring. The trap needs a single-key brace-wrapped literal to parse as a labelled block statement and stay green under any spelling; there was no candidate here, single-key or multi-key. So no block in this document was green-under-any-spelling before this change.Non-vacuity: six planted probes, direction predicted IN WRITING before each run
Predictions were written to a file before the first probe ran. No build artifact sits between a mutation and the thing under test — every mutation edits markdown the gate reads straight from disk, and the
dist/it compiles against is untouched — so no rebuild was needed on either leg, and that is stated rather than assumed. Each leg proved the mutation reached disk (git hash-objectdiffering from theHEADblob, with an equal hash treated as "this probe did not run" and aborting) and each restore was proved by an emptygit diff HEADplus a blob hash equal to theHEADblob, never inferred from an exit code. Every probe was run twice — once atf81d879f4and again at the merged headc97bd02cb— with identical diagnostics.severity: 'success'to'successs'TS2820: Type '"successs"' is not assignable to type 'NotificationSeverityLevel'. Did you mean '"success"'?columns:tocolumnss:TS2561: Object literal may only specify known properties, but 'columnss' does not exist in type 'ElementDataSourceMapping'. Did you mean to write 'columns'?const { data, updateData } = useSchemaContext()TS2339x2 — the exact pair the ledger reason recordedSyntax phase: 1 block(s) failed to parse and were NOT semantically checked,TS1005x3 +TS1109x2dataSource={adapter}to a string literalschema={formSchema}toschema={123}TS2322: Type 'number' is not assignable to type 'string | BaseSchema | null | undefined'Two honest notes on the table. P2's exact code was predicted as
TS2353and observed asTS2561; the direction predicted was RED and the observed diagnostic is the same fact with a spelling suggestion attached. P4's textual before/after counting is degenerate because the post-mutation text is a prefix of the pre-mutation text — the discriminators there are the differing blob hash and the syntax-phase line flipping from "every block parsed" to "1 block(s) failed to parse".The bound of the green, published rather than left to be found
P5 was predicted GREEN in writing and observed GREEN.
SchemaRendererProviderdeclaresdataSource: anyin the shipped types, so theSchemaRendererProviderblock cannot check what the host injects: replacing the adapter with a bare string raises nothing. That is a real limit of this document's new coverage and it is stated here rather than hidden behind the exit code. It is the same class as objectui#7483 (a props parameter typed bareanymakes a wrong prop raise nothing), on a different consumer.P2 and P6 bound it from the other side: a type without an index signature does catch a wrong key (
ElementDataSourceMapping), and a declared member's value type is checked even where the surrounding type is open (SchemaRendererProps.schemarefusesnumber, which its own docblock says is excluded deliberately).Gates run locally, each quoting its own printed verdict
All at
c97bd02cb, exit codes captured by redirect before any pipe, never read after one.git status --porcelainempty at measurement time and after all twelve probe runs.pnpm check:doc-snippetsEvery covered documentation snippet compiles against the built types.pnpm check:doc-fencesevery TypeScript block in 227 document(s) is fenced ts/tsx/typescript, except 80 declared file(s) carrying 89 block(s)pnpm check:doc-typesEvery documented component type is registered.node scripts/check-doc-links.mjsLinks are valid across 17 scan roots.pnpm check:control-bytesOK (scanned 6396 tracked text file(s); skipped 85 binary)pnpm check:readme-exports426 of them self-imports judged (426 real, 0 wrong-path, 0 fabricated)pnpm type-check:scriptstsc -p tsconfig.scripts.json, no output)node scripts/check-changeset-presence.mjsNo source or published contract of a released package changed in this range, so no changeset is owed.pnpm run lint:root33 problems (0 errors, 33 warnings)— all pre-existingnode scripts/check-governed-queue-guard.mjs --testNOT GOVERNED — 3 path(s) checked against 5 governed surface(s); none matched.A manual
grep -naPover the C0 control-byte set on both changed files returned no hits, on top of the gate.lint:rootis not a narrowing, three pieces: the population read from eslint's own--format jsonis 252 files of which 0 are.md/.mdx(so the edited README is outside lint's population entirely); the one changed file inside that population,scripts/check-doc-snippet-types.mjs, reportserrorCount 0 warningCount 0; andeslint.config.jssets noproject/projectService/tsconfigRootDir, so type-aware linting is off and this diff cannot move the verdict on a file it does not touch.Vitest, from the repo root,
--maxWorkers=2, exit 0:Test Files 13 passed (13)/Tests 545 passed (545). The suite set was derived bygit grep -lfor the gate's name and for the edited document, and includesscripts/__tests__/check-doc-snippet-types.test.ts— the edited script's own suite, which is owed separately from the doc-gate family. The derived set was identical before and after the merge below.No changeset — and why, since the dispatch assumed otherwise
scripts/check-changeset-presence.mjs, which AGENTS.md names as the authority, exits 0 with2 file(s) changed, 0 of them published source of a package the release covers … no changeset is owed: apackages/*/README.mdships inside the package but*.mdis subtracted from thefilesjudgement, andscripts/publishes nothing. Batches 10 and 11 landed the same shape with no changeset (c4f541df9,c39c825d3— two files each). An empty-frontmatter changeset was written, measured against the gate, and then removed so this PR matches its own precedent and the gate's verdict.Scope guard
origin/mainmoved to84ce0b80dmid-run and was merged, never rebased. It touched four documents in the gate's scan surface (the objectui#7900 guide pages) but no non-test package source, so the builtdist/did not move; every figure above, all six probes included, was nonetheless re-taken after the merge atc97bd02cb, and thedist/index.d.tsof all 26 build-filter packages was confirmed present on disk in this worktree before any gate result was trusted.Untouched, deliberately:
packages/plugin-gantt/README.mdandpackages/plugin-kanban/README.md(#7302 /PARTIAL_EXCERPTS),packages/plugin-dashboard/README.md(its four untyped example blocks are #7035's), andcontent/docs/guide/architecture.md/layout.md/schema-rendering.md(PR #7900's, and not ledger entries).Filed, not fixed here
Two findings were filed unassigned rather than ridden along on a ledger batch:
SchemaRendererProvider'sdataSourceprop andSchemaRendererContextTypeare typedany, which is what probe P5 above measures. Same class as finding(app-shell):ObjectView's entire props surface is typedany— a misspelled prop on a public route-level view raises nothing #7483, on the injection point for the whole renderer tree. Narrowing it to the publishedDataSourceis a public-contract change with its own blast radius.packages/plugin-markdown/src/toc-anchor-parity.test.tsx:136names its case by the line addresspackages/react/README.md:224; this diff moves that heading to:253. Nothing fails (the test asserts against an inline string and never reads the file), which is precisely why the citation rots silently. It is the class objectui#7853 ruled on, in another package's suite, so it stays out of this two-file diff.Draft on purpose, not enqueued, auto-merge not enabled.
Generated by Claude Code