chtypes 2.0.0.dev9__py3-none-any.whl → 2.0.0.dev11__py3-none-any.whl

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.
chtypes/__init__.py CHANGED
@@ -47,28 +47,41 @@ from importlib.metadata import PackageNotFoundError as _PackageNotFound
47
47
  from importlib.metadata import version as _package_version
48
48
 
49
49
  from ._abi2._vocab import (
50
+ CODE_DECLINED,
50
51
  EXPORT_NONE,
51
52
  DeclinedLayer,
52
53
  DeclinedTier,
53
54
  DefaultKind,
55
+ DefaultSupport,
54
56
  DiscoverQueryParam,
55
57
  DocFlags,
56
58
  FilterOutcome,
57
59
  Format,
58
60
  MergeReason,
59
61
  Outcome,
62
+ Posture,
60
63
  Reason,
64
+ RefusalSite,
61
65
  Source,
62
66
  Status,
63
67
  Verdict,
64
68
  )
65
- from ._input import BytesIn, ServerProfile, Settings
69
+ from ._input import (
70
+ BytesIn,
71
+ ColumnDefault,
72
+ DeferDefaults,
73
+ ParamEncoding,
74
+ ServerProfile,
75
+ Settings,
76
+ VerdictBasis,
77
+ )
66
78
  from ._setup import setup
