Skip to content

Commit bd9ce03

Browse files
committed
docs(driver-turso, spec): comments and the D3 entry stop calling syncUrl-under-remote constructed-and-ignored
With the inert floor at 0 the driver constructs-and-ignores nothing the schemas refuse. The comments beside tursoTransportIssues (spec and mirror), both section headings, the spec test's block comment, the parity test's two comments, and the turso-config-transport-mismatch-refused entry's header comment and reason clause now say what holds since #20200, the entry's clause put in the past tense. Text only. Claude-Session: https://claude.ai/code/session_01N8TPEsoJxPsdSdNKGnNGEN Co-authored-by: Claude <noreply@anthropic.com>
1 parent 2242ad5 commit bd9ce03

5 files changed

Lines changed: 43 additions & 35 deletions

File tree

‎packages/drivers/driver-turso/src/spec/turso-config-constructor-parity.test.ts‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,8 @@
1010
* 3. this package's own `TursoConfigSchema` mirror (`./turso.zod.ts`).
1111
*
1212
* The two schemas used to accept every combination below, so a datasource the
13-
* driver refuses at construction (or constructs and ignores) was accepted at
14-
* authoring and failed a boot later. Each row states the constructor's verdict
13+
* driver refuses at construction (or, until #20200, constructed and ignored)
14+
* was accepted at authoring and failed a boot later. Each row states the constructor's verdict
1515
* and the schemas' verdict, and the test asserts all three against it:
1616
*
1717
* - a row the constructor REFUSES is refused by both schemas, on the key the
@@ -224,7 +224,7 @@ describe('turso config: the constructor, the spec contract and this mirror agree
224224

225225
it(row.refusedOn ? `the spec contract refuses it on \`${row.refusedOn}\`` : 'the spec contract accepts it', () => {
226226
// Authoring refuses what construction refuses, and nothing it accepts
227-
// but the declared-and-ignored keys.
227+
// but an `inert` row's declared-and-ignored key (none since #20200).
228228
expect(Boolean(row.refusedOn)).toBe(row.ctor === 'refuse' || Boolean(row.inert));
229229
const verdict = schemaVerdict(SpecTursoConfigSchema, row.config);
230230
expect(verdict.refusedOn, verdict.message).toBe(row.refusedOn);

‎packages/drivers/driver-turso/src/spec/turso.zod.ts‎

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -82,13 +82,14 @@ const WASM_RETIRED =
8282
+ 'Run `os migrate meta --from 17` to list the mechanical edits for existing sources; apply them by hand.';
8383

8484
// ==========================================================================
85-
// 2a. Transport coherence — what `new TursoDriver` refuses or ignores
85+
// 2a. Transport coherence — what `new TursoDriver` refuses
8686
// ==========================================================================
8787
//
8888
// #19977. Each key below parsed on its own, so this mirror accepted
8989
// combinations the driver in this very package refuses at construction
90-
// (`VALIDATION_ERROR` / 400), or constructs and ignores. It now refuses them,
91-
// with the supported spelling in the message. The predicates and the messages
90+
// (`VALIDATION_ERROR` / 400), or, until #20200, constructed and ignored. It
91+
// now refuses them, with the supported spelling in the message. The
92+
// predicates and the messages
9293
// are the ones `@objectstack/spec`'s own turso contract
9394
// (`packages/spec/src/data/driver/turso.zod.ts`, `tursoTransportIssues`)
9495
// carries, byte for byte: the helper is internal to that package and not on
@@ -390,8 +391,8 @@ export const TursoConfigSchema = lazySchema(() => z.object({
390391
+ 'nothing.',
391392
});
392393
}
393-
// What the driver refuses at construction, or constructs and ignores —
394-
// see `tursoTransportIssues` above.
394+
// What the driver refuses at construction — see `tursoTransportIssues`
395+
// above.
395396
for (const issue of tursoTransportIssues(cfg)) {
396397
ctx.addIssue({ code: 'custom', path: [issue.path], message: issue.message });
397398
}

‎packages/spec/src/data/driver/turso.test.ts‎

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -197,8 +197,9 @@ describe('TursoConfig.timeout carries its unit (#15680)', () => {
197197
});
198198

199199
// #19977 — the transport refusals: every combination `new TursoDriver` refuses
200-
// at construction, plus `syncUrl` under a forced `mode: 'remote'` (which it
201-
// constructs and ignores), refused at authoring. Asserted on the envelope — the
200+
// at construction (since #20200 that includes `syncUrl` under a forced
201+
// `mode: 'remote'`, which it used to construct and ignore), refused at
202+
// authoring. Asserted on the envelope — the
202203
// issue code, the key it sits on, and the spelling it prescribes — never on a
203204
// bare `success: false`, which a schema refusing for some OTHER reason (a
204205
// credential, a placeholder) would satisfy identically. The driver-local mirror

‎packages/spec/src/data/driver/turso.zod.ts‎

Lines changed: 16 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -78,34 +78,37 @@ export const TursoTransportModeSchema = z.enum(['local', 'replica', 'remote'])
7878
export type TursoTransportMode = z.input<typeof TursoTransportModeSchema>;
7979

8080
// ==========================================================================
81-
// 1b. Transport coherence — what `new TursoDriver` refuses or ignores
81+
// 1b. Transport coherence — what `new TursoDriver` refuses
8282
// ==========================================================================
8383
//
8484
// #19977. `url`, `syncUrl`, `mode` and `timeoutMs` each parsed on their own,
8585
// so this shape accepted combinations the driver refuses at construction
86-
// (`VALIDATION_ERROR` / 400) — or constructs and then ignores. Authoring now
87-
// refuses exactly those, with the supported spelling in the message:
86+
// (`VALIDATION_ERROR` / 400) — or, until #20200, constructed and then ignored.
87+
// Authoring now refuses exactly those, with the supported spelling in the
88+
// message:
8889
//
8990
// - a local or replica mode (forced by `mode`, or selected by `syncUrl`
9091
// beside a `file:` / `:memory:` url, or by a url that is none of those)
9192
// on a url its local SQLite engine cannot open: a remote url, or anything
9293
// that is not a `file:` url or `:memory:` (a bare path, another scheme);
9394
// - a replica on an in-memory url;
9495
// - `timeoutMs` beside a `wss://` / `ws://` url in remote mode;
95-
// - `syncUrl` under a forced `mode: 'remote'`, which the driver accepts and
96-
// then IGNORES: the remote client is built without it, no sync ever runs,
97-
// and the driver's sync call fails as not supported while its sync-enabled
98-
// check still answers true. That arm has no constructor refusal behind it;
99-
// it is refused here because a declared setting that changes nothing is
100-
// the shape ADR-0049 does not ship.
96+
// - `syncUrl` under a forced `mode: 'remote'`, which the driver used to accept
97+
// and then IGNORE: the remote client was built without it, no sync ever
98+
// ran, and the driver's sync call failed as not supported while its
99+
// sync-enabled check still answered true. It was refused here first,
100+
// because a declared setting that changes nothing is the shape ADR-0049
101+
// does not ship; since #20200 the constructor refuses it too, in this
102+
// arm's own words.
101103
//
102104
// The predicates MIRROR the constructor's on `main` (`localEngineDefect`,
103105
// `refuseWebSocketTimeout` and `detectMode` in
104106
// `packages/drivers/driver-turso/src/turso-driver.ts`): a scheme matches in
105107
// any letter case, `:memory:` is matched exactly, and a `file:` url whose path
106108
// is `:memory:` (or starts `:memory:?`) is in-memory. Nothing the constructor
107-
// accepts is refused here, the `syncUrl`-under-`mode: 'remote'` arm aside. The
108-
// url is classified TRIMMED, because
109+
// accepts is refused here: the one former exception, the
110+
// `syncUrl`-under-`mode: 'remote'` arm, has been a constructor refusal too
111+
// since #20200. The url is classified TRIMMED, because
109112
// both loaders trim it before construction (`resolveTursoUrl` in
110113
// `@objectstack/service-datasource`); `syncUrl` counts when it is a non-empty
111114
// string, as `buildTursoDriverConfig` forwards it. The driver-local mirror
@@ -467,8 +470,8 @@ export const TursoConfigSchema = lazySchema(() => strictObject(
467470
+ 'nothing.',
468471
});
469472
}
470-
// What the driver refuses at construction, or constructs and ignores —
471-
// see `tursoTransportIssues` above the shape.
473+
// What the driver refuses at construction — see `tursoTransportIssues`
474+
// above the shape.
472475
for (const issue of tursoTransportIssues(cfg)) {
473476
ctx.addIssue({ code: 'custom', path: [issue.path], message: issue.message });
474477
}

‎packages/spec/src/migrations/entries/semantic/18.turso-config-transport-mismatch-refused.ts‎

Lines changed: 15 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -5,10 +5,11 @@ import type { SemanticMigration } from '../../types.js';
55
// The AUTHORING half of the turso driver's constructor refusals. The driver
66
// refuses these configurations when it is built; this entry records that the
77
// datasource contract now refuses them where they are written, together with
8-
// the one combination the driver builds and then ignores. A structured TODO,
9-
// not a D2 conversion: which way out an author wants — a remote database, an
10-
// embedded replica on a local file, or a plain local file — is intent no
11-
// artifact records.
8+
// the one combination the driver used to build and then ignore (syncUrl under
9+
// a forced remote mode), which the constructor refuses too since #20200. A
10+
// structured TODO, not a D2 conversion: which way out an author wants — a
11+
// remote database, an embedded replica on a local file, or a plain local
12+
// file — is intent no artifact records.
1213
export const entry: SemanticMigration = {
1314
id: 'turso-config-transport-mismatch-refused',
1415
// No backticks in `surface` — build-upgrade-guide renders it inside a code
@@ -35,14 +36,16 @@ export const entry: SemanticMigration = {
3536
'#19977. Each key parsed on its own, so the contract accepted configurations the turso driver '
3637
+ 'refuses when it is built (VALIDATION_ERROR / 400 from the constructor, since the #19893 '
3738
+ 'and #19976 changes) — a datasource published clean and then failed at boot or at test '
38-
+ 'connection. One more it builds and then ignores: syncUrl under a forced remote mode, where '
39-
+ 'the remote client is created without it, no sync ever runs and the sync call fails as not '
40-
+ 'supported while the driver reports sync as enabled (measured on the built driver). '
41-
+ 'Authoring now refuses exactly the constructor\'s refused set — the same predicates, a '
42-
+ 'scheme matched in any letter case, the url read trimmed as both datasource loaders hand it '
43-
+ 'over — plus that ignored key, which is the declared-but-not-enforced shape ADR-0049 does '
44-
+ 'not ship. Nothing the constructor accepts is refused, that key aside: a forced remote mode '
45-
+ 'keeps its url unjudged, as the constructor does. Stored datasource rows are not re-parsed '
39+
+ 'connection. One more it built and then ignored until #20200: syncUrl under a forced remote '
40+
+ 'mode, where the remote client was created without it, no sync ever ran and the sync call '
41+
+ 'failed as not supported while the driver reported sync as enabled (measured on the built '
42+
+ 'driver). Authoring now refuses exactly the constructor\'s refused set — the same predicates, '
43+
+ 'a scheme matched in any letter case, the url read trimmed as both datasource loaders hand '
44+
+ 'it over — plus that key, refused at authoring first as the declared-but-not-enforced shape '
45+
+ 'ADR-0049 does not ship, and by the constructor too since #20200. Nothing the constructor '
46+
+ 'accepts is refused (at #19977 that key was the one exception; since #20200 there is none): '
47+
+ 'a forced remote mode keeps its url unjudged, as the constructor does. Stored datasource '
48+
+ 'rows are not re-parsed '
4649
+ 'when they load, so a stored row still reaches the constructor as written; the constructor '
4750
+ 'refuses the first four shapes there already and, since #20200, also refuses syncUrl under '
4851
+ 'a forced remote mode and sync with no syncUrl when the datasource boots. What changes here '

0 commit comments

Comments
 (0)