@metabase/cli 0.3.1-alpha.transform-tests.3fbcf8b → 0.3.1-alpha.transform-tests.c0bc2d1

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 (190) hide show
  1. package/dist/{add-collection-C-XJPp3F.mjs → add-collection-CVDgC7C6.mjs} +2 -2
  2. package/dist/{alert-Klz8Bhst.mjs → alert-Co9m8k5l.mjs} +6 -6
  3. package/dist/{alerts-Bp2vByJf.mjs → alerts-DjZGGxOy.mjs} +3 -3
  4. package/dist/{append-D16_s1HW.mjs → append-BXqeNFzW.mjs} +2 -2
  5. package/dist/{archive-Q_qUuYh8.mjs → archive-Bhk1IqGH.mjs} +2 -2
  6. package/dist/{archive-BOJUGwyL.mjs → archive-CH9osnGq.mjs} +2 -2
  7. package/dist/{archive-vzu8ghZZ.mjs → archive-CUGpIXDT.mjs} +2 -2
  8. package/dist/{archive-C9iNjXcI.mjs → archive-CXYUkzZo.mjs} +2 -2
  9. package/dist/{archive-Bj4MjbJY.mjs → archive-Cchi-tqq.mjs} +2 -2
  10. package/dist/{archive-CA-HIfQq.mjs → archive-Csku9zDp.mjs} +2 -2
  11. package/dist/{archive-lDnTIypd.mjs → archive-CzcjKpUC.mjs} +2 -2
  12. package/dist/{archive-RzzXt2V0.mjs → archive-D1xZRRRA.mjs} +2 -2
  13. package/dist/{archive-D4nGMs8A.mjs → archive-DvV3oLCg.mjs} +2 -2
  14. package/dist/{archive-nDvHMzTv.mjs → archive-I61vFPxv.mjs} +2 -2
  15. package/dist/{archive-Dd7ZTibw.mjs → archive-pA5UZn1f.mjs} +2 -2
  16. package/dist/{auth-kyPQfiND.mjs → auth-BKgMIAKH.mjs} +4 -4
  17. package/dist/{branches-QixvzIpl.mjs → branches-B96keFsO.mjs} +1 -1
  18. package/dist/{cancel-CPStS4zJ.mjs → cancel-6GPBlUkr.mjs} +2 -2
  19. package/dist/{cancel-task--cuSISnl.mjs → cancel-task-BIGAgcKk.mjs} +1 -1
  20. package/dist/{card-p2r_szeS.mjs → card-zluRR7xD.mjs} +7 -7
  21. package/dist/{cards-CNbV8aGO.mjs → cards-DY6Togtl.mjs} +2 -2
  22. package/dist/cli.mjs +32 -32
  23. package/dist/{client-DynvZqa0.mjs → client-C9HBWl6A.mjs} +1 -1
  24. package/dist/{collection-CAM47Der.mjs → collection-CrIkQWUK.mjs} +6 -6
  25. package/dist/{content-translation-CxTabpLF.mjs → content-translation-Cg_VW3kW.mjs} +2 -2
  26. package/dist/{create-BGV7ejai.mjs → create-BeNQQTPt.mjs} +1 -1
  27. package/dist/{create-UxWtLwXT.mjs → create-BkIoWkzP.mjs} +1 -1
  28. package/dist/{create-BTvSwLws.mjs → create-BpjBffBq.mjs} +1 -1
  29. package/dist/{create-ku05K1Oj.mjs → create-BsDJATJM.mjs} +4 -4
  30. package/dist/{create-BMokmmLp2.mjs → create-BuWV1GpI2.mjs} +1 -1
  31. package/dist/{create-M8qXs24L.mjs → create-BxWMTy6i.mjs} +1 -1
  32. package/dist/{create-CtDaASGO.mjs → create-CK5MABYu.mjs} +1 -1
  33. package/dist/{create-BGy4L_yh.mjs → create-CaDAT54M.mjs} +1 -1
  34. package/dist/{create-BsvpUxJq.mjs → create-D_pNL2X9.mjs} +1 -1
  35. package/dist/{create-CEP4Jsrd.mjs → create-DqCdW3tt.mjs} +1 -1
  36. package/dist/{create-U15wd8_9.mjs → create-JZevXtCI.mjs} +1 -1
  37. package/dist/{create-CYhsYOOJ.mjs → create-V2Bdeu8p.mjs} +1 -1
  38. package/dist/{create-CsABLrSI.mjs → create-bH-qAv03.mjs} +1 -1
  39. package/dist/{create-branch-Bkq9rtf7.mjs → create-branch-DN9PrlRR.mjs} +1 -1
  40. package/dist/{create-WIIp7MVV.mjs → create-cHltWf0e.mjs} +1 -1
  41. package/dist/{create-DMLjSEkF.mjs → create-cSpqEzKH.mjs} +1 -1
  42. package/dist/{create-BikaTHCw.mjs → create-mzHtey5k.mjs} +1 -1
  43. package/dist/{csv-GincCch9.mjs → csv-CVKLuIuS.mjs} +2 -2
  44. package/dist/{current-task-CbnNWQ7H.mjs → current-task-Dnm3JaWg.mjs} +1 -1
  45. package/dist/{dashboard-ReNaou5J.mjs → dashboard-SxUrG3Cg.mjs} +9 -9
  46. package/dist/{db-2hSYsqHk.mjs → db-BnhuXAP9.mjs} +6 -6
  47. package/dist/{delete-B2wmUpj_.mjs → delete-6lroLZIE.mjs} +2 -2
  48. package/dist/{delete-C1YmyeVy.mjs → delete-BClvnlBc.mjs} +2 -2
  49. package/dist/{delete-CZqleA9Q.mjs → delete-C3xeqTzS.mjs} +3 -3
  50. package/dist/{delete-Bv3_SIqh.mjs → delete-CH0FsDBg.mjs} +2 -2
  51. package/dist/{delete-BEPw7WRT.mjs → delete-DDVNawxh.mjs} +2 -2
  52. package/dist/{delete-DNsY94Ok.mjs → delete-Dn6VJuyR.mjs} +2 -2
  53. package/dist/{delete-table-DySwoEaq.mjs → delete-table-C6LPzUDg.mjs} +2 -2
  54. package/dist/{dependencies-ygT6uMu4.mjs → dependencies-vr51EFIu.mjs} +2 -2
  55. package/dist/{dirty-BkiHZ8gb.mjs → dirty-W0PzG3Yt.mjs} +1 -1
  56. package/dist/{document-DGbDloCb.mjs → document-B1w9aIq7.mjs} +5 -5
  57. package/dist/{download-Chr-YNTG.mjs → download-B-l6ajeo.mjs} +1 -1
  58. package/dist/{eid-BvY-YGpN.mjs → eid-BGl_X67N.mjs} +1 -1
  59. package/dist/{events-B01P0G7C.mjs → events-BRRnroJb.mjs} +2 -2
  60. package/dist/{export-CG23iezf.mjs → export-DEPLFq_E.mjs} +2 -2
  61. package/dist/{field-DikmNcAt.mjs → field-BXaUzJvx.mjs} +4 -4
  62. package/dist/{fields-C9BF3jHL.mjs → fields-LFMSMV5Z.mjs} +2 -2
  63. package/dist/{get-UW0DOjH5.mjs → get-7-OiP8ma.mjs} +2 -2
  64. package/dist/{get-PKhv8WUf.mjs → get-B6lWlGeD.mjs} +2 -2
  65. package/dist/{get-C1V7vZse.mjs → get-BM7MA5-7.mjs} +2 -2
  66. package/dist/{get-B4GltkXP.mjs → get-BUiHdwdU.mjs} +1 -1
  67. package/dist/{get-DvqYIBp5.mjs → get-BempHTsm.mjs} +2 -2
  68. package/dist/{get-C99cjjD0.mjs → get-Bjvu5GM7.mjs} +2 -2
  69. package/dist/{get-DY-e5oP7.mjs → get-BvI5QqjY.mjs} +2 -2
  70. package/dist/{get-CMMXBVff.mjs → get-C2DWxXYb.mjs} +2 -2
  71. package/dist/{get-BHpVRSbm.mjs → get-CapP9GiI.mjs} +5 -5
  72. package/dist/{get-BYSFFlsd.mjs → get-Cjx_5Zm-.mjs} +2 -2
  73. package/dist/{get-Buxkx-RX.mjs → get-DAsSPKxF.mjs} +1 -1
  74. package/dist/{get-DdSB-fpR.mjs → get-DCHhq5Qv.mjs} +2 -2
  75. package/dist/{get-B3jvGI0b.mjs → get-DCf0O3GJ.mjs} +2 -2
  76. package/dist/{get-BtauixMx.mjs → get-DhxE02Ia.mjs} +2 -2
  77. package/dist/{get-FJofgEPB.mjs → get-DiRtfImy.mjs} +1 -1
  78. package/dist/{get-CkMLxzVy.mjs → get-DlQHyv4D.mjs} +2 -2
  79. package/dist/{get-gFM8-HHP.mjs → get-Du11BNRd.mjs} +1 -1
  80. package/dist/{get-DZpRq_Fw.mjs → get-DvCgLmPW.mjs} +2 -2
  81. package/dist/{get-Blbcl76m.mjs → get-M3zgKoZr.mjs} +2 -2
  82. package/dist/{get-N5EUCDL0.mjs → get-XcSH5Zyz.mjs} +2 -2
  83. package/dist/{get-run-F7ARJeAD.mjs → get-run-UJmyRo7H.mjs} +2 -2
  84. package/dist/git-sync-DM5Nuv3a.mjs +28 -0
  85. package/dist/{has-remote-changes-Bwyp8mc-.mjs → has-remote-changes-DmhFpgJe.mjs} +1 -1
  86. package/dist/{import-CPY8aM8d.mjs → import-BRC0TzWQ.mjs} +2 -2
  87. package/dist/{is-dirty-0F_UJY7Q.mjs → is-dirty-CT9e5vSd.mjs} +1 -1
  88. package/dist/{items-FUop0zGR.mjs → items-BSAEWZlw.mjs} +1 -1
  89. package/dist/{library-DpOtb0E0.mjs → library-Zxh_MRVL.mjs} +4 -4
  90. package/dist/{list-rQ-6XSua.mjs → list-08dyODsP.mjs} +1 -1
  91. package/dist/{list-Beoh2AYD.mjs → list-BOUmEn2X.mjs} +1 -1
  92. package/dist/{list-GyP4b_tU.mjs → list-BZbC260R.mjs} +1 -1
  93. package/dist/{list-Bqm0F1Y-.mjs → list-BxCk3QTy.mjs} +1 -1
  94. package/dist/{list-BASNYNJr.mjs → list-C3IRtLP6.mjs} +1 -1
  95. package/dist/{list-BQaXU1bp.mjs → list-CAalCea_.mjs} +1 -1
  96. package/dist/{list-BQrk4Ua4.mjs → list-CleMHJBY.mjs} +1 -1
  97. package/dist/{list-CGkgypYz.mjs → list-D6qH2PUE.mjs} +1 -1
  98. package/dist/{list-C2qxVTu7.mjs → list-D9RmPIEJ.mjs} +1 -1
  99. package/dist/{list-Uc1OxV36.mjs → list-DCA0T8bS.mjs} +2 -2
  100. package/dist/{list-ba7lI44w.mjs → list-DCBLu0KG.mjs} +1 -1
  101. package/dist/{list-B-74c1BD.mjs → list-DDFk1IFP.mjs} +5 -5
  102. package/dist/{list-xC99-2X0.mjs → list-DGLK2lso.mjs} +1 -1
  103. package/dist/{list-lzIKVtE9.mjs → list-DYlphSxV.mjs} +1 -1
  104. package/dist/{list-DfbsmsHv.mjs → list-De0ebgzc.mjs} +2 -2
  105. package/dist/{list-DdFViPYS.mjs → list-Dqyd2TZI.mjs} +1 -1
  106. package/dist/{list-DMlFbccD.mjs → list-Drm6l_tt.mjs} +1 -1
  107. package/dist/{list--B2EUWJg.mjs → list-QFieRzSf.mjs} +1 -1
  108. package/dist/{list-CvzWE6CS.mjs → list-kIMBSzS-.mjs} +1 -1
  109. package/dist/{login-D5jt0q9K.mjs → login-DDHEyjWz.mjs} +2 -2
  110. package/dist/{logout-DViy0VzV.mjs → logout-BbB0vvQN.mjs} +1 -1
  111. package/dist/{measure-IPlonpqU.mjs → measure-CGuwA0KX.mjs} +5 -5
  112. package/dist/{parameter-values-CHyOCxmR.mjs → parameter-values-CI6-CkB7.mjs} +2 -2
  113. package/dist/{parse-id-CPINxy7h.mjs → parse-id-CdZ0-1TM.mjs} +1 -1
  114. package/dist/{path-bMZzUOVo.mjs → path-Df2itv7t.mjs} +1 -1
  115. package/dist/{publish-Cs-OUG6n.mjs → publish-xUBySB1T.mjs} +2 -2
  116. package/dist/{query-CEdmSEq8.mjs → query-BkZvffIM.mjs} +1 -1
  117. package/dist/{query-CpD46hL6.mjs → query-CmkC8sfu.mjs} +2 -2
  118. package/dist/{remove-collection-DynsqkwG.mjs → remove-collection-DFfmuTwD.mjs} +2 -2
  119. package/dist/{replace-C6YqqCG9.mjs → replace-DjoDBCLa.mjs} +2 -2
  120. package/dist/{rescan-values-C6PB02uT.mjs → rescan-values-Ca2Wa0A2.mjs} +2 -2
  121. package/dist/{run-Cb86sH_c.mjs → run-BCYATTjE.mjs} +3 -3
  122. package/dist/{run-C7PXBBEl.mjs → run-B_-pMw67.mjs} +4 -4
  123. package/dist/{run-CpmWoOGp.mjs → run-CP-chc5O.mjs} +2 -2
  124. package/dist/{runs-CCRszsbB.mjs → runs-B0ypYKmn.mjs} +2 -2
  125. package/dist/{runtime-BMJv4VOi.mjs → runtime-CJUDVwBu.mjs} +1 -1
  126. package/dist/{schema-tables-BQdFNy1B.mjs → schema-tables-Nl83e2Zm.mjs} +2 -2
  127. package/dist/{schemas-CNAPFh4n.mjs → schemas-Cp29qgn0.mjs} +2 -2
  128. package/dist/{search-BKVV6YtB.mjs → search-BbktlnDC.mjs} +2 -2
  129. package/dist/{segment-CDoZHSYX.mjs → segment-BHBoMpL9.mjs} +5 -5
  130. package/dist/{selectors-BXbjj36S.mjs → selectors-e_0QdkaG.mjs} +2 -2
  131. package/dist/{send-D2eXL9lt.mjs → send-DEGpBT_7.mjs} +2 -2
  132. package/dist/{set-sHBtSGLi.mjs → set-C3tLEVuY.mjs} +1 -1
  133. package/dist/{set-active-DT61WwV0.mjs → set-active-CqvLJysE.mjs} +1 -1
  134. package/dist/{setting-dkfKvCxc.mjs → setting-Dwi-Wifx.mjs} +3 -3
  135. package/dist/{setup-TOwWatgm.mjs → setup-CcSVPnEI.mjs} +1 -1
  136. package/dist/{skills-BcOjZldN.mjs → skills-Cxi3fKMZ.mjs} +3 -3
  137. package/dist/{snippet-DMdFqvNq.mjs → snippet-hrEAI5Yf.mjs} +5 -5
  138. package/dist/{stash-BgWw2lyu.mjs → stash-CVhkyRIT.mjs} +2 -2
  139. package/dist/{status-B14FO8n7.mjs → status-B7tYgPVV.mjs} +1 -1
  140. package/dist/{status-J4pEIm-c.mjs → status-C9uhZuip.mjs} +1 -1
  141. package/dist/{subscription-B1uuKxM7.mjs → subscription-Cj9jyFEB.mjs} +5 -5
  142. package/dist/{subscriptions-BHIATSN6.mjs → subscriptions-B5oVkkZk.mjs} +3 -3
  143. package/dist/{summary-B1V5TXaZ.mjs → summary-PVERfPr2.mjs} +2 -2
  144. package/dist/{sync-schema-D1vX-rpv.mjs → sync-schema-CtG6r6Pr.mjs} +3 -3
  145. package/dist/{table-CDeO1WbH.mjs → table-6IHwQyr6.mjs} +4 -4
  146. package/dist/{timeline-MQFX3Fla.mjs → timeline-BwQIj-le.mjs} +7 -7
  147. package/dist/{timeline-event-oGmne082.mjs → timeline-event-ox_Bw9F4.mjs} +5 -5
  148. package/dist/transform-IPKGUzzd.mjs +28 -0
  149. package/dist/transform-job-COwH1ww7.mjs +22 -0
  150. package/dist/{transform-tag-Bpj8l5Ci.mjs → transform-tag-La1wmOTP.mjs} +4 -4
  151. package/dist/{transform-test-Dhcj7u-U.mjs → transform-test-C4VRGmGm.mjs} +8 -1
  152. package/dist/{transform-test-BhkpwFqD.mjs → transform-test-DGYx6MCT.mjs} +6 -6
  153. package/dist/{transform-test-BJOPAwKl.mjs → transform-test-w5hDTx_D.mjs} +1 -1
  154. package/dist/{transforms-K7Y4ON_q.mjs → transforms-DIgACzP-.mjs} +2 -2
  155. package/dist/{tree-CtFtroe4.mjs → tree-CQ0FXBnn.mjs} +1 -1
  156. package/dist/{unpublish-D7UaaIWA.mjs → unpublish-Binr4uOG.mjs} +2 -2
  157. package/dist/{update-C_wTtrtX.mjs → update-B4lIwY0G.mjs} +2 -2
  158. package/dist/{update-e4ufwrkF.mjs → update-B5NYEIHU.mjs} +5 -5
  159. package/dist/{update-dRAPKE3c.mjs → update-BKvSfdXu.mjs} +2 -2
  160. package/dist/{update-DUNJEk8m.mjs → update-BZS5m-vx.mjs} +2 -2
  161. package/dist/{update-CGJXd_E3.mjs → update-BbOX6axn.mjs} +2 -2
  162. package/dist/{update-BlBEKrNE.mjs → update-BiG9eLNH.mjs} +2 -2
  163. package/dist/{update-MWaDj2VX.mjs → update-CIuoW1M9.mjs} +2 -2
  164. package/dist/{update-YkB3xWUh.mjs → update-CWIhy9Ax.mjs} +2 -2
  165. package/dist/{update-HqUKBeM2.mjs → update-Cb68f4dx.mjs} +2 -2
  166. package/dist/{update-BpuZsX9z.mjs → update-DH9CL61y.mjs} +2 -2
  167. package/dist/{update-B7veBLhx.mjs → update-Db3j44fi.mjs} +2 -2
  168. package/dist/{update-D9Nfv864.mjs → update-TDaf7Xbt.mjs} +2 -2
  169. package/dist/{update-dashcard-BGqKMqQb.mjs → update-dashcard-DbZ8NlLZ.mjs} +2 -2
  170. package/dist/{update-3ksm443P.mjs → update-gGZjfZN3.mjs} +2 -2
  171. package/dist/{update-BicO3Lio.mjs → update-la0K6wAf.mjs} +2 -2
  172. package/dist/{update-BvbPpgOL.mjs → update-lpLLpKhX.mjs} +2 -2
  173. package/dist/{update-bix8NoKq.mjs → update-mOqedkLk.mjs} +2 -2
  174. package/dist/{upgrade-DkQ1wk4z.mjs → upgrade-BCWXgRmG.mjs} +1 -1
  175. package/dist/{upload-JN6EK96c.mjs → upload-BVBs2F69.mjs} +3 -3
  176. package/dist/{upload-BfGc-L4t.mjs → upload-DUViVk1x.mjs} +1 -1
  177. package/dist/{uuid-BLBLkWAF.mjs → uuid-D3CGL8wF.mjs} +1 -1
  178. package/dist/{values-8CrXBkyg.mjs → values-8XUr04w3.mjs} +2 -2
  179. package/dist/{verify-nNVN-0CR.mjs → verify-deF_hThH.mjs} +2 -2
  180. package/dist/{wait-YrD7UYFF.mjs → wait-Ct0weHol.mjs} +2 -2
  181. package/dist/{wait-flags-CDtMS8FP.mjs → wait-flags-Cb-bI0RD.mjs} +1 -1
  182. package/package.json +1 -1
  183. package/skill-data/core/SKILL.md +12 -11
  184. package/skill-data/transform/SKILL.md +9 -5
  185. package/skill-data/transform-test-plan/SKILL.md +170 -0
  186. package/skill-data/transform-test-plan/references/checklist.md +81 -0
  187. package/skill-data/transform-test-plan/references/checks.md +259 -0
  188. package/dist/git-sync-IW4T2sKq.mjs +0 -28
  189. package/dist/transform-CWIqW64R.mjs +0 -28
  190. package/dist/transform-job-DpF2MARE.mjs +0 -22