67
79
  from .errors import (
68
80
  CODE_ARTIFACT_CORRUPT,
69
81
  CODE_ARTIFACT_INCOMPATIBLE,
70
82
  CODE_ARTIFACT_MISSING,
71
83
  CODE_ARTIFACT_PINNED,
84
+ CODE_ARTIFACT_REVOKED,
72
85
  CODE_ARTIFACT_UNPUBLISHED,
73
86
  CODE_ARTIFACT_UNTRUSTED,
74
87
  CODE_CACHE_UNUSABLE,
@@ -77,17 +90,20 @@ from .errors import (
77
90
  CODE_SOURCE_RETIRED,
78
91
  CODE_SOURCE_UNAUTHORIZED,
79
92
  CODE_SOURCE_UNREACHABLE,
93
+ Advisory,
80
94
  ArtifactCorruptError,
81
95
  ArtifactError,
82
96
  ArtifactIncompatibleError,
83
97
  ArtifactMissingError,
84
98
  ArtifactPinnedError,
99
+ ArtifactRevokedError,
85
100
  ArtifactUnpublishedError,
86
101
  ArtifactUntrustedError,
87
102
  CacheUnusableError,
88
103
  CallError,
89
104
  ChtypesError,
90
105
  InternalError,
106
+ Revocation,
91
107
  SchemaError,
92
108
  SourceForbiddenError,
93
109
  SourceIncompatibleError,
@@ -130,6 +146,7 @@ __all__ = [
130
146
  "CODE_ARTIFACT_INCOMPATIBLE",
131
147
  "CODE_ARTIFACT_MISSING",
132
148
  "CODE_ARTIFACT_PINNED",
149
+ "CODE_ARTIFACT_REVOKED",
133
150
  "CODE_ARTIFACT_UNPUBLISHED",
134
151
  "CODE_ARTIFACT_UNTRUSTED",
135
152
  "CODE_CACHE_UNUSABLE",
@@ -138,12 +155,15 @@ __all__ = [
138
155
  "CODE_SOURCE_RETIRED",
139
156
  "CODE_SOURCE_UNAUTHORIZED",
140
157
  "CODE_SOURCE_UNREACHABLE",
158
+ "CODE_DECLINED",
141
159
  "EXPORT_NONE",
160
+ "Advisory",
142
161
  "ArtifactCorruptError",
143
162
  "ArtifactError",
144
163
  "ArtifactIncompatibleError",
145
164
  "ArtifactMissingError",
146
165
  "ArtifactPinnedError",
166
+ "ArtifactRevokedError",
147
167
  "ArtifactUnpublishedError",
148
168
  "ArtifactUntrustedError",
149
169
  "AtMergeEntry",
@@ -156,11 +176,14 @@ __all__ = [
156
176
  "Capabilities",
157
177
  "ChtypesError",
158
178
  "Column",
179
+ "ColumnDefault",
159
180
  "Computed",
160
181
  "DeclinedLayer",
161
182
  "DeclinedSetting",
162
183
  "DeclinedTier",
184
+ "DeferDefaults",
163
185
  "DefaultKind",
186
+ "DefaultSupport",
164
187
  "DiscoverQueryParam",
165
188
  "DiscoveredColumn",
166
189
  "Discovery",
@@ -180,9 +203,13 @@ __all__ = [
180
203
  "Library",
181
204
  "MergeReason",
182
205
  "Outcome",
206
+ "ParamEncoding",
207
+ "Posture",
183
208
  "Reason",
184
209
  "Registry",
210
+ "RefusalSite",
185
211
  "Resolved",
212
+ "Revocation",
186
213
  "RowResult",
187
214
  "Schema",
188
215
  "SchemaDescription",
@@ -205,6 +232,7 @@ __all__ = [
205
232
  "UsageError",
206
233
  "Value",
207
234
  "Verdict",
235
+ "VerdictBasis",
208
236
  "cache_root",
209
237
  "open_unverified",
210
238
  "search_dirs",
chtypes/__main__.py CHANGED
@@ -3,6 +3,7 @@
3
3
 
4
4
  chtypes fetch <spelling>... | --all [--platform <os-arch>] [--cache <dir>] [--lock <file>]
5
5
  [--frozen] [--offline] [--update] [--strict]
6
+ [--allow-revoked] [--require-revocation-check]
6
7
  chtypes verify [--cache <dir>] [--strict] re-verify every installed build
7
8
  chtypes list [--cache <dir>] [--offline] [--strict]
8
9
  chtypes where [--cache <dir>] [--strict] [--all] the cache root; --all: every search dir
@@ -37,7 +38,7 @@ from collections.abc import Sequence
37
38
 
38
39
  from . import __version__ as chtypes_version
39
40
  from . import _ocifetch as fetch_layer
40
- from ._codes import CODE_ARTIFACT_CORRUPT
41
+ from ._codes import CODE_ARTIFACT_CORRUPT, CODE_ARTIFACT_REVOKED
41
42
  from ._ocifetch import _channel
42
43
  from ._ocifetch import _constants as C
43
44
  from ._ocifetch._ensure import _translate_transport_error, detect_host_platform, missing_notes
@@ -148,6 +149,19 @@ def build_parser() -> argparse.ArgumentParser:
148
149
  "(or set CHTYPES_OFFLINE=1)"
149
150
  ),
150
151
  )
152
+ fetch.add_argument(
153
+ "--allow-revoked",
154
+ action="store_true",
155
+ help=(
156
+ "use a build a verified revocation refuses, with one warning "
157
+ "(this call only; never --lock or --update)"
158
+ ),
159
+ )
160
+ fetch.add_argument(
161
+ "--require-revocation-check",
162
+ action="store_true",
163
+ help="a revocation status that cannot be read is the transport's error, not a warning",
164
+ )
151
165
 
152
166
  verify = sub.add_parser(
153
167
  "verify",
@@ -249,6 +263,8 @@ def _options(args: argparse.Namespace, *, platform: str | None = None):
249
263
  lock_path=lock_path,
250
264
  lock_write=lock_write,
251
265
  update=getattr(args, "update", False),
266
+ allow_revoked=getattr(args, "allow_revoked", False),
267
+ require_revocation_check=getattr(args, "require_revocation_check", False),
252
268
  )
253
269
  return fetch._to_options(platform)
254
270
 
@@ -348,10 +364,23 @@ def _cmd_verify(args: argparse.Namespace) -> int:
348
364
  return EXIT_OK
349
365
  _say_notes(options)
350
366
  failed = 0
367
+ revoked = 0
351
368
  for r in results:
352
- if not r.ok:
369
+ if r.revocation is not None:
370
+ # A build a stored revocation refuses (docs/guides/fetch-v1.md,
371
+ # "Build-level revocation"); it is reported whatever its bytes say.
372
+ revoked += 1
373
+ _say(f"REVOKED {r.version} {r.platform} {r.dir}: {r.detail}")
374
+ elif not r.ok:
353
375
  failed += 1
354
376
  _say(f"chtypes: FAILED {r.version} {r.platform} {r.dir}: {r.detail}")
377
+ if revoked:
378
+ # Exit 11 wins over a mismatch's 1: a revocation is the more specific finding.
379
+ _say(
380
+ f"chtypes: {revoked} of {len(results)} installed build(s) are revoked "
381
+ f"[{CODE_ARTIFACT_REVOKED}]"
382
+ )
383
+ return C.ERROR_EXIT_CODES[CODE_ARTIFACT_REVOKED]
355
384
  if failed:
356
385
  _say(f"chtypes: {failed} of {len(results)} installed build(s) FAILED verification")
357
386
  return C.ERROR_EXIT_CODES[CODE_ARTIFACT_CORRUPT]
chtypes/_abi2/_decls.py CHANGED
@@ -1,4 +1,4 @@
1
- # GENERATED by scripts/abi-v1/gen.py --major 2 from spec/abi-v2/abi.json (CHS_ABI_FINGERPRINT sha256:d60a681ea0e249ab9e2c83b50640ad9cef040261ddf61805106c93e2c68774e4) — DO NOT EDIT # noqa: E501
1
+ # GENERATED by scripts/abi-v1/gen.py --major 2 from spec/abi-v2/abi.json (CHS_ABI_FINGERPRINT sha256:d53239933966e15a3c363e631a94fbba1231d84c4300337115d3ae5377bb41c2) — DO NOT EDIT # noqa: E501
2
2
  """The Python binding's generated ABI v2 layer: ctypes signatures, the handle
3
3
  classes, the two-phase resolve functions and invoke_by_name(), the test-only
4
4
  dispatcher the conformance suite drives from tests/fixtures/abi-v2/cases.json.
@@ -19,7 +19,7 @@ from dataclasses import dataclass, field
19
19
  from . import _errmap
20
20
 
21
21
  CHS_ABI_VERSION = 2
22
- CHS_ABI_FINGERPRINT = "sha256:d60a681ea0e249ab9e2c83b50640ad9cef040261ddf61805106c93e2c68774e4"
22
+ CHS_ABI_FINGERPRINT = "sha256:d53239933966e15a3c363e631a94fbba1231d84c4300337115d3ae5377bb41c2"
23
23
 
24
24
  # The description's stability: "unstable" while this generation is being
25
25
  # designed, so CHS_ABI_FINGERPRINT moves with every change, and "locked" after
@@ -87,6 +87,7 @@ ALL_SYMBOLS: tuple[str, ...] = (
87
87
  "chs_error_column",
88
88
  "chs_error_free",
89
89
  "chs_error_message",
90
+ "chs_error_reason",
90
91
  "chs_error_status",
91
92
  "chs_filter_create",
92
93
  "chs_filter_eval_block",
@@ -248,6 +249,7 @@ _add("chs_error_ch_code", "scalar", "int32", _P("error", "handle", "chs_error"))
248
249
  _add("chs_error_ch_name", "handle", "chs_buf", _P("error", "handle", "chs_error"))
249
250
  _add("chs_error_message", "handle", "chs_buf", _P("error", "handle", "chs_error"))
250
251
  _add("chs_error_column", "handle", "chs_buf", _P("error", "handle", "chs_error"))
252
+ _add("chs_error_reason", "handle", "chs_buf", _P("error", "handle", "chs_error"))
251
253
  _add("chs_error_free", "void", None, _P("error", "handle", "chs_error", nullable=True))
252
254
  _add(
253
255
  "chs_live_handles",
@@ -371,6 +373,7 @@ _add(
371
373
  _P("body", "bytes_in", None),
372
374
  _P("settings", "bytes_in", None),
373
375
  _P("columns", "bytes_in", None),
376
+ _P("options", "bytes_in", None),
374
377
  _P("out", "out_handle", "chs_buf"),
375
378
  _P("err", "out_error", "chs_error", nullable=True),
376
379
  )
@@ -386,6 +389,7 @@ _add(
386
389
  _P("filter", "handle", "chs_filter", nullable=True),
387
390
  _P("export_format", "scalar", "int32"),
388
391
  _P("doc_flags", "scalar", "uint32"),
392
+ _P("options", "bytes_in", None),
389
393
  _P("out", "out_handle", "chs_buf"),
390
394
  _P("out_export", "out_handle", "chs_buf", nullable=True),
391
395
  _P("err", "out_error", "chs_error", nullable=True),
@@ -398,6 +402,7 @@ _add(
398
402
  _P("expr", "bytes_in", None),
399
403
  _P("query_params", "bytes_in", None),
400
404
  _P("settings", "bytes_in", None),
405
+ _P("options", "bytes_in", None),
401
406
  _P("out", "out_handle", "chs_filter"),
402
407
  _P("err", "out_error", "chs_error", nullable=True),
403
408
  )
@@ -410,6 +415,8 @@ _add(
410
415
  _P("format", "enum", "chs_format"),
411
416
  _P("body", "bytes_in", None),
412
417
  _P("settings", "bytes_in", None),
418
+ _P("columns", "bytes_in", None),
419
+ _P("options", "bytes_in", None),
413
420
  _P("out", "out_handle", "chs_buf"),
414
421
  _P("err", "out_error", "chs_error", nullable=True),
415
422
  )
@@ -422,6 +429,7 @@ _add(
422
429
  _P("body", "bytes_in", None),
423
430
  _P("settings", "bytes_in", None),
424
431
  _P("columns", "bytes_in", None),
432
+ _P("options", "bytes_in", None),
425
433
  _P("out", "out_handle", "chs_block"),
426
434
  _P("err", "out_error", "chs_error", nullable=True),
427
435
  )
@@ -563,6 +571,7 @@ class Api:
563
571
  info.ch_name.decode("ascii", "replace") if info else "",
564
572
  message,
565
573
  info.column if info else b"",
574
+ reason=info.reason.decode("ascii", "replace") if info else "",
566
575
  )
567
576
 
568
577
  def live_handles(self) -> bytes:
@@ -801,6 +810,7 @@ class Api:
801
810
  body: bytes | None,
802
811
  settings: bytes | None,
803
812
  columns: bytes | None,
813
+ options: bytes | None,
804
814
  ) -> bytes:
805
815
  """The generated call wrapper for chs_preview_row (thread class shared).
806
816
 
@@ -813,6 +823,7 @@ class Api:
813
823
  *_bytes_in(body),
814
824
  *_bytes_in(settings),
815
825
  *_bytes_in(columns),
826
+ *_bytes_in(options),
816
827
  ctypes.byref(out),
817
828
  ctypes.byref(err),
818
829
  )
@@ -829,6 +840,7 @@ class Api:
829
840
  filter: FilterHandle | None,
830
841
  export_format: int,
831
842
  doc_flags: int,
843
+ options: bytes | None,
832
844
  ) -> tuple[bytes, bytes | None]:
833
845
  """The generated call wrapper for chs_preview_batch (thread class shared).
834
846
 
@@ -845,6 +857,7 @@ class Api:
845
857
  None if filter is None else filter.value,
846
858
  int(export_format),
847
859
  int(doc_flags),
860
+ *_bytes_in(options),
848
861
  ctypes.byref(out),
849
862
  ctypes.byref(out_export),
850
863
  ctypes.byref(err),
@@ -861,6 +874,7 @@ class Api:
861
874
  expr: bytes | None,
862
875
  query_params: bytes | None,
863
876
  settings: bytes | None,
877
+ options: bytes | None,
864
878
  ) -> FilterHandle:
865
879
  """The generated call wrapper for chs_filter_create (thread class shared).
866
880
 
@@ -872,6 +886,7 @@ class Api:
872
886
  *_bytes_in(expr),
873
887
  *_bytes_in(query_params),
874
888
  *_bytes_in(settings),
889
+ *_bytes_in(options),
875
890
  ctypes.byref(out),
876
891
  ctypes.byref(err),
877
892
  )
@@ -884,6 +899,8 @@ class Api:
884
899
  format: int,
885
900
  body: bytes | None,
886
901
  settings: bytes | None,
902
+ columns: bytes | None,
903
+ options: bytes | None,
887
904
  ) -> bytes:
888
905
  """The generated call wrapper for chs_filter_eval_body (thread class shared).
889
906
 
@@ -895,6 +912,8 @@ class Api:
895
912
  int(format),
896
913
  *_bytes_in(body),
897
914
  *_bytes_in(settings),
915
+ *_bytes_in(columns),
916
+ *_bytes_in(options),
898
917
  ctypes.byref(out),
899
918
  ctypes.byref(err),
900
919
  )
@@ -908,6 +927,7 @@ class Api:
908
927
  body: bytes | None,
909
928
  settings: bytes | None,
910
929
  columns: bytes | None,
930
+ options: bytes | None,
911
931
  ) -> BlockHandle:
912
932
  """The generated call wrapper for chs_block_create (thread class shared).
913
933
 
@@ -920,6 +940,7 @@ class Api:
920
940
  *_bytes_in(body),
921
941
  *_bytes_in(settings),
922
942
  *_bytes_in(columns),
943
+ *_bytes_in(options),
923
944
  ctypes.byref(out),
924
945
  ctypes.byref(err),
925
946
  )
