fancy-conformance 0.55.1__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.
Files changed (235) hide show
  1. fancy_conformance/__init__.py +482 -0
  2. fancy_conformance/_data/VERSION +1 -0
  3. fancy_conformance/_data/schema/case-table.schema.json +77 -0
  4. fancy_conformance/_data/schema/suite-manifest.schema.json +85 -0
  5. fancy_conformance/_data/suites/dark-slide/table-cell-model/cases.json +2457 -0
  6. fancy_conformance/_data/suites/dark-slide/table-cell-model/manifest.json +49 -0
  7. fancy_conformance/_data/suites/doc-model/page-refusal/cases.json +803 -0
  8. fancy_conformance/_data/suites/doc-model/page-refusal/manifest.json +43 -0
  9. fancy_conformance/_data/suites/doc-model/shared/cases.json +565 -0
  10. fancy_conformance/_data/suites/doc-model/shared/manifest.json +29 -0
  11. fancy_conformance/_data/suites/exchange/SPEC.md +781 -0
  12. fancy_conformance/_data/suites/exchange/content/cases.json +2025 -0
  13. fancy_conformance/_data/suites/exchange/content/manifest.json +73 -0
  14. fancy_conformance/_data/suites/exchange/csv/cases.json +579 -0
  15. fancy_conformance/_data/suites/exchange/csv/manifest.json +38 -0
  16. fancy_conformance/_data/suites/exchange/from-dark-slide/cases.json +1904 -0
  17. fancy_conformance/_data/suites/exchange/from-dark-slide/manifest.json +38 -0
  18. fancy_conformance/_data/suites/exchange/from-fine-print/cases.json +599 -0
  19. fancy_conformance/_data/suites/exchange/from-fine-print/manifest.json +28 -0
  20. fancy_conformance/_data/suites/exchange/from-holy-sheet/cases.json +2521 -0
  21. fancy_conformance/_data/suites/exchange/from-holy-sheet/manifest.json +38 -0
  22. fancy_conformance/_data/suites/exchange/from-last-word/cases.json +2351 -0
  23. fancy_conformance/_data/suites/exchange/from-last-word/manifest.json +38 -0
  24. fancy_conformance/_data/suites/exchange/limits/cases.json +1909 -0
  25. fancy_conformance/_data/suites/exchange/limits/manifest.json +74 -0
  26. fancy_conformance/_data/suites/exchange/number-display/cases.json +776 -0
  27. fancy_conformance/_data/suites/exchange/number-display/manifest.json +38 -0
  28. fancy_conformance/_data/suites/exchange/policy/cases.json +707 -0
  29. fancy_conformance/_data/suites/exchange/policy/manifest.json +74 -0
  30. fancy_conformance/_data/suites/exchange/range/cases.json +974 -0
  31. fancy_conformance/_data/suites/exchange/range/manifest.json +40 -0
  32. fancy_conformance/_data/suites/exchange/report-kinds/cases.json +765 -0
  33. fancy_conformance/_data/suites/exchange/report-kinds/manifest.json +74 -0
  34. fancy_conformance/_data/suites/exchange/to-dark-slide/cases.json +1297 -0
  35. fancy_conformance/_data/suites/exchange/to-dark-slide/manifest.json +38 -0
  36. fancy_conformance/_data/suites/exchange/to-fine-print/cases.json +1045 -0
  37. fancy_conformance/_data/suites/exchange/to-fine-print/manifest.json +28 -0
  38. fancy_conformance/_data/suites/exchange/to-holy-sheet/cases.json +691 -0
  39. fancy_conformance/_data/suites/exchange/to-holy-sheet/manifest.json +38 -0
  40. fancy_conformance/_data/suites/exchange/to-last-word/cases.json +1045 -0
  41. fancy_conformance/_data/suites/exchange/to-last-word/manifest.json +38 -0
  42. fancy_conformance/_data/suites/expr/evaluate/cases.json +1587 -0
  43. fancy_conformance/_data/suites/expr/evaluate/manifest.json +43 -0
  44. fancy_conformance/_data/suites/expr/limits/cases.json +1754 -0
  45. fancy_conformance/_data/suites/expr/limits/manifest.json +38 -0
  46. fancy_conformance/_data/suites/expr/references/cases.json +226 -0
  47. fancy_conformance/_data/suites/expr/references/manifest.json +26 -0
  48. fancy_conformance/_data/suites/fine-print/SPEC.md +174 -0
  49. fancy_conformance/_data/suites/fine-print/php-semantics/cases.json +2814 -0
  50. fancy_conformance/_data/suites/fine-print/php-semantics/manifest.json +45 -0
  51. fancy_conformance/_data/suites/fine-print/writer-bytes/cases.json +9618 -0
  52. fancy_conformance/_data/suites/fine-print/writer-bytes/fixtures/0001-empty.pdf +37 -0
  53. fancy_conformance/_data/suites/fine-print/writer-bytes/fixtures/0002-hello.pdf +46 -0
  54. fancy_conformance/_data/suites/fine-print/writer-bytes/fixtures/0003-memo-title.pdf.gz +0 -0
  55. fancy_conformance/_data/suites/fine-print/writer-bytes/fixtures/0004-a4-portrait.pdf +46 -0
  56. fancy_conformance/_data/suites/fine-print/writer-bytes/fixtures/0005-letter-landscape.pdf +46 -0
  57. fancy_conformance/_data/suites/fine-print/writer-bytes/fixtures/0006-legal.pdf +46 -0
  58. fancy_conformance/_data/suites/fine-print/writer-bytes/fixtures/0007-a4-landscape.pdf +46 -0
  59. fancy_conformance/_data/suites/fine-print/writer-bytes/fixtures/0008-margins-wrap.pdf.gz +0 -0
  60. fancy_conformance/_data/suites/fine-print/writer-bytes/fixtures/0009-many-pages.pdf.gz +0 -0
  61. fancy_conformance/_data/suites/fine-print/writer-bytes/fixtures/0010-page-break.pdf.gz +0 -0
  62. fancy_conformance/_data/suites/fine-print/writer-bytes/fixtures/0011-header-footer.pdf.gz +0 -0
  63. fancy_conformance/_data/suites/fine-print/writer-bytes/fixtures/0012-standard-faces.pdf.gz +0 -0
  64. fancy_conformance/_data/suites/fine-print/writer-bytes/fixtures/0013-sizes.pdf.gz +0 -0
  65. fancy_conformance/_data/suites/fine-print/writer-bytes/fixtures/0014-colour.pdf +48 -0
  66. fancy_conformance/_data/suites/fine-print/writer-bytes/fixtures/0015-alignment.pdf.gz +0 -0
  67. fancy_conformance/_data/suites/fine-print/writer-bytes/fixtures/0016-line-breaks.pdf +51 -0
  68. fancy_conformance/_data/suites/fine-print/writer-bytes/fixtures/0017-unencodable.pdf +46 -0
  69. fancy_conformance/_data/suites/fine-print/writer-bytes/fixtures/0018-letter-spacing.pdf.gz +0 -0
  70. fancy_conformance/_data/suites/fine-print/writer-bytes/fixtures/0019-lists.pdf.gz +0 -0
  71. fancy_conformance/_data/suites/fine-print/writer-bytes/fixtures/0020-table-widths.pdf.gz +0 -0
  72. fancy_conformance/_data/suites/fine-print/writer-bytes/fixtures/0021-table-header-fill.pdf.gz +0 -0
  73. fancy_conformance/_data/suites/fine-print/writer-bytes/fixtures/0022-table-spans.pdf.gz +0 -0
  74. fancy_conformance/_data/suites/fine-print/writer-bytes/fixtures/0023-table-repeat-header.pdf.gz +0 -0
  75. fancy_conformance/_data/suites/fine-print/writer-bytes/fixtures/0024-keep-next.pdf.gz +0 -0
  76. fancy_conformance/_data/suites/fine-print/writer-bytes/fixtures/0025-orphans-widows.pdf.gz +0 -0
  77. fancy_conformance/_data/suites/fine-print/writer-bytes/fixtures/0026-code-quote-rule.pdf.gz +0 -0
  78. fancy_conformance/_data/suites/fine-print/writer-bytes/fixtures/0027-links.pdf.gz +0 -0
  79. fancy_conformance/_data/suites/fine-print/writer-bytes/fixtures/0028-hostile-keys.pdf.gz +0 -0
  80. fancy_conformance/_data/suites/fine-print/writer-bytes/fixtures/0029-background-frame.pdf.gz +0 -0
  81. fancy_conformance/_data/suites/fine-print/writer-bytes/fixtures/0030-default-frame.pdf +48 -0
  82. fancy_conformance/_data/suites/fine-print/writer-bytes/fixtures/0031-jpeg-rgb.pdf.gz +0 -0
  83. fancy_conformance/_data/suites/fine-print/writer-bytes/fixtures/0032-jpeg-grey-sized.pdf +0 -0
  84. fancy_conformance/_data/suites/fine-print/writer-bytes/fixtures/0033-jpeg-twice.pdf +0 -0
  85. fancy_conformance/_data/suites/fine-print/writer-bytes/fixtures/0034-png-rgb.canon.pdf +0 -0
  86. fancy_conformance/_data/suites/fine-print/writer-bytes/fixtures/0035-png-grey-16.canon.pdf +0 -0
  87. fancy_conformance/_data/suites/fine-print/writer-bytes/fixtures/0036-png-grey-1.canon.pdf +0 -0
  88. fancy_conformance/_data/suites/fine-print/writer-bytes/fixtures/0037-png-palette.canon.pdf +0 -0
  89. fancy_conformance/_data/suites/fine-print/writer-bytes/fixtures/0038-png-rgba.canon.pdf +0 -0
  90. fancy_conformance/_data/suites/fine-print/writer-bytes/fixtures/0039-png-palette-trns.canon.pdf +0 -0
  91. fancy_conformance/_data/suites/fine-print/writer-bytes/fixtures/0040-png-interlaced.canon.pdf +0 -0
  92. fancy_conformance/_data/suites/fine-print/writer-bytes/fixtures/0041-host-font.pdf.gz +0 -0
  93. fancy_conformance/_data/suites/fine-print/writer-bytes/fixtures/0042-host-font-faces.pdf.gz +0 -0
  94. fancy_conformance/_data/suites/fine-print/writer-bytes/fixtures/0043-from-array.pdf.gz +0 -0
  95. fancy_conformance/_data/suites/fine-print/writer-bytes/fixtures/0044-portable-block.pdf.gz +0 -0
  96. fancy_conformance/_data/suites/fine-print/writer-bytes/fixtures/0045-canonical.canon.pdf.gz +0 -0
  97. fancy_conformance/_data/suites/fine-print/writer-bytes/fixtures/0046-hello-compressed.canon.pdf +34 -0
  98. fancy_conformance/_data/suites/fine-print/writer-bytes/fixtures/0047-header-footer-compressed.canon.pdf.gz +0 -0
  99. fancy_conformance/_data/suites/fine-print/writer-bytes/fixtures/0048-table-repeat-header-compressed.canon.pdf.gz +0 -0
  100. fancy_conformance/_data/suites/fine-print/writer-bytes/fixtures/0049-host-font-compressed.canon.pdf.gz +0 -0
  101. fancy_conformance/_data/suites/fine-print/writer-bytes/fixtures/0050-png-rgba-compressed.canon.pdf +0 -0
  102. fancy_conformance/_data/suites/fine-print/writer-bytes/fixtures/0051-canonical-compressed.canon.pdf.gz +0 -0
  103. fancy_conformance/_data/suites/fine-print/writer-bytes/fixtures/font-fptest-bold.ttf.gz +0 -0
  104. fancy_conformance/_data/suites/fine-print/writer-bytes/fixtures/font-fptest-regular.ttf.gz +0 -0
  105. fancy_conformance/_data/suites/fine-print/writer-bytes/manifest.json +38 -0
  106. fancy_conformance/_data/suites/fine-print/writer-model/cases.json +7029 -0
  107. fancy_conformance/_data/suites/fine-print/writer-model/manifest.json +44 -0
  108. fancy_conformance/_data/suites/flow/config-admission/cases.json +306 -0
  109. fancy_conformance/_data/suites/flow/config-admission/manifest.json +29 -0
  110. fancy_conformance/_data/suites/flow/connector-runs/cases.json +123 -0
  111. fancy_conformance/_data/suites/flow/connector-runs/manifest.json +52 -0
  112. fancy_conformance/_data/suites/flow/durable-dispatch/cases.json +1199 -0
  113. fancy_conformance/_data/suites/flow/durable-dispatch/manifest.json +31 -0
  114. fancy_conformance/_data/suites/flow/entry-points/cases.json +721 -0
  115. fancy_conformance/_data/suites/flow/entry-points/manifest.json +26 -0
  116. fancy_conformance/_data/suites/flow/executor-resolution/cases.json +231 -0
  117. fancy_conformance/_data/suites/flow/executor-resolution/manifest.json +27 -0
  118. fancy_conformance/_data/suites/flow/graph-runs/cases.json +3613 -0
  119. fancy_conformance/_data/suites/flow/graph-runs/manifest.json +29 -0
  120. fancy_conformance/_data/suites/flow/kind-declaration-surface/cases.json +399 -0
  121. fancy_conformance/_data/suites/flow/kind-declaration-surface/manifest.json +30 -0
  122. fancy_conformance/_data/suites/flow/port-activation/cases.json +166 -0
  123. fancy_conformance/_data/suites/flow/port-activation/manifest.json +32 -0
  124. fancy_conformance/_data/suites/flow/run-diagnostics/cases.json +1334 -0
  125. fancy_conformance/_data/suites/flow/run-diagnostics/manifest.json +29 -0
  126. fancy_conformance/_data/suites/flow/subflow-registry/cases.json +126 -0
  127. fancy_conformance/_data/suites/flow/subflow-registry/manifest.json +28 -0
  128. fancy_conformance/_data/suites/flow/template-references/cases.json +1949 -0
  129. fancy_conformance/_data/suites/flow/template-references/manifest.json +26 -0
  130. fancy_conformance/_data/suites/flow/workflow-props/cases.json +558 -0
  131. fancy_conformance/_data/suites/flow/workflow-props/manifest.json +28 -0
  132. fancy_conformance/_data/suites/formula/captures/v1/capture-v1-export.xlsx +0 -0
  133. fancy_conformance/_data/suites/formula/captures/v1/provenance.json +10 -0
  134. fancy_conformance/_data/suites/formula/captures/v1/request.json +21815 -0
  135. fancy_conformance/_data/suites/formula/coerce/cases.json +1743 -0
  136. fancy_conformance/_data/suites/formula/coerce/manifest.json +26 -0
  137. fancy_conformance/_data/suites/formula/dates/cases.json +759 -0
  138. fancy_conformance/_data/suites/formula/dates/manifest.json +26 -0
  139. fancy_conformance/_data/suites/formula/eval-date/cases.json +1205 -0
  140. fancy_conformance/_data/suites/formula/eval-date/manifest.json +26 -0
  141. fancy_conformance/_data/suites/formula/eval-info/cases.json +1111 -0
  142. fancy_conformance/_data/suites/formula/eval-info/manifest.json +26 -0
  143. fancy_conformance/_data/suites/formula/eval-logical/cases.json +1150 -0
  144. fancy_conformance/_data/suites/formula/eval-logical/manifest.json +26 -0
  145. fancy_conformance/_data/suites/formula/eval-lookup/cases.json +3234 -0
  146. fancy_conformance/_data/suites/formula/eval-lookup/manifest.json +26 -0
  147. fancy_conformance/_data/suites/formula/eval-math/cases.json +2327 -0
  148. fancy_conformance/_data/suites/formula/eval-math/manifest.json +26 -0
  149. fancy_conformance/_data/suites/formula/eval-operators/cases.json +2474 -0
  150. fancy_conformance/_data/suites/formula/eval-operators/manifest.json +26 -0
  151. fancy_conformance/_data/suites/formula/eval-stat/cases.json +2198 -0
  152. fancy_conformance/_data/suites/formula/eval-stat/manifest.json +26 -0
  153. fancy_conformance/_data/suites/formula/eval-text/cases.json +2100 -0
  154. fancy_conformance/_data/suites/formula/eval-text/manifest.json +26 -0
  155. fancy_conformance/_data/suites/formula/float/cases.json +998 -0
  156. fancy_conformance/_data/suites/formula/float/manifest.json +26 -0
  157. fancy_conformance/_data/suites/formula/pricing/cases.json +4814 -0
  158. fancy_conformance/_data/suites/formula/pricing/manifest.json +26 -0
  159. fancy_conformance/_data/suites/formula/security/cases.json +923 -0
  160. fancy_conformance/_data/suites/formula/security/manifest.json +26 -0
  161. fancy_conformance/_data/suites/fun-lab/analytics/cases.json +1581 -0
  162. fancy_conformance/_data/suites/fun-lab/analytics/manifest.json +34 -0
  163. fancy_conformance/_data/suites/fun-lab/events/cases.json +1154 -0
  164. fancy_conformance/_data/suites/fun-lab/events/manifest.json +34 -0
  165. fancy_conformance/_data/suites/fun-lab/grants/cases.json +1237 -0
  166. fancy_conformance/_data/suites/fun-lab/grants/manifest.json +34 -0
  167. fancy_conformance/_data/suites/fun-lab/leaderboard/cases.json +2072 -0
  168. fancy_conformance/_data/suites/fun-lab/leaderboard/manifest.json +34 -0
  169. fancy_conformance/_data/suites/fun-lab/progression/cases.json +3428 -0
  170. fancy_conformance/_data/suites/fun-lab/progression/manifest.json +34 -0
  171. fancy_conformance/_data/suites/fun-lab/strings/cases.json +296 -0
  172. fancy_conformance/_data/suites/fun-lab/strings/manifest.json +34 -0
  173. fancy_conformance/_data/suites/http/SPEC.md +300 -0
  174. fancy_conformance/_data/suites/http/error-envelope/cases.json +1532 -0
  175. fancy_conformance/_data/suites/http/error-envelope/envelope.schema.json +44 -0
  176. fancy_conformance/_data/suites/http/error-envelope/manifest.json +40 -0
  177. fancy_conformance/_data/suites/http/request-guards/cases.json +2500 -0
  178. fancy_conformance/_data/suites/http/request-guards/fixtures/five-rows.xlsx +0 -0
  179. fancy_conformance/_data/suites/http/request-guards/fixtures/list-10000.json +1 -0
  180. fancy_conformance/_data/suites/http/request-guards/fixtures/list-10001.json +1 -0
  181. fancy_conformance/_data/suites/http/request-guards/fixtures/not-a-workbook.xlsx +1 -0
  182. fancy_conformance/_data/suites/http/request-guards/manifest.json +36 -0
  183. fancy_conformance/_data/suites/last-word/docx-constructs/cases.json +10885 -0
  184. fancy_conformance/_data/suites/last-word/docx-constructs/fixtures/section-starts.docx +0 -0
  185. fancy_conformance/_data/suites/last-word/docx-constructs/fixtures/two-sections.docx +0 -0
  186. fancy_conformance/_data/suites/last-word/docx-constructs/manifest.json +52 -0
  187. fancy_conformance/_data/suites/shared/decimal/cases.json +182 -0
  188. fancy_conformance/_data/suites/shared/decimal/manifest.json +29 -0
  189. fancy_conformance/_data/suites/shared/expr/cases.json +255 -0
  190. fancy_conformance/_data/suites/shared/expr/manifest.json +26 -0
  191. fancy_conformance/_data/suites/shared/feature-entitlement/cases.json +459 -0
  192. fancy_conformance/_data/suites/shared/feature-entitlement/manifest.json +33 -0
  193. fancy_conformance/_data/suites/shared/flow-run-identity/cases.json +241 -0
  194. fancy_conformance/_data/suites/shared/flow-run-identity/manifest.json +30 -0
  195. fancy_conformance/_data/suites/shared/image-header/cases.json +275 -0
  196. fancy_conformance/_data/suites/shared/image-header/manifest.json +51 -0
  197. fancy_conformance/_data/suites/shared/money-minor-units/cases.json +409 -0
  198. fancy_conformance/_data/suites/shared/money-minor-units/manifest.json +28 -0
  199. fancy_conformance/_data/suites/shared/satisfies-range/cases.json +147 -0
  200. fancy_conformance/_data/suites/shared/satisfies-range/manifest.json +21 -0
  201. fancy_conformance/_data/suites/shared/strings/cases.json +454 -0
  202. fancy_conformance/_data/suites/shared/strings/manifest.json +26 -0
  203. fancy_conformance/_data/suites/shared/subscription-lease/cases.json +206 -0
  204. fancy_conformance/_data/suites/shared/subscription-lease/manifest.json +41 -0
  205. fancy_conformance/_data/suites/shared/trading-pnl/cases.json +364 -0
  206. fancy_conformance/_data/suites/shared/trading-pnl/manifest.json +46 -0
  207. fancy_conformance/_data/suites/shared/value-equality/cases.json +524 -0
  208. fancy_conformance/_data/suites/shared/value-equality/manifest.json +28 -0
  209. fancy_conformance/_data/suites/sign/SPEC.md +135 -0
  210. fancy_conformance/_data/suites/sign/chain/cases.json +1466 -0
  211. fancy_conformance/_data/suites/sign/chain/manifest.json +32 -0
  212. fancy_conformance/_data/suites/sign/completion/cases.json +1682 -0
  213. fancy_conformance/_data/suites/sign/completion/manifest.json +35 -0
  214. fancy_conformance/_data/suites/sign/fields/cases.json +1330 -0
  215. fancy_conformance/_data/suites/sign/fields/manifest.json +30 -0
  216. fancy_conformance/_data/suites/sign/otp/cases.json +2455 -0
  217. fancy_conformance/_data/suites/sign/otp/manifest.json +32 -0
  218. fancy_conformance/_data/suites/template/directives/cases.json +3740 -0
  219. fancy_conformance/_data/suites/template/directives/manifest.json +31 -0
  220. fancy_conformance/_data/suites/template/filters/cases.json +1904 -0
  221. fancy_conformance/_data/suites/template/filters/manifest.json +30 -0
  222. fancy_conformance/_data/suites/template/inspect/cases.json +2611 -0
  223. fancy_conformance/_data/suites/template/inspect/manifest.json +29 -0
  224. fancy_conformance/_data/suites/template/limits/cases.json +12768 -0
  225. fancy_conformance/_data/suites/template/limits/manifest.json +29 -0
  226. fancy_conformance/_data/suites/template/profiles/cases.json +2054 -0
  227. fancy_conformance/_data/suites/template/profiles/manifest.json +31 -0
  228. fancy_conformance/_data/suites/template/resolve/cases.json +2122 -0
  229. fancy_conformance/_data/suites/template/resolve/manifest.json +31 -0
  230. fancy_conformance/_data/suites/template/tokenize/cases.json +744 -0
  231. fancy_conformance/_data/suites/template/tokenize/manifest.json +29 -0
  232. fancy_conformance/py.typed +0 -0
  233. fancy_conformance-0.55.1.dist-info/METADATA +128 -0
  234. fancy_conformance-0.55.1.dist-info/RECORD +235 -0
  235. fancy_conformance-0.55.1.dist-info/WHEEL +4 -0