@@ -172,7 +172,7 @@ mb transform run "$ID" --wait --profile <n> --json # → succeeded
172
172
 
173
173
  If you really must `create + delete` instead, do the `delete` **before** the first `git-sync export` so the failed entity never lands in git history — an export of a soft-failed state is noise that needs a follow-up cleanup commit. See `git-sync`, "Read state before mutating", for the ordering rule.
174
174
 
175
- ## Transform tests (v64+)
175
+ ## Transform tests (v65+)
176
176
 
177
177
  A transform test replaces every table the transform reads with a fixture, runs it into a temp table, and checks that output. No real table is read or written.
178
178
 
@@ -185,10 +185,14 @@ mb transform-test delete <id> --yes --profile <n>
185
185
  mb transform-test run <id> --profile <n> --json # exits non-zero unless it passes
186
186
  ```
187
187
 
188
- **`inputs`** — one per table the transform reads, each naming a `table` plus either `format: "sql"` with `sql`, or `format: "rows"` with `columns` (each a `name` and a `database_type` the warehouse takes as a `CAST` target) and `rows`.
188
+ **`inputs`** — one per table the transform reads, each naming a `table` plus either `format: "sql"` with `sql`, or `format: "rows"` with `columns` (each a `name` and a `cast_type`) and `rows`.
189
+
190
+ **`cast_type` is a `CAST` target, not a column type**, and the two vocabularies differ per warehouse: MySQL casts to `SIGNED` and reports `INTEGER`; ClickHouse takes `Nullable(Int32)` for a column that is `Int64`. So a body is warehouse-specific — don't copy a `database_type` out of a run result into a `cast_type`, and don't expect one body to run everywhere.
189
191
 
190
192
  **`expectations`** — `type: "empty"` with the `sql` that must return no rows, or `type: "equals"`, which needs the same `format` split as an input (`"rows"` with `columns`/`rows`, or `"sql"` with a query). An `equals` without a `format` is refused.
191
193
 
194
+ **An `empty` query may only name the transform's target table and its declared input tables.** Those are rewritten to the run's temp tables; any other table you name is left exactly as written and reads the real one — the single way a test run can touch production data.
195
+
192
196
  ```json