@@ -1007,6 +1028,7 @@ class ErrorInfo:
1007
1028
  ch_name: bytes
1008
1029
  message: bytes
1009
1030
  column: bytes
1031
+ reason: bytes = b""
1010
1032
 
1011
1033
 
1012
1034
  @dataclass
@@ -1068,6 +1090,7 @@ def _decode_error(api: Api, err_ptr: int) -> ErrorInfo:
1068
1090
  ch_name = _read_buf(api, api._raw["chs_error_ch_name"](err_ptr))
1069
1091
  message = _read_buf(api, api._raw["chs_error_message"](err_ptr))
1070
1092
  column = _read_buf(api, api._raw["chs_error_column"](err_ptr))
1093
+ reason = _read_buf(api, api._raw["chs_error_reason"](err_ptr))
1071
1094
  api._raw["chs_error_free"](err_ptr)
1072
1095
  return ErrorInfo(
1073
1096
  status=STATUS_BY_VALUE.get(status_val, f"UNKNOWN:{status_val}"),
@@ -1075,6 +1098,7 @@ def _decode_error(api: Api, err_ptr: int) -> ErrorInfo:
1075
1098
  ch_name=ch_name,
1076
1099
  message=message,
1077
1100
  column=column,
1101
+ reason=reason,
1078
1102
  )
