Repository navigation
Commit a484966
docs(readme): make the published README TypeScript examples compile (#18968)
Part of #18915
Clause-②: no
Executes maintainer decision batch #156 item 2 — ruling F on #18715. No
gate, no ratchet, no CI wiring is added: this is the user-facing half of
PR #18751's census, corrected.
## Act 1 — the split, re-derived
PR #18751's instrument re-run on a fresh `origin/main` (`node
scripts/measure-markdown-ts-blocks.mjs --json`, workspace built first,
all three controls behaving: GREEN clean, FIRING reports TS2341,
UNPUBLISHED_SUBPATH reports a counted TS2307 on each of its three
specifiers).
The card's numbers reproduce exactly:
```
handwritten stratum blocks 282 files 54 raw 195 tolerant 76 well-formed-and-wrong 58
changelog stratum blocks 720 (out of scope)
```
Split by publication — a block is *published* when its document is
inside its package's `files[]`:
| reading | total | published | internal |
|:---|---:|---:|---:|
| tolerant failures | 76 | **54** | 22 |
| syntactically valid and wrong | 58 | **44** | 14 |
The split is unambiguous in this repo: every non-private package's
`files[]` is `["dist","README.md","CHANGELOG.md"]` (only
`@objectstack/spec` lists more), so **the published package-root
Markdown is exactly `README.md`**, and every other package-root document
— `ADVANCED_FEATURES.md`, `PHASE2_IMPLEMENTATION.md`,
`V3_MIGRATION_GUIDE.md`, `ARCHITECTURE.md`, `DEVELOPMENT_PLAN.md`,
`PLUGIN_STANDARDS.md`, `REST_API_PLUGIN.md`,
`ZOD_SCHEMA_AUDIT_REPORT.md`, `STACKBLITZ.md`,
`CLIENT_SPEC_COMPLIANCE.md`, `ROADMAP.md`, plus the private
`packages/qa/*` READMEs — is internal.
Confirmed against the packer rather than asserted from `package.json`,
with a control from the same population that must read the other way:
```
npm pack --dry-run --json, packages/core
README.md in tarball: True # positive control
ADVANCED_FEATURES.md in tarball: False # same population, must be absent
PHASE2_IMPLEMENTATION.md in tarball: False
```
No count in the split is zero, so no zero needed pairing.
**`packages/spec/liveness/README.md`** (PR #18938's surface) measures as
**published** — `liveness` is a `files[]` entry, and `npm pack` puts
`liveness/README.md` and `liveness/state-counts.md` in the tarball. It
is nonetheless **not in this card's population**: the census population
is Markdown at a *package root* (a directory carrying a `package.json`),
`packages/spec/liveness` is not one, and the file therefore contributes
none of the 76/58. No overlap with #18938, and nothing of theirs is
touched here.
## Act 2 — the published corrections
**43 of the 44** published syntactically-valid-and-wrong blocks now
compile; 20 READMEs changed. Re-measured on the same instrument:
| reading | before | after |
|:---|---:|---:|
| published, syntactically valid and wrong | 44 | **1** |
| published, tolerant failures | 54 | 11 |
| internal, syntactically valid and wrong | 14 | 14 (untouched) |
| internal, tolerant failures | 22 | 22 (untouched) |
The 11 remaining published tolerant failures are **10 syntax-only
blocks** — bare type-signature fragments in `service-automation`,
`trigger-record-change`, `trigger-schedule` and `service-job`, the
`needs-explicit-partial-tag` class the instrument's own forward
convention describes — plus the one block below. Syntax-only blocks are
outside act 2's mandate, which is the syntactically-valid-and-wrong set.
What was wrong, by class:
- **Legacy option vocabulary.** `@objectstack/client-react`'s hooks take
`fields` / `orderBy` / `limit` / `where`; the README still wrote
`select` / `sort` / `top` / `filters`, and read `PaginatedResult.value`
where the member is `records`. Also `timeout` to `timeoutMs`
(`service-job`), `attempts` to `maxAttempts` (`service-queue`), `filter`
to `where` (`IDataEngine.find`).
- **An async API used as a chainable one.** `ObjectKernel.use()` is
async and resolves to the kernel, so `kernel.use(a).use(b)` does not
type-check at all; and `ObjectKernelConfig` has no `plugins` member.
- **Interfaces implemented but never imported.** Four plugin examples
wrote `implements Plugin` with no import — which silently bound to the
DOM's `Plugin` — and three omitted the required `init`.
`PluginContext.getService` is declared with a type parameter that has no
default, so every example that read a service back left it `unknown`.
- **Removed or never-existing API, rewritten rather than left as a
fossil.** `@objectstack/driver-memory`'s default export is a legacy
`onEnable` object that `kernel.use()` refuses on both the type and the
boot path — the quick start now registers through `DriverPlugin`, and
the "Key Exports" row that called it a drop-in plugin is corrected with
it. Its persistence adapters take an options bag and hang under
`persistence.adapter`. `defineStack` has no `driver` key.
`@objectstack/rest`'s `RestServer` takes the host `IHttpServer` as its
first argument and `registerRoutes()` takes none; `RouteManager` is
constructed on a server. `ObjectSchema.parse()` returns the value — the
`{ success, data }` envelope belongs to `safeParse`. `useMutation` has
no `onMutate` and no mutation context, so the "Optimistic Updates"
example was rebuilt on the options it does have.
- **Untyped parameters under `--strict`** in React and handler examples,
annotated.
Two of the 44 (`packages/cli`, `packages/mcp`) were **measurement
artefacts worth stating plainly**: `objects: Object.values(objects)`
over an elided `./src/objects` barrel. The forgiven TS2307 leaves the
namespace `any`, and `Object.values` then infers its type parameter from
the union-shaped contextual type, producing a mismatch a reader's own
resolvable barrel would not produce. Both now name the objects they
import, which is typed and clearer either way.
Beyond the counted blocks, the same defect class was corrected in three
further `client-react` blocks (Master-Detail, Search with Debounce, and
the Type Safety comment) that the census does not flag only because they
import nothing and so type-check as `any`. Leaving `data.value` and
`select:` standing one section below a corrected copy of themselves was
not defensible; this is called out because it is work outside the
measured set.
## The one block deliberately left, and why
`packages/plugins/knowledge-ragflow/README.md` writes
`source.options.datasetId`. That is what the shipped adapter reads
(`extractRagflowOptions` casts the source to a shape carrying an
optional `options` record, and its error text names
`source.options.datasetId`), and it is **not** what
`KnowledgeSourceSchema` declares — the declared key is `adapterConfig`,
and the schema is a plain `z.object`, so a parse would strip `options`
outright.
Correcting the document to `adapterConfig` would make it compile and
stop working. Correcting the adapter is a runtime change, out of this
card's scope, and picks a winner between two live spellings.
Contract-first says the defect is upstream, so the block is left as it
stands and the conflict is reported for the maintainer instead of being
papered over in a docs PR.
That is why this PR says `Part of #18915` and not `Fixes`.
## Changeset — measured for this diff, not inherited
The house `skip-changeset` argument for docs cards is "no package's
`files[]` reaches `content/docs/**`". **It inverts here.** `README.md`
is listed in `files[]` for every one of the 20 packages touched, so the
bytes this PR changes are inside the published tarball — measured above
with `npm pack --dry-run` and a same-population control that reads the
other way.
AGENTS.md: `skip-changeset` "is for a diff that publishes nothing from
any released package". This diff publishes changed bytes from twenty
released packages, and those bytes are what an upgrading agent reads. So
this PR carries a **`patch`** changeset naming all twenty, and ⛔ no
`skip-changeset` label.
## Scope
- Touched: `packages/*/README.md` only, plus the changeset. ⛔ No
internal document, ⛔ no `CHANGELOG.md`, ⛔ no `content/docs/**`, ⛔ no
runtime code, ⛔ no gate or CI wiring.
- The changeset file is the one path outside the claim's declared file
surface (`packages/**/README.md`); it is the companion artefact the
measurement above obliges, and it is named here rather than slipped in.
## Acceptance notes
- `packages/client/README.md` documents `data.find()`'s legacy
vocabulary (`select` / `filters` / `sort` / `top`). Unlike the
`client-react` case this **compiles** — `QueryOptions` still accepts it
— so it is out of this card's set, but `find` itself carries
`@deprecated` and `data.query()` is the canonical call. Noted, not
filed.
- The `check:undeclared-dep-imports` family is not affected: no
`package.json` moved.
## Verification
Tree: `a8b75f978` (`origin/main` merged in, workspace rebuilt, `pnpm
install --frozen-lockfile` after the lockfile moved). Every number below
is from that tree.
**The census, final run.** `node scripts/measure-markdown-ts-blocks.mjs
--json`, exit 0, all three controls behaving (`green=clean firing=fires
unpublished-subpath=fires`):
```
handwritten blocks 284 files 54 raw 172 tolerant 33 well-formed-and-wrong 15
published tolerant 11 well-formed-and-wrong 1
internal tolerant 22 well-formed-and-wrong 14
```
284 rather than 282 because the `observability` wiring block, which
redeclared `metrics` four times in one fence, is now three fences — one
per deployment, which is how a reader picks between them.
**Gate families**, derived in-worktree from this tree with `node
scripts/pm/dispatch-gates.mjs --commands --repo
objectstack-ai/objectstack` (no stale-tree warning after the merge):
**63 derived, 63 run, all exit 0**, reconciled back through `--ran` with
each command's exit code captured before any pipe — "63 derived
familt(ies) accounted for — 63 run, 0 NOT-MEASURED (a DERIVED zero — all
63 recorded an exit code and none of them is 3)".
`check:pm-dispatch-gates` is not among the derived families for this
change set. That reconciliation answers one link only; it is not a
complete account of CI.
**Tests.** The diff changes no TypeScript, so no package's `tsc` program
or vitest source set moves. Two suites do read a README this PR edits,
found by grepping every test file in `packages/` for `README.md` (19
hits, triaged by the path each one reads), and both were run:
```
pnpm --filter @objectstack/client exec vitest run --maxWorkers=2 src/readme-package-install-example.test.ts
Test Files 1 passed (1) · Tests 6 passed (6) · CLIENT_README_EXIT=0
pnpm --filter @objectstack/spec exec vitest run --maxWorkers=2 src/api/package-api.test.ts src/kernel/plugin-structure.test.ts
Test Files 2 passed (2) · Tests 81 passed (81) · SPEC_TARGETED_EXIT=0
```
The first one parses `packages/client/README.md` with the TypeScript
parser and validates the manifest it finds against the install contract
— it is the pin that a README edit in that package could break.
**Lint.** Zero files in this diff are in eslint's population, measured
from eslint's own config rather than assumed, with a control from the
same tree that must read the other way:
```
ESLint#calculateConfigForFile
packages/types/README.md rules: 0 ignored: true
.changeset/18915-published-readme-examples-compile.md rules: 0 ignored: true
packages/types/src/index.ts rules: 6 ignored: false # control
```
`eslint.config.mjs` scopes every block to
`{ts,tsx,mts,cts,js,jsx,mjs,cjs}`, so no configuration in this diff can
move an untouched file's verdict either.
**Control bytes.** `grep -naP` for the C0 range over every changed path:
no hits; a fixture carrying one byte in that range hits, so the scan is
live. `pnpm check:nul-bytes` is among the 63 green gates.
Authored by Claude Code, session `session_017ef78bLdybu3AffehKkhfk`.
---
_Generated by [Claude Code](https://claude.ai/code)_
Co-authored-by: claude[bot] <claude[bot]@users.noreply.github.com>
Co-authored-by: Claude <noreply@anthropic.com>1 parent 2265bb0 commit a484966
21 files changed
Lines changed: 276 additions & 161 deletions
File tree
- .changeset
- packages
- client-react
- client
- cli
- drivers
- driver-memory
- driver-mongodb
- driver-turso
- mcp
- observability
- plugins/plugin-auth
- rest
- runtime
- services
- service-cache
- service-i18n
- service-job
- service-package
- service-queue
- service-realtime
- service-storage
- spec
- types
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
131 | 131 | | |
132 | 132 | | |
133 | 133 | | |
134 | | - | |
| 134 | + | |
135 | 135 | | |
136 | 136 | | |
137 | 137 | | |
| |||
141 | 141 | | |
142 | 142 | | |
143 | 143 | | |
144 | | - | |
| 144 | + | |
145 | 145 | | |
146 | 146 | | |
147 | 147 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
51 | 51 | | |
52 | 52 | | |
53 | 53 | | |
54 | | - | |
55 | | - | |
56 | | - | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
57 | 57 | | |
58 | 58 | | |
59 | 59 | | |
60 | 60 | | |
61 | 61 | | |
62 | 62 | | |
63 | 63 | | |
64 | | - | |
| 64 | + | |
65 | 65 | | |
66 | 66 | | |
67 | 67 | | |
| |||
73 | 73 | | |
74 | 74 | | |
75 | 75 | | |
| 76 | + | |
76 | 77 | | |
77 | 78 | | |
78 | 79 | | |
| |||
82 | 83 | | |
83 | 84 | | |
84 | 85 | | |
85 | | - | |
| 86 | + | |
86 | 87 | | |
87 | 88 | | |
88 | 89 | | |
| |||
119 | 120 | | |
120 | 121 | | |
121 | 122 | | |
122 | | - | |
| 123 | + | |
123 | 124 | | |
124 | 125 | | |
125 | 126 | | |
126 | 127 | | |
127 | | - | |
| 128 | + | |
128 | 129 | | |
129 | 130 | | |
130 | 131 | | |
| |||
155 | 156 | | |
156 | 157 | | |
157 | 158 | | |
158 | | - | |
| 159 | + | |
159 | 160 | | |
160 | 161 | | |
161 | 162 | | |
| |||
180 | 181 | | |
181 | 182 | | |
182 | 183 | | |
183 | | - | |
| 184 | + | |
184 | 185 | | |
185 | 186 | | |
186 | 187 | | |
| |||
199 | 200 | | |
200 | 201 | | |
201 | 202 | | |
202 | | - | |
| 203 | + | |
203 | 204 | | |
204 | 205 | | |
205 | 206 | | |
| |||
218 | 219 | | |
219 | 220 | | |
220 | 221 | | |
221 | | - | |
| 222 | + | |
222 | 223 | | |
223 | 224 | | |
224 | 225 | | |
| |||
269 | 270 | | |
270 | 271 | | |
271 | 272 | | |
272 | | - | |
| 273 | + | |
273 | 274 | | |
274 | 275 | | |
275 | 276 | | |
| |||
280 | 281 | | |
281 | 282 | | |
282 | 283 | | |
| 284 | + | |
| 285 | + | |
| 286 | + | |
283 | 287 | | |
284 | 288 | | |
285 | | - | |
| 289 | + | |
286 | 290 | | |
287 | | - | |
288 | | - | |
| 291 | + | |
| 292 | + | |
289 | 293 | | |
290 | | - | |
| 294 | + | |
291 | 295 | | |
292 | | - | |
| 296 | + | |
293 | 297 | | |
294 | 298 | | |
295 | | - | |
| 299 | + | |
296 | 300 | | |
297 | 301 | | |
298 | | - | |
299 | | - | |
| 302 | + | |
| 303 | + | |
300 | 304 | | |
301 | 305 | | |
302 | 306 | | |
| |||
305 | 309 | | |
306 | 310 | | |
307 | 311 | | |
308 | | - | |
| 312 | + | |
| 313 | + | |
| 314 | + | |
| 315 | + | |
| 316 | + | |
| 317 | + | |
| 318 | + | |
| 319 | + | |
309 | 320 | | |
310 | | - | |
311 | | - | |
312 | | - | |
313 | | - | |
314 | | - | |
315 | | - | |
316 | | - | |
317 | | - | |
318 | | - | |
319 | | - | |
320 | | - | |
| 321 | + | |
| 322 | + | |
| 323 | + | |
321 | 324 | | |
322 | 325 | | |
323 | | - | |
| 326 | + | |
324 | 327 | | |
325 | | - | |
326 | | - | |
327 | | - | |
| 328 | + | |
| 329 | + | |
| 330 | + | |
| 331 | + | |
| 332 | + | |
| 333 | + | |
| 334 | + | |
| 335 | + | |
| 336 | + | |
328 | 337 | | |
329 | 338 | | |
330 | 339 | | |
| |||
333 | 342 | | |
334 | 343 | | |
335 | 344 | | |
336 | | - | |
| 345 | + | |
| 346 | + | |
| 347 | + | |
337 | 348 | | |
338 | 349 | | |
339 | | - | |
| 350 | + | |
340 | 351 | | |
341 | | - | |
| 352 | + | |
342 | 353 | | |
343 | 354 | | |
344 | | - | |
| 355 | + | |
345 | 356 | | |
346 | 357 | | |
347 | | - | |
| 358 | + | |
348 | 359 | | |
349 | 360 | | |
350 | | - | |
351 | | - | |
| 361 | + | |
| 362 | + | |
352 | 363 | | |
353 | 364 | | |
354 | 365 | | |
| |||
357 | 368 | | |
358 | 369 | | |
359 | 370 | | |
360 | | - | |
| 371 | + | |
| 372 | + | |
361 | 373 | | |
362 | 374 | | |
363 | 375 | | |
364 | 376 | | |
365 | 377 | | |
366 | 378 | | |
367 | | - | |
| 379 | + | |
368 | 380 | | |
369 | 381 | | |
370 | 382 | | |
| |||
377 | 389 | | |
378 | 390 | | |
379 | 391 | | |
380 | | - | |
| 392 | + | |
381 | 393 | | |
382 | 394 | | |
383 | 395 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
46 | 46 | | |
47 | 47 | | |
48 | 48 | | |
49 | | - | |
50 | | - | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
51 | 52 | | |
52 | 53 | | |
53 | 54 | | |
| |||
143 | 144 | | |
144 | 145 | | |
145 | 146 | | |
| 147 | + | |
| 148 | + | |
146 | 149 | | |
147 | 150 | | |
148 | | - | |
| 151 | + | |
| 152 | + | |
149 | 153 | | |
150 | 154 | | |
151 | 155 | | |
| |||
288 | 292 | | |
289 | 293 | | |
290 | 294 | | |
291 | | - | |
| 295 | + | |
292 | 296 | | |
293 | 297 | | |
294 | 298 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
19 | 19 | | |
20 | 20 | | |
21 | 21 | | |
22 | | - | |
| 22 | + | |
| 23 | + | |
23 | 24 | | |
24 | 25 | | |
25 | | - | |
| 26 | + | |
26 | 27 | | |
27 | 28 | | |
28 | 29 | | |
| |||
41 | 42 | | |
42 | 43 | | |
43 | 44 | | |
44 | | - | |
| 45 | + | |
45 | 46 | | |
46 | 47 | | |
47 | 48 | | |
| |||
52 | 53 | | |
53 | 54 | | |
54 | 55 | | |
55 | | - | |
| 56 | + | |
56 | 57 | | |
57 | 58 | | |
58 | 59 | | |
59 | 60 | | |
60 | 61 | | |
61 | 62 | | |
62 | 63 | | |
63 | | - | |
| 64 | + | |
64 | 65 | | |
65 | 66 | | |
66 | 67 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
36 | 36 | | |
37 | 37 | | |
38 | 38 | | |
| 39 | + | |
39 | 40 | | |
40 | 41 | | |
41 | 42 | | |
42 | | - | |
43 | | - | |
44 | | - | |
45 | | - | |
46 | | - | |
47 | | - | |
48 | | - | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
49 | 52 | | |
50 | 53 | | |
51 | 54 | | |
| |||
0 commit comments