193
197
  {
194
198
  "transform_id": 1,
@@ -198,8 +202,8 @@ mb transform-test run <id> --profile <n> --json # exits non-zero u
198
202
  "table": { "schema": "public", "name": "people" },
199
203
  "format": "rows",
200
204
  "columns": [
201
- { "name": "id", "database_type": "INTEGER" },
202
- { "name": "age", "database_type": "INTEGER" }
205
+ { "name": "id", "cast_type": "INTEGER" },
206
+ { "name": "age", "cast_type": "INTEGER" }
203
207
  ],
204
208
  "rows": [
205
209
  { "id": 1, "age": 30 },
@@ -212,7 +216,7 @@ mb transform-test run <id> --profile <n> --json # exits non-zero u
212
216
  "type": "equals",
213
217
  "name": "exactly one row, id 1",
214
218
  "format": "rows",
215
- "columns": [{ "name": "id", "database_type": "INTEGER" }],
219
+ "columns": [{ "name": "id", "cast_type": "INTEGER" }],
216
220
  "rows": [{ "id": 1 }]
217
221
  },
218
222
  {
@@ -0,0 +1,170 @@
1
+ ---
2
+ name: transform-test-plan
3
+ description: Derive a comprehensive test plan for a transform — the fixture cast, the expectations, hand-derived expected rows, and a coverage matrix — from the model's declared design. Covers input partitioning (zero-case, multiplicity, dirty rows), grain / conservation / recomputation / conformance checks, and known-quirk conventions. Load when the user wants tests planned or written for transforms — "write tests for my transforms", "is my model right", "test plan for this pipeline", "add data quality checks" — whether the model is mid-build or already deployed. The `mb transform-test` command and body shapes live in the `transform` skill; this one decides what to test.
4
+ allowed-tools: Read, Write, Edit, Bash, AskUserQuestion
5
+ ---
6
+
7
+ # Planning transform tests
8
+
9
+ Turn a transform into a fixture cast that proves the logic on small known rows, expectations that
10
+ state the model's invariants, and a coverage matrix showing what's checked and what's deliberately
11
+ not. Mechanics — the `inputs`/`expectations` body shape and every `mb transform-test` verb — live in
12
+ the `transform` skill (`mb skills get transform`); load it before authoring, and never restate it
13
+ here.
14
+
15
+ Every check derives from what the model **declares** — detected from its SQL, confirmed with its
16
+ owner — never from conformance to a modeling doctrine. One plan serves two moments: while the model
17
+ is **built**, checks pin each design decision; once **deployed**, the same SQL screens production
18
+ tables for anomalies.
19
+
20
+ ## Operating rules
21
+
22
+ - **Detect, then derive.** Classify what the transform is and which conventions it uses (the
23
+ checklist); derive checks only from that. Star, one-big-table, partial denormalization — all
24
+ fine; never flag a style.
25
+ - **Judgment calls go through the checklist.** The session's autonomy setting governs which answers
26
+ you supply yourself and which you bring to the user — it never makes the checklist a formality.
27
+ Every answer you supply yourself is recorded in the plan as a stated assumption, paired with the
28
+ named expectation that enforces it — reversing the decision then breaks a test, not a paragraph.
29
+ And regardless of setting, when genuinely unsure, ask — a wrong-but-confident grain poisons every
30
+ downstream check.
31
+ - **Expected rows are derived by hand** from the fixture story and business meaning — never captured
32
+ from the transform's output, which asserts only that the transform equals itself.
33
+ - **Batteries stay off until declared structure switches them on.** No snapshot-density checks
34
+ without a snapshot, no version-history checks without effective/end/current columns. An empty
35
+ section beats a speculative one.
36
+
37
+ ## The procedure
38
+
39
+ 1. **Profile the real inputs**: per table, row count; per column, min/max/distinct-count/null
40
+ incidence; orphan counts across declared links (`mb field summary`, `mb query`). Profiling feeds
41
+ domains, bounds, null partitions, and key candidates — and every fixture edge cites the real-data
42
+ condition that warrants it, with its count ("the warehouse has 67 ship-before-order rows").
43
+ 2. **Detect.** Read the transform's SQL (`mb transform get <id> --full --json`) for: grain
44
+ candidates (`GROUP BY` keys, the joins' driving table), join types (orphan handling), correlated
45
+ aggregates (stored aggregates), `<entity>_<attr>` naming (copies), effective/end/current columns
46
+ (version history), `now()`/`current_date` (volatile columns). A transform whose grain you cannot
47
+ state in one phrase is itself a finding — raise it before writing any test.
48
+ 3. **Confirm.** Walk [references/checklist.md](references/checklist.md). Three stages: classify the
49
+ model, per-table declarations, per-column declarations. Each question carries its detection hint;
50
+ answer autonomously where the hint resolves, ask where it doesn't. In build-along mode these are
51
+ design questions — treat an undecided answer as a decision to make together, not a blocker.
52
+ 4. **Derive.** Route every output column through [references/checks.md](references/checks.md) —
53
+ declared property → expectation shape, fixture implication, expected-row convention. Read it in
54
+ full once per plan; it is the plan's content.
55
+ 5. **Design the fixture cast**: one small cast per transform (≈5–10 rows per table), human-named
56
+ rows ("Alice Premium"), every row a named edge — zero-case entities for every outer join and
57
+ aggregation, ≥2-member groups for every grouping and join, one dirty row per screenable defect,
58
+ boundary dates. Document it as a table (row → attributes → purpose) in the plan.
59
+
60
+ Express the cast as literal rows rather than as a query, so the story stays legible in the test
61
+ itself; a query is worth it only when the rows are mechanical to generate. A cast is written
62
+ against one warehouse and does not carry to another.
63
+
64
+ 6. **Hand-derive the expected rows**, arithmetic recorded in the plan (premium: 3 orders / 350.50 /
65
+ 3.0). Every fixture row's fate appears in some expected cell. Pin NULL-vs-0-vs-empty for every
66
+ zero-case row — that cell is the null policy's only enforcement.
67
+ 7. **Author the test.** One test per transform, per coherent story: an `equals` pinning the output,
68
+ and `empty` expectations stating the invariants that survive a change to the cast.
69
+
70
+ Give each expectation a name that states the invariant, because the name is what a
71
+ failure leads with ("revenue never negative", not "check 3"), and open each `empty` expectation's
72
+ SQL with a `--` contract comment: the invariant, and the failure modes it catches ("catches both
73
+ dropped orders and join fan-out").
74
+
75
+ Where one invariant applies to several transforms, duplicate the SQL. Nothing is shared between
76
+ tests, so give each copy its own name and comment rather than one that only makes sense next to
77
+ its twin.
78
+
79
+ 8. **Emit the coverage matrix** in the plan: rows = output columns with the table's grain; columns =
80
+ check classes (grain, conservation, recomputation, conformance, domains, referential integrity,
81
+ temporal, screens); cells name the covering expectation or expected-row cell, or state
82
+ `gap: <reason>`. Scan shared-attribute columns across transforms for cross-table agreement
83
+ obligations. Empty cells are honest; silent gaps are not.
84
+ 9. **Prove the tests have teeth.** Once per test: corrupt one expected cell, `run`, confirm
85
+ `cell-mismatches` names exactly that column; revert. Then perturb one input cell and confirm
86
+ exactly the declared output cells move. Every `empty` expectation passes against an empty output,
87
+ so a green test can still be vacuous.
88
+
89
+ ## Severity: error, or the tolerated oddity
90
+
91
+ Every expectation is pass or fail, and one failure fails the run. **error** = forbidden, and it
92
+ becomes an `empty` expectation. There is no warn severity, so **never author an expectation you
93
+ expect to fire**: a permanently red test trains everyone to ignore the result, and a red run gates
94
+ everyone else's work.
95
+
96
+ A tolerated-but-surfaced oddity — one the owner lives with, like orphan rows or ship-before-order
97
+ dates — gets encoded the two ways that hold: **pin it in the `equals` rows** (an orphan passing
98
+ through with NULLs is a cell in the expected output, so reversing the tolerance breaks the test),
99
+ and **record it in the plan's known-quirks list** with its real-data count, so the tolerance stays a
100
+ conscious choice.
101
+
102
+ Under budget pressure cut business-rule checks first, then cross-table structure checks; never
103
+ single-column screens (domains, ranges, nulls) — cheapest, and the last line.
104
+
105
+ ## When a check exposes a live bug
106
+
107
+ Non-negotiable: **never soften the test to green** — expected values state correct behavior; matching
108
+ them to buggy output documents the bug as intended — and **surface the finding with its blast radius
109
+ at both scales**, fixture ("1530.24 of 1600.74 fixture dollars survive") and warehouse ("908 of
110
+ 2,050 orders dropped"). What happens next follows the session's terms, not a fixed protocol: propose
111
+ and apply the fix now (when the user wants it or the autonomy setting covers it), or — when the fix
112
+ must wait — hold the correct expectation and record the red in the plan with the minimal fix body.
113
+ A stored test has no red-by-design state, so a deferred
114
+ fix must be visible in the plan or the test reads as broken. Either way, once green the test stays
115
+ as the regression guard.
116
+
117
+ ## When the doctrine doesn't apply
118
+
119
+ The vocabulary follows Kimball's dimensional modeling (grain, additivity, conformed attributes,
120
+ slowly changing dimensions) — precise, widely understood terms. Real models are Kimball-inspired at
121
+ most; no check may score adherence:
122
+
123
+ - Full calendar date dimensions are rare. Never demand one; test date _semantics_ — ranges,
124
+ orderings, volatile derivations.
125
+ - Surrogate keys are doctrine, natural-key joins are practice. Test whichever key the model
126
+ declares; never flag natural-key joins.
127
+ - "No NULL FKs / no NULL attributes" is doctrine routinely dropped. Null policy is three independent
128
+ declarations — measures, attributes, FKs — each detected and confirmed, never presumed.
129
+ - One-big-table is legitimate: it still has a grain, its copies still need agreement checks, its
130
+ functional dependencies still hold.
131
+ - A transform-level `ORDER BY` has no testable effect — output tables carry no row order and the
132
+ `equals` comparison is a multiset. Flag it as probable dead weight (clustering hints aside); never
133
+ write an ordering expectation.
134
+
135
+ ## One transform at a time
136
+
137
+ Each test covers one transform. When the transform under test reads another transform's output,
138
+ that target table is an input like any other: declare it and fake it. Derive those rows from the
139
+ base transform's own expected output, so the two tests tell one story, and note the coupling in both
140
+ plans — changing the base's expected rows means changing this test's input.
141
+
142
+ ## Worked example, condensed
143
+
144
+ `orders` + `customers` → _enriched_orders_ (order grain; LEFT JOIN attaches `customer_name`,
145
+ `tier`).
146
+
147
+ Cast, 7 orders: two tiers; Alice and Carol with 2 orders each (multiplicity); two never shipped
148
+ (zero-case for the shipping join); order 106 shipped before ordered (real oddity, count cited);
149
+ order 107's customer_id matches no customer (orphan). Two `rows` inputs, one per source table.
150
+
151
+ Derived, per catalog: grain uniqueness on `order_id`; row and amount conservation from input to
152
+ output, as scalar subqueries over the target and the seeded input; `tier` domain ⊆ {standard,
153
+ premium}; orphan = keep-with-NULLs → an expected row pinning the NULL pass-through; ship-before-order
154
+ tolerated → the plan's known-quirks list with the warehouse count. The whole output pinned in one
155
+ `equals`, hand-computed, arithmetic in the plan. The inner-vs-LEFT-join bug this cast catches —
156
+ unshipped orders silently dropped from revenue — is what the zero-case rows exist for.
157
+
158
+ ## Don't
159
+
160
+ - Don't author expectations before loading the `transform` skill — the body shape, the closed
161
+ create/update contract, and the verb flags live there.
162
+ - Don't capture expected rows from the transform's own output — hand-derive them or they assert
163
+ nothing.
164
+ - Don't emit checks for structure the model doesn't declare (snapshot density, version history,
165
+ bridge weights) — an inapplicable battery buries real findings.
166
+ - Don't let a fixture cast go all-clean — no zero-case, no orphan, no dirty row proves the happy
167
+ path and nothing else; the bugs live in the edges.
168
+ - Don't write an expectation you expect to fail.
169
+ - Don't surface bare check-ids ("per C3…") to the user — name the check in plain words; the ids are
170
+ for your cross-referencing, not their reading.
@@ -0,0 +1,81 @@
1
+ # Confirmation checklist
2
+
3
+ The judgment calls a plan depends on, in derivation order. Each question carries a **detect** hint —
4
+ how to answer it from the SQL, the metadata, or profiling. Answer autonomously where the hint
5
+ resolves cleanly; ask where it doesn't. Every answer you supply yourself goes into the emitted plan
6
+ as a stated assumption, phrased so the owner can falsify it at a glance ("Assuming `discount` can
7
+ never be negative — correct?").
8
+
9
+ In build-along mode these are design questions: the owner is deciding, not recalling. An undecided
10
+ answer is a decision to make together — surface the options and the check each implies (the
11
+ `checks.md` entry named in parentheses).
12
+
13
+ ## Stage 1 — classify the model (per transform)
14
+
15
+ 1. **Grain: one row per what?** (G1, G2)
16
+ Detect: `GROUP BY` keys; otherwise the driving table of the joins. Confirm whenever detection and
17
+ any written description disagree — that disagreement is itself a finding.
18
+ 2. **Fact-table type — and if periodic snapshot, dense or sparse?** (F2)
19
+ Detect: event-grain with a single event date → transaction; entity×period grain → periodic
20
+ snapshot (density is the one yes/no that flips its whole invariant set — always confirm); one row
21
+ per pipeline occurrence with milestone-date columns → accumulating snapshot.
22
+
23
+ ## Stage 2 — per-table declarations
24
+
25
+ 3. **Conservation ties: output rows/sums tie to which input, with which declared exclusions?** (A2)
26
+ Detect: `WHERE` clauses and join types name the exclusions (filtered rows, dropped duplicates).
27
+ Exclusions must be declared, or conservation appears to fail.
28
+ 4. **Zero-group policy: does a group with no contributing rows appear (with zeros) or stay absent?**
29
+ (A5)
30
+ Detect: driving table of the rollup — grouping the detail can't produce empty groups; joining a
31
+ dimension first can.
32
+ 5. **Orphan handling per join: drop / keep-with-NULLs / default row — and is an orphan tolerated or
33
+ forbidden?** (C3, I5)
34
+ Detect: join type. INNER = drop, LEFT = keep-with-NULLs, COALESCE to a sentinel = default row.
35
+ Tolerated-vs-forbidden is the owner's call — profiling says whether orphans exist today, not
36
+ whether they're acceptable. Forbidden becomes an `empty` expectation; tolerated is pinned in the
37
+ expected rows and recorded in the known-quirks list.
38
+ 6. **Version history: effective/end/current columns anywhere? If not, confirm overwrite-everywhere.**
39
+ (T1)
40
+ Detect: column names. Absence means history is silently rewritten in rollups — state that
41
+ consequence when confirming, not just the mechanism.
42
+ 7. **Does this transform read another transform's output?** (A5)
43
+ Detect: another transform's target table in this one's SQL. It becomes a declared input like any
44
+ other, faked from that transform's own expected output — confirm which rows, and record the
45
+ coupling in both plans.
46
+
47
+ ## Stage 3 — per-column declarations
48
+
49
+ 8. **Each measure: additive, semi-additive, or non-additive?** (A1)
50
+ Detect: sums and counts are additive; balances and levels are semi-additive; ratios, rates, and
51
+ unit prices are non-additive. Confirm the ambiguous ones (a "score"? a "quantity on hand"?).
52
+ 9. **Legal bounds per measure?** (Q1)
53
+ Detect: profiling min/max suggests, business meaning decides — can `discount` be negative? can
54
+ `quantity` be zero? Derived bounds are free (a sum of non-negatives is non-negative).
55
+ 10. **Each derived measure: the exact recomputation rule?** (A3)
56
+ Detect: the SELECT expression is the rule — but rounding, business-day adjustments, and NULL
57
+ handling are conventions to confirm, not read.
58
+ 11. **Which columns are stored aggregates, over which detail and filter?** (A4)
59
+ Detect: correlated subqueries / joined-aggregate CTEs in the SQL.
60
+ 12. **Which categorical columns have closed domains — enumerate; is NULL a member?** (C2)
61
+ Detect: profiling distinct values gives today's set; the owner confirms it's closed rather than
62
+ merely small so far.
63
+ 13. **Which columns are denormalized copies, of which owning attribute?** (C1)
64
+ Detect: `<entity>_<attr>` naming; any column functionally dependent on a non-grain key. Every hit
65
+ must be classified: copy (C1), stored aggregate (A4), or smuggled coarser-grain fact — a
66
+ finding.
67
+ 14. **Which many-to-one edges hold within one output table?** (C4)
68
+ Detect: hierarchy-shaped column pairs (product/category, zip/state). Applies where no owning
69
+ table is in scope; otherwise C1 covers it.
70
+ 15. **Which date orderings are business-guaranteed vs. known-violated and tolerated (with real-data
71
+ counts)?** (T2)
72
+ Detect: profiling counts the violations that exist; the owner decides tolerated vs. bug.
73
+ 16. **Null policy per column — measures, attributes, FKs separately.** (Q2)
74
+ Detect: the SQL shows what's produced (COALESCE, CASE); the owner confirms intent — "count of
75
+ nothing": 0 or NULL? empty date: NULL or sentinel?
76
+ 17. **Which columns are volatile across runs?** (T3)
77
+ Detect: `now()` / `current_date` / run-metadata expressions in the SQL. A volatile column is left
78
+ out of the `equals` columns; its form can still be asserted with an `empty`.
79
+ 18. **Per tolerated oddity: does it stay tolerated, and what is its current count?** (Q3)
80
+ Detect: can't — this is the conscious-choice question, and the plan's known-quirks list is where
81
+ it survives.
@@ -0,0 +1,259 @@
1
+ # Check catalog
2
+
3
+ Every check the plan can derive, grouped by theme. Per entry: **when it applies** (the declared
4
+ property that switches it on — blank means always), **assert** (the expectation shape), and
5
+ **fixtures** (what the input cast must contain for the check to have teeth).
6
+
7
+ Expectation SQL names the transform's **target table** and its **declared input tables** under their
8
+ real names; both are rewritten to the run's temp tables, so per-row recomputation joins against
9
+ inputs are writable. Anything else you name is left exactly as written and reads the real table.
10
+
11
+ Ids (G1, A2, …) are for cross-referencing within the plan documents only — never surface them to the
12
+ user bare.
13
+
14
+ Throughout, `<target>` stands for the transform's target table as written in the transform's own
15
+ definition, and `<input>` for a declared input table.
16
+
17
+ ## Grain & keys
18
+
19
+ **G1 — Declared grain.** Every output table states "one row per X"; the declaration anchors every
20
+ other check.
21
+
22
+ - Applies: always. Elicit or detect (GROUP BY keys; the join's driving table).
23
+ - Assert: nothing directly — G1 is the plan's opening move. A table with no statable grain, or a
24
+ grain stated inconsistently between docs and SQL, is a finding before any SQL runs.
25
+ - Fixtures: the grain declaration decides the cast's row structure.
26
+
27
+ **G2 — Grain-key uniqueness.** The grain key stays a key; doubles as the fan-out guard for every
28
+ enriching join.
29
+
30
+ - Applies: always — one-big-table, rollups, and stars all have a grain.
31
+ - Assert (`empty`): `SELECT <grain cols>, COUNT(*) FROM <target> GROUP BY <grain cols> HAVING
32
+ COUNT(*) > 1`. NULL grain values form their own bucket.
33
+ - Fixtures: a parent with ≥2 children on every join (I4) is what makes this check able to fail.
34
+
35
+ ## Additivity & reconciliation
36
+
37
+ **A1 — Measure additivity classification.** Additive / semi-additive (balances) / non-additive
38
+ (ratios, rates, unit prices) decides which aggregations are valid tests.
39
+
40
+ - Applies: every numeric measure; per-column declaration.
41
+ - Assert: routes the measure — additive → A2; semi-additive → sum across non-time slices only (a
42
+ test summing a balance over time is a bug in the plan); non-additive → A3 recomputation, never
43
+ reconciled by summing.
44
+ - Fixtures: none directly; one coverage-matrix axis (measure × valid aggregation set).
45
+
46
+ **A2 — Conservation reconciliation.** Row counts and additive-measure sums tie from input to output;
47
+ catches dropped rows and join double-counting at once.
48
+
49
+ - Applies: per declared tie (which input, which declared exclusions).
50
+ - Assert (`empty`): independent scalar subqueries compared with `IS DISTINCT FROM`, returning the
51
+ mismatched pair:
52
+ `SELECT (SELECT SUM(t.m) FROM <target> t) AS output_sum, (SELECT SUM(s.m) FROM <input> s) AS
53
+ input_sum WHERE (…) IS DISTINCT FROM (…)`.
54
+ Never reconcile via a fact-to-fact join — cardinality is uncontrollable and wrong results are
55
+ silent.
56
+ - Fixtures: amounts chosen so partial survival is visible (distinct values, odd cents).
57
+
58
+ **A3 — Derived-measure recomputation.** Averages, lags, ratios, rounded presentations recompute from
59
+ their components per row.
60
+
61
+ - Applies: every derived column, with its declared rule (rounding, business-day adjustment, NULL
62
+ handling).
63
+ - Assert (`empty`): `SELECT <key> FROM <target> t WHERE t.<derived> IS DISTINCT FROM <recomputation
64
+ from inputs or sibling columns>`.
65
+ - Fixtures: component values whose derivation is non-trivial (a NULL in the AVG, a negative lag).
66
+
67
+ **A4 — Stored aggregates on entity tables.** Lifetime/rollup stats carried on an entity-grain table
68
+ (`lifetime_orders`, `review_count`, `first_order_date`) equal recomputation from detail — per row
69
+ _and_ in total.
70
+
71
+ - Applies: columns detected as correlated aggregates over a detail table.
72
+ - Assert (`empty`), two per column: per-row — `WHERE t.<agg> IS DISTINCT FROM (SELECT
73
+ COUNT(*)/SUM(…)/MIN(…) FROM <detail> d WHERE d.<fk> = t.<key>)`; total — the A2 scalar-pair shape.
74
+ Totals alone cancel offsetting per-row errors; the per-row form is the one that catches them.
75
+ - Fixtures: an entity with several detail rows and an entity with none (I3/I4).
76
+
77
+ **A5 — Rollup consistency.** A layered rollup always agrees with its base.
78
+
79
+ - Applies: any transform reading another transform's output. The base is a declared input like any
80
+ other, faked with rows taken from the base transform's own expected output.
81
+ - Assert (`empty`): every rollup measure equals the corresponding aggregation over the base (A2
82
+ shape); group-set equality both directions — `SELECT <group> FROM <target> EXCEPT SELECT DISTINCT
83
+ <group col> FROM <base>` and the reverse, filtered by the declared zero-group policy.
84
+ - Fixtures: a group with no contributing rows pins the zero-group policy.
85
+
86
+ ## Fact-table type
87
+
88
+ **F2 — Fact-table type bundle.** Transaction / periodic snapshot / accumulating snapshot each carry
89
+ a distinct invariant set.
90
+
91
+ - Applies: per fact-shaped output, always classified; **transaction** needs nothing beyond G2 + A2
92
+ (sparsity is legitimate).
93
+ - Periodic snapshot, if declared _dense_: `COUNT(*) = |entities| × |periods|` (or the declared
94
+ subset); per-entity gap detection in the period series; inactive-period representation (zero vs
95
+ NULL) pinned in the expected rows. If sparse, density checks off — the one yes/no flips the whole
96
+ set.
97
+ - Accumulating snapshot: milestone dates monotone in pipeline order where set (`WHERE <later> <
98
+ <earlier>` per adjacent pair); unset-milestone default (NULL vs sentinel) pinned in the expected
99
+ rows; completion flags ∈ {0,1} and consistent with their date's set-ness; lags via A3.
100
+ - Fixtures (accumulating): occurrences at every completion stage — none, some, all milestones.
101
+
102
+ ## Conformance & domains
103
+
104
+ **C1 — Denormalized-copy agreement.** Every copied attribute agrees with the owning table's value
105
+ for that key.
106
+
107
+ - Applies: columns declared as copies (detect: `<entity>_<attr>` naming; any column functionally
108
+ dependent on a non-grain key). Each such column must be a declared copy (this check), a stored
109
+ aggregate (A4), or it's a smuggled coarser-grain fact — a finding: it double-counts under
110
+ summation.
111
+ - Assert (`empty`): `SELECT t.<key>, t.<copy>, d.<attr> FROM <target> t JOIN <owning input> d ON
112
+ t.<key> = d.<key> WHERE t.<copy> IS DISTINCT FROM d.<attr>`.
113
+ - Scope: in a test, the copies are produced by the very join under test, so this join-form is near-
114
+ tautological — the C4 functional-dependency form plus expected-row cell pinning carries the test.
115
+ The join-form against an independently materialized owning table is the _drift_ check, which
116
+ belongs to whatever screens the deployed tables.
117
+ - Fixtures: copies with distinct values per entity so a crossed join is visible.
118
+
119
+ **C2 — Closed-domain screen.** A categorical column's values stay inside the declared enumeration.
120
+
121
+ - Applies: per column declared closed (detect from profiling; confirm the set and whether NULL is a
122
+ member).
123
+ - Assert (`empty`): `SELECT <key>, <col> FROM <target> WHERE <col> IS NOT NULL AND <col> NOT IN
124
+ (<domain>)`.
125
+ - Fixtures: every domain value represented where practical; one out-of-domain input row if the
126
+ source can produce one (I5).
127
+
128
+ **C3 — Referential integrity / orphan policy.** Every FK resolves, or the declared orphan handling is
129
+ pinned.
130
+
131
+ - Applies: per join, conditioned on the declared response — drop / keep-with-NULLs / default row;
132
+ tolerated or forbidden.
133
+ - Assert, forbidden (`empty`): `SELECT t.<fk> FROM <target> t LEFT JOIN <dim input> d ON t.<fk> =
134
+ d.<key> WHERE t.<fk> IS NOT NULL AND d.<key> IS NULL`.
135
+ Tolerated: not an expectation — pin the orphan's pass-through as a row in the `equals` (NULL in
136
+ the copied attributes), and record the tolerance with its warehouse count in the plan.
137
+ Default-row convention adds: distinct unknown keys must not collapse into one output row.
138
+ - Fixtures: one orphan row (I5). Without it the join direction is untested — an inner join silently
139
+ dropping unmatched rows is the classic bug this catches.
140
+
141
+ **C4 — Many-to-one consistency.** Each declared many-to-one edge holds within the output (product →
142
+ one category; zip → one state).
143
+
144
+ - Applies: per declared edge; where an owning table is in scope, C1 subsumes it — this is the
145
+ one-big-table variant with nothing to join against.
146
+ - Assert (`empty`): `SELECT t.<many>, COUNT(DISTINCT t.<one>) FROM <target> t GROUP BY t.<many>
147
+ HAVING COUNT(DISTINCT t.<one>) > 1`.
148
+ - Fixtures: a violating input row if the source can produce one (I5), pinning the transform's
149
+ behavior on dirty input.
150
+
151
+ ## Temporal & version history
152
+
153
+ **T1 — Change handling per attribute.** How the model treats a changed source attribute decides the
154
+ temporal fixtures.
155
+
156
+ - Applies: detect effective/end/current housekeeping columns.
157
+ - Present → version-history battery (`empty` each): per durable key exactly one current row;
158
+ `effective < end` per row; intervals contiguous and non-overlapping; current row's end = the
159
+ declared far-future default; fact rows join the version whose interval contains the fact date.
160
+ - Absent → confirm overwrite-everywhere as a stated assumption (history is silently rewritten in
161
+ rollups), and derive the propagation probe: change an attribute in an input, run, assert the
162
+ output regrouped.
163
+ - Fixtures: a before/after change pair; for version history, an entity with ≥2 versions and a fact
164
+ row dated inside each interval.
165
+
166
+ **T2 — Date-pair ordering.** Business-guaranteed orderings asserted; known violations recorded.
167
+
168
+ - Applies: per declared date pair (ordered ≤ shipped ≤ delivered; signup ≤ first order), each
169
+ classified guaranteed vs. tolerated-violated.
170
+ - Assert: guaranteed (`empty`) — `SELECT <key>, <earlier>, <later> FROM <target> WHERE <later> <
171
+ <earlier>`. Tolerated — pin the violating row's downstream arithmetic (a negative lag inside an
172
+ average) in the expected rows, and record the real-data count in the plan.
173
+ - Fixtures: one violating row for every tolerated ordering.
174
+
175
+ **T3 — Volatile columns.** Values that change across runs can't be pinned.
176
+
177
+ - Applies: columns derived from `now()`/`current_date` (age), run metadata (load timestamps, batch
178
+ ids).
179
+ - Assert: leave the column out of the `equals` `columns` list — an undeclared column never enters the
180
+ comparison. Separately assert its form where warranted (`empty`): `WHERE age NOT BETWEEN 0 AND
181
+ 120`. The stable source column (`birth_date`) stays exact in the expected rows.
182
+ - Fixtures: none special; the split is the point — omit the volatile, pin the stable.
183
+
184
+ ## Screens & severity
185
+
186
+ **Q1 — Range / sign screens.** Each measure's declared bounds hold.
187
+
188
+ - Applies: per bounded measure; bounds from business meaning plus profiling (derived bounds are
189
+ free: a sum of non-negatives is non-negative).
190
+ - Assert (`empty`): `SELECT <key>, <col> FROM <target> WHERE <col> < <lo> OR <col> > <hi>` (one-sided
191
+ where only one bound exists).
192
+ - Fixtures: boundary values where the bound is business-set.
193
+
194
+ **Q2 — Null policy, three ways.** Measures, descriptive attributes, and FKs carry independent null
195
+ policies; never presume one from another.
196
+
197
+ - Applies: per column, asked separately — "count of nothing": 0 or NULL? empty date: NULL or
198
+ sentinel? FK: see C3.
199
+ - Assert: declared non-null columns get `WHERE <col> IS NULL` (`empty`). Otherwise the policy is
200
+ enforced by the expected-row cell of a zero-case fixture row — NULL vs 0 vs empty is invisible
201
+ until a fixture forces the choice into a cell.
202
+ - Fixtures: the zero-case row (I3) is the enforcement mechanism.
203
+
204
+ **Q3 — Naming & the tolerated oddity.** Every expectation declares its meaning.
205
+
206
+ - Applies: always, every expectation.
207
+ - Convention: the expectation's `name` states the invariant in plain words, because a failure leads
208
+ with it. Each `empty` SQL opens with 1–3 comment lines naming the invariant and the failure modes
209
+ it catches. Budget cuts drop business-rule checks first, then cross-table structure checks, never
210
+ single-column screens.
211
+ - A forbidden condition is an `empty` expectation. A tolerated one is pinned in the expected rows
212
+ and recorded in the plan's known-quirks list with its warehouse count. Never author an expectation
213
+ designed to fire.
214
+
215
+ ## Input modeling (fixture-design rules)
216
+
217
+ **I1 — Profiling-derived partitions.** Fixture edges and tolerated non-ties cite profiled reality
218
+ with counts; the plan's known-quirks section carries each tolerated oddity with its reason and
219
+ count.
220
+
221
+ **I2 — Shared fixture cast.** One small human-named cast per transform, every row a named edge,
222
+ documented as a story table (row → attributes → purpose) in the plan. Where one transform's output
223
+ is another's input, derive the faked rows from the first's expected output so the two tests tell one
224
+ story.
225
+
226
+ **I3 — Zero-case partitions.** For every outer join and aggregation relation: one entity with zero
227
+ matches. Its expected row pins the absence representation (Q2) and the join direction (C3) — the
228
+ all-clean cast is the single most common cause of vacuous tests. When the schema distinguishes
229
+ states the profiled data never exhibits (a literal zero in a source that only has NULLs and
230
+ positives), fixture the missing state — nothing else forces it onto an expected cell.
231
+
232
+ **I4 — Multiplicity partitions.** Every aggregation gets a >1-member group and an exactly-1 group
233
+ (the 0 case is I3); every join gets a parent with ≥2 children. Expected values then differ from any
234
+ single row's, so copy-through bugs can't pass.
235
+
236
+ **I5 — Dirty-input pinning.** Per screenable defect the source can carry (orphan FK, out-of-domain
237
+ value, duplicate natural key, hierarchy violation, ordering violation): one fixture row exhibiting
238
+ it, an expected row pinning the transform's response (drop / pass-through / default), and — where
239
+ the defect is forbidden — the matching `empty` expectation. Which duplicate survives a dedupe is
240
+ invisible until a conflicting-duplicate fixture pins it.
241
+
242
+ **I6 — Mutation probes.** Run at plan-validation time, not on every run: corrupt one expected cell →
243
+ `cell-mismatches` must name that exact column; perturb one input cell → exactly the declared output
244
+ cells move. Both guard against vacuous tests: every `empty` expectation passes against an empty
245
+ output.
246
+
247
+ ## Plan-level artifacts
248
+
249
+ **P1 — Coverage matrix.** Output columns (with the table's grain) × check classes; cells name the
250
+ covering expectation or expected-row cell, or state `gap: <reason>`; shared-attribute columns scanned
251
+ across transforms for agreement obligations (C1).
252
+
253
+ **P2 — Hand-derived expected rows.** From the fixture story and business meaning, arithmetic recorded
254
+ in the plan; never captured from output; every fixture row's fate appears in some expected cell.
255
+
256
+ **P3 — Live-bug handling.** A check failing against a deployed transform is a real finding: never
257
+ soften the test to green; quantify the damage at fixture and warehouse scale. Then fix now, or record
258
+ the red in the plan with the minimal fix body, per the session's terms. A stored test has no
259
+ red-by-design state, so a deferred fix must be visible in the plan or the test reads as broken.
@@ -1,28 +0,0 @@
1
- import { t as defineCommandGroup } from "./group-DBM87IgC.mjs";
2
- //#region src/commands/git-sync/index.ts
3
- var git_sync_default = defineCommandGroup({
4
- name: "git-sync",
5
- description: "Sync Metabase content with a git remote",
6
- skills: [{
7
- skill: "git-sync",
8
- purpose: "import/export round-trip and dirty checks"
9
- }],
10
- subCommands: {
11
- status: () => import("./status-J4pEIm-c.mjs").then((mod) => mod.default),
12
- "is-dirty": () => import("./is-dirty-0F_UJY7Q.mjs").then((mod) => mod.default),
13
- "has-remote-changes": () => import("./has-remote-changes-Bwyp8mc-.mjs").then((mod) => mod.default),
14
- dirty: () => import("./dirty-BkiHZ8gb.mjs").then((mod) => mod.default),
15
- "current-task": () => import("./current-task-CbnNWQ7H.mjs").then((mod) => mod.default),
16
- "cancel-task": () => import("./cancel-task--cuSISnl.mjs").then((mod) => mod.default),
17
- wait: () => import("./wait-YrD7UYFF.mjs").then((mod) => mod.default),
18
- import: () => import("./import-CPY8aM8d.mjs").then((mod) => mod.default),
19
- export: () => import("./export-CG23iezf.mjs").then((mod) => mod.default),
20
- stash: () => import("./stash-BgWw2lyu.mjs").then((mod) => mod.default),
21
- branches: () => import("./branches-QixvzIpl.mjs").then((mod) => mod.default),
22
- "create-branch": () => import("./create-branch-Bkq9rtf7.mjs").then((mod) => mod.default),
23
- "add-collection": () => import("./add-collection-C-XJPp3F.mjs").then((mod) => mod.default),
24
- "remove-collection": () => import("./remove-collection-DynsqkwG.mjs").then((mod) => mod.default)
25
- }
26
- });
27
- //#endregion
28
- export { git_sync_default as default };
@@ -1,28 +0,0 @@
1
- import { t as defineCommandGroup } from "./group-DBM87IgC.mjs";
2
- //#region src/commands/transform/index.ts
3
- var transform_default = defineCommandGroup({
4
- name: "transform",
5
- description: "Manage Metabase transforms",
6
- skills: [{
7
- skill: "transform",
8
- purpose: "body shape, run-with-wait, iterate"
9
- }, {
10
- skill: "mbql",
11
- purpose: "MBQL source.query bodies"
12
- }],
13
- subCommands: {
14
- list: () => import("./list-DMlFbccD.mjs").then((mod) => mod.default),
15
- get: () => import("./get-B3jvGI0b.mjs").then((mod) => mod.default),
16
- dependencies: () => import("./dependencies-ygT6uMu4.mjs").then((mod) => mod.default),
17
- create: () => import("./create-BMokmmLp2.mjs").then((mod) => mod.default),
18
- update: () => import("./update-C_wTtrtX.mjs").then((mod) => mod.default),
19
- delete: () => import("./delete-DNsY94Ok.mjs").then((mod) => mod.default),
20
- "delete-table": () => import("./delete-table-DySwoEaq.mjs").then((mod) => mod.default),
21
- run: () => import("./run-Cb86sH_c.mjs").then((mod) => mod.default),
22
- cancel: () => import("./cancel-CPStS4zJ.mjs").then((mod) => mod.default),
23
- "get-run": () => import("./get-run-F7ARJeAD.mjs").then((mod) => mod.default),
24
- runs: () => import("./runs-CCRszsbB.mjs").then((mod) => mod.default)
25
- }
26
- });
27
- //#endregion
28
- export { transform_default as default };
@@ -1,22 +0,0 @@
1
- import { t as defineCommandGroup } from "./group-DBM87IgC.mjs";
2
- //#region src/commands/transform-job/index.ts
3
- var transform_job_default = defineCommandGroup({
4
- name: "transform-job",
5
- description: "Manage Metabase transform jobs",
6
- skills: [{
7
- skill: "transform",
8
- purpose: "tag-driven job schedules"
9
- }],
10
- subCommands: {
11
- list: () => import("./list-ba7lI44w.mjs").then((mod) => mod.default),
12
- get: () => import("./get-CMMXBVff.mjs").then((mod) => mod.default),
13
- create: () => import("./create-BikaTHCw.mjs").then((mod) => mod.default),
14
- update: () => import("./update-BicO3Lio.mjs").then((mod) => mod.default),
15
- delete: () => import("./delete-BEPw7WRT.mjs").then((mod) => mod.default),
16
- run: () => import("./run-CpmWoOGp.mjs").then((mod) => mod.default),
17
- transforms: () => import("./transforms-K7Y4ON_q.mjs").then((mod) => mod.default),
18
- "set-active": () => import("./set-active-DT61WwV0.mjs").then((mod) => mod.default)
19
- }
20
- });
21
- //#endregion
22
- export { transform_job_default as default };