1079
1103
 
1080
1104
 
chtypes/_abi2/_errmap.py CHANGED
@@ -1,4 +1,4 @@
1
- # GENERATED by scripts/abi-v1/gen.py --major 2 from spec/abi-v2/abi.json (CHS_ABI_FINGERPRINT sha256:d60a681ea0e249ab9e2c83b50640ad9cef040261ddf61805106c93e2c68774e4) — DO NOT EDIT # noqa: E501
1
+ # GENERATED by scripts/abi-v1/gen.py --major 2 from spec/abi-v2/abi.json (CHS_ABI_FINGERPRINT sha256:d53239933966e15a3c363e631a94fbba1231d84c4300337115d3ae5377bb41c2) — DO NOT EDIT # noqa: E501
2
2
  """spec/abi-v2/sdk.json's error-mapping tables, as references to the
3
3
  public classes (python/src/chtypes/errors.py, re-exported by
4
4
  python/src/chtypes/_abi2/_errors.py). Only the MAPPING is generated: the
chtypes/_abi2/_vocab.py CHANGED
@@ -1,4 +1,4 @@
1
- # GENERATED by scripts/abi-v1/gen.py --major 2 from spec/abi-v2/abi.json (CHS_ABI_FINGERPRINT sha256:d60a681ea0e249ab9e2c83b50640ad9cef040261ddf61805106c93e2c68774e4) — DO NOT EDIT # noqa: E501
1
+ # GENERATED by scripts/abi-v1/gen.py --major 2 from spec/abi-v2/abi.json (CHS_ABI_FINGERPRINT sha256:d53239933966e15a3c363e631a94fbba1231d84c4300337115d3ae5377bb41c2) — DO NOT EDIT # noqa: E501
2
2
  """The Python binding's generated vocabularies, from spec/abi-v2/abi.json: the C