@@ -0,0 +1,482 @@
1
+ """Loader for the shared conformance fixtures, for Python implementations.
2
+
3
+ The third loader, deliberately the same shape as ``src/index.ts`` (Node) and
4
+ ``php/src/Conformance.php`` (PHP), so a reviewer comparing three CI logs is
5
+ comparing like with like.
6
+
7
+ It exists because four Python packages -- ``holy-sheet-py``, ``dark-slide-py``,
8
+ ``last-word-py`` and ``fancy-flow-py`` -- each carried a private copy of it, and
9
+ those copies had **already diverged**: two of them read a case's ``skip`` as a
10
+ scalar rather than as a map keyed by language, which makes a row skipped for PHP
11
+ silently skip on Python too, while the log still reads green. That is precisely
12
+ the failure this repository exists to stop, reproduced inside its own consumers,
13
+ which is why the loader belongs here rather than in any of them.
14
+
15
+ Zero runtime dependencies: a fixture loader that needs a framework booted is a
16
+ fixture loader that gets skipped.
17
+
18
+ Four rules from ``runners/README.md``, all honoured below:
19
+
20
+ 1. Run on every push and PR -- not nightly, not at release.
21
+ 2. **A missing toolchain is a FAILURE, not a skip.** ``skipIf(!HAS_X)``
22
+ returning green is the exact mechanism that hid two-way drift for months, so
23
+ :func:`suites_root` raises rather than returning ``None``.
24
+ 3. Print the summary unconditionally, including every skip and its reason.
25
+ 4. Print and assert the pinned suite version.
26
+ """
27
+
28
+ from __future__ import annotations
29
+
30
+ import gzip
31
+ import hashlib
32
+ import json
33
+ import os
34
+ import re
35
+ import zlib
36
+ from collections.abc import Callable, Mapping
37
+ from pathlib import Path
38
+ from typing import Any, Literal
39
+
40
+ __version__ = "0.55.1"
41
+
42
+ Language = Literal["php", "node", "rust", "python", "go"]
43
+
44
+ __all__ = [
45
+ "Language",
46
+ "cases",
47
+ "equals",
48
+ "fixture_bytes",
49
+ "format_summary",
50
+ "is_file_ref",
51
+ "list_suites",
52
+ "manifest",
53
+ "run_table",
54
+ "suite_path",
55
+ "suites_root",
56
+ "version",
57
+ ]
58
+
59
+ _ENV = "FANCY_CONFORMANCE_ROOT"
60
+
61
+ #: Where a wheel build drops the fixture tree, so an installed package carries
62
+ #: its own data and does not need a checkout beside it.
63
+ _PACKAGED_DATA = Path(__file__).resolve().parent / "_data"
64
+
65
+
66
+ def suites_root() -> Path:
67
+ """The fixture root -- the directory holding ``suites/``.
68
+
69
+ Resolution order:
70
+
71
+ 1. the ``FANCY_CONFORMANCE_ROOT`` environment variable,
72
+ 2. fixtures shipped inside this package (an installed wheel),
73
+ 3. a bounded walk up from this file to whatever directory holds ``suites/``
74
+ (a checkout of this repository),
75
+ 4. a bounded walk up looking for a sibling ``fancy-conformance`` checkout,
76
+ directly or under ``repos/`` (an envelope layout).
77
+
78
+ Never a fixed ``../..`` and never a hard-coded sibling path: the two parity
79
+ harnesses this package replaced both did that, which is why they ran in
80
+ exactly one directory layout and silently no-opped everywhere else.
81
+
82
+ Raises rather than returning ``None`` so the failure is a red build.
83
+ """
84
+ override = os.environ.get(_ENV)
85
+ if override:
86
+ candidate = Path(override)
87
+ if (candidate / "suites").is_dir():
88
+ return candidate
89
+ raise RuntimeError(
90
+ f"{_ENV} is set to {override!r} but there is no suites/ directory there."
91
+ )
92
+
93
+ if (_PACKAGED_DATA / "suites").is_dir():
94
+ return _PACKAGED_DATA
95
+
96
+ here = Path(__file__).resolve()
97
+ for parent in here.parents[:8]:
98
+ if (parent / "suites").is_dir():
99
+ return parent
100
+ for base in (parent, parent / "repos"):
101
+ sibling = base / "fancy-conformance"
102
+ if (sibling / "suites").is_dir():
103
+ return sibling
104
+
105
+ raise RuntimeError(
106
+ "fancy-conformance: could not locate the suites/ directory. Check this repository "
107
+ f"out beside the one under test or set {_ENV} to its root. This is deliberately an "
108
+ "error and not a skip: a conformance suite that silently does not run is worse than "
109
+ "no suite, because the log reads identically to full coverage."
110
+ )
111
+
112
+
113
+ def version() -> str:
114
+ """The fixture collection's own version -- the thing a runner must print."""
115
+ return (suites_root() / "VERSION").read_text(encoding="utf-8").strip()
116
+
117
+
118
+ def list_suites() -> list[str]:
119
+ """Every suite id present, e.g. ``["shared/decimal", "shared/expr", ...]``."""
120
+ root = suites_root() / "suites"
121
+ return sorted(m.parent.relative_to(root).as_posix() for m in root.rglob("manifest.json"))
122
+
123
+
124
+ def suite_path(suite: str, root: Path | str | None = None) -> str:
125
+ """Absolute path to a suite's directory -- for runners that read artifacts."""
126
+ return str(_root(root) / "suites" / suite)
127
+
128
+
129
+ def manifest(suite: str, root: Path | str | None = None) -> dict[str, Any]:
130
+ """One suite's manifest: the contract it pins and whose behaviour is the reference."""
131
+ path = _root(root) / "suites" / suite / "manifest.json"
132
+ decoded = json.loads(path.read_text(encoding="utf-8"))
133
+ if not isinstance(decoded, dict):
134
+ raise RuntimeError(f"fancy-conformance: {path} is not an object.")
135
+ return decoded
136
+
137
+
138
+ def cases(suite: str, root: Path | str | None = None) -> list[dict[str, Any]]:
139
+ """Load a table suite's rows, enforcing the repository's own invariants.
140
+
141
+ ``root`` exists so the load-time guards below can be tested against a
142
+ throwaway fixture tree, rather than a test re-implementing them. A guard
143
+ asserted by a copy of itself is the failure mode this whole repository
144
+ exists to stop, and it would be an embarrassing one to ship here. Both peer
145
+ loaders take the same argument for the same reason.
146
+ """
147
+ base = _root(root)
148
+ meta = manifest(suite, base)
149
+
150
+ if meta.get("caseFormat") != "table":
151
+ raise RuntimeError(
152
+ f'fancy-conformance: suite "{suite}" is not a table suite. Directory suites are '
153
+ "driven through the subprocess CLI in runners/, not this loader."
154
+ )
155
+
156
+ payload = json.loads(
157
+ (base / "suites" / suite / meta.get("cases", "cases.json")).read_text(encoding="utf-8")
158
+ )
159
+ rows = payload.get("cases")
160
+
161
+ if not isinstance(rows, list) or not rows:
162
+ raise RuntimeError(f'fancy-conformance: suite "{suite}" has no cases.')
163
+
164
+ _assert_usable_cases(suite, rows)
165
+ _assert_file_refs(base / "suites" / suite, suite, rows)
166
+ return rows
167
+
168
+
169
+ _FILE_PATTERN = re.compile(r"fixtures/[A-Za-z0-9_-][A-Za-z0-9._-]*")
170
+ _SHA256_PATTERN = re.compile(r"[0-9a-f]{64}")
171
+
172
+
173
+ def is_file_ref(value: Any) -> bool:
174
+ """Is this a file reference (well formed or not)?
175
+
176
+ A dict whose ``file`` is a STRING starting ``fixtures/``. Any other ``file``
177
+ member is ordinary data: a hostile document model carries
178
+ ``{"type": "launch", "file": "calc.exe"}`` for a writer to ignore.
179
+ """
180
+ if not isinstance(value, dict):
181
+ return False
182
+ file = value.get("file")
183
+ return isinstance(file, str) and file.startswith("fixtures/")
184
+
185
+
186
+ def _file_ref_problem(ref: Mapping[str, Any]) -> str | None:
187
+ """Why a reference is malformed, or ``None``. The four loaders return these exact sentences."""
188
+ if sorted(ref) != ["file", "sha256"]:
189
+ return "it must have exactly the members file and sha256"
190
+ file = ref["file"]
191
+ if not isinstance(file, str) or _FILE_PATTERN.fullmatch(file) is None:
192
+ return (
193
+ "file must be fixtures/<name>, the name made of A-Z a-z 0-9 . _ - "
194
+ "and not starting with a dot"
195
+ )
196
+ digest = ref["sha256"]
197
+ if not isinstance(digest, str) or _SHA256_PATTERN.fullmatch(digest) is None:
198
+ return "sha256 must be 64 lowercase hex digits"
199
+ return None
200
+
201
+
202
+ def _assert_file_refs(folder: Path, suite: str, rows: list[dict[str, Any]]) -> None:
203
+ """Every file reference is well formed and its file exists, at LOAD time.
204
+
205
+ In input, expected and artifacts alike: where a reference sits must not
206
+ decide whether it is checked. Existence only; :func:`fixture_bytes` hashes.
207
+ """
208
+
209
+ def walk(value: Any, pointer: str, case_id: str) -> None:
210
+ if is_file_ref(value):
211
+ problem = _file_ref_problem(value)
212
+ if problem is not None:
213
+ raise RuntimeError(
214
+ f'fancy-conformance: case "{suite}/{case_id}" has a malformed file '
215
+ f"reference at {pointer}: {problem}."
216
+ )
217
+ if not (folder / value["file"]).is_file():
218
+ raise RuntimeError(
219
+ f'fancy-conformance: case "{suite}/{case_id}" references {value["file"]}, '
220
+ "which does not exist in the suite directory."
221
+ )
222
+ return
223
+ if isinstance(value, list):
224
+ for index, item in enumerate(value):
225
+ walk(item, f"{pointer}/{index}", case_id)
226
+ elif isinstance(value, dict):
227
+ for key, item in value.items():
228
+ walk(item, f"{pointer}/{key.replace('~', '~0').replace('/', '~1')}", case_id)
229
+
230
+ for row in rows:
231
+ for member in ("input", "expected", "artifacts"):
232
+ if member in row:
233
+ walk(row[member], "/" + member, str(row.get("id")))
234
+
235
+
236
+ def fixture_bytes(suite: str, ref: Mapping[str, Any], root: Path | str | None = None) -> bytes:
237
+ """The bytes a file reference names: gunzipped for ``.gz``, checked against its sha256.
238
+
239
+ A mismatch RAISES: a fixture that is not the bytes its row names must never
240
+ be asserted against as if it were.
241
+ """
242
+ problem = _file_ref_problem(ref)
243
+ if problem is not None:
244
+ raise RuntimeError(f"fancy-conformance: malformed file reference: {problem}.")
245
+ name = str(ref["file"])
246
+ data = (_root(root) / "suites" / suite / name).read_bytes()
247
+ if name.endswith(".gz"):
248
+ try:
249
+ if len(data) < 18 or data[:2] != b"\x1f\x8b":
250
+ raise OSError("no gzip magic")
251
+ data = gzip.decompress(data)
252
+ except (OSError, EOFError, zlib.error) as exc:
253
+ raise RuntimeError(
254
+ f'fancy-conformance: suite "{suite}" fixture {name} is not a gzip file.'
255
+ ) from exc
256
+ got = hashlib.sha256(data).hexdigest()
257
+ if got != ref["sha256"]:
258
+ raise RuntimeError(
259
+ f'fancy-conformance: suite "{suite}" fixture {name} does not match its sha256 '
260
+ f"(expected {ref['sha256']}, got {got})."
261
+ )
262
+ return data
263
+
264
+
265
+ def _assert_usable_cases(suite: str, rows: list[dict[str, Any]]) -> None:
266
+ """Reject a case table that cannot do its job, at LOAD time.
267
+
268
+ A skip with no reason and a duplicate id are both otherwise silent: the
269
+ suite still loads, still reports green, and still covers less than it
270
+ appears to.
271
+ """
272
+ seen: set[str] = set()
273
+
274
+ for row in rows:
275
+ case_id = str(row.get("id"))
276
+ if case_id in seen:
277
+ raise RuntimeError(
278
+ f'fancy-conformance: suite "{suite}" has duplicate case id "{case_id}".'
279
+ )
280
+ seen.add(case_id)
281
+
282
+ # `skip` is a MAP keyed by language, not a string. Reading it as a
283
+ # scalar makes every skip apply to every language AND makes the
284
+ # empty-reason guard unreachable, because `str({...})` is never blank.
285
+ for language, reason in (row.get("skip") or {}).items():
286
+ if not isinstance(reason, str) or reason.strip() == "":
287
+ raise RuntimeError(
288
+ f'fancy-conformance: case "{suite}/{case_id}" skips {language} with no '
289
+ "reason. A skip must say why, because every runner prints it."
290
+ )
291
+
292
+
293
+ def run_table(
294
+ suite: str,
295
+ impl: Callable[[dict[str, Any]], Any],
296
+ language: Language | str = "python",
297
+ root: Path | str | None = None,
298
+ equals_fn: Callable[[Any, Any], bool] | None = None,
299
+ ) -> dict[str, Any]:
300
+ """Run one implementation against a table suite.
301
+
302
+ ``impl`` receives a case and returns the value to compare. A case that
303
+ raises is a FAILURE with the message recorded, not a crash -- an
304
+ implementation blowing up is data about the implementation.
305
+
306
+ ``language`` decides which ``skip`` entries apply, and is reported in the
307
+ summary. It is a parameter rather than a constant so a Python harness can
308
+ drive another implementation out of process, exactly as the PHP loader's
309
+ ``$language`` argument allows.
310
+ """
311
+ # A caller-supplied comparator may take two arguments; the built-in takes an
312
+ # optional third. Adapting here keeps a custom comparator working rather
313
+ # than breaking every caller that passed one before tolerances existed.
314
+ base = equals_fn or equals
315
+
316
+ def compare(actual: Any, expected: Any, tolerance: float | None) -> bool:
317
+ try:
318
+ return bool(base(actual, expected, tolerance))
319
+ except TypeError:
320
+ return bool(base(actual, expected))
321
+
322
+ results: list[dict[str, Any]] = []
323
+
324
+ for row in cases(suite, root):
325
+ reason = (row.get("skip") or {}).get(language)
326
+ if reason is not None:
327
+ results.append(
328
+ {"id": row["id"], "title": row.get("title"), "status": "skip", "reason": reason}
329
+ )
330
+ continue
331
+
332
+ try:
333
+ actual: Any = impl(row)
334
+ except Exception as exc:
335
+ results.append(
336
+ {
337
+ "id": row["id"],
338
+ "title": row.get("title"),
339
+ "status": "fail",
340
+ "expected": row.get("expected"),
341
+ "actual": f"threw: {exc}",
342
+ }
343
+ )
344
+ continue
345
+
346
+ expected = row.get("expected")
347
+ results.append(
348
+ {"id": row["id"], "title": row.get("title"), "status": "pass"}
349
+ if compare(actual, expected, _tolerance_for(row))
350
+ else {
351
+ "id": row["id"],
352
+ "title": row.get("title"),
353
+ "status": "fail",
354
+ "expected": expected,
355
+ "actual": actual,
356
+ }
357
+ )
358
+
359
+ def count(status: str) -> int:
360
+ return sum(1 for r in results if r["status"] == status)
361
+
362
+ failed = count("fail")
363
+
364
+ return {
365
+ "suite": suite,
366
+ "language": language,
367
+ "suiteVersion": version(),
368
+ "passed": count("pass"),
369
+ "failed": failed,
370
+ "skipped": count("skip"),
371
+ "results": results,
372
+ "ok": failed == 0,
373
+ }
374
+
375
+
376
+ def _tolerance_for(case: Mapping[str, Any]) -> float | None:
377
+ """A case's declared float tolerance, or ``None`` for exact comparison.
378
+
379
+ Declared ON THE ROW so it is visible in the fixtures and in any diff of
380
+ them. A global epsilon is invisible: nobody reading a case can tell whether
381
+ it asserts a value or a neighbourhood.
382
+
383
+ ``bool`` is excluded explicitly -- ``isinstance(True, int)`` is true in
384
+ Python, so a stray ``"tolerance": true`` would otherwise become a tolerance
385
+ of 1.0 and quietly pass almost anything.
386
+ """
387
+ tolerance = case.get("tolerance")
388
+ if isinstance(tolerance, bool) or not isinstance(tolerance, int | float):
389
+ return None
390
+ return float(tolerance)
391
+
392
+
393
+ def equals(a: Any, b: Any, tolerance: float | None = None) -> bool:
394
+ """Order-sensitive for lists, order-insensitive for object keys.
395
+
396
+ Two deliberate rules, each with a peer it is matching:
397
+
398
+ **Booleans are not integers.** Python's ``==`` says ``True == 1`` and
399
+ ``False == 0``; the peers compare with ``===`` and PHP's ``equals`` with
400
+ ``===`` too. Without this a row expecting ``False`` is satisfied by an
401
+ implementation returning ``0``, and a money row expecting ``0`` by one
402
+ returning ``False``.
403
+
404
+ **Floats compare EXACTLY, by numeric value.** A scaled ``1e-12`` epsilon
405
+ used to live here, justified as "a golden written as ``0.002`` in JSON is a
406
+ decimal literal, and the nearest double to it is not the nearest double to
407
+ every language's parse of the same text".
408
+
409
+ That justification is FALSE, and it was measured rather than argued.
410
+ ``0.002`` -- the literal the reason itself named -- along with ``0.1``,
411
+ ``1e300``, ``DBL_MAX``, the ``5e-324`` denormal and
412
+ ``0.30000000000000004`` all parse to BIT-IDENTICAL doubles in PHP, Python
413
+ and Node. Decimal-to-double conversion is specified, not per-implementation.
414
+
415
+ What the epsilon actually did was let two runtimes that computed DIFFERENT
416
+ values pass as equal, in the package whose entire product is detecting
417
+ exactly that. On a money row a relative ``1e-12`` is real money at scale.
418
+
419
+ Where a case genuinely needs tolerance it declares one -- visible on the row
420
+ and reviewable in a diff, rather than a global behaviour no reader of the
421
+ fixtures can see. Same principle as a skip having to state its reason.
422
+ """
423
+ if isinstance(a, bool) != isinstance(b, bool):
424
+ return False
425
+ if isinstance(a, bool):
426
+ return a is b
427
+
428
+ if isinstance(a, dict) and isinstance(b, dict):
429
+ if set(a) != set(b):
430
+ return False
431
+ return all(equals(a[k], b[k], tolerance) for k in a)
432
+
433
+ if isinstance(a, list) and isinstance(b, list):
434
+ if len(a) != len(b):
435
+ return False
436
+ return all(equals(x, y, tolerance) for x, y in zip(a, b, strict=True))
437
+
438
+ if isinstance(a, dict | list) or isinstance(b, dict | list):
439
+ return False
440
+
441
+ if isinstance(a, int | float) and isinstance(b, int | float):
442
+ if isinstance(a, int) and isinstance(b, int):
443
+ return a == b
444
+ if tolerance is not None:
445
+ scale = max(1.0, abs(float(a)), abs(float(b)))
446
+ return abs(float(a) - float(b)) <= tolerance * scale
447
+ return float(a) == float(b)
448
+
449
+ return bool(a == b)
450
+
451
+
452
+ def format_summary(summary: dict[str, Any]) -> str:
453
+ """A summary a CI log can be read from -- including every skip, by name and reason.
454
+
455
+ Skips are printed unconditionally and never folded into a bare count.
456
+ "3 skipped" in a log looks the same as full coverage at a glance, which is
457
+ how a suite stops meaning anything without anyone deciding that it should.
458
+ """
459
+ lines = [
460
+ f"{summary['suite']} [{summary['language']}] "
461
+ f"-- fancy-conformance {summary['suiteVersion']}",
462
+ f" {summary['passed']} passed, {summary['failed']} failed, {summary['skipped']} skipped",
463
+ ]
464
+
465
+ for r in summary["results"]:
466
+ if r["status"] == "skip":
467
+ lines.append(f" SKIP {r['id']} -- {r['reason']}")
468
+ if r["status"] == "fail":
469
+ lines.append(f" FAIL {r['id']} {r.get('title') or ''}".rstrip())
470
+ lines.append(f" expected: {_preview(r.get('expected'))}")
471
+ lines.append(f" actual: {_preview(r.get('actual'))}")
472
+
473
+ return "\n".join(lines)
474
+
475
+
476
+ def _preview(value: Any) -> str:
477
+ text = value if isinstance(value, str) else json.dumps(value, ensure_ascii=False)
478
+ return f"{text[:60]}...{text[-40:]} (len {len(text)})" if len(text) > 120 else text
479
+
480
+
481
+ def _root(root: Path | str | None) -> Path:
482
+ return suites_root() if root is None else Path(root)
@@ -0,0 +1 @@
1
+ 0.55.1
@@ -0,0 +1,77 @@
1
+ {
2
+ "$schema": "https://json-schema.org/draft/2020-12/schema",
3
+ "$id": "https://ui.particle.academy/schemas/conformance-case-table.schema.json",
4
+ "title": "Fancy conformance case table",
5
+ "type": "object",
6
+ "required": ["suite", "cases"],
7
+ "properties": {
8
+ "$schema": { "type": "string" },
9
+ "suite": { "type": "string", "minLength": 1 },
10
+ "cases": {
11
+ "type": "array",
12
+ "minItems": 1,
13
+ "items": { "$ref": "#/$defs/case" }
14
+ }
15
+ },
16
+ "additionalProperties": false,
17
+ "$defs": {
18
+ "case": {
19
+ "type": "object",
20
+ "required": ["id", "title", "since", "input", "expected"],
21
+ "properties": {
22
+ "id": {
23
+ "description": "Stable, ordered, unique within the suite. Never renumber — an id appears in changelogs and in other repos' skip lists.",
24
+ "type": "string",
25
+ "pattern": "^[0-9]{4}-[a-z0-9]+(?:[-.][a-z0-9]+)*$"
26
+ },
27
+ "title": { "type": "string", "minLength": 1 },
28
+ "since": {
29
+ "type": "string",
30
+ "pattern": "^[0-9]+\\.[0-9]+\\.[0-9]+$"
31
+ },
32
+ "tags": {
33
+ "type": "array",
34
+ "items": { "type": "string", "minLength": 1 }
35
+ },
36
+ "fn": {
37
+ "description": "Which of the suite's functions this case exercises. Required when the suite declares contract.functions.",
38
+ "type": "string",
39
+ "minLength": 1
40
+ },
41
+ "input": {
42
+ "description": "The arguments. Anywhere inside it (and inside expected and artifacts), an object whose `file` is a string starting `fixtures/` is a FILE REFERENCE, `$defs.fileRef`: bytes stored beside the suite, resolved by the loader's fixtureBytes().",
43
+ "type": "object"
44
+ },
45
+ "expected": {},
46
+ "artifacts": {
47
+ "description": "Named data that is NOT compared: typically file references to the reference implementation's own output, kept so a failing implementation can diff against it. A runner must never derive its answer from an artifact.",
48
+ "type": "object"
49
+ },
50
+ "skip": {
51
+ "description": "The ONLY sanctioned way not to run a case. Keyed by language; the value is a REASON and may not be empty. A runner prints every skip in its summary — a silent skip is what turned two existing parity suites into decoration.",
52
+ "type": "object",
53
+ "propertyNames": { "enum": ["php", "node", "rust", "python", "go"] },
54
+ "additionalProperties": { "type": "string", "minLength": 1 },
55
+ "minProperties": 1
56
+ },
57
+ "tolerance": {
58
+ "description": "Optional relative tolerance for FLOAT comparison in this case, scaled by the larger magnitude. Omit it and numbers compare EXACTLY, which is the default in all four loaders. Declared on the row rather than applied globally so a reader of the fixture can see whether it asserts a value or a neighbourhood — the same reason a skip must state its reason. A global 1e-12 epsilon lived in three loaders until 0.10.0 and let two runtimes that computed different values pass as equal.",
59
+ "type": "number",
60
+ "exclusiveMinimum": 0
61
+ },
62
+ "notes": { "type": "string", "minLength": 1 }
63
+ },
64
+ "additionalProperties": false
65
+ },
66
+ "fileRef": {
67
+ "description": "Bytes too large or too binary for a JSON cell. `file` is relative to the suite directory: `fixtures/` plus a flat name of [A-Za-z0-9._-] not starting with a dot. A name ending `.gz` is ONE gzip member and resolves to its decompressed bytes. `sha256` is the lowercase hex digest of the RESOLVED bytes, so how the stored file is compressed is never part of the contract. Shape and existence are checked at load time in every loader; the digest in fixtureBytes().",
68
+ "type": "object",
69
+ "required": ["file", "sha256"],
70
+ "properties": {
71
+ "file": { "type": "string", "pattern": "^fixtures/[A-Za-z0-9_-][A-Za-z0-9._-]*$" },
72
+ "sha256": { "type": "string", "pattern": "^[0-9a-f]{64}$" }
73
+ },
74
+ "additionalProperties": false
75
+ }
76
+ }
77
+ }
@@ -0,0 +1,85 @@
1
+ {
2
+ "$schema": "https://json-schema.org/draft/2020-12/schema",
3
+ "$id": "https://ui.particle.academy/schemas/conformance-suite-manifest.schema.json",
4
+ "title": "Fancy conformance suite manifest",
5
+ "type": "object",
6
+ "required": ["suite", "title", "since", "caseFormat", "contract"],
7
+ "properties": {
8
+ "$schema": { "type": "string" },
9
+ "suite": {
10
+ "description": "Path-shaped id, matching this file's directory under suites/.",
11
+ "type": "string",
12
+ "pattern": "^[a-z0-9]+(?:-[a-z0-9]+)*(?:/[a-z0-9]+(?:-[a-z0-9]+)*)*$"
13
+ },
14
+ "title": { "type": "string", "minLength": 1 },
15
+ "since": {
16
+ "description": "Suite version in which this suite first appeared.",
17
+ "type": "string",
18
+ "pattern": "^[0-9]+\\.[0-9]+\\.[0-9]+$"
19
+ },
20
+ "caseFormat": {
21
+ "description": "'table' — one cases.json whose rows are the cases; for pure functions. 'directory' — cases/<id>/ holding input + expected artifacts; for capabilities that emit files.",
22
+ "enum": ["table", "directory"]
23
+ },
24
+ "cases": {
25
+ "description": "For caseFormat=table, the file holding the rows. Defaults to cases.json.",
26
+ "type": "string"
27
+ },
28
+ "contract": {
29
+ "type": "object",
30
+ "required": ["summary", "implementations"],
31
+ "properties": {
32
+ "summary": { "type": "string", "minLength": 1 },
33
+ "function": { "type": "string" },
34
+ "functions": {
35
+ "type": "object",
36
+ "additionalProperties": { "type": "string" }
37
+ },
38
+ "runShape": { "type": "object" },
39
+ "reference": {
40
+ "description": "Which language's behaviour the goldens were taken from. Goldens are never what a value 'obviously' is. 'authored' means the suite's author decided them rather than capturing them from a runtime; referenceNote must say by whom and on what evidence. 'google-sheets' means the goldens were CAPTURED from Google Sheets (fancy-formula, D4); referenceNote is then required and must name the capture artifact, its date and who captured it.",
41
+ "enum": ["php", "node", "rust", "python", "go", "authored", "google-sheets"]
42
+ },
43
+ "referenceNote": { "type": "string" },
44
+ "implementations": {
45
+ "type": "array",
46
+ "minItems": 1,
47
+ "items": {
48
+ "type": "object",
49
+ "required": ["language", "package"],
50
+ "properties": {
51
+ "language": { "enum": ["php", "node", "rust", "python", "go"] },
52
+ "package": { "type": "string", "minLength": 1 },
53
+ "symbol": { "type": "string" },
54
+ "engine": { "type": "string", "description": "For an implementation that runs inside a workflow engine: the engine package and the range it is exercised against." }
55
+ },
56
+ "additionalProperties": false
57
+ }
58
+ }
59
+ },
60
+ "allOf": [
61
+ {
62
+ "if": { "properties": { "reference": { "const": "google-sheets" } }, "required": ["reference"] },
63
+ "then": {
64
+ "required": ["referenceNote"],
65
+ "properties": { "referenceNote": { "type": "string", "minLength": 1 } }
66
+ }
67
+ }
68
+ ],
69
+ "additionalProperties": false
70
+ },
71
+ "normalisation": {
72
+ "description": "For artifact suites only: which parts of an emitted document are ignored when comparing. Declared once per suite so a comparison never quietly loosens per case.",
73
+ "type": "object",
74
+ "properties": {
75
+ "ignoreAttributes": { "type": "array", "items": { "type": "string" } },
76
+ "orderInsensitive": { "type": "array", "items": { "type": "string" } },
77
+ "whitespace": { "enum": ["preserve", "collapse-between-elements"] },
78
+ "newline": { "enum": ["lf", "crlf", "preserve"] }
79
+ },
80
+ "additionalProperties": false
81
+ },
82
+ "notes": { "type": "array", "items": { "type": "string" } }
83
+ },
84
+ "additionalProperties": false
85
+ }