@wavehouse/chtypes 0.2.2 → 0.3.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +57 -0
- package/dist/discover.d.ts +12 -4
- package/dist/discover.d.ts.map +1 -1
- package/dist/discover.js +13 -16
- package/dist/discover.js.map +1 -1
- package/dist/errors.d.ts +11 -6
- package/dist/errors.d.ts.map +1 -1
- package/dist/errors.js +11 -6
- package/dist/errors.js.map +1 -1
- package/dist/fetch.d.ts +19 -0
- package/dist/fetch.d.ts.map +1 -1
- package/dist/fetch.js +104 -33
- package/dist/fetch.js.map +1 -1
- package/dist/ffi.d.ts +39 -3
- package/dist/ffi.d.ts.map +1 -1
- package/dist/ffi.js +132 -7
- package/dist/ffi.js.map +1 -1
- package/dist/format.d.ts +27 -8
- package/dist/format.d.ts.map +1 -1
- package/dist/format.js +27 -8
- package/dist/format.js.map +1 -1
- package/dist/index.d.ts +3 -3
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +2 -2
- package/dist/index.js.map +1 -1
- package/dist/library.d.ts +66 -3
- package/dist/library.d.ts.map +1 -1
- package/dist/library.js +79 -3
- package/dist/library.js.map +1 -1
- package/dist/registry.d.ts +109 -30
- package/dist/registry.d.ts.map +1 -1
- package/dist/registry.js +175 -67
- package/dist/registry.js.map +1 -1
- package/dist/results.d.ts +84 -3
- package/dist/results.d.ts.map +1 -1
- package/dist/results.js +96 -19
- package/dist/results.js.map +1 -1
- package/dist/schema.d.ts +99 -12
- package/dist/schema.d.ts.map +1 -1
- package/dist/schema.js +45 -9
- package/dist/schema.js.map +1 -1
- package/dist/transform.d.ts.map +1 -1
- package/dist/transform.js +6 -0
- package/dist/transform.js.map +1 -1
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -4,6 +4,63 @@ All notable changes to the ts binding. The format is [Keep a Changelog](https://
|
|
|
4
4
|
|
|
5
5
|
The four bindings in this repository are released together and give one answer, so an entry here has a counterpart in the other three.
|
|
6
6
|
|
|
7
|
+
## [Unreleased]
|
|
8
|
+
|
|
9
|
+
## [0.3.1] — 2026-09-26
|
|
10
|
+
|
|
11
|
+
Speaks ABI revision 5, unchanged from 0.3.0: every artifact 0.3.0 loads, this release loads.
|
|
12
|
+
|
|
13
|
+
### Changed
|
|
14
|
+
|
|
15
|
+
- **The publish-window retry (`docs/guides/fetch.md` §3a) now also covers a release-level file whose hash disagrees with its `SHA256SUMS` row** — `sdk-goldens.json`, checked after the requested artifact has already installed, since it is best-effort and never blocks that install — and the retry budget widened from 3 attempts ~10s apart to 5 attempts with delays doubling from 4s (4/8/16/32s, ~60s of sleep, ~70s of wall time with network latency). The artifacts host's edge cache can hold a stale pairing of `SHA256SUMS`, its signature, `index.json` or `sdk-goldens.json` for up to its measured 60-second `Cache-Control: max-age`, wider than the original ~10s budget covered. Every retry now re-reads the WHOLE consistent set fresh — never one freshly re-fetched object checked against another attempt's stale one. A release-level file mismatch that never heals still leaves the golden tests skipping loudly, exactly as before, and never fails the fetch that asked for the artifact (issue #223).
|
|
16
|
+
|
|
17
|
+
## [0.3.0] — 2026-09-22
|
|
18
|
+
|
|
19
|
+
### Added
|
|
20
|
+
|
|
21
|
+
- **Identifier and literal quoting now come from ClickHouse itself: `QuoteIdentifier`, `QuoteIdentifierIfNeeded` and `QuoteLiteral` on a loaded library** (issue #52; each binding spells the three in its own idiom — the parity contract's `library.quote-*` rows carry the four spellings). Each is a passthrough over `chs_quote_identifier`, `chs_quote_identifier_if_needed` or `chs_quote_literal` — the vendored `backQuote`, `backQuoteIfNeed` and `quoteString` that the server's own formatter runs — and nothing else. **`QuoteLiteral` is new surface**: a string value as a ClickHouse string literal, quotes and escapes included, which is exactly what a caller splicing a value into DDL text needed (the value-injection recipe in `docs/guides/transformations.md` told the caller to do it themselves, because no binding exported it). Inputs are **counted**, not NUL-terminated, so a value carrying a NUL byte is quoted correctly; the answer is escaped and therefore NUL-free. They hang off a loaded library rather than off the package because the answers are the LOADED BUILD's own, and `QuoteIdentifierIfNeeded`'s differ between ClickHouse lines — `all`, `distinct`, `table` and `null` are back-quoted on every line this release was tested against, `select` from 26.3, `from` and `values` from 26.5, and `where` stays bare throughout. That is the server's own list of names it treats as problematic unquoted, not a keyword class: do not read it as one. The three symbols joined ABI revision 5 without a revision bump, so an artifact built from a revision-5 header that predates them still reports revision 5 and does not export them; all four bindings degrade to their own "this artifact predates the symbol" decline rather than failing to load. **The per-line answers are not pinned by any test in this repository yet** — they need a revision-5 artifact, none of which is fetchable, and are deferred (#119).
|
|
22
|
+
- **This binding now speaks ABI revision 5** — the explicit INSERT column list. `Schema#row`, `Schema#rows` (and its export channel) and `Schema#parseBlock` all gain the option: name the columns this data supplies, and the server computes the rest with them in scope for their DEFAULTs. `row()` and `parseBlock()` take the new `RowOptions` (just `columns` — the revision-3 export/doc-flag channels are meaningless on either, so that type does not offer them); `rows()` keeps `RowsOptions`, which now `extends RowOptions` to add `exportFormat` and `docFlags`. Absent or an empty array is the no-list behavior of every earlier revision; a listed `EPHEMERAL` column's value is read and is in scope for the DEFAULTs that reference it, and is still never stored and never exported. An unknown name, an `ALIAS` column or a repeated name is the server's own refusal (codes 16, 16 and 15), surfaced through the row/batch outcome exactly as it arrives — nothing is validated locally.
|
|
23
|
+
- **This release requires revision-5 artifacts.** A revision-4 artifact — everything published so far — is refused at load, naming both numbers (`chtypes: <path> reports ABI revision 4, this binding speaks 5; refusing to call through mismatched declarations`).
|
|
24
|
+
- **`Source.EphemeralInput` / `Source.MaterializedInput`** name `columns_json`'s two new `Value.source` provenances (revision 5, issue #53): a listed `EPHEMERAL` column's read value (`'ephemeral_input'`) and a listed `MATERIALIZED` column's supplied value under `insert_allow_materialized_columns=1` (`'materialized_input'` — stored, replacing the expression). `Source` is a plain const object plus a union type, the same shape as `Reason`, not a TypeScript `enum` — an unrecognized `source` from a newer artifact must pass through, not throw. **The two get opposite treatment in `RowResult.values`**: `'ephemeral_input'` is never stored, so it is excluded from `values` exactly as `'skipped'` already is — reported only through the per-column result document, never through `values`. `'materialized_input'` IS stored, so it stays IN `values`. The artifact-backed behavior tests (a listed EPHEMERAL/MATERIALIZED column actually producing these values end to end) need a revision-5 artifact, none of which is fetchable yet, and are deferred; the `values` membership rule itself was decidable without one, since "never stored" is definitional rather than something an artifact reveals.
|
|
25
|
+
- **`Source.Skipped`** names the `source` provenance the `'skipped'` string has always carried (`MATERIALIZED`/`ALIAS`/`EPHEMERAL`, never read from an input row). The exclusion it names from `RowResult.values` predates revision 5 and was already correct — `rowResultOf` has special-cased it from the start — it simply had no named constant, only the bare string literal `'skipped'` at the one call site that checks it. Added to the `Source` const object alongside `EphemeralInput` / `MaterializedInput`, in the same idiom, so the parity manifest's `results.skipped-excluded-from-values` rule can be keyed on a real symbol instead of four bindings agreeing on a bare literal by coincidence (issue #90). No behavior change: `rowResultOf` compares against the same string either way.
|
|
26
|
+
- **`Source.DefaultSubstituted`** names the `source` provenance the `'default_substituted'` string has always carried: a VOLATILE DEFAULT this library resolved locally, which the caller MUST echo as an explicit column on any later INSERT. `rowResultOf` has populated `substituted` for exactly this src value from the start; like `Source.Skipped` before it, it simply had no named constant, only the bare string literal `'default_substituted'` at the one call site that checks it. Added to the `Source` const object in the same idiom, so the parity manifest's `results.default-substituted-populates-substituted` rule can be keyed on a real symbol instead of four bindings agreeing on a bare literal by coincidence (issue #122). No behavior change: `rowResultOf` compares against the same string either way.
|
|
27
|
+
- **`Schema#rows` gains `RowsOptions#rowFilter`** (revision 5, second half — issue #54, `docs/guides/filters.md` §Exporting only the rows a filter admits): attach a compiled `Filter` to the export channel and get ONE `chs_rows` parse that answers both a per-row filter verdict (`RowResult#verdict`, the same `Verdict` `Filter#rows` already answers) and, for verdict `'t'` rows, the export bytes. `'e'` (the predicate threw) and `'d'` (declined — including a row whose own `outcome` was not `'accepted'`) are NEVER exported and NEVER collapsed into `'f'`: collapsing either inverts fail-closed into fail-open, the leak class this vocabulary exists to prevent. `BatchResult#rowsPassed`/`#rowsCut` join the result. A filter compiled over a different `Schema` of the same loaded library rejects the whole call, loudly (code 1002); one from a different loaded library throws `ChtypesError` before any C call. The lifetime mechanism is the one `compileFilter` already established — reused, not duplicated. The artifact-backed behavior tests need a revision-5 artifact, none of which is fetchable yet, and are deferred; the decode rule and the cross-library refusal were both decidable without one, and are unit-tested against a hand-built document and fake handles.
|
|
28
|
+
- **`CSVWithNames` = 10 and `TSVWithNames` = 11 join the `chs_format` set** (issue #55; ClickHouse's own format names, which each binding spells in its own idiom). **Both numbers are frozen from the day they ship**, like every other `chs_format` value: they are what crosses the C boundary, and they are never renumbered. Each is CSV / TSV whose first row is a header naming the columns, so the data is addressed by name rather than by position. With an INSERT column list as well, the list decides the block and the header decides the layout: a listed column the header omits takes its `DEFAULT` under `input_format_defaults_for_omitted_fields=1` and the reader's zero under `0`, an unlisted column the header names is an unknown field, and an unlisted column takes its `DEFAULT` whatever that setting says. **Header-name matching differs by ClickHouse line: exact through 26.4, case-insensitive from 26.5**, exactly as those servers do, so the same header can bind differently on either side of that boundary. As an export format both are the existing loud decline. They joined the set inside ABI revision 5 without a revision bump, so an artifact built from a revision-5 header that predates them still reports revision 5 and does not know them: **probe the artifact before declaring either format** (`docs/reference/bindings.md` §Values a binding must accept and reject). The round trip through a real artifact needs a revision-5 artifact that supports them, none of which is fetchable yet, and is deferred (#119).
|
|
29
|
+
|
|
30
|
+
### Changed
|
|
31
|
+
|
|
32
|
+
- **BREAKING: `QuoteIdentifier` ALWAYS quotes**, and it is a call into the loaded library rather than a function of this binding (issue #52). It used to quote only where it decided quoting was needed, from a hand-written copy of ClickHouse's rule living in the binding; that copy is deleted, not kept as a fallback, because two implementations of one rule is how it came to disagree with the server in the first place. **This changes the bytes a caller gets back** — a name that used to come back bare now comes back quoted — so it can move a cached key, a golden file or a stored test expectation even where the SQL means the same thing. **The one-line migration for a caller who genuinely wanted the old shape is `QuoteIdentifierIfNeeded`**, which is that behavior under a name that says so; read the next two entries before assuming it is byte-for-byte what you had.
|
|
33
|
+
|
|
34
|
+
- **`QuoteIdentifierIfNeeded` returns `` `all` ``, `` `distinct` ``, `` `table` `` and `` `null` `` back-quoted**, where the hand-written copy returned all four bare. The server back-quotes them on every ClickHouse line this release was tested against, so the copy was simply wrong, and a bare `null` is exactly the shape that parses as something else. This is a behavior change **on top of** the breaking one above: a caller who migrates from `QuoteIdentifier` to `QuoteIdentifierIfNeeded` to keep the old shape still gets different bytes for these four names. Which further names it quotes is the loaded build's own rule and moves between lines (`select` from 26.3, `from` and `values` from 26.5, while `where` stays bare), so an answer cached across versions was never safe and is now visibly so.
|
|
35
|
+
|
|
36
|
+
- **`QuoteIdentifier` emits the BACKSLASH spelling for an embedded back-quote** — `` `a\`b` `` — where the deleted copy doubled it (``` `a``b` ```). Both spellings parse, on every line, and both round-trip to the same column name; only one is what the server itself prints. That is how two hand-written quoters can each look correct and still disagree, and it is the same failure that produced the `null` divergence above. A caller comparing quoted text against a stored string, rather than passing it straight into DDL, must expect the new spelling.
|
|
37
|
+
|
|
38
|
+
- **BREAKING: reconstructing DDL from discovered columns is a method on a loaded library.** It was a free function; it is not one any more, because the single thing it spells — the column NAME — is now spelled by the library's own `QuoteIdentifier` instead of by a rule in the binding. Resolve the artifact first (the server's own version string already decides which one) and call reconstruction on it; the arguments, the return and every refusal are unchanged, and the declaration list it produces differs only in how the names are spelled. This was not in the issue's own scope — it is the unavoidable consequence of deleting the hand-written rule, since nothing else in the binding could spell a name afterwards.
|
|
39
|
+
|
|
40
|
+
- **BREAKING: loading is lazy by default, and `preload` is the one eager path.** `new Registry()` picked the first search-path directory holding artifacts and `dlopen`ed **every** artifact under it — whether or not `dir` was passed, so the search-path constructor the guides called safe was eager here too. It now reads the `manifest.json` files on the whole search path and opens nothing. Nothing in this package opens an artifact except a request for a specific version (`for()` / `open()`) or an explicit `preload`. Measured on seven artifacts in one directory: **1.096 s and 351 MB resident** to open them all at construction against **1 ms and 66.8 MB** to open none (#50).
|
|
41
|
+
|
|
42
|
+
**What a caller who relied on eager opening must do:** name the lines. `new Registry(dir, { preload: ['25.8', '26.7'] })` opens exactly those, in order, before the constructor returns — deliberately a list rather than "everything in the directory", because a registry directory is whatever a fetch left behind and each line costs about 120 MB resident. An entry no directory on the search path holds is `ArtifactMissingError` at construction: the same §7 error the first `for()` would have thrown, thrown earlier. `preload` never fetches, even with `autofetch` on — this constructor is synchronous and `ensure()` is not, and autofetch stays a first-use behavior.
|
|
43
|
+
|
|
44
|
+
**What moved, and where it moved to.** Construction still throws for a directory named explicitly (the argument or `CHTYPES_REGISTRY`) that does not exist, and for a search path on which no directory holds an artifact — both suppressed by `autofetch`, as before. A failed checksum, a load failure, a refused ABI revision and a library whose ClickHouse version disagrees with its manifest are now reported by the call that opens the line. A registry over a directory holding a corrupt 25.8 and a good 26.7 used to fail at construction and serve neither; it now constructs, serves 26.7, and throws on the call that asks for 25.8.
|
|
45
|
+
|
|
46
|
+
- **BREAKING: `versions()` means "every line this registry can answer for", loaded OR discovered.** It listed what was LOADED, where Go, Python and Rust list both. That was invisible only because construction had loaded everything — and it would have been `[]` for a full directory the moment it did not. It is now answered from the construction-time manifest scan, in the same numeric release order, and it opens nothing. `libraries()` is unchanged: what is open right now (#50).
|
|
47
|
+
|
|
48
|
+
- **`verifyChecksums` is unchanged, and the timing is now stated: a library's checksum is computed immediately before that library is `dlopen`ed, and at no other time** — at construction for the `preload`ed lines, at first use for the rest, never for a line nobody asks for. It is a policy on the registry, not a property of the preload list: a lazily-opened line is hashed too (#50).
|
|
49
|
+
|
|
50
|
+
- **BREAKING: `library_bytes` is now checked on EVERY load, not only under `verifyChecksums`** (issue #82, split out of #50 so the behavior change was not hidden inside a larger one). The size check — the file's actual length against the manifest's `library_bytes` — used to run only when verification was on, bundled inside the sha256 comparison; Go and Python agreed with TypeScript on that, and Rust did not, checking bytes unconditionally on every load. It is nearly free (one `stat`, never a re-hash of the library's contents) and it catches the commonest shape of a broken artifact directory — a truncated or partially-written library file — so all four bindings now check it unconditionally, and TypeScript stops being three of the four that didn't.
|
|
51
|
+
|
|
52
|
+
**What changes for a caller who never asked for verification:** an artifact directory whose manifest carries a `library_bytes` that does not match the file on disk now fails the load (`for()`, `open()`, and `preload`, which all route through the same internal loader) with `chtypes: <path> is <n> bytes, manifest says <m>`, refused before `dlopen` is ever attempted. Before this change the same directory reached `dlopen` regardless — usually failing there too, with a less specific error, though a stale-rather-than-corrupt manifest could pass through unnoticed. A manifest with no `library_bytes` at all (`undefined`, its shape for one that predates the field) is unaffected either way: this was never, and is still not, a reason a load fails for a directory with no size to check against.
|
|
53
|
+
|
|
54
|
+
**Timing, read together with `verifyChecksums`'s rule above:** the size check runs at the exact same point the hash check does — immediately before `dlopen`, at construction for `preload`ed lines and at first use for the rest — because the internal loader is the one place both checks live, whether or not verification is on.
|
|
55
|
+
|
|
56
|
+
- **CSV and TSV rejection messages are now ClickHouse's own text** (with revision-5 artifacts). The error **codes are unchanged**, and so is every verdict and every stored value; only the human-readable message moved, because CSV and TSV rows are now read by ClickHouse's own readers rather than hand-written splitters. A CSV row the reader rejects now carries an **empty `cols` list**, where the previous path could report a partial one. **Match on the error code, never on the message text** — the message is ClickHouse's to change between releases.
|
|
57
|
+
|
|
58
|
+
- **An empty CSV field under `input_format_defaults_for_omitted_fields=0` is now reported as an input, and its coercion as a transform** (with revision-5 artifacts). Where the previous reader reported no transform, the detector now reports one, because the field's reference value is the empty string rather than absent. The reason follows the column's type — measured as `enum_coerce` for an `Enum`, `fixedstring_pad` for a `FixedString`, and `uuid_mangle` for a `UUID` (the zero UUID). **Stored values are unchanged** — this changes what is reported, not what is stored. A caller that reads "no transform" as "the value was not changed" should expect these rows to report one. Under the default setting (`1`) an empty field still takes the column's `DEFAULT`, as before. **TSV is not affected:** its reader takes an empty field through the typed parse whether the setting is on or off, exactly as the previous splitter did.
|
|
59
|
+
|
|
60
|
+
- **An unlisted column now takes its `DEFAULT` regardless of `input_format_defaults_for_omitted_fields` when a column list is present** (with revision-5 artifacts). With an INSERT column list, a column the list does not name is computed from its `DEFAULT` expression under `input_format_defaults_for_omitted_fields=0` as well as under the default `1`. This is a fix in the artifact that rides revision 5, and it applies to **every format**, not only `CSVWithNames` and `TSVWithNames`.
|
|
61
|
+
|
|
62
|
+
- **The rolling artifacts channel now serves ABI revision 5.** A 0.2.x consumer that fetches from the default channel will download an artifact its bindings **refuse at load** — correct behavior that looks exactly like a broken install. ⚠️ **Pinning an exact ClickHouse version does not avoid this**: a relink republishes the same `clickhouse_version`, and an exact request resolves to the highest-ranked matching row, which is the revision-5 one. The only way to stay on revision 4 is `--url` / `--tag` pointed at a source that still serves revision-4 artifacts, if one is retained. **Upgrading to 0.3.0 is the supported path.**
|
|
63
|
+
|
|
7
64
|
## [0.2.2] — 2026-09-17
|
|
8
65
|
|
|
9
66
|
No functional change in this binding. This release ships together with the other three because the four give one answer, not because anything here moved.
|
package/dist/discover.d.ts
CHANGED
|
@@ -8,7 +8,7 @@
|
|
|
8
8
|
*
|
|
9
9
|
* profile.version -> Registry#for / the artifact to load
|
|
10
10
|
* profile.settings -> compileDdl({ settings }) (compile-time) and per-call settings
|
|
11
|
-
* columns -> reconstructDdl -> compileDdl
|
|
11
|
+
* columns -> Library#reconstructDdl -> compileDdl
|
|
12
12
|
*
|
|
13
13
|
* The pattern, in full (docs/reference/bindings.md §Discovery):
|
|
14
14
|
*
|
|
@@ -98,13 +98,20 @@ export declare function parseChangedSettingsResult(body: Uint8Array | string): R
|
|
|
98
98
|
*
|
|
99
99
|
* @param body - the query result bytes (or text) as the server sent them.
|
|
100
100
|
* @returns one `DiscoveredColumn` per row, in the query's position order —
|
|
101
|
-
* feed `reconstructDdl`.
|
|
101
|
+
* feed `Library#reconstructDdl`.
|
|
102
102
|
* @throws {ChtypesError} when a row is malformed, lacks `name`/`type`, or the
|
|
103
103
|
* body holds no rows at all (wrong database/table, or no access).
|
|
104
104
|
*/
|
|
105
105
|
export declare function parseColumnsResult(body: Uint8Array | string): DiscoveredColumn[];
|
|
106
106
|
/**
|
|
107
|
-
*
|
|
107
|
+
* The body of `Library#reconstructDdl`, with the identifier quoting HANDED IN
|
|
108
|
+
* rather than computed here.
|
|
109
|
+
*
|
|
110
|
+
* `quote` is the loaded library's own `quoteIdentifier`. This module used to
|
|
111
|
+
* spell the rule itself and the copy disagreed with the server (issue #52);
|
|
112
|
+
* nothing in this file decides how a name is spelled.
|
|
113
|
+
*
|
|
114
|
+
* Turns `QUERY_TABLE_COLUMNS`' rows back into the column-declaration list
|
|
108
115
|
* `compileDdl` takes. It is a spelling exercise, not a semantic one: types
|
|
109
116
|
* and expressions are the server's own text, passed through verbatim, and the
|
|
110
117
|
* library's own compile is the judge of the result.
|
|
@@ -125,10 +132,11 @@ export declare function parseColumnsResult(body: Uint8Array | string): Discovere
|
|
|
125
132
|
* EPHEMERAL column may legitimately have an empty `default_expression`.
|
|
126
133
|
*
|
|
127
134
|
* @param cols - the discovered columns, e.g. from `parseColumnsResult`.
|
|
135
|
+
* @param quote - the library's own `quoteIdentifier`.
|
|
128
136
|
* @returns the column-declaration list for `Library#compileDdl`.
|
|
129
137
|
* @throws {ChtypesError} when a column is inconsistent: no name/type, a
|
|
130
138
|
* `default_expression` with no kind, a DEFAULT/MATERIALIZED/ALIAS kind with
|
|
131
139
|
* no expression, an unknown kind, or no columns at all.
|
|
132
140
|
*/
|
|
133
|
-
export declare function
|
|
141
|
+
export declare function reconstructDdlWith(cols: readonly DiscoveredColumn[], quote: (name: string) => string): string;
|
|
134
142
|
//# sourceMappingURL=discover.d.ts.map
|
package/dist/discover.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"discover.d.ts","sourceRoot":"","sources":["../src/discover.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA6BG;AAUH;;;GAGG;AACH,eAAO,MAAM,oBAAoB,mDAAmD,CAAC;AAErF;;;;;;GAMG;AACH,eAAO,MAAM,sBAAsB,6EAA6E,CAAC;AAEjH;;;;;;GAMG;AACH,eAAO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AAC;IACzB,gFAAgF;IAChF,QAAQ,CAAC,QAAQ,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;CAC3C;AAED,wCAAwC;AACxC,MAAM,WAAW,gBAAgB;IAC/B,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,8DAA8D;IAC9D,QAAQ,CAAC,WAAW,EAAE,MAAM,CAAC;IAC7B,QAAQ,CAAC,iBAAiB,EAAE,MAAM,CAAC;IACnC,QAAQ,CAAC,QAAQ,EAAE,MAAM,CAAC;CAC3B;AAsED;;;;;;;GAOG;AACH,wBAAgB,kBAAkB,CAAC,IAAI,EAAE,UAAU,GAAG,MAAM,GAAG,MAAM,CAcpE;AAED;;;;;;;;GAQG;AACH,wBAAgB,0BAA0B,CAAC,IAAI,EAAE,UAAU,GAAG,MAAM,GAAG,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAc5F;AAED;;;;;;;;;;;;;GAaG;AACH,wBAAgB,kBAAkB,CAAC,IAAI,EAAE,UAAU,GAAG,MAAM,GAAG,gBAAgB,EAAE,CA2BhF;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAkCG;AACH,wBAAgB,kBAAkB,CAChC,IAAI,EAAE,SAAS,gBAAgB,EAAE,EACjC,KAAK,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,MAAM,GAC9B,MAAM,CAmCR"}
|
package/dist/discover.js
CHANGED
|
@@ -8,7 +8,7 @@
|
|
|
8
8
|
*
|
|
9
9
|
* profile.version -> Registry#for / the artifact to load
|
|
10
10
|
* profile.settings -> compileDdl({ settings }) (compile-time) and per-call settings
|
|
11
|
-
* columns -> reconstructDdl -> compileDdl
|
|
11
|
+
* columns -> Library#reconstructDdl -> compileDdl
|
|
12
12
|
*
|
|
13
13
|
* The pattern, in full (docs/reference/bindings.md §Discovery):
|
|
14
14
|
*
|
|
@@ -180,7 +180,7 @@ export function parseChangedSettingsResult(body) {
|
|
|
180
180
|
*
|
|
181
181
|
* @param body - the query result bytes (or text) as the server sent them.
|
|
182
182
|
* @returns one `DiscoveredColumn` per row, in the query's position order —
|
|
183
|
-
* feed `reconstructDdl`.
|
|
183
|
+
* feed `Library#reconstructDdl`.
|
|
184
184
|
* @throws {ChtypesError} when a row is malformed, lacks `name`/`type`, or the
|
|
185
185
|
* body holds no rows at all (wrong database/table, or no access).
|
|
186
186
|
*/
|
|
@@ -214,18 +214,14 @@ export function parseColumnsResult(body) {
|
|
|
214
214
|
return out;
|
|
215
215
|
}
|
|
216
216
|
/**
|
|
217
|
-
*
|
|
218
|
-
*
|
|
219
|
-
*
|
|
220
|
-
*
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
return '`' + name.replaceAll('`', '``') + '`';
|
|
226
|
-
}
|
|
227
|
-
/**
|
|
228
|
-
* Turn `QUERY_TABLE_COLUMNS`' rows back into the column-declaration list
|
|
217
|
+
* The body of `Library#reconstructDdl`, with the identifier quoting HANDED IN
|
|
218
|
+
* rather than computed here.
|
|
219
|
+
*
|
|
220
|
+
* `quote` is the loaded library's own `quoteIdentifier`. This module used to
|
|
221
|
+
* spell the rule itself and the copy disagreed with the server (issue #52);
|
|
222
|
+
* nothing in this file decides how a name is spelled.
|
|
223
|
+
*
|
|
224
|
+
* Turns `QUERY_TABLE_COLUMNS`' rows back into the column-declaration list
|
|
229
225
|
* `compileDdl` takes. It is a spelling exercise, not a semantic one: types
|
|
230
226
|
* and expressions are the server's own text, passed through verbatim, and the
|
|
231
227
|
* library's own compile is the judge of the result.
|
|
@@ -246,12 +242,13 @@ function backquoteIfNeeded(name) {
|
|
|
246
242
|
* EPHEMERAL column may legitimately have an empty `default_expression`.
|
|
247
243
|
*
|
|
248
244
|
* @param cols - the discovered columns, e.g. from `parseColumnsResult`.
|
|
245
|
+
* @param quote - the library's own `quoteIdentifier`.
|
|
249
246
|
* @returns the column-declaration list for `Library#compileDdl`.
|
|
250
247
|
* @throws {ChtypesError} when a column is inconsistent: no name/type, a
|
|
251
248
|
* `default_expression` with no kind, a DEFAULT/MATERIALIZED/ALIAS kind with
|
|
252
249
|
* no expression, an unknown kind, or no columns at all.
|
|
253
250
|
*/
|
|
254
|
-
export function
|
|
251
|
+
export function reconstructDdlWith(cols, quote) {
|
|
255
252
|
if (cols.length === 0) {
|
|
256
253
|
throw new ChtypesError('chtypes: no columns to reconstruct');
|
|
257
254
|
}
|
|
@@ -261,7 +258,7 @@ export function reconstructDdl(cols) {
|
|
|
261
258
|
if (c.name === '' || c.type === '') {
|
|
262
259
|
throw new ChtypesError(`chtypes: column ${i} has no name/type`);
|
|
263
260
|
}
|
|
264
|
-
let decl = `${
|
|
261
|
+
let decl = `${quote(c.name)} ${c.type}`;
|
|
265
262
|
switch (c.defaultKind) {
|
|
266
263
|
case '':
|
|
267
264
|
if (c.defaultExpression !== '') {
|
package/dist/discover.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"discover.js","sourceRoot":"","sources":["../src/discover.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA6BG;AAEH,OAAO,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AAC3C,OAAO,EAAE,QAAQ,EAAE,cAAc,EAAE,OAAO,EAAa,MAAM,WAAW,CAAC;AAEzE,yEAAyE;AACzE,sEAAsE;AACtE,sEAAsE;AACtE,gEAAgE;AAEhE;;;GAGG;AACH,MAAM,CAAC,MAAM,oBAAoB,GAAG,gDAAgD,CAAC;AAErF;;;;;;GAMG;AACH,MAAM,CAAC,MAAM,sBAAsB,GAAG,0EAA0E,CAAC;AAEjH;;;;;;GAMG;AACH,MAAM,CAAC,MAAM,mBAAmB,GAC9B,gEAAgE;IAChE,8EAA8E;IAC9E,sCAAsC,CAAC;AAwBzC,MAAM,QAAQ,GAAG,CAAC,IAAyB,EAAU,EAAE,CACrD,OAAO,IAAI,KAA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.ts
CHANGED
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
*
|
|
5
5
|
* - ClickHouse rejects -> a real ClickHouse error code
|
|
6
6
|
* - this build refuses -> CODE_UNSUPPORTED (-2), never a ClickHouse code
|
|
7
|
-
* - ClickHouse accepts but the value cannot be read back -> code 691
|
|
7
|
+
* - ClickHouse accepts but the value cannot be read back -> usually code 691; it
|
|
8
8
|
* is an ACCEPTED insert, surfaced through the row outcome rather than here.
|
|
9
9
|
*
|
|
10
10
|
* Mapping `unsupported` onto a rejection manufactures an over-reject the product
|
|
@@ -32,12 +32,17 @@ export declare const CODE_UNSUPPORTED = -2;
|
|
|
32
32
|
*
|
|
33
33
|
* Revision 4 (2026-08-31, the filter phase-2 cycle): `chs_filter_compile`
|
|
34
34
|
* gained `params_json` (`{name:Type}` query parameters), and the block twin
|
|
35
|
-
* joined — `chs_block_parse` / `chs_block_free` / `chs_filter_eval`.
|
|
36
|
-
*
|
|
37
|
-
* 5-
|
|
38
|
-
*
|
|
35
|
+
* joined — `chs_block_parse` / `chs_block_free` / `chs_filter_eval`.
|
|
36
|
+
*
|
|
37
|
+
* Revision 5 (2026-09-15, the explicit INSERT column list): `chs_row`,
|
|
38
|
+
* `chs_rows` and `chs_block_parse` each gained a trailing `columns_json` —
|
|
39
|
+
* `RowsOptions#columns`. This binding therefore speaks 5 and refuses
|
|
40
|
+
* revision-4 artifacts — calling the 6-argument `chs_row` (or the
|
|
41
|
+
* 9-argument `chs_rows`, or the 8-argument `chs_block_parse`) through a
|
|
42
|
+
* revision-4 artifact's shorter declaration is undefined behavior, which is
|
|
43
|
+
* exactly what the gate exists to prevent.
|
|
39
44
|
*/
|
|
40
|
-
export declare const ABI_REVISION =
|
|
45
|
+
export declare const ABI_REVISION = 5;
|
|
41
46
|
/** Base class for everything this package throws. */
|
|
42
47
|
export declare class ChtypesError extends Error {
|
|
43
48
|
constructor(message: string, options?: {
|
package/dist/errors.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"errors.d.ts","sourceRoot":"","sources":["../src/errors.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AAEH,0EAA0E;AAC1E,eAAO,MAAM,gBAAgB,KAAK,CAAC;AAEnC
|
|
1
|
+
{"version":3,"file":"errors.d.ts","sourceRoot":"","sources":["../src/errors.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AAEH,0EAA0E;AAC1E,eAAO,MAAM,gBAAgB,KAAK,CAAC;AAEnC;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;AACH,eAAO,MAAM,YAAY,IAAI,CAAC;AAE9B,qDAAqD;AACrD,qBAAa,YAAa,SAAQ,KAAK;IACrC,YAAY,OAAO,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE;QAAE,KAAK,CAAC,EAAE,OAAO,CAAA;KAAE,EAGzD;CACF;AAED,0EAA0E;AAC1E,qBAAa,aAAc,SAAQ,YAAY;CAAG;AAElD;;;;;;;;GAQG;AACH,qBAAa,WAAY,SAAQ,YAAY;IAC3C,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;IACxB,QAAQ,CAAC,MAAM,EAAE,MAAM,GAAG,SAAS,CAAC;IAEpC,YAAY,IAAI,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,CAAC,EAAE,MAAM,EASxD;CACF;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA+BG;AACH,qBAAa,gBAAiB,SAAQ,YAAY;IAChD,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;IACxB,QAAQ,CAAC,MAAM,EAAE,MAAM,GAAG,SAAS,CAAC;IAEpC,YAAY,MAAM,EAAE,MAAM,EAAE,MAAM,CAAC,EAAE,MAAM,EAQ1C;CACF;AAED;;;;;;;;;;;;;GAaG;AACH,wBAAgB,cAAc,CAC5B,IAAI,EAAE,MAAM,EACZ,MAA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
|
* - ClickHouse rejects -> a real ClickHouse error code
|
|
6
6
|
* - this build refuses -> CODE_UNSUPPORTED (-2), never a ClickHouse code
|
|
7
|
-
* - ClickHouse accepts but the value cannot be read back -> code 691
|
|
7
|
+
* - ClickHouse accepts but the value cannot be read back -> usually code 691; it
|
|
8
8
|
* is an ACCEPTED insert, surfaced through the row outcome rather than here.
|
|
9
9
|
*
|
|
10
10
|
* Mapping `unsupported` onto a rejection manufactures an over-reject the product
|
|
@@ -32,12 +32,17 @@ export const CODE_UNSUPPORTED = -2;
|
|
|
32
32
|
*
|
|
33
33
|
* Revision 4 (2026-08-31, the filter phase-2 cycle): `chs_filter_compile`
|
|
34
34
|
* gained `params_json` (`{name:Type}` query parameters), and the block twin
|
|
35
|
-
* joined — `chs_block_parse` / `chs_block_free` / `chs_filter_eval`.
|
|
36
|
-
*
|
|
37
|
-
* 5-
|
|
38
|
-
*
|
|
35
|
+
* joined — `chs_block_parse` / `chs_block_free` / `chs_filter_eval`.
|
|
36
|
+
*
|
|
37
|
+
* Revision 5 (2026-09-15, the explicit INSERT column list): `chs_row`,
|
|
38
|
+
* `chs_rows` and `chs_block_parse` each gained a trailing `columns_json` —
|
|
39
|
+
* `RowsOptions#columns`. This binding therefore speaks 5 and refuses
|
|
40
|
+
* revision-4 artifacts — calling the 6-argument `chs_row` (or the
|
|
41
|
+
* 9-argument `chs_rows`, or the 8-argument `chs_block_parse`) through a
|
|
42
|
+
* revision-4 artifact's shorter declaration is undefined behavior, which is
|
|
43
|
+
* exactly what the gate exists to prevent.
|
|
39
44
|
*/
|
|
40
|
-
export const ABI_REVISION =
|
|
45
|
+
export const ABI_REVISION = 5;
|
|
41
46
|
/** Base class for everything this package throws. */
|
|
42
47
|
export class ChtypesError extends Error {
|
|
43
48
|
constructor(message, options) {
|
package/dist/errors.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"errors.js","sourceRoot":"","sources":["../src/errors.ts"],"names":[],"mappings":"AAAA;;;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AC,0BAA0B,EAAE,OAAO,EAAE,OAAO,CAAC,CAAC;IACtD,CAAC;CACF;AAED;;;GAGG;AACH,MAAM,OAAO,mBAAoB,SAAQ,UAAU;IACjD,YAAY,OAAe,EAAE,OAA6B;QACxD,KAAK,CAAC,yBAAyB,EAAE,OAAO,EAAE,OAAO,CAAC,CAAC;IACrD,CAAC;CACF;AAED,sGAAsG;AACtG,MAAM,OAAO,wBAAyB,SAAQ,UAAU;IACtD,YAAY,OAAe,EAAE,OAA6B;QACxD,KAAK,CAAC,8BAA8B,EAAE,OAAO,EAAE,OAAO,CAAC,CAAC;IAC1D,CAAC;CACF;AAED;;;;GAIG;AACH,MAAM,OAAO,sBAAuB,SAAQ,UAAU;IACpD,YAAY,OAAe,EAAE,OAA6B;QACxD,KAAK,CAAC,4BAA4B,EAAE,OAAO,EAAE,OAAO,CAAC,CAAC;IACxD,CAAC;CACF"}
|
package/dist/fetch.d.ts
CHANGED
|
@@ -212,6 +212,25 @@ export declare function parseSignatureFile(bytes: Uint8Array): {
|
|
|
212
212
|
* @throws {ChtypesError} when an entry is not 64 hex characters.
|
|
213
213
|
*/
|
|
214
214
|
export declare function trustedKeys(explicit?: readonly string[]): string[];
|
|
215
|
+
/**
|
|
216
|
+
* How many times {@link loadRelease} (and {@link installGoldens}'s own retry)
|
|
217
|
+
* reads an HTTP release before giving up, and the BASE delay (ms) before the
|
|
218
|
+
* first retry — each later retry doubles it, so the default 5 attempts sleep
|
|
219
|
+
* 4+8+16+32 = 60s (~70s wall with network time). That is chosen to outlast
|
|
220
|
+
* the artifacts host's edge cache (observed `Cache-Control: max-age=60` on
|
|
221
|
+
* the mutable release objects, so a stale pairing of any of them can persist
|
|
222
|
+
* up to 60s), while a genuine few-second mid-publish window still clears on
|
|
223
|
+
* the second attempt.
|
|
224
|
+
*
|
|
225
|
+
* A mutable object, not two `const`s: an ES module's imported bindings are
|
|
226
|
+
* read-only, so a plain exported `let` could not be reassigned from outside,
|
|
227
|
+
* and the fetch test suite needs to shrink `delayMs` to near zero. Not
|
|
228
|
+
* re-exported from `index.ts` — internal to this module and its test suite.
|
|
229
|
+
*/
|
|
230
|
+
export declare const RELEASE_RETRY: {
|
|
231
|
+
attempts: number;
|
|
232
|
+
delayMs: number;
|
|
233
|
+
};
|
|
215
234
|
/** The one row for a request, or `CHTYPES_ARTIFACT_UNPUBLISHED` naming what the release does have. */
|
|
216
235
|
export declare function selectArtifact(index: ReleaseIndex, platform: string, req: VersionRequest): IndexArtifact;
|
|
217
236
|
/** Every line the release publishes for the platform, newest patch per line, oldest line first. */
|
package/dist/fetch.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"fetch.d.ts","sourceRoot":"","sources":["../src/fetch.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;GA0BG;AAwBH,iGAAiG;AACjG,eAAO,MAAM,qBAAqB,oCAAoC,CAAC;AACvE,kFAAkF;AAClF,eAAO,MAAM,mBAAmB,cAAc,CAAC;AAC/C;;;;GAIG;AACH,eAAO,MAAM,mBAAmB,EAAE,SAAS,MAAM,EAEhD,CAAC;AACF,gFAAgF;AAChF,eAAO,MAAM,WAAW,IAAI,CAAC;AAC7B,qIAAqI;AACrI,eAAO,MAAM,iBAAiB,iBAAiB,CAAC;AAKhD,yEAAyE;AACzE,MAAM,WAAW,aAAa;IAC5B,QAAQ,CAAC,EAAE,EAAE,MAAM,CAAC;IACpB,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,6BAA6B;IAC7B,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;IACxB,2BAA2B;IAC3B,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;IACvB,QAAQ,CAAC,kBAAkB,EAAE,MAAM,CAAC;IACpC,QAAQ,CAAC,gBAAgB,EAAE,MAAM,CAAC;IAClC,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC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CAAC,QAAQ,CAAC,EAAE,MAAM,GAAG,MAAM,CAKzD;AA2DD,gFAAgF;AAChF,wBAAsB,UAAU,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC,CAM9D"}
|
package/dist/fetch.js
CHANGED
|
@@ -335,30 +335,49 @@ async function loadReleaseOnce(source, options, emit) {
|
|
|
335
335
|
}
|
|
336
336
|
return release;
|
|
337
337
|
}
|
|
338
|
-
/**
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
338
|
+
/**
|
|
339
|
+
* How many times {@link loadRelease} (and {@link installGoldens}'s own retry)
|
|
340
|
+
* reads an HTTP release before giving up, and the BASE delay (ms) before the
|
|
341
|
+
* first retry — each later retry doubles it, so the default 5 attempts sleep
|
|
342
|
+
* 4+8+16+32 = 60s (~70s wall with network time). That is chosen to outlast
|
|
343
|
+
* the artifacts host's edge cache (observed `Cache-Control: max-age=60` on
|
|
344
|
+
* the mutable release objects, so a stale pairing of any of them can persist
|
|
345
|
+
* up to 60s), while a genuine few-second mid-publish window still clears on
|
|
346
|
+
* the second attempt.
|
|
347
|
+
*
|
|
348
|
+
* A mutable object, not two `const`s: an ES module's imported bindings are
|
|
349
|
+
* read-only, so a plain exported `let` could not be reassigned from outside,
|
|
350
|
+
* and the fetch test suite needs to shrink `delayMs` to near zero. Not
|
|
351
|
+
* re-exported from `index.ts` — internal to this module and its test suite.
|
|
352
|
+
*/
|
|
353
|
+
export const RELEASE_RETRY = { attempts: 5, delayMs: 4_000 };
|
|
342
354
|
/**
|
|
343
355
|
* {@link loadReleaseOnce}, retried through a publish window.
|
|
344
356
|
*
|
|
345
357
|
* A publish into the rolling release is three objects — `SHA256SUMS`,
|
|
346
358
|
* `SHA256SUMS.sig`, `index.json` — and object storage cannot swap them
|
|
347
|
-
* atomically.
|
|
348
|
-
*
|
|
349
|
-
*
|
|
359
|
+
* atomically. The edge cache in front of the artifacts host widens the unsafe
|
|
360
|
+
* window from "between two uploads" to "as long as any one object can still be
|
|
361
|
+
* served stale from cache", which measures the same as its `Cache-Control`
|
|
362
|
+
* max-age.
|
|
350
363
|
*
|
|
351
|
-
*
|
|
352
|
-
* an index that disagrees with the sums
|
|
353
|
-
*
|
|
354
|
-
*
|
|
355
|
-
*
|
|
364
|
+
* Three symptoms of reading inside that window are retried: a signature under
|
|
365
|
+
* no trusted key, an index that disagrees with the sums, and (in
|
|
366
|
+
* {@link installGoldens}) a release-level file whose hash disagrees with its
|
|
367
|
+
* own SHA256SUMS row, or that the sums list but the source does not yet serve.
|
|
368
|
+
* Every retry re-reads the WHOLE set from scratch — never one freshly
|
|
369
|
+
* re-fetched object checked against another attempt's stale one. Nothing else
|
|
370
|
+
* is retried, and neither are these three once the attempts run out: the same
|
|
371
|
+
* error surfaces, with the same code, as it did before. A tarball whose hash
|
|
372
|
+
* is wrong is never retried; that is the release lying about a byte, not a
|
|
373
|
+
* half-finished upload.
|
|
356
374
|
*
|
|
357
375
|
* Only an HTTP source can be mid-publish, so a `file://` or directory source is
|
|
358
376
|
* read exactly once and refuses on the first look.
|
|
359
377
|
*/
|
|
360
378
|
async function loadRelease(source, options, emit) {
|
|
361
|
-
const attempts = source instanceof HttpSource ?
|
|
379
|
+
const attempts = source instanceof HttpSource ? RELEASE_RETRY.attempts : 1;
|
|
380
|
+
let delayMs = RELEASE_RETRY.delayMs;
|
|
362
381
|
for (let attempt = 1;; attempt++) {
|
|
363
382
|
try {
|
|
364
383
|
return await loadReleaseOnce(source, options, emit);
|
|
@@ -370,9 +389,10 @@ async function loadRelease(source, options, emit) {
|
|
|
370
389
|
emit({
|
|
371
390
|
type: 'status',
|
|
372
391
|
message: `${String(err)} (attempt ${attempt}/${attempts}) — this is what a release being ` +
|
|
373
|
-
`published looks like from outside; retrying in ${
|
|
392
|
+
`published looks like from outside; retrying in ${delayMs / 1000}s`,
|
|
374
393
|
});
|
|
375
|
-
await new Promise((resolve) => setTimeout(resolve,
|
|
394
|
+
await new Promise((resolve) => setTimeout(resolve, delayMs));
|
|
395
|
+
delayMs *= 2;
|
|
376
396
|
}
|
|
377
397
|
}
|
|
378
398
|
}
|
|
@@ -559,7 +579,7 @@ export async function ensureAll(options = {}) {
|
|
|
559
579
|
const out = [];
|
|
560
580
|
for (const art of selectAll(release.index, platform))
|
|
561
581
|
out.push(await installOne(release, art, ctx));
|
|
562
|
-
await installGoldens(release, ctx);
|
|
582
|
+
await installGoldens(release, ctx, options);
|
|
563
583
|
return out;
|
|
564
584
|
}
|
|
565
585
|
/**
|
|
@@ -570,27 +590,78 @@ export async function ensureAll(options = {}) {
|
|
|
570
590
|
*/
|
|
571
591
|
const GOLDENS_ASSET = 'sdk-goldens.json';
|
|
572
592
|
/**
|
|
573
|
-
*
|
|
574
|
-
*
|
|
575
|
-
*
|
|
576
|
-
*
|
|
577
|
-
*
|
|
578
|
-
*
|
|
593
|
+
* One look at the served golden set against an already-verified `sums` map.
|
|
594
|
+
* Resolves `null` when the release simply does not list it (not an error).
|
|
595
|
+
* Throws `ArtifactCorruptError`/`SourceUnreachableError` for the new window
|
|
596
|
+
* symptom — a hash mismatch, or the sums listing it while the source does not
|
|
597
|
+
* (yet) serve it — matching the codes {@link loadRelease}'s own retry
|
|
598
|
+
* recognizes, so {@link installGoldens} can reuse the same retryable check.
|
|
579
599
|
*/
|
|
580
|
-
async function
|
|
581
|
-
const want =
|
|
582
|
-
if (want === undefined)
|
|
583
|
-
|
|
584
|
-
|
|
585
|
-
}
|
|
586
|
-
const blob = await release.source.get(GOLDENS_ASSET);
|
|
600
|
+
async function readGoldensOnce(source, sums) {
|
|
601
|
+
const want = sums.get(GOLDENS_ASSET);
|
|
602
|
+
if (want === undefined)
|
|
603
|
+
return null;
|
|
604
|
+
const blob = await source.get(GOLDENS_ASSET);
|
|
587
605
|
if (blob === null) {
|
|
588
|
-
|
|
589
|
-
return;
|
|
606
|
+
throw new ArtifactCorruptError(`chtypes: SHA256SUMS lists ${GOLDENS_ASSET} but ${source.description} does not serve it — the release disagrees with itself; not installing it`);
|
|
590
607
|
}
|
|
591
608
|
const got = createHash('sha256').update(blob).digest('hex');
|
|
592
609
|
if (got !== want) {
|
|
593
|
-
|
|
610
|
+
throw new ArtifactCorruptError(`chtypes: ${GOLDENS_ASSET} hashes to ${got} but the signed SHA256SUMS says ${want} — not installing it`);
|
|
611
|
+
}
|
|
612
|
+
return blob;
|
|
613
|
+
}
|
|
614
|
+
/**
|
|
615
|
+
* Install the served golden set, if this release publishes one, and never
|
|
616
|
+
* fail the fetch that called it: a release-level file here is best-effort.
|
|
617
|
+
*
|
|
618
|
+
* The first look reuses `release.sums` — already verified by {@link loadRelease}
|
|
619
|
+
* — which is cheap and right on the overwhelmingly common case that nothing is
|
|
620
|
+
* mid-publish. Only a disagreement is retried (the same publish-window symptom
|
|
621
|
+
* as the signature and index.json), and a retry re-reads the WHOLE consistent
|
|
622
|
+
* set fresh through {@link loadReleaseOnce} — SHA256SUMS, its signature,
|
|
623
|
+
* index.json AND the golden set together — never the golden set alone checked
|
|
624
|
+
* against this call's by-then possibly-stale `release.sums`.
|
|
625
|
+
*
|
|
626
|
+
* Never throws. A release with no such row simply predates the served set, and a
|
|
627
|
+
* mismatch that never heals — or a set that cannot be written — leaves the
|
|
628
|
+
* golden tests skipping loudly, which is their job when there is nothing
|
|
629
|
+
* trustworthy to read.
|
|
630
|
+
*/
|
|
631
|
+
async function installGoldens(release, ctx, options) {
|
|
632
|
+
const attempts = release.source instanceof HttpSource ? RELEASE_RETRY.attempts : 1;
|
|
633
|
+
let delayMs = RELEASE_RETRY.delayMs;
|
|
634
|
+
let blob = null;
|
|
635
|
+
for (let attempt = 1;; attempt++) {
|
|
636
|
+
try {
|
|
637
|
+
if (attempt === 1) {
|
|
638
|
+
blob = await readGoldensOnce(release.source, release.sums);
|
|
639
|
+
}
|
|
640
|
+
else {
|
|
641
|
+
// A stale first look: re-verify everything from scratch, not just the
|
|
642
|
+
// golden set against sums that may themselves have moved on.
|
|
643
|
+
const fresh = await loadReleaseOnce(release.source, options, ctx.emit);
|
|
644
|
+
blob = await readGoldensOnce(fresh.source, fresh.sums);
|
|
645
|
+
}
|
|
646
|
+
break;
|
|
647
|
+
}
|
|
648
|
+
catch (err) {
|
|
649
|
+
const retryable = err instanceof ArtifactUntrustedError || err instanceof ArtifactCorruptError;
|
|
650
|
+
if (!retryable || attempt >= attempts) {
|
|
651
|
+
ctx.emit({ type: 'status', message: `${String(err)} — the golden tests will skip` });
|
|
652
|
+
return;
|
|
653
|
+
}
|
|
654
|
+
ctx.emit({
|
|
655
|
+
type: 'status',
|
|
656
|
+
message: `${String(err)} (attempt ${attempt}/${attempts}) — this is what a release being ` +
|
|
657
|
+
`published looks like from outside; retrying in ${delayMs / 1000}s`,
|
|
658
|
+
});
|
|
659
|
+
await new Promise((resolve) => setTimeout(resolve, delayMs));
|
|
660
|
+
delayMs *= 2;
|
|
661
|
+
}
|
|
662
|
+
}
|
|
663
|
+
if (blob === null) {
|
|
664
|
+
ctx.emit({ type: 'status', message: `this release does not publish ${GOLDENS_ASSET} (the SDKs' golden tests will skip until it does)` });
|
|
594
665
|
return;
|
|
595
666
|
}
|
|
596
667
|
const out = path.join(ctx.dest, GOLDENS_ASSET);
|
|
@@ -659,7 +730,7 @@ async function ensureUncached(req, platform, dest, options) {
|
|
|
659
730
|
const release = await loadRelease(source, options, ctx.emit);
|
|
660
731
|
const art = selectArtifact(release.index, platform, req);
|
|
661
732
|
const installed = await installOne(release, art, ctx);
|
|
662
|
-
await installGoldens(release, ctx);
|
|
733
|
+
await installGoldens(release, ctx, options);
|
|
663
734
|
return installed;
|
|
664
735
|
}
|
|
665
736
|
/** One index row, from the release into `<dest>/<minor>/` — steps 2 through 4. */
|