3
3
  enums (`Format`, `Status`), the document vocabularies (`Outcome`, `FilterOutcome`,
4
4
  `Verdict`, `DefaultKind`, `MergeReason`, `DeclinedTier`, `DeclinedLayer`, `Reason`,
@@ -256,6 +256,7 @@ class DeclinedTier(StrEnum):
256
256
  PREDICATE = "predicate"
257
257
  PREDICATE_UNFLIPPED = "predicate-unflipped"
258
258
  RESULT_CONTENT = "result-content"
259
+ SERVER_REFUSES = "server-refuses"
259
260
 
260
261
  @classmethod
261
262
  def _missing_(cls, value: object) -> DeclinedTier | None:
@@ -299,6 +300,83 @@ class DeclinedLayer(StrEnum):
299
300
  return cls(text)
300
301
 
301
302
 
303
+ class Posture(StrEnum):
304
+ """How a schema's statement was compiled: `create`, as a server's CREATE TABLE,
305
+ or `load`, as a server loads the stored definition of a table it holds."""
306
+
307
+ CREATE = "create"
308
+ LOAD = "load"
309
+
310
+ @classmethod
311
+ def _missing_(cls, value: object) -> Posture | None:
312
+ return _unknown_str(cls, value)
313
+
314
+ @property
315
+ def known(self) -> bool:
316
+ """Whether the description lists this value: False for exactly the unknown(n)
317
+ member an unlisted value reads as (rule r3)."""
318
+ return type(self)._value2member_map_.get(self._value_) is self
319
+
320
+ @classmethod
321
+ def of(cls, text: str) -> Posture:
322
+ """Map a document's spelling. One the description does not list is kept as
323
+ this vocabulary's unknown(n) member, carrying it (rule r3)."""
324
+ return cls(text)
325
+
326
+
327
+ class RefusalSite(StrEnum):
328
+ """Where a batch or filter document's refusal sits: `call` (the call, its settings or its
329
+ column list), `body_read` (the body outside any row: a header, the framing), `row` (one
330
+ row, `refused_row`) or `body_step` (a whole-body step)."""
331
+
332
+ CALL = "call"
333
+ BODY_READ = "body_read"
334
+ ROW = "row"
335
+ BODY_STEP = "body_step"
336
+
337
+ @classmethod
338
+ def _missing_(cls, value: object) -> RefusalSite | None:
339
+ return _unknown_str(cls, value)
340
+
341
+ @property
342
+ def known(self) -> bool:
343
+ """Whether the description lists this value: False for exactly the unknown(n)
344
+ member an unlisted value reads as (rule r3)."""
345
+ return type(self)._value2member_map_.get(self._value_) is self
346
+
347
+ @classmethod
348
+ def of(cls, text: str) -> RefusalSite:
349
+ """Map a document's spelling. One the description does not list is kept as
350
+ this vocabulary's unknown(n) member, carrying it (rule r3)."""
351
+ return cls(text)
352
+
353
+
354
+ class DefaultSupport(StrEnum):
355
+ """What this build does with a column's DEFAULT, as `schema_description` reports it per
356
+ column: `computed`, `generated`, `deferred` or `declined` (with a reason)."""
357
+
358
+ COMPUTED = "computed"
359
+ GENERATED = "generated"
360
+ DEFERRED = "deferred"
361
+ DECLINED = "declined"
362
+
363
+ @classmethod
364
+ def _missing_(cls, value: object) -> DefaultSupport | None:
365
+ return _unknown_str(cls, value)
366
+
367
+ @property
368
+ def known(self) -> bool:
369
+ """Whether the description lists this value: False for exactly the unknown(n)
370
+ member an unlisted value reads as (rule r3)."""
371
+ return type(self)._value2member_map_.get(self._value_) is self
372
+
373
+ @classmethod
374
+ def of(cls, text: str) -> DefaultSupport:
375
+ """Map a document's spelling. One the description does not list is kept as
376
+ this vocabulary's unknown(n) member, carrying it (rule r3)."""
377
+ return cls(text)
378
+
379
+
302
380
  class DiscoverQueryParam(StrEnum):
303
381
  """A query parameter of the SQL `discover_query` returns, which the caller binds
304
382
  when it runs the query."""
@@ -409,6 +487,8 @@ class Source:
409
487
  DEFAULT_EXPR_UNSUPPORTED: Final = "default_expr_unsupported"
410
488
  DEFAULT_VOLATILE_UNRESOLVED: Final = "default_volatile_unresolved"
411
489
  DEFAULT_PENDING: Final = "default_pending"
490
+ DEFAULT_DEFERRED: Final = "default_deferred"
491
+ DEFAULT_OVERRIDE: Final = "default_override"
412
492
 
413
493
  @staticmethod
414
494
  def known(source: str) -> bool:
@@ -417,9 +497,8 @@ class Source:
417
497
 
418
498
  @staticmethod
419
499
  def is_stored(source: str) -> bool:
420
- """The description's `is_stored` fact for `source`. The description does not yet
421
- say what an unknown(n) source reports (rule r3, "Facts without a fallback");
422
- until it does, an unlisted source is not stored."""
500
+ """The description's `is_stored` fact for `source`; an unknown(n) source
501
+ reports its fallback's (`skipped`), as rule r3 says."""
423
502
  return _SOURCE_IS_STORED.get(source, False)
424
503
 
425
504
 
@@ -435,6 +514,8 @@ _SOURCE_IS_STORED: Final[dict[str, bool]] = {
435
514
  "default_expr_unsupported": False,
436
515
  "default_volatile_unresolved": False,
437
516
  "default_pending": False,
517
+ "default_deferred": False,
518
+ "default_override": True,
438
519
  }
439
520
 
440
521
 
@@ -450,6 +531,10 @@ class DocFlags(IntFlag):
450
531
  # `chs_preview_batch`'s `export_format` for no export (`CHS_EXPORT_NONE`).
451
532
  EXPORT_NONE: Final = -1
452
533
 
534
+ # The code a declined row, outcome or verdict carries (`CHS_CODE_DECLINED`), outside
535
+ # ClickHouse's code table.
536
+ CODE_DECLINED: Final = -2
537
+
453
538
  # Every enum the description defines, by its own name, and the Python type that
454
539
  # spells it: rule r3's tests reach every one from here, so a new enum is covered
455
540
  # without a hand-kept list.
@@ -463,10 +548,13 @@ DESCRIBED_VOCABULARIES: Final[dict[str, type]] = {
463
548
  "batch_outcome": Outcome,
464
549
  "filter_outcome": FilterOutcome,
465
550
  "filter_verdict": Verdict,
551
+ "refusal_site": RefusalSite,
466
552
  "discover_query_param": DiscoverQueryParam,
467
553
  "default_kind": DefaultKind,
554
+ "default_support": DefaultSupport,
468
555
  "declined_tier": DeclinedTier,
469
556
  "declined_layer": DeclinedLayer,
557
+ "posture": Posture,
470
558
  }
471
559
 
472
560
 
chtypes/_advisory.py ADDED
@@ -0,0 +1,38 @@
1
+ """What a `CHTYPES_ARTIFACT_REVOKED` error carries for programs
2
+ (docs/guides/fetch-v1.md, "Build-level revocation"; public issue #625).
3
+
4
+ A leaf module, so the fetch layer's errors and the public ones share the two
5
+ types without importing each other."""
6
+
7
+ from __future__ import annotations
8
+
9
+ from dataclasses import dataclass
10
+
11
+ __all__ = ["Advisory", "Revocation"]
12
+
13
+
14
+ @dataclass(frozen=True)
15
+ class Advisory:
16
+ """One advisory a revocation names, every string made safe to print. A
17
+ signed revocation's carries its `revoked_at`; a 410's carries the `build` it
18
+ names, newest first. A field the source did not send is "". `class_` is the
19
+ advisory's `class` (a keyword in Python)."""
20
+
21
+ id: str = ""
22
+ url: str = ""
23
+ class_: str = ""
24
+ summary: str = ""
25
+ build: str = ""
26
+ superseded_by: str = ""
27
+ revoked_at: str = ""
28
+
29
+
30
+ @dataclass(frozen=True)
31
+ class Revocation:
32
+ """`signed` is true for a verified, signed revocation of `manifest`, whose
33
+ one advisory it is, and false for a 410's body, which is unsigned, names no
34
+ manifest (`manifest` is "") and lists one advisory per revoked build."""
35
+
36
+ signed: bool = False
37
+ manifest: str = ""
38
+ advisories: tuple[Advisory, ...] = ()
chtypes/_codes.py CHANGED
@@ -1,6 +1,6 @@
1
1
  # Code generated by scripts/fetch-v1/gen-constants.py from
2
2
  # spec/fetch-v1/constants.json. DO NOT EDIT.
3
- # Source sha256: 82afa8d6cba96c10b5945c6f7c1c8360a504cc8ac6231e74017cc6c20b908df6
3
+ # Source sha256: 5aa3d14a5d8b60399040a8242f003135fa5f6c2c402de7d4e2db4c768a3366ae
4
4
  """The shared error codes (docs/guides/fetch-v1.md §8), one per entry of the
5
5
  fetch constants' `errors`, in their order. `chtypes.errors` re-exports them
6
6
  (docs/reference/bindings-v1.md §4, the codes)."""
@@ -21,3 +21,4 @@ CODE_SOURCE_INCOMPATIBLE: Final[str] = "CHTYPES_SOURCE_INCOMPATIBLE"
21
21
  CODE_ARTIFACT_INCOMPATIBLE: Final[str] = "CHTYPES_ARTIFACT_INCOMPATIBLE"
22
22
  CODE_CACHE_UNUSABLE: Final[str] = "CHTYPES_CACHE_UNUSABLE"
23
23
  CODE_SOURCE_RETIRED: Final[str] = "CHTYPES_SOURCE_RETIRED"
24
+ CODE_ARTIFACT_REVOKED: Final[str] = "CHTYPES_ARTIFACT_REVOKED"