Commit 4384921
* fix(spec,driver-sql,driver-memory): the three drivers type-check — and 165 of their 292 errors were the types, not the tests (#4311)
`driver-sql` (241), `driver-sqlite-wasm` (27) and `driver-memory` (23) were
filed as one playbook: author-tier literals handed to a parsed-tier parameter.
That is what 127 of them were. The other 165 were the types being wrong, and
only a tsc that had never run could have kept them invisible:
- **`bypassTenantAudit` was never on `DriverOptionsSchema`** (118 errors).
`SqlDriver.auditMissingTenant` reads it, its own warning text tells callers
to pass it, `ObjectQLEngine` sets it for system-context calls, and both
`service-settings` and `service-datasource` send it on global-scope writes.
Declared now, with the limit stated: it silences a diagnostic, it never
changes which rows a write touches. The driver read it — and `timezone`,
`tenantId`, `tenantIds`, `preserveAudit`, all four long since declared —
through `(options as any)`; those seven casts are gone, so the next
undeclared option fails the build instead of hiding behind one.
- **`findOne(object, id)` was on no contract** (41). An undeclared
`typeof query === 'string'` branch in `SqlDriver`, used by nothing outside
this package's own tests, and answered differently by the other two drivers:
`MemoryDriver` spreads the string (`{0:'t',1:'1'}`), `MongoDriver` reads
`query.where` (undefined → an arbitrary row). It also bypassed `find()`, so
it skipped field selection, temporal coercion and the deterministic-order
tie-breaker `IDataDriver.find` promises. Removed; the call sites spell the
lookup as `{ object, where: { id } }`.
- **`initObjects` did not declare the `tenancy` it consumes** (4) — each
object flows into `computeAndRecordTenantField`, which reads `obj.tenancy`
to pick the tenant column and set the sticky opt-out.
`registerExternalObject` had it right all along.
- **`AnalyticsQuery` has no author tier** (19+1). `timezone` is
`.default('UTC')` and `public` is `.default(false)`, so the parsed types
require both; the tests wrote author-tier literals. Added
`AnalyticsQueryInput` beside `AnalyticsQuery` (the `QueryInput`/`QueryAST`
pattern) and routed the literals through the schema, so the parse itself is
the proof the default lands — `defineCube` does the same job for the cube.
- **`InMemoryDriver.create` declared no return type** (3), so TS inferred the
literal it builds and every other column of the created row vanished from
the caller's view.
The remaining 127 are the filed playbook: `object` added to the query literal
(the driver reads the name from parameter 1 — the AST field is required and
redundant there, filed separately), and `count`/`find` calls likewise.
Six call sites the type checker could not see at all wrote
`findOne('users', alice.id as any)`; the cast is what let an off-contract call
survive a narrowing. They surfaced as runtime failures the moment the branch
was removed, which is the point.
All three packages now declare `typecheck` and leave the DEBT ledger: 60/77
packages covered, 17 ledgered. 1069 tests green across the three.
Claude-Session: https://claude.ai/code/session_011m13wbaZziPveBdtQthrXd
Co-authored-by: Claude <noreply@anthropic.com>
* fix(driver-sql,driver-sqlite-wasm,driver-memory): 111 `as any` casts were opting the driver call sites out of the check they had just been given (#4311)
Onboarding a package is supposed to make its `typecheck` mean something. These
three declared it while 111 driver-call arguments were cast to `any` — the
gate went green over call sites the type checker was not allowed to read.
Stripping the casts produced 66 fresh errors, every one real:
- 65 were a missing `object` on the query literal, the same defect the first
commit fixed 127 times in the sites that were visible.
- 1 was a silent runtime bug. `sql-driver-aggregate-temporal-output.test.ts`
asked for `orderBy: [['id', 'asc']]`; the driver reads `item.field`, a tuple
has none, so `if (item.field)` was false and the sort never reached SQL. The
helper is named `viaFind` and exists to read a column in order — it had been
reading whatever order the rows came back in, in the one file whose subject
is output ordering. The tuple form appears nowhere else in the repo.
43 of the casts were needed by nothing at all. Exactly 2 are load-bearing and
stay: `sql-driver-filter-no-silent-drop` and `memory-filter-ast-vocabulary`
both feed `where` shapes `isFilterAST()` refuses, deliberately, to prove the
driver throws rather than dropping the condition — those now say
`where as FilterCondition` next to a comment, so the one honest cast in the
package is not camouflaged by a hundred idle ones.
Verified: `turbo run typecheck` 122/122 (three new), `pnpm test` 132/132,
eslint, the 12 lint.yml check gates, coverage ratchet self-test 18/18.
Claude-Session: https://claude.ai/code/session_011m13wbaZziPveBdtQthrXd
Co-authored-by: Claude <noreply@anthropic.com>
* docs(spec): regenerate the DriverOptions reference for `bypassTenantAudit` (#4311)
`content/docs/references/data/driver.mdx` is generated from the Zod schema, so
declaring a new `DriverOptions` key leaves it stale until `gen:docs` runs.
`@objectstack/spec check:docs` caught it — the generated table is what a driver
author reads to learn which options exist, and it had been complete for every
key except the one this branch adds.
`pnpm --filter @objectstack/spec gen:schema && gen:docs`; the diff is the one
row. 252 generated files back in sync.
Claude-Session: https://claude.ai/code/session_011m13wbaZziPveBdtQthrXd
Co-authored-by: Claude <noreply@anthropic.com>
* docs(spec): record `AnalyticsQueryInput` in the api-surface snapshot (#4311)
`check:api-surface` reports every public export against a committed snapshot,
so a new type — additive, 0 breaking — still has to be acknowledged rather than
appearing unannounced in a consumer's build. One line.
Also ran the other fifteen `@objectstack/spec` gates against this branch rather
than waiting to meet them one CI round at a time: docs, generated, skill-refs,
skill-docs, exported-any, authorable-surface, spec-changes, upgrade-guide,
liveness, empty-state, variant-docs, strictness-ledger, react-blocks,
react-conformance, skill-examples — plus `check:i18n` / `check:i18n-coverage`
and `check:generated --reconcile-only`, which are the remaining steps of the
CI job that failed. All green; only this snapshot needed regenerating.
The pattern behind both this and the previous commit: `pnpm build` does not run
the generators, so a schema edit type-checks and tests clean locally while two
committed artifacts derived from it sit stale. Worth knowing before the next
spec change — the generators are `gen:*` in `packages/spec`, and their gates
are the `check:*` beside them.
Claude-Session: https://claude.ai/code/session_011m13wbaZziPveBdtQthrXd
Co-authored-by: Claude <noreply@anthropic.com>
---------
Co-authored-by: Claude <noreply@anthropic.com>
1 parent 9881074 commit 4384921
60 files changed
Lines changed: 539 additions & 338 deletions
File tree
- .changeset
- content/docs/references/data
- packages
- plugins
- driver-memory
- src
- driver-sqlite-wasm
- src
- driver-sql
- src
- spec
- src/data
- scripts
Some content is hidden
Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.
| 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 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
98 | 98 | | |
99 | 99 | | |
100 | 100 | | |
| 101 | + | |
101 | 102 | | |
102 | 103 | | |
103 | 104 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
15 | 15 | | |
16 | 16 | | |
17 | 17 | | |
18 | | - | |
| 18 | + | |
| 19 | + | |
19 | 20 | | |
20 | 21 | | |
21 | 22 | | |
| |||
Lines changed: 58 additions & 41 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
3 | 3 | | |
4 | 4 | | |
5 | 5 | | |
6 | | - | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
7 | 21 | | |
8 | 22 | | |
9 | 23 | | |
| |||
160 | 174 | | |
161 | 175 | | |
162 | 176 | | |
163 | | - | |
| 177 | + | |
164 | 178 | | |
165 | 179 | | |
166 | | - | |
| 180 | + | |
167 | 181 | | |
168 | 182 | | |
169 | 183 | | |
| |||
173 | 187 | | |
174 | 188 | | |
175 | 189 | | |
176 | | - | |
| 190 | + | |
177 | 191 | | |
178 | 192 | | |
179 | 193 | | |
180 | | - | |
| 194 | + | |
181 | 195 | | |
182 | 196 | | |
183 | 197 | | |
| |||
187 | 201 | | |
188 | 202 | | |
189 | 203 | | |
190 | | - | |
| 204 | + | |
191 | 205 | | |
192 | 206 | | |
193 | 207 | | |
194 | | - | |
| 208 | + | |
195 | 209 | | |
196 | 210 | | |
197 | 211 | | |
198 | 212 | | |
199 | 213 | | |
200 | 214 | | |
201 | 215 | | |
202 | | - | |
| 216 | + | |
203 | 217 | | |
204 | 218 | | |
205 | 219 | | |
206 | | - | |
| 220 | + | |
207 | 221 | | |
208 | 222 | | |
209 | 223 | | |
210 | 224 | | |
211 | 225 | | |
212 | 226 | | |
213 | 227 | | |
214 | | - | |
| 228 | + | |
215 | 229 | | |
216 | 230 | | |
217 | | - | |
| 231 | + | |
218 | 232 | | |
219 | 233 | | |
220 | 234 | | |
| |||
223 | 237 | | |
224 | 238 | | |
225 | 239 | | |
226 | | - | |
| 240 | + | |
227 | 241 | | |
228 | 242 | | |
229 | 243 | | |
230 | | - | |
| 244 | + | |
231 | 245 | | |
232 | 246 | | |
233 | 247 | | |
234 | 248 | | |
235 | 249 | | |
236 | 250 | | |
237 | 251 | | |
238 | | - | |
| 252 | + | |
239 | 253 | | |
240 | 254 | | |
241 | 255 | | |
242 | | - | |
| 256 | + | |
243 | 257 | | |
244 | 258 | | |
245 | 259 | | |
246 | 260 | | |
247 | 261 | | |
248 | 262 | | |
249 | 263 | | |
250 | | - | |
| 264 | + | |
251 | 265 | | |
252 | 266 | | |
253 | 267 | | |
254 | | - | |
| 268 | + | |
255 | 269 | | |
256 | 270 | | |
257 | 271 | | |
258 | 272 | | |
259 | 273 | | |
260 | | - | |
| 274 | + | |
261 | 275 | | |
262 | 276 | | |
263 | 277 | | |
264 | | - | |
| 278 | + | |
265 | 279 | | |
266 | 280 | | |
267 | 281 | | |
268 | 282 | | |
269 | 283 | | |
270 | | - | |
| 284 | + | |
271 | 285 | | |
272 | 286 | | |
273 | 287 | | |
274 | 288 | | |
275 | | - | |
| 289 | + | |
276 | 290 | | |
277 | 291 | | |
278 | 292 | | |
279 | 293 | | |
280 | 294 | | |
281 | 295 | | |
282 | 296 | | |
283 | | - | |
| 297 | + | |
284 | 298 | | |
285 | 299 | | |
286 | 300 | | |
287 | 301 | | |
288 | 302 | | |
289 | 303 | | |
290 | | - | |
| 304 | + | |
291 | 305 | | |
292 | 306 | | |
293 | 307 | | |
| |||
299 | 313 | | |
300 | 314 | | |
301 | 315 | | |
302 | | - | |
| 316 | + | |
| 317 | + | |
| 318 | + | |
| 319 | + | |
303 | 320 | | |
304 | 321 | | |
305 | 322 | | |
| |||
309 | 326 | | |
310 | 327 | | |
311 | 328 | | |
312 | | - | |
| 329 | + | |
313 | 330 | | |
314 | 331 | | |
315 | | - | |
| 332 | + | |
316 | 333 | | |
317 | 334 | | |
318 | 335 | | |
319 | | - | |
| 336 | + | |
320 | 337 | | |
321 | 338 | | |
322 | 339 | | |
| |||
325 | 342 | | |
326 | 343 | | |
327 | 344 | | |
328 | | - | |
| 345 | + | |
329 | 346 | | |
330 | 347 | | |
331 | | - | |
| 348 | + | |
332 | 349 | | |
333 | 350 | | |
334 | 351 | | |
335 | 352 | | |
336 | | - | |
| 353 | + | |
337 | 354 | | |
338 | 355 | | |
339 | | - | |
| 356 | + | |
340 | 357 | | |
341 | 358 | | |
342 | 359 | | |
| |||
345 | 362 | | |
346 | 363 | | |
347 | 364 | | |
348 | | - | |
| 365 | + | |
349 | 366 | | |
350 | 367 | | |
351 | | - | |
| 368 | + | |
352 | 369 | | |
353 | 370 | | |
354 | 371 | | |
355 | 372 | | |
356 | 373 | | |
357 | 374 | | |
358 | 375 | | |
359 | | - | |
| 376 | + | |
360 | 377 | | |
361 | 378 | | |
362 | 379 | | |
363 | | - | |
| 380 | + | |
364 | 381 | | |
365 | 382 | | |
366 | 383 | | |
367 | 384 | | |
368 | 385 | | |
369 | | - | |
| 386 | + | |
370 | 387 | | |
371 | 388 | | |
372 | 389 | | |
373 | | - | |
| 390 | + | |
374 | 391 | | |
375 | 392 | | |
376 | 393 | | |
377 | 394 | | |
378 | 395 | | |
379 | 396 | | |
380 | | - | |
| 397 | + | |
381 | 398 | | |
382 | 399 | | |
383 | 400 | | |
384 | 401 | | |
385 | | - | |
| 402 | + | |
386 | 403 | | |
387 | 404 | | |
388 | 405 | | |
389 | 406 | | |
390 | 407 | | |
391 | 408 | | |
392 | | - | |
| 409 | + | |
393 | 410 | | |
394 | 411 | | |
395 | 412 | | |
396 | 413 | | |
397 | | - | |
| 414 | + | |
398 | 415 | | |
399 | 416 | | |
400 | 417 | | |
| |||
0 commit comments