Repository navigation
Commit df67985
fix(driver-sql): refusals, drift reports and log lines state each decision in words instead of a tracker number (stage 1) (#20795)
Part of #20513
Clause-②: no
**Stage 1 of 5 of this lane (`driver-sql`), under the maintainer's A / A
ruling on the card.** The card stays open for stages 2-5, so this PR
carries no closing keyword. Text only: no error `code`, field name, HTTP
status, export or control flow moves. Every changed line in the four
source files is a string-literal line.
## What this does
The SQL driver's refusals, drift reports and log lines sent the reader
to a tracker number for the reason behind them. Each rewritten string
now says that reason in words (form D, as the migration-entry rewrite
applied it). Where the sentence already stated what was decided, only
the citation goes. Where it did not, the decision is added in words:
| Where | Cited | The sentence now says |
|---|---|---|
| `sql-driver.ts` `reference_to` DDL refusal | 3896, 11567 | Raw
`registerObject` skips Zod; the FOREIGN KEY DDL the key used to gate is
retired, because it could never fire for a spec-conformant lookup. |
| `sql-driver.ts` NULL-safe UNIQUE messages (drift plan, restore,
hash-shadow, direct, bare-composite fallback) | 5030 | SQL UNIQUE is
NULL-distinct, so the old index never constrained rows without an
organization. |
| `sql-driver.ts` foreign column in the hash-shadow slot | 11627, 13015
| The column is not the driver's to replace: it may hold data. |
| `sql-driver.ts` SQLite canonicalisation info lines | 3912, 3994, 12380
| Datetime and time are now one text form, so filters and sorts compare
values rather than mixed encodings; json cells are now JSON-encoded
strings, the one encoding a json column holds on every dialect. |
| `sql-driver.ts` MySQL widening info lines | 3942, 3994 | `TIMESTAMP`
ends at 2038-01-19, keeps no milliseconds and converts through the
session timezone; a zero-precision `TIME` rounds the canonical
milliseconds to the second. |
| `cross-field-conformance-cases.ts` case notes | 5146, 7597, 1051
(cloud), 7398, 5041 | Each note states the rule it guards: `$not` is
NULL-safe because each leaf is totalised; the `=` spelling of a field
reference lowers to `$eq`; only a declared column reaches a SQL
identifier position; scalar operators on a JSON column compare the whole
serialized text; `$field` comparands compile, and the positions that
cannot compile are refused. |
| everything else (filter refusals, withheld-detail wording, TEXT-key
and row-size explanations, other hash-shadow lines, drift entries,
pagination warning, testkit error) | 4363, 4560, 5158, 5240, 5347, 5348,
5369, 5907 (uncompilable), 6050, 6212, 7398, 7929, 8197, 8220, 8790,
8931, 9350, 11067, 11374, 11535, 11541, 11565, 11627, 12121, 12999,
13015, 13056, 3696 | The sentence already said what was decided; only
the citation goes. |
The withheld-detail wording now reads "withheld from the message; the
full diagnostic is in the server log". That is exactly the Turso remote
transport's existing copy, which
`remote-transport-compile-refusal-seam.test.ts` derives from this
driver's sentence by stripping the citation, so the pin still holds.
## Three strings kept for the driver-turso stage
Three aggregate refusals keep their citation: `sql-driver.ts` about 1674
(undeclared function, 5907), 1778 (per-aggregation `filter`, 10413) and
1812 (`count_distinct` without `field`, 6409). Their twins in
`driver-turso`'s `remote-transport.ts` (about 948, 1071 and 1014) carry
the same citation. Tests compare the two faces byte for byte:
- `remote-transport-aggregate-function-refusal.test.ts` about 348, 408,
510 and 576;
- `remote-transport-undeclared-aggregate-keys.test.ts` about 201.
So one face cannot drop the number alone. Measured with a one-off
ablation on the committed head: deleting only the 5907 citation here,
rebuilding `driver-sql` (the marker present in `dist/`, 2 files) and
running those two driver-turso files gave **8 failed, 25 passed**. After
the restore (blob equal to HEAD, `git diff HEAD` empty, the marker
absent from `dist/`, working tree clean) they gave 33/33. No test file
was left behind. The order forbids moving another package's ledger rows
here, so these three rows (`#5907: 1`, `#10413: 1`, `#6409: 1`) are
handed to the `driver-turso` stage, where both twins change together.
## Pins re-pinned: 18 assertion lines in 6 test files
Each asserted a number; each now asserts the words that carry the
decision:
- `#5030` (12 lines): `sql-driver-unique-violation-predicate.test.ts`
199, 208, 218, 232, 289;
`sql-driver-14902-plain-unique-duplicate-preflight.test.ts` 222, 301,
308; `sql-driver-15479-shadow-plain-unique-duplicates.test.ts` 172, 199,
222; `sql-driver-unique-tenancy.test.ts` 694. They now assert
`NULL-distinct`. The negative pins (289, 222 in 14902, 172 and 199 in
15479) keep their meaning: the plain-unique messages do not borrow the
NULL-safe arm's story.
- `#11374` (2) and `#12999` (3):
`sql-driver-12999-stale-text-remedy.test.ts` 193, 243 and 196, 210, 224.
They now assert the declare-`maxLength` sentence, and the absence of the
stale-column sentence ("re-declaring `maxLength` changes nothing here").
- `#11535` (1): `schema-drift.base-type-mismatch.test.ts` 114. It now
asserts "receives one opaque id instead of a list".
## Ledger burn-down
`scripts/doc-authoring-prose-id.baseline.json` was regenerated with
`node scripts/check-doc-authoring.mjs --census-ledger`. It was generated
into a scratch file first, so the growth refusal ran against the
checked-in baseline, and then copied into place. Only `driver-sql` rows
moved:
| File | Occurrences before | after | (file, id) pairs before | after |
|---|---:|---:|---:|---:|
| `driver-sql/src/sql-driver.ts` | 62 | 3 | 32 | 3 |
| `driver-sql/src/cross-field-conformance-cases.ts` | 6 | 0 (row leaves)
| 5 | 0 |
| `driver-sql/src/schema-drift.ts` | 4 | 0 (row leaves) | 4 | 0 |
| `driver-sql/src/live-dialect-matrix.testkit.ts` | 1 | 0 (row leaves) |
1 | 0 |
| **driver-sql total** | **73** | **3** | **42** | **3** |
Whole ledger: files 227 to 224, pairs 611 to 572, occurrences 931 to
861. The gate's printed "pinned site(s)" (id-bearing string literals) go
794 to 732. A census of every other package's sites before and after is
identical.
**The two counts on the card, reconciled.** The census counted 52
messages, and the ledger holds 73 occurrences. The census's 52 are
`sql-driver.ts` 48 plus `schema-drift.ts` 4. It folds a `+` chain into
one message, so its 48 messages are the gate's 54 string literals. Those
52 messages carry 66 occurrences, the ledger's 62 + 4. The census
listing prints ids deduplicated per message, which gives 65. The one gap
is the hash-shadow warning, whose two ternary branches each cite 13015.
The remaining 7 occurrences are the 7 `src/`-shipped test strings (the
six case notes and the testkit error), which sit outside the census's
52-message population.
## Verification (head `733b0e6815`)
- **Build.** `turbo run build` over the `driver-turso` and
`driver-sqlite-wasm` closures (which include `driver-sql`): 9/9. Then
every package under `packages/`: 71/71. Both runs exited 0 under the
verify lock.
- **Built output.** The new sentences are in both `dist/index.js` and
`dist/index.mjs`. The three held citations are the only runtime
citations left in them; the other hits are docblocks, which the bundle
keeps.
- **Tests.**
- `@objectstack/driver-sql`: 200 files passed and 11 skipped (the live
PG / MySQL cells, no server here); 3,248 tests passed and 188 skipped.
- The six re-pinned files, run on their own: 76 passed, 4 skipped.
`sql-driver-15479-shadow-plain-unique-duplicates.test.ts` is MySQL-only.
- `@objectstack/driver-turso` (the byte-parity consumer, reading the
rebuilt `dist/`): 80 files, 2,195 tests passed, 33 skipped.
- `@objectstack/driver-sqlite-wasm` (extends `SqlDriver`): 36 files, 675
tests passed.
- **Typecheck.** `@objectstack/driver-sql typecheck` exits 0;
`--listFiles` shows it reads all 211 of the package's test files.
- **Derived gates.** `node scripts/pm/dispatch-gates.mjs --commands` (no
paths; 12 paths against merge base `085ca6bc1`) names 71 commands, and
all 71 exit 0. `check:dual-build-cjs-loads`, `check:lean-entry-closure`
and `check:type-check-debt` first answered PREREQUISITE NOT MET (exit 3)
on the partial build. After the full build they exit 0, and
`check:dts-closure` was re-run there too (71 packages swept). `--ran`
reconciliation: "71 derived, 71 run, 0 NOT-MEASURED, 0 UNRUN".
`check:doc-authoring`: "sibling-package prose ids hold the baseline —
732 pinned site(s) across 224 file(s) ... no growth, no burn-down
unrecorded".
- **Lint, narrowed.** `eslint --no-inline-config --format json` over the
10 touched TypeScript files reports 10 files, 0 errors and 0 warnings.
The population is the touched files, and the count is read from eslint's
JSON. The narrowing is safe because `eslint.config.mjs` enables no
type-aware linting: the resolved `parserOptions` are `ecmaVersion` and
`sourceType` only, with no `project` or `projectService`. So this diff
cannot move an untouched file's verdict. The repo-wide `pnpm lint` is
CI's.
- **NOT MEASURED here (CI's):** the live PG / MySQL cells of the
`driver-sql` suite, including the three re-pins in the MySQL-only 15479
file. The required `Temporal Conformance (live PG + MySQL)` job runs the
whole `driver-sql` suite against both servers. Also CI's: the Test Core
shards, the Dogfood jobs and the workspace type-check lanes.
## Acceptance notes
- **Carrier for the three held strings: the `driver-turso` stage (stage
4 of this lane).** It should rewrite each pair together, the
`driver-sql` string and its `remote-transport.ts` twin, and that PR's
ledger diff then moves one `driver-sql` row as well. That is the same
serial ledger, one stage later.
- **Two twins now differ by the citation only.** The
declared-but-uncompiled refusal (5907, about 1749 here and 987 there)
and the date-bucket refusal (6212, about 1867 here and 1108 there).
Their contract is first-sentence parity, which holds; the remote copies
drop the number in the `driver-turso` stage.
- **Cited cards read.** Of the 41 distinct cited ids, 35 read as closed
and completed. Five answer 404: 11067, 11374, 12380, 12999 and 13015.
They were read through their landing commits and today's docblocks. The
cloud-repository card behind the `$field` identifier note is not
readable from this session; that note is rewritten from its own
sentence. Each rewritten sentence describes today's code: `$field`
comparands are compiled (the enforce-or-remove question was answered
"enforce"), the `=` lowering fix landed, and the FK DDL is retired.
- **Comments untouched.** Code comments and docblocks citing the same
numbers are not runtime strings and are not changed here.
---
_Generated by [Claude
Code](https://claude.ai/code/session_01DEvba2nBuD4tWzfq8r8NFY)_
Co-authored-by: Claude <noreply@anthropic.com>1 parent 96e7244 commit df67985
12 files changed
Lines changed: 120 additions & 132 deletions
File tree
- .changeset
- packages/drivers/driver-sql/src
- scripts
Lines changed: 26 additions & 0 deletions
| 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 | + | |
Lines changed: 6 additions & 6 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
189 | 189 | | |
190 | 190 | | |
191 | 191 | | |
192 | | - | |
| 192 | + | |
193 | 193 | | |
194 | 194 | | |
195 | 195 | | |
| |||
235 | 235 | | |
236 | 236 | | |
237 | 237 | | |
238 | | - | |
| 238 | + | |
239 | 239 | | |
240 | 240 | | |
241 | 241 | | |
| |||
314 | 314 | | |
315 | 315 | | |
316 | 316 | | |
317 | | - | |
| 317 | + | |
318 | 318 | | |
319 | 319 | | |
320 | 320 | | |
| |||
393 | 393 | | |
394 | 394 | | |
395 | 395 | | |
396 | | - | |
| 396 | + | |
397 | 397 | | |
398 | 398 | | |
399 | 399 | | |
| |||
446 | 446 | | |
447 | 447 | | |
448 | 448 | | |
449 | | - | |
| 449 | + | |
450 | 450 | | |
451 | 451 | | |
452 | 452 | | |
| |||
479 | 479 | | |
480 | 480 | | |
481 | 481 | | |
482 | | - | |
| 482 | + | |
483 | 483 | | |
484 | 484 | | |
485 | 485 | | |
| |||
Lines changed: 1 addition & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
216 | 216 | | |
217 | 217 | | |
218 | 218 | | |
219 | | - | |
| 219 | + | |
220 | 220 | | |
221 | 221 | | |
222 | 222 | | |
| |||
Lines changed: 1 addition & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
111 | 111 | | |
112 | 112 | | |
113 | 113 | | |
114 | | - | |
| 114 | + | |
115 | 115 | | |
116 | 116 | | |
117 | 117 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
995 | 995 | | |
996 | 996 | | |
997 | 997 | | |
998 | | - | |
| 998 | + | |
999 | 999 | | |
1000 | 1000 | | |
1001 | 1001 | | |
| |||
1142 | 1142 | | |
1143 | 1143 | | |
1144 | 1144 | | |
1145 | | - | |
| 1145 | + | |
1146 | 1146 | | |
1147 | 1147 | | |
1148 | 1148 | | |
| |||
1347 | 1347 | | |
1348 | 1348 | | |
1349 | 1349 | | |
1350 | | - | |
1351 | | - | |
| 1350 | + | |
| 1351 | + | |
1352 | 1352 | | |
1353 | 1353 | | |
1354 | 1354 | | |
| |||
2391 | 2391 | | |
2392 | 2392 | | |
2393 | 2393 | | |
2394 | | - | |
| 2394 | + | |
2395 | 2395 | | |
2396 | 2396 | | |
2397 | 2397 | | |
| |||
Lines changed: 5 additions & 5 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
190 | 190 | | |
191 | 191 | | |
192 | 192 | | |
193 | | - | |
| 193 | + | |
194 | 194 | | |
195 | 195 | | |
196 | | - | |
| 196 | + | |
197 | 197 | | |
198 | 198 | | |
199 | 199 | | |
| |||
207 | 207 | | |
208 | 208 | | |
209 | 209 | | |
210 | | - | |
| 210 | + | |
211 | 211 | | |
212 | 212 | | |
213 | 213 | | |
| |||
221 | 221 | | |
222 | 222 | | |
223 | 223 | | |
224 | | - | |
| 224 | + | |
225 | 225 | | |
226 | 226 | | |
227 | 227 | | |
| |||
240 | 240 | | |
241 | 241 | | |
242 | 242 | | |
243 | | - | |
| 243 | + | |
244 | 244 | | |
245 | 245 | | |
246 | 246 | | |
| |||
Lines changed: 3 additions & 3 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
219 | 219 | | |
220 | 220 | | |
221 | 221 | | |
222 | | - | |
| 222 | + | |
223 | 223 | | |
224 | 224 | | |
225 | 225 | | |
| |||
298 | 298 | | |
299 | 299 | | |
300 | 300 | | |
301 | | - | |
| 301 | + | |
302 | 302 | | |
303 | 303 | | |
304 | 304 | | |
305 | 305 | | |
306 | 306 | | |
307 | 307 | | |
308 | | - | |
| 308 | + | |
309 | 309 | | |
310 | 310 | | |
311 | 311 | | |
| |||
Lines changed: 3 additions & 3 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
169 | 169 | | |
170 | 170 | | |
171 | 171 | | |
172 | | - | |
| 172 | + | |
173 | 173 | | |
174 | 174 | | |
175 | 175 | | |
| |||
196 | 196 | | |
197 | 197 | | |
198 | 198 | | |
199 | | - | |
| 199 | + | |
200 | 200 | | |
201 | 201 | | |
202 | 202 | | |
| |||
219 | 219 | | |
220 | 220 | | |
221 | 221 | | |
222 | | - | |
| 222 | + | |
223 | 223 | | |
224 | 224 | | |
225 | 225 | | |
| |||
Lines changed: 1 addition & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
691 | 691 | | |
692 | 692 | | |
693 | 693 | | |
694 | | - | |
| 694 | + | |
695 | 695 | | |
696 | 696 | | |
697 | 697 | | |
| |||
Lines changed: 5 additions & 5 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
196 | 196 | | |
197 | 197 | | |
198 | 198 | | |
199 | | - | |
| 199 | + | |
200 | 200 | | |
201 | 201 | | |
202 | 202 | | |
| |||
205 | 205 | | |
206 | 206 | | |
207 | 207 | | |
208 | | - | |
| 208 | + | |
209 | 209 | | |
210 | 210 | | |
211 | 211 | | |
| |||
215 | 215 | | |
216 | 216 | | |
217 | 217 | | |
218 | | - | |
| 218 | + | |
219 | 219 | | |
220 | 220 | | |
221 | 221 | | |
| |||
229 | 229 | | |
230 | 230 | | |
231 | 231 | | |
232 | | - | |
| 232 | + | |
233 | 233 | | |
234 | 234 | | |
235 | 235 | | |
| |||
286 | 286 | | |
287 | 287 | | |
288 | 288 | | |
289 | | - | |
| 289 | + | |
290 | 290 | | |
291 | 291 | | |
292 | 292 | | |
| |||
0 commit comments