@sixb/core 0.1.8 → 0.1.9
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/actions/index.js +77 -89
- package/dist/actions/index.js.map +1 -1
- package/dist/actions/run-dispatch.d.ts.map +1 -1
- package/dist/actions/types/context.d.ts +2 -0
- package/dist/actions/types/context.d.ts.map +1 -1
- package/dist/actions/validation.d.ts +1 -1
- package/dist/actions/validation.d.ts.map +1 -1
- package/dist/actions/worker.js +33 -37
- package/dist/actions/worker.js.map +2 -2
- package/dist/agents/adapters.d.ts +3 -3
- package/dist/agents/{context.d.ts → context/entries.d.ts} +3 -3
- package/dist/agents/context/entries.d.ts.map +1 -0
- package/dist/agents/context/index.d.ts +4 -0
- package/dist/agents/context/index.d.ts.map +1 -0
- package/dist/agents/context/index.js +19 -0
- package/dist/agents/{streams.js.map → context/index.js.map} +1 -1
- package/dist/agents/context-model.d.ts +1 -1
- package/dist/agents/context-model.d.ts.map +1 -1
- package/dist/agents/context-resolution.d.ts +1 -1
- package/dist/agents/context-resolution.d.ts.map +1 -1
- package/dist/agents/index.d.ts +4 -4
- package/dist/agents/index.d.ts.map +1 -1
- package/dist/agents/index.js +192 -204
- package/dist/agents/index.js.map +1 -1
- package/dist/agents/message.d.ts +1 -1
- package/dist/agents/message.d.ts.map +1 -1
- package/dist/agents/model-loop.d.ts +2 -0
- package/dist/agents/model-loop.d.ts.map +1 -1
- package/dist/agents/request.d.ts +1 -1
- package/dist/agents/request.d.ts.map +1 -1
- package/dist/agents/streams/index.d.ts +4 -0
- package/dist/agents/streams/index.d.ts.map +1 -0
- package/dist/agents/streams/index.js +20 -0
- package/dist/{chunk-y64skrwp.js.map → agents/streams/index.js.map} +1 -1
- package/dist/agents/streams/internal.d.ts +3 -0
- package/dist/agents/streams/internal.d.ts.map +1 -0
- package/dist/agents/streams/internal.js +40 -0
- package/dist/agents/{context.js.map → streams/internal.js.map} +1 -1
- package/dist/agents/{streams.d.ts → streams/protocol.d.ts} +5 -5
- package/dist/agents/streams/protocol.d.ts.map +1 -0
- package/dist/agents/types.d.ts +1 -1
- package/dist/agents/types.d.ts.map +1 -1
- package/dist/agents/validation.d.ts.map +1 -1
- package/dist/auth/index.d.ts +0 -1
- package/dist/auth/index.d.ts.map +1 -1
- package/dist/auth/index.js +96 -108
- package/dist/auth/index.js.map +1 -1
- package/dist/auth/strategy.js +8 -9
- package/dist/auth/strategy.js.map +1 -1
- package/dist/authorization/index.js +51 -56
- package/dist/authorization/index.js.map +1 -1
- package/dist/blob-storage/browser.js +15 -17
- package/dist/blob-storage/browser.js.map +1 -1
- package/dist/blob-storage/index.js +36 -38
- package/dist/blob-storage/index.js.map +1 -1
- package/dist/bootstrap/discovery.d.ts +14 -1
- package/dist/bootstrap/discovery.d.ts.map +1 -1
- package/dist/bootstrap/index.d.ts +2 -2
- package/dist/bootstrap/index.d.ts.map +1 -1
- package/dist/bootstrap/index.js +79 -88
- package/dist/bootstrap/index.js.map +1 -1
- package/dist/broker/index.js +8 -10
- package/dist/broker/index.js.map +1 -1
- package/dist/{chunk-k34z5rvh.js → chunk-0rdrecsb.js} +18 -18
- package/dist/{chunk-k34z5rvh.js.map → chunk-0rdrecsb.js.map} +2 -2
- package/dist/{chunk-q0k9nc5a.js → chunk-0w35wavj.js} +98 -98
- package/dist/{chunk-q0k9nc5a.js.map → chunk-0w35wavj.js.map} +2 -2
- package/dist/chunk-0y39rgsb.js +43 -0
- package/dist/{chunk-c15dr03f.js.map → chunk-0y39rgsb.js.map} +2 -2
- package/dist/{chunk-k522z7v6.js → chunk-17kfctj6.js} +16 -11
- package/dist/chunk-17kfctj6.js.map +10 -0
- package/dist/{chunk-aa2pen2v.js → chunk-1enhpacz.js} +188 -175
- package/dist/{chunk-aa2pen2v.js.map → chunk-1enhpacz.js.map} +2 -2
- package/dist/{chunk-5gd7tpv6.js → chunk-2c4j899j.js} +4 -4
- package/dist/{chunk-5gd7tpv6.js.map → chunk-2c4j899j.js.map} +2 -2
- package/dist/{chunk-fvt9rjsa.js → chunk-38zv5rkr.js} +4 -4
- package/dist/{chunk-fvt9rjsa.js.map → chunk-38zv5rkr.js.map} +1 -1
- package/dist/{chunk-w3e09qqk.js → chunk-39tqv9hz.js} +24 -24
- package/dist/{chunk-w3e09qqk.js.map → chunk-39tqv9hz.js.map} +2 -2
- package/dist/{chunk-04b07a9q.js → chunk-3bh94gbw.js} +13 -13
- package/dist/{chunk-04b07a9q.js.map → chunk-3bh94gbw.js.map} +2 -2
- package/dist/{chunk-8m5ejdpn.js → chunk-3f7veca0.js} +4 -4
- package/dist/{chunk-8m5ejdpn.js.map → chunk-3f7veca0.js.map} +2 -2
- package/dist/chunk-3frsnm7x.js +32 -0
- package/dist/chunk-3frsnm7x.js.map +11 -0
- package/dist/{chunk-n2w475r0.js → chunk-3tgwrcyh.js} +81 -81
- package/dist/{chunk-n2w475r0.js.map → chunk-3tgwrcyh.js.map} +2 -2
- package/dist/{chunk-mwsxn98e.js → chunk-52hbv0ak.js} +170 -170
- package/dist/{chunk-mwsxn98e.js.map → chunk-52hbv0ak.js.map} +4 -4
- package/dist/{chunk-nf4r78r4.js → chunk-5a4a52tq.js} +4 -4
- package/dist/{chunk-nf4r78r4.js.map → chunk-5a4a52tq.js.map} +2 -2
- package/dist/{chunk-rte5sm3z.js → chunk-5hz0fnca.js} +23 -23
- package/dist/{chunk-rte5sm3z.js.map → chunk-5hz0fnca.js.map} +2 -2
- package/dist/chunk-653vwrzr.js +39 -0
- package/dist/chunk-653vwrzr.js.map +10 -0
- package/dist/{chunk-qw9gvjv5.js → chunk-72w2pxk7.js} +13 -13
- package/dist/{chunk-qw9gvjv5.js.map → chunk-72w2pxk7.js.map} +2 -2
- package/dist/chunk-7apz6hg4.js +50 -0
- package/dist/{chunk-jq43kdvk.js.map → chunk-7apz6hg4.js.map} +2 -2
- package/dist/chunk-7bs40fe1.js +218 -0
- package/dist/{chunk-p1rzczbt.js.map → chunk-7bs40fe1.js.map} +3 -3
- package/dist/chunk-7zgecwy1.js +113 -0
- package/dist/chunk-7zgecwy1.js.map +10 -0
- package/dist/{chunk-pc7ys28c.js → chunk-860dwwy0.js} +29 -29
- package/dist/{chunk-pc7ys28c.js.map → chunk-860dwwy0.js.map} +2 -2
- package/dist/chunk-8vj0rjgs.js +165 -0
- package/dist/chunk-8vj0rjgs.js.map +15 -0
- package/dist/{chunk-7y0f6rf1.js → chunk-92vk7gta.js} +58 -58
- package/dist/chunk-92vk7gta.js.map +10 -0
- package/dist/{chunk-rafagrwr.js → chunk-93csa55g.js} +45 -17
- package/dist/chunk-93csa55g.js.map +11 -0
- package/dist/{chunk-d8qkxt2v.js → chunk-98cw09sw.js} +7 -7
- package/dist/chunk-98cw09sw.js.map +10 -0
- package/dist/{chunk-n4khvw9n.js → chunk-9qsh3p5y.js} +17 -17
- package/dist/{chunk-n4khvw9n.js.map → chunk-9qsh3p5y.js.map} +2 -2
- package/dist/{chunk-4a849fr1.js → chunk-9tc8dxmn.js} +1 -1
- package/dist/{chunk-9nbmsvn5.js → chunk-9vx5e9g1.js} +9 -9
- package/dist/{chunk-9nbmsvn5.js.map → chunk-9vx5e9g1.js.map} +2 -2
- package/dist/{chunk-f26bck4t.js → chunk-an5tt9y0.js} +353 -353
- package/dist/{chunk-f26bck4t.js.map → chunk-an5tt9y0.js.map} +2 -2
- package/dist/{chunk-2dw777qw.js → chunk-ap0g1g74.js} +37 -82
- package/dist/{chunk-2dw777qw.js.map → chunk-ap0g1g74.js.map} +3 -4
- package/dist/{chunk-v4en4jc2.js → chunk-awbhdqyc.js} +7 -7
- package/dist/{chunk-v4en4jc2.js.map → chunk-awbhdqyc.js.map} +2 -2
- package/dist/{chunk-ka3a2ft3.js → chunk-b19g04jk.js} +12 -12
- package/dist/{chunk-ka3a2ft3.js.map → chunk-b19g04jk.js.map} +2 -2
- package/dist/{chunk-nx7k8tpr.js → chunk-br3k6qbf.js} +23 -23
- package/dist/{chunk-nx7k8tpr.js.map → chunk-br3k6qbf.js.map} +2 -2
- package/dist/{chunk-dbc80ad7.js → chunk-c5rkjrgp.js} +28 -28
- package/dist/{chunk-dbc80ad7.js.map → chunk-c5rkjrgp.js.map} +2 -2
- package/dist/{chunk-dktq02ne.js → chunk-cqr3acm1.js} +4 -4
- package/dist/{chunk-dktq02ne.js.map → chunk-cqr3acm1.js.map} +2 -2
- package/dist/chunk-d62kjtbg.js +7 -0
- package/dist/{chunk-zcnhxkvd.js.map → chunk-d62kjtbg.js.map} +2 -2
- package/dist/{chunk-74drx9gd.js → chunk-dfm066qg.js} +10 -10
- package/dist/{chunk-74drx9gd.js.map → chunk-dfm066qg.js.map} +2 -2
- package/dist/{chunk-5e3pq99w.js → chunk-dmn70ztd.js} +30 -30
- package/dist/chunk-dmn70ztd.js.map +11 -0
- package/dist/{chunk-p1x242ad.js → chunk-dz5h08xv.js} +175 -175
- package/dist/{chunk-p1x242ad.js.map → chunk-dz5h08xv.js.map} +2 -2
- package/dist/{chunk-p2vqaxkc.js → chunk-e0d1rzef.js} +27 -22
- package/dist/{chunk-p2vqaxkc.js.map → chunk-e0d1rzef.js.map} +3 -3
- package/dist/{chunk-5sz8ta9r.js → chunk-e1c18xjx.js} +52 -52
- package/dist/{chunk-5sz8ta9r.js.map → chunk-e1c18xjx.js.map} +2 -2
- package/dist/{chunk-wtf06et8.js → chunk-emyyk7dx.js} +55 -55
- package/dist/{chunk-wtf06et8.js.map → chunk-emyyk7dx.js.map} +2 -2
- package/dist/{chunk-19jp6g9d.js → chunk-f0rwz2vh.js} +54 -33
- package/dist/chunk-f0rwz2vh.js.map +11 -0
- package/dist/{chunk-2xns679x.js → chunk-f4w3yp4f.js} +171 -36
- package/dist/chunk-f4w3yp4f.js.map +12 -0
- package/dist/{chunk-979ww6b3.js → chunk-fb3feg1e.js} +29 -29
- package/dist/{chunk-979ww6b3.js.map → chunk-fb3feg1e.js.map} +2 -2
- package/dist/{chunk-4sm0aznx.js → chunk-g00bfdq6.js} +254 -256
- package/dist/{chunk-4sm0aznx.js.map → chunk-g00bfdq6.js.map} +3 -3
- package/dist/{chunk-p03r0h5s.js → chunk-g53f0e4j.js} +76 -202
- package/dist/chunk-g53f0e4j.js.map +15 -0
- package/dist/chunk-g6cke204.js +124 -0
- package/dist/chunk-g6cke204.js.map +10 -0
- package/dist/{chunk-51fjndv0.js → chunk-gfdh9kqa.js} +4 -4
- package/dist/{chunk-51fjndv0.js.map → chunk-gfdh9kqa.js.map} +2 -2
- package/dist/chunk-h1gfhhbh.js +602 -0
- package/dist/chunk-h1gfhhbh.js.map +18 -0
- package/dist/chunk-h3v76ams.js +32 -0
- package/dist/{chunk-08m3b6w8.js.map → chunk-h3v76ams.js.map} +2 -2
- package/dist/{chunk-xajtptbw.js → chunk-hpr1r6av.js} +1367 -418
- package/dist/chunk-hpr1r6av.js.map +44 -0
- package/dist/{chunk-jecn6t54.js → chunk-jgwb25gc.js} +74 -74
- package/dist/{chunk-jecn6t54.js.map → chunk-jgwb25gc.js.map} +2 -2
- package/dist/{chunk-w9tg6yyb.js → chunk-jjy0fhrn.js} +36 -36
- package/dist/{chunk-w9tg6yyb.js.map → chunk-jjy0fhrn.js.map} +2 -2
- package/dist/{chunk-wdage1eb.js → chunk-jmfet9r4.js} +6 -6
- package/dist/{chunk-wdage1eb.js.map → chunk-jmfet9r4.js.map} +2 -2
- package/dist/{chunk-ajnan18g.js → chunk-k3cqkkn2.js} +58 -55
- package/dist/chunk-k3cqkkn2.js.map +12 -0
- package/dist/{chunk-s5y30bc9.js → chunk-kxwa347f.js} +51 -49
- package/dist/{chunk-s5y30bc9.js.map → chunk-kxwa347f.js.map} +4 -4
- package/dist/{chunk-2ab72m2h.js → chunk-m2ca93my.js} +3 -3
- package/dist/{chunk-2ab72m2h.js.map → chunk-m2ca93my.js.map} +2 -2
- package/dist/{chunk-3z1qec12.js → chunk-m3z3x9v0.js} +107 -64
- package/dist/{chunk-3z1qec12.js.map → chunk-m3z3x9v0.js.map} +3 -3
- package/dist/{chunk-sbzzr4kx.js → chunk-mjbk2djy.js} +1061 -1195
- package/dist/{chunk-sbzzr4kx.js.map → chunk-mjbk2djy.js.map} +9 -15
- package/dist/{chunk-4jjp5k14.js → chunk-mmagke4x.js} +6 -6
- package/dist/{chunk-4jjp5k14.js.map → chunk-mmagke4x.js.map} +2 -2
- package/dist/{chunk-359jm1jw.js → chunk-mrp7k0pw.js} +20 -20
- package/dist/{chunk-359jm1jw.js.map → chunk-mrp7k0pw.js.map} +2 -2
- package/dist/{chunk-h0k55pc7.js → chunk-ms2tmn1k.js} +139 -139
- package/dist/{chunk-h0k55pc7.js.map → chunk-ms2tmn1k.js.map} +2 -2
- package/dist/{chunk-rv2hkwwa.js → chunk-ppytyr6w.js} +156 -179
- package/dist/{chunk-rv2hkwwa.js.map → chunk-ppytyr6w.js.map} +3 -5
- package/dist/{chunk-trxxmgnf.js → chunk-pqajwytd.js} +10 -10
- package/dist/{chunk-trxxmgnf.js.map → chunk-pqajwytd.js.map} +3 -3
- package/dist/{chunk-nn0tekr1.js → chunk-pr2h4bv4.js} +33 -33
- package/dist/{chunk-nn0tekr1.js.map → chunk-pr2h4bv4.js.map} +2 -2
- package/dist/{chunk-xwnf87e1.js → chunk-q5gz3g2j.js} +64 -64
- package/dist/{chunk-xwnf87e1.js.map → chunk-q5gz3g2j.js.map} +2 -2
- package/dist/{chunk-5ntny1qx.js → chunk-qf954wje.js} +6 -6
- package/dist/{chunk-5ntny1qx.js.map → chunk-qf954wje.js.map} +2 -2
- package/dist/{chunk-mth82m8t.js → chunk-qhcpj9wc.js} +77 -77
- package/dist/{chunk-mth82m8t.js.map → chunk-qhcpj9wc.js.map} +2 -2
- package/dist/{chunk-tpnd31c1.js → chunk-r29fxdhn.js} +12 -12
- package/dist/{chunk-tpnd31c1.js.map → chunk-r29fxdhn.js.map} +2 -2
- package/dist/{chunk-b49dgvsj.js → chunk-r2y23egw.js} +3 -3
- package/dist/{chunk-b49dgvsj.js.map → chunk-r2y23egw.js.map} +2 -2
- package/dist/{chunk-3xep5cjx.js → chunk-r4tfx1sf.js} +104 -86
- package/dist/chunk-r4tfx1sf.js.map +15 -0
- package/dist/{chunk-4rh2m6zg.js → chunk-rb1xx120.js} +13 -13
- package/dist/{chunk-4rh2m6zg.js.map → chunk-rb1xx120.js.map} +2 -2
- package/dist/chunk-s3csryxe.js +152 -0
- package/dist/chunk-s3csryxe.js.map +11 -0
- package/dist/chunk-s670k14v.js +60 -0
- package/dist/{chunk-407j3msh.js.map → chunk-s670k14v.js.map} +2 -2
- package/dist/chunk-skz0hst3.js +788 -0
- package/dist/chunk-skz0hst3.js.map +19 -0
- package/dist/{chunk-r8jrnexe.js → chunk-v4jbb3rs.js} +4 -4
- package/dist/{chunk-r8jrnexe.js.map → chunk-v4jbb3rs.js.map} +2 -2
- package/dist/{chunk-v1xppd0y.js → chunk-vf691g1r.js} +60 -60
- package/dist/{chunk-v1xppd0y.js.map → chunk-vf691g1r.js.map} +2 -2
- package/dist/{chunk-w1tvjszy.js → chunk-vsj3mdfj.js} +8 -8
- package/dist/{chunk-w1tvjszy.js.map → chunk-vsj3mdfj.js.map} +2 -2
- package/dist/{chunk-9dzba0f2.js → chunk-wjasrj67.js} +8 -8
- package/dist/{chunk-9dzba0f2.js.map → chunk-wjasrj67.js.map} +2 -2
- package/dist/{chunk-1evzqhks.js → chunk-wr8qp979.js} +6 -6
- package/dist/{chunk-1evzqhks.js.map → chunk-wr8qp979.js.map} +2 -2
- package/dist/{chunk-n6jxh8sw.js → chunk-wy0qdqfm.js} +18 -18
- package/dist/{chunk-n6jxh8sw.js.map → chunk-wy0qdqfm.js.map} +2 -2
- package/dist/{chunk-8tsf6dmc.js → chunk-x57ycxq0.js} +204 -204
- package/dist/{chunk-8tsf6dmc.js.map → chunk-x57ycxq0.js.map} +2 -2
- package/dist/{chunk-z4ccwbkz.js → chunk-x9v4cx1d.js} +1 -1
- package/dist/{chunk-gbejpkex.js → chunk-xfbydgzy.js} +26 -26
- package/dist/{chunk-gbejpkex.js.map → chunk-xfbydgzy.js.map} +2 -2
- package/dist/{chunk-gzasd5b6.js → chunk-xyr8kppc.js} +22 -22
- package/dist/{chunk-gzasd5b6.js.map → chunk-xyr8kppc.js.map} +2 -2
- package/dist/{chunk-h5vqbfmd.js → chunk-ypbtykv6.js} +117 -117
- package/dist/{chunk-h5vqbfmd.js.map → chunk-ypbtykv6.js.map} +3 -3
- package/dist/{chunk-ry24jbr1.js → chunk-yv79ncbv.js} +10 -10
- package/dist/{chunk-ry24jbr1.js.map → chunk-yv79ncbv.js.map} +2 -2
- package/dist/{chunk-yp8ee62z.js → chunk-z30bv4ga.js} +35 -35
- package/dist/{chunk-yp8ee62z.js.map → chunk-z30bv4ga.js.map} +2 -2
- package/dist/{chunk-8ydjhh27.js → chunk-z3y411fq.js} +11 -7
- package/dist/{chunk-8ydjhh27.js.map → chunk-z3y411fq.js.map} +3 -3
- package/dist/{chunk-9t8f5xfx.js → chunk-z5rnrmz1.js} +10 -10
- package/dist/{chunk-9t8f5xfx.js.map → chunk-z5rnrmz1.js.map} +2 -2
- package/dist/{chunk-96swp2wd.js → chunk-z667z3sg.js} +3 -3
- package/dist/{chunk-96swp2wd.js.map → chunk-z667z3sg.js.map} +2 -2
- package/dist/{chunk-4yqmp43v.js → chunk-z8fx5cgb.js} +12 -12
- package/dist/{chunk-4yqmp43v.js.map → chunk-z8fx5cgb.js.map} +2 -2
- package/dist/{chunk-xhy826cz.js → chunk-zcnq6105.js} +7 -7
- package/dist/{chunk-xhy826cz.js.map → chunk-zcnq6105.js.map} +2 -2
- package/dist/{chunk-yt8wphsx.js → chunk-zvx7h87b.js} +3 -3
- package/dist/{chunk-yt8wphsx.js.map → chunk-zvx7h87b.js.map} +2 -2
- package/dist/connectors/connections/internal.js +9 -10
- package/dist/connectors/connections/internal.js.map +1 -1
- package/dist/datasets/write.js +8 -12
- package/dist/datasets/write.js.map +1 -1
- package/dist/edits/index.js +7 -8
- package/dist/edits/index.js.map +1 -1
- package/dist/error-reporting/internal.js +22 -24
- package/dist/error-reporting/internal.js.map +1 -1
- package/dist/errors/internal.d.ts +1 -1
- package/dist/errors/internal.d.ts.map +1 -1
- package/dist/errors/internal.js +22 -24
- package/dist/errors/internal.js.map +1 -1
- package/dist/errors/redaction.d.ts +8 -0
- package/dist/errors/redaction.d.ts.map +1 -0
- package/dist/errors/types.d.ts +4 -0
- package/dist/errors/types.d.ts.map +1 -1
- package/dist/events/index.js +60 -63
- package/dist/events/index.js.map +1 -1
- package/dist/events/scope.js +4 -5
- package/dist/events/scope.js.map +1 -1
- package/dist/events/selectors/index.js +9 -10
- package/dist/events/selectors/index.js.map +1 -1
- package/dist/execution/agent.d.ts +3 -3
- package/dist/execution/agent.d.ts.map +1 -1
- package/dist/execution/agent.js +70 -82
- package/dist/execution/agent.js.map +1 -1
- package/dist/execution/durable.d.ts +1 -0
- package/dist/execution/durable.d.ts.map +1 -1
- package/dist/execution/primitive.d.ts +2 -0
- package/dist/execution/primitive.d.ts.map +1 -1
- package/dist/execution/primitive.js +63 -71
- package/dist/execution/primitive.js.map +3 -3
- package/dist/execution/request.d.ts +1 -0
- package/dist/execution/request.d.ts.map +1 -1
- package/dist/execution/request.js +65 -75
- package/dist/execution/request.js.map +3 -3
- package/dist/http/index.js +10 -11
- package/dist/http/index.js.map +1 -1
- package/dist/index.d.ts +14 -10
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +455 -477
- package/dist/index.js.map +1 -1
- package/dist/lake-storage/index.js +38 -42
- package/dist/lake-storage/index.js.map +1 -1
- package/dist/logging/index.d.ts +3 -4
- package/dist/logging/index.d.ts.map +1 -1
- package/dist/logging/index.js +18 -40
- package/dist/logging/index.js.map +1 -1
- package/dist/logging/internal.d.ts +5 -0
- package/dist/logging/internal.d.ts.map +1 -0
- package/dist/logging/internal.js +43 -0
- package/dist/logging/internal.js.map +9 -0
- package/dist/materialization/index.js +46 -49
- package/dist/materialization/index.js.map +1 -1
- package/dist/materializer/index.js +137 -145
- package/dist/materializer/index.js.map +1 -1
- package/dist/models/errors.d.ts +4 -0
- package/dist/models/errors.d.ts.map +1 -1
- package/dist/models/execution/binding.d.ts +9 -0
- package/dist/models/execution/binding.d.ts.map +1 -0
- package/dist/models/execution/errors.d.ts +9 -0
- package/dist/models/execution/errors.d.ts.map +1 -0
- package/dist/models/execution/index.d.ts +11 -0
- package/dist/models/execution/index.d.ts.map +1 -0
- package/dist/models/execution/index.js +55 -0
- package/dist/models/execution/index.js.map +9 -0
- package/dist/models/execution/model-call-accounting.d.ts +17 -0
- package/dist/models/execution/model-call-accounting.d.ts.map +1 -0
- package/dist/models/execution/model-call-admission.d.ts +47 -0
- package/dist/models/execution/model-call-admission.d.ts.map +1 -0
- package/dist/models/execution/model-call-limits.d.ts +15 -0
- package/dist/models/execution/model-call-limits.d.ts.map +1 -0
- package/dist/models/execution/model-call-recorder.d.ts +40 -0
- package/dist/models/execution/model-call-recorder.d.ts.map +1 -0
- package/dist/models/execution/model-call-recovery.d.ts +12 -0
- package/dist/models/execution/model-call-recovery.d.ts.map +1 -0
- package/dist/models/execution/recovery-queue.d.ts +5 -0
- package/dist/models/execution/recovery-queue.d.ts.map +1 -0
- package/dist/models/execution/types.d.ts +44 -0
- package/dist/models/execution/types.d.ts.map +1 -0
- package/dist/models/execution/usage.d.ts +5 -0
- package/dist/models/execution/usage.d.ts.map +1 -0
- package/dist/models/execution.d.ts +6 -0
- package/dist/models/execution.d.ts.map +1 -0
- package/dist/models/generation-types.d.ts +40 -0
- package/dist/models/generation-types.d.ts.map +1 -0
- package/dist/models/index.d.ts +1 -0
- package/dist/models/index.d.ts.map +1 -1
- package/dist/models/index.js +42 -43
- package/dist/models/index.js.map +1 -1
- package/dist/models/language-model.d.ts +3 -0
- package/dist/models/language-model.d.ts.map +1 -1
- package/dist/models/output.d.ts +5 -0
- package/dist/models/output.d.ts.map +1 -0
- package/dist/models/resolve.d.ts +4 -0
- package/dist/models/resolve.d.ts.map +1 -0
- package/dist/objects/execution.d.ts.map +1 -1
- package/dist/objects/index.js +75 -87
- package/dist/objects/index.js.map +1 -1
- package/dist/objects/query/index.js +67 -76
- package/dist/objects/query/index.js.map +1 -1
- package/dist/ontology/index.d.ts +1 -2
- package/dist/ontology/index.d.ts.map +1 -1
- package/dist/ontology/index.js +62 -113
- package/dist/ontology/index.js.map +1 -1
- package/dist/ontology/internal.d.ts +7 -0
- package/dist/ontology/internal.d.ts.map +1 -1
- package/dist/ontology/internal.js +65 -116
- package/dist/ontology/internal.js.map +3 -4
- package/dist/pipelines/index.js +57 -66
- package/dist/pipelines/index.js.map +1 -1
- package/dist/projections/internal.js +58 -67
- package/dist/projections/internal.js.map +1 -1
- package/dist/query.d.ts +0 -1
- package/dist/query.d.ts.map +1 -1
- package/dist/query.js +11 -15
- package/dist/query.js.map +1 -1
- package/dist/queues/index.d.ts +2 -1
- package/dist/queues/index.d.ts.map +1 -1
- package/dist/queues/index.js +6 -7
- package/dist/queues/index.js.map +1 -1
- package/dist/queues/types.d.ts +3 -20
- package/dist/queues/types.d.ts.map +1 -1
- package/dist/rules/internal.js +4 -5
- package/dist/rules/internal.js.map +1 -1
- package/dist/runtime/create.d.ts +2 -1
- package/dist/runtime/create.d.ts.map +1 -1
- package/dist/runtime/host.d.ts +2 -1
- package/dist/runtime/host.d.ts.map +1 -1
- package/dist/runtime/internal.js +13 -14
- package/dist/runtime/internal.js.map +1 -1
- package/dist/runtime/sixb.d.ts +2 -0
- package/dist/runtime/sixb.d.ts.map +1 -1
- package/dist/sandboxes/errors.d.ts +4 -0
- package/dist/sandboxes/errors.d.ts.map +1 -1
- package/dist/sandboxes/index.d.ts +2 -2
- package/dist/sandboxes/index.d.ts.map +1 -1
- package/dist/sandboxes/index.js +14 -13
- package/dist/sandboxes/index.js.map +1 -1
- package/dist/sandboxes/sandbox.d.ts +35 -7
- package/dist/sandboxes/sandbox.d.ts.map +1 -1
- package/dist/scheduler/index.js +9 -10
- package/dist/scheduler/index.js.map +1 -1
- package/dist/schedules/index.js +31 -33
- package/dist/schedules/index.js.map +1 -1
- package/dist/shares/internal.js +46 -54
- package/dist/shares/internal.js.map +2 -2
- package/dist/storage/action-runs/failure.js +7 -9
- package/dist/storage/action-runs/failure.js.map +1 -1
- package/dist/storage/action-runs/provider.js +4 -8
- package/dist/storage/action-runs/provider.js.map +1 -1
- package/dist/storage/agents/in-memory.d.ts.map +1 -1
- package/dist/storage/agents/provider.js +26 -30
- package/dist/storage/agents/provider.js.map +1 -1
- package/dist/storage/agents/types.d.ts +0 -3
- package/dist/storage/agents/types.d.ts.map +1 -1
- package/dist/storage/ai-cost/attribution.d.ts +4 -0
- package/dist/storage/ai-cost/attribution.d.ts.map +1 -0
- package/dist/storage/ai-cost/groups.d.ts +3 -0
- package/dist/storage/ai-cost/groups.d.ts.map +1 -1
- package/dist/storage/ai-cost/provider.d.ts +1 -0
- package/dist/storage/ai-cost/provider.d.ts.map +1 -1
- package/dist/storage/ai-cost/provider.js +30 -143
- package/dist/storage/ai-cost/provider.js.map +3 -4
- package/dist/storage/ai-cost/types.d.ts +15 -0
- package/dist/storage/ai-cost/types.d.ts.map +1 -1
- package/dist/storage/ai-limits/enforcement.js +14 -16
- package/dist/storage/ai-limits/enforcement.js.map +1 -1
- package/dist/storage/ai-limits/provider.js +56 -57
- package/dist/storage/ai-limits/provider.js.map +1 -1
- package/dist/storage/auth/in-memory.d.ts +1 -1
- package/dist/storage/auth/in-memory.d.ts.map +1 -1
- package/dist/storage/connector-connections/provider.js +34 -36
- package/dist/storage/connector-connections/provider.js.map +2 -2
- package/dist/storage/executions/in-memory.d.ts.map +1 -1
- package/dist/storage/executions/provider.d.ts +2 -1
- package/dist/storage/executions/provider.d.ts.map +1 -1
- package/dist/storage/executions/provider.js +14 -11
- package/dist/storage/executions/provider.js.map +3 -3
- package/dist/storage/executions/types.d.ts +6 -2
- package/dist/storage/executions/types.d.ts.map +1 -1
- package/dist/storage/executions/validation.d.ts +2 -0
- package/dist/storage/executions/validation.d.ts.map +1 -1
- package/dist/storage/in-memory/index.d.ts.map +1 -1
- package/dist/storage/index.d.ts +6 -7
- package/dist/storage/index.d.ts.map +1 -1
- package/dist/storage/index.js +221 -256
- package/dist/storage/index.js.map +1 -1
- package/dist/storage/internal.d.ts +10 -0
- package/dist/storage/internal.d.ts.map +1 -0
- package/dist/storage/internal.js +47 -0
- package/dist/storage/internal.js.map +9 -0
- package/dist/storage/ontology/provider.js +105 -109
- package/dist/storage/ontology/provider.js.map +1 -1
- package/dist/storage/operation-scope.js +18 -19
- package/dist/storage/operation-scope.js.map +1 -1
- package/dist/storage/pipeline-runs/provider.js +4 -6
- package/dist/storage/pipeline-runs/provider.js.map +1 -1
- package/dist/storage/projection-runs/provider.js +66 -70
- package/dist/storage/projection-runs/provider.js.map +1 -1
- package/dist/storage/share-grants/provider.js +17 -19
- package/dist/storage/share-grants/provider.js.map +1 -1
- package/dist/storage/share-sessions/provider.js +14 -15
- package/dist/storage/share-sessions/provider.js.map +1 -1
- package/dist/storage/sync-runs/provider.js +4 -6
- package/dist/storage/sync-runs/provider.js.map +1 -1
- package/dist/storage/webhook-runs/provider.js +4 -6
- package/dist/storage/webhook-runs/provider.js.map +1 -1
- package/dist/storage/workflow-runs/in-memory.d.ts.map +1 -1
- package/dist/storage/workflow-runs/provider.js +13 -21
- package/dist/storage/workflow-runs/provider.js.map +1 -1
- package/dist/storage/workflow-runs/types.d.ts +0 -3
- package/dist/storage/workflow-runs/types.d.ts.map +1 -1
- package/dist/syncs/index.js +55 -65
- package/dist/syncs/index.js.map +1 -1
- package/dist/testing/action-execution.d.ts +4 -1
- package/dist/testing/action-execution.d.ts.map +1 -1
- package/dist/testing/agent-execution.d.ts +1 -0
- package/dist/testing/agent-execution.d.ts.map +1 -1
- package/dist/testing/agent-storage-contract.d.ts.map +1 -1
- package/dist/testing/ai-model-call-groups-contract.d.ts.map +1 -1
- package/dist/testing/execution-storage-contract.d.ts.map +1 -1
- package/dist/testing/execution.d.ts +1 -0
- package/dist/testing/execution.d.ts.map +1 -1
- package/dist/testing/index.js +911 -799
- package/dist/testing/index.js.map +9 -9
- package/dist/testing/workflow-execution.d.ts +1 -0
- package/dist/testing/workflow-execution.d.ts.map +1 -1
- package/dist/webhooks/internal.js +51 -59
- package/dist/webhooks/internal.js.map +2 -2
- package/dist/workers/index.js +11 -13
- package/dist/workers/index.js.map +2 -2
- package/dist/workflows/failure.d.ts +2 -0
- package/dist/workflows/failure.d.ts.map +1 -1
- package/dist/workflows/index.js +135 -147
- package/dist/workflows/index.js.map +1 -1
- package/dist/workflows/request.d.ts.map +1 -1
- package/dist/workflows/run-dispatch.d.ts +0 -1
- package/dist/workflows/run-dispatch.d.ts.map +1 -1
- package/dist/workflows/types.d.ts +2 -0
- package/dist/workflows/types.d.ts.map +1 -1
- package/package.json +48 -30
- package/src/actions/run-dispatch.ts +2 -6
- package/src/actions/types/context.ts +2 -0
- package/src/actions/validation.ts +2 -1
- package/src/agents/adapters.ts +4 -9
- package/src/agents/{context.ts → context/entries.ts} +4 -4
- package/src/agents/context/index.ts +15 -0
- package/src/agents/context-model.ts +1 -1
- package/src/agents/context-resolution.ts +1 -1
- package/src/agents/index.ts +4 -4
- package/src/agents/message.ts +1 -1
- package/src/agents/model-loop.ts +8 -0
- package/src/agents/request.ts +11 -26
- package/src/agents/streams/index.ts +18 -0
- package/src/agents/streams/internal.ts +19 -0
- package/src/agents/{streams.ts → streams/protocol.ts} +5 -5
- package/src/agents/types.ts +1 -1
- package/src/agents/validation.ts +3 -7
- package/src/auth/index.ts +0 -1
- package/src/bootstrap/discovery.ts +81 -24
- package/src/bootstrap/index.ts +8 -1
- package/src/errors/internal.ts +90 -10
- package/src/errors/redaction.ts +98 -0
- package/src/errors/types.ts +4 -0
- package/src/execution/agent.ts +5 -3
- package/src/execution/durable.ts +11 -1
- package/src/execution/primitive.ts +5 -1
- package/src/execution/request.ts +3 -0
- package/src/index.ts +20 -18
- package/src/logging/index.ts +2 -33
- package/src/logging/internal.ts +43 -0
- package/src/models/errors.ts +12 -0
- package/src/models/execution/binding.ts +29 -0
- package/src/models/execution/errors.ts +18 -0
- package/src/models/execution/index.ts +26 -0
- package/src/models/execution/model-call-accounting.ts +211 -0
- package/src/models/execution/model-call-admission.ts +127 -0
- package/src/models/execution/model-call-limits.ts +135 -0
- package/src/models/execution/model-call-recorder.ts +235 -0
- package/src/models/execution/model-call-recovery.ts +125 -0
- package/src/models/execution/recovery-queue.ts +31 -0
- package/src/models/execution/types.ts +58 -0
- package/src/models/execution/usage.ts +23 -0
- package/src/models/execution.ts +207 -0
- package/src/models/generation-types.ts +50 -0
- package/src/models/index.ts +8 -0
- package/src/models/language-model.ts +3 -0
- package/src/models/output.ts +45 -0
- package/src/models/resolve.ts +27 -0
- package/src/objects/execution.ts +1 -1
- package/src/ontology/index.ts +1 -2
- package/src/ontology/internal.ts +35 -0
- package/src/projections/run-dispatch.ts +1 -0
- package/src/query.ts +0 -1
- package/src/queues/index.ts +4 -2
- package/src/queues/types.ts +6 -25
- package/src/runtime/create.ts +2 -1
- package/src/runtime/host.ts +2 -1
- package/src/runtime/sixb.ts +4 -0
- package/src/sandboxes/errors.ts +5 -0
- package/src/sandboxes/index.ts +3 -0
- package/src/sandboxes/sandbox.ts +35 -7
- package/src/storage/agents/in-memory.ts +0 -3
- package/src/storage/agents/types.ts +0 -3
- package/src/storage/ai-cost/analytics.ts +1 -1
- package/src/storage/ai-cost/attribution.ts +15 -0
- package/src/storage/ai-cost/groups.ts +5 -1
- package/src/storage/ai-cost/provider.ts +1 -0
- package/src/storage/ai-cost/types.ts +7 -0
- package/src/storage/auth/in-memory.ts +1 -1
- package/src/storage/executions/in-memory.ts +4 -9
- package/src/storage/executions/provider.ts +4 -0
- package/src/storage/executions/types.ts +6 -2
- package/src/storage/executions/validation.ts +32 -0
- package/src/storage/in-memory/index.ts +16 -1
- package/src/storage/index.ts +3 -29
- package/src/storage/internal.ts +20 -0
- package/src/storage/workflow-runs/in-memory.ts +0 -2
- package/src/storage/workflow-runs/types.ts +0 -3
- package/src/testing/action-execution.ts +9 -2
- package/src/testing/agent-execution.ts +3 -0
- package/src/testing/agent-storage-contract.ts +0 -5
- package/src/testing/ai-model-call-groups-contract.ts +74 -2
- package/src/testing/execution-storage-contract.ts +59 -1
- package/src/testing/execution.ts +6 -0
- package/src/testing/workflow-execution.ts +4 -0
- package/src/workflows/failure.ts +62 -1
- package/src/workflows/request.ts +0 -9
- package/src/workflows/run-dispatch.ts +0 -3
- package/src/workflows/types.ts +2 -0
- package/src/workflows/validation.ts +1 -1
- package/dist/agents/context.d.ts.map +0 -1
- package/dist/agents/context.js +0 -23
- package/dist/agents/streams.d.ts.map +0 -1
- package/dist/agents/streams.js +0 -55
- package/dist/chunk-08m3b6w8.js +0 -32
- package/dist/chunk-19jp6g9d.js.map +0 -11
- package/dist/chunk-2xns679x.js.map +0 -11
- package/dist/chunk-3xep5cjx.js.map +0 -15
- package/dist/chunk-407j3msh.js +0 -60
- package/dist/chunk-4qfkag59.js +0 -1568
- package/dist/chunk-4qfkag59.js.map +0 -20
- package/dist/chunk-5e3pq99w.js.map +0 -11
- package/dist/chunk-7y0f6rf1.js.map +0 -10
- package/dist/chunk-ajnan18g.js.map +0 -12
- package/dist/chunk-c15dr03f.js +0 -43
- package/dist/chunk-d8qkxt2v.js.map +0 -10
- package/dist/chunk-jq43kdvk.js +0 -50
- package/dist/chunk-k522z7v6.js.map +0 -10
- package/dist/chunk-p03r0h5s.js.map +0 -16
- package/dist/chunk-p1rzczbt.js +0 -218
- package/dist/chunk-rafagrwr.js.map +0 -11
- package/dist/chunk-xajtptbw.js.map +0 -40
- package/dist/chunk-y64skrwp.js +0 -19
- package/dist/chunk-zcnhxkvd.js +0 -7
- package/dist/logging/types.js +0 -27
- package/dist/logging/types.js.map +0 -9
- /package/dist/{chunk-zqqz8052.js → chunk-7n30ybym.js} +0 -0
- /package/dist/{chunk-zqqz8052.js.map → chunk-7n30ybym.js.map} +0 -0
- /package/dist/{chunk-4a849fr1.js.map → chunk-9tc8dxmn.js.map} +0 -0
- /package/dist/{chunk-j1sbhm7p.js → chunk-ey1nk510.js} +0 -0
- /package/dist/{chunk-j1sbhm7p.js.map → chunk-ey1nk510.js.map} +0 -0
- /package/dist/{chunk-z4ccwbkz.js.map → chunk-x9v4cx1d.js.map} +0 -0
package/dist/testing/index.js
CHANGED
|
@@ -1,171 +1,160 @@
|
|
|
1
1
|
// @bun
|
|
2
2
|
import {
|
|
3
|
-
|
|
4
|
-
|
|
3
|
+
defineProjection2,
|
|
4
|
+
agentServiceAccountId2,
|
|
5
|
+
MAX_OBJECT_READ_FACETS2
|
|
6
|
+
} from "../chunk-dz5h08xv.js";
|
|
7
|
+
import"../chunk-f4w3yp4f.js";
|
|
5
8
|
import {
|
|
6
|
-
|
|
7
|
-
} from "../chunk-
|
|
8
|
-
import"../chunk-
|
|
9
|
-
import"../chunk-ajnan18g.js";
|
|
9
|
+
compileSelectedObjectReadScope2
|
|
10
|
+
} from "../chunk-v4jbb3rs.js";
|
|
11
|
+
import"../chunk-ms2tmn1k.js";
|
|
10
12
|
import {
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
} from "../chunk-
|
|
14
|
-
import"../chunk-
|
|
15
|
-
import"../chunk-
|
|
16
|
-
import"../chunk-
|
|
17
|
-
import"../chunk-
|
|
18
|
-
import"../chunk-n2w475r0.js";
|
|
13
|
+
AuthStorageError2,
|
|
14
|
+
SYSTEM_PRINCIPAL2
|
|
15
|
+
} from "../chunk-g00bfdq6.js";
|
|
16
|
+
import"../chunk-q5gz3g2j.js";
|
|
17
|
+
import"../chunk-pqajwytd.js";
|
|
18
|
+
import"../chunk-e0d1rzef.js";
|
|
19
|
+
import"../chunk-gfdh9kqa.js";
|
|
19
20
|
import {
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
21
|
+
computeBlobDigest2,
|
|
22
|
+
InMemoryBlobStorage2
|
|
23
|
+
} from "../chunk-39tqv9hz.js";
|
|
23
24
|
import {
|
|
24
|
-
|
|
25
|
-
} from "../chunk-
|
|
26
|
-
import"../chunk-gbejpkex.js";
|
|
27
|
-
import"../chunk-z4ccwbkz.js";
|
|
28
|
-
import"../chunk-gzasd5b6.js";
|
|
29
|
-
import"../chunk-5sz8ta9r.js";
|
|
30
|
-
import"../chunk-979ww6b3.js";
|
|
31
|
-
import"../chunk-2ab72m2h.js";
|
|
32
|
-
import"../chunk-74drx9gd.js";
|
|
33
|
-
import"../chunk-b49dgvsj.js";
|
|
25
|
+
AgentStorageError2
|
|
26
|
+
} from "../chunk-7bs40fe1.js";
|
|
34
27
|
import {
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
import"../chunk-
|
|
28
|
+
AiUsageStorageError2
|
|
29
|
+
} from "../chunk-g53f0e4j.js";
|
|
30
|
+
import"../chunk-b19g04jk.js";
|
|
31
|
+
import"../chunk-vsj3mdfj.js";
|
|
39
32
|
import {
|
|
40
|
-
|
|
41
|
-
} from "../chunk-
|
|
42
|
-
import"../chunk-
|
|
43
|
-
import"../chunk-
|
|
44
|
-
import"../chunk-v4en4jc2.js";
|
|
45
|
-
import"../chunk-w9tg6yyb.js";
|
|
46
|
-
import"../chunk-aa2pen2v.js";
|
|
47
|
-
import"../chunk-xhy826cz.js";
|
|
48
|
-
import"../chunk-4rh2m6zg.js";
|
|
49
|
-
import"../chunk-9nbmsvn5.js";
|
|
50
|
-
import"../chunk-8m5ejdpn.js";
|
|
51
|
-
import"../chunk-nf4r78r4.js";
|
|
33
|
+
aiLimitCalendarMonth2
|
|
34
|
+
} from "../chunk-jgwb25gc.js";
|
|
35
|
+
import"../chunk-8vj0rjgs.js";
|
|
36
|
+
import"../chunk-93csa55g.js";
|
|
52
37
|
import {
|
|
53
|
-
|
|
54
|
-
|
|
38
|
+
OntologyRegistry2,
|
|
39
|
+
defineObjectType2,
|
|
40
|
+
prop2,
|
|
41
|
+
link2,
|
|
42
|
+
stringEnum2
|
|
43
|
+
} from "../chunk-ap0g1g74.js";
|
|
55
44
|
import {
|
|
56
|
-
|
|
57
|
-
|
|
45
|
+
AGENT_MESSAGE_CONTENT_VERSION2,
|
|
46
|
+
AiCostStorageError2,
|
|
47
|
+
objectBatchKey2,
|
|
48
|
+
linkBatchKey2,
|
|
49
|
+
objectLinkCursor2,
|
|
50
|
+
InMemoryStorage2
|
|
51
|
+
} from "../chunk-mjbk2djy.js";
|
|
52
|
+
import"../chunk-c5rkjrgp.js";
|
|
58
53
|
import {
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
import"../chunk-
|
|
64
|
-
import"../chunk-
|
|
54
|
+
createEventId2
|
|
55
|
+
} from "../chunk-x57ycxq0.js";
|
|
56
|
+
import"../chunk-z30bv4ga.js";
|
|
57
|
+
import"../chunk-mmagke4x.js";
|
|
58
|
+
import"../chunk-3frsnm7x.js";
|
|
59
|
+
import"../chunk-ppytyr6w.js";
|
|
60
|
+
import"../chunk-jmfet9r4.js";
|
|
61
|
+
import"../chunk-qf954wje.js";
|
|
62
|
+
import"../chunk-pr2h4bv4.js";
|
|
65
63
|
import {
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
existsObjects,
|
|
71
|
-
facetObjects,
|
|
72
|
-
validateObjectQuery
|
|
73
|
-
} from "../chunk-q0k9nc5a.js";
|
|
64
|
+
ProjectionRegistry2,
|
|
65
|
+
createLinkScopeFingerprint2,
|
|
66
|
+
createOntologyMaterializer2
|
|
67
|
+
} from "../chunk-an5tt9y0.js";
|
|
74
68
|
import {
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
} from "../chunk-
|
|
69
|
+
bindModelExecutionAttempt,
|
|
70
|
+
isBoundSixb
|
|
71
|
+
} from "../chunk-hpr1r6av.js";
|
|
72
|
+
import"../chunk-5a4a52tq.js";
|
|
78
73
|
import {
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
import"../chunk-
|
|
74
|
+
SixbHost2
|
|
75
|
+
} from "../chunk-52hbv0ak.js";
|
|
76
|
+
import"../chunk-7apz6hg4.js";
|
|
77
|
+
import"../chunk-3tgwrcyh.js";
|
|
78
|
+
import"../chunk-r2y23egw.js";
|
|
79
|
+
import"../chunk-dfm066qg.js";
|
|
84
80
|
import {
|
|
85
|
-
|
|
86
|
-
|
|
81
|
+
validateObjectQuery2,
|
|
82
|
+
collectObjectQueryValidationIssues2,
|
|
83
|
+
executeObjectQuery2,
|
|
84
|
+
countObjects2,
|
|
85
|
+
existsObjects2,
|
|
86
|
+
facetObjects2,
|
|
87
|
+
executeObjectQueryLinks2
|
|
88
|
+
} from "../chunk-0w35wavj.js";
|
|
89
|
+
import"../chunk-ypbtykv6.js";
|
|
90
|
+
import"../chunk-kxwa347f.js";
|
|
91
|
+
import"../chunk-k3cqkkn2.js";
|
|
92
|
+
import"../chunk-fb3feg1e.js";
|
|
93
|
+
import"../chunk-z5rnrmz1.js";
|
|
94
|
+
import"../chunk-zcnq6105.js";
|
|
95
|
+
import"../chunk-wr8qp979.js";
|
|
96
|
+
import"../chunk-vf691g1r.js";
|
|
97
|
+
import"../chunk-skz0hst3.js";
|
|
87
98
|
import {
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
import"../chunk-
|
|
96
|
-
import"../chunk-
|
|
97
|
-
import"../chunk-nx7k8tpr.js";
|
|
98
|
-
import"../chunk-4yqmp43v.js";
|
|
99
|
-
import"../chunk-wdage1eb.js";
|
|
100
|
-
import"../chunk-5ntny1qx.js";
|
|
101
|
-
import"../chunk-nn0tekr1.js";
|
|
99
|
+
col2,
|
|
100
|
+
defineDataset2,
|
|
101
|
+
change2
|
|
102
|
+
} from "../chunk-860dwwy0.js";
|
|
103
|
+
import"../chunk-e1c18xjx.js";
|
|
104
|
+
import"../chunk-awbhdqyc.js";
|
|
105
|
+
import"../chunk-9vx5e9g1.js";
|
|
106
|
+
import"../chunk-dmn70ztd.js";
|
|
107
|
+
import"../chunk-emyyk7dx.js";
|
|
102
108
|
import {
|
|
103
|
-
|
|
104
|
-
} from "../chunk-
|
|
109
|
+
writeDataset2
|
|
110
|
+
} from "../chunk-mrp7k0pw.js";
|
|
111
|
+
import"../chunk-g6cke204.js";
|
|
112
|
+
import"../chunk-0y39rgsb.js";
|
|
113
|
+
import"../chunk-92vk7gta.js";
|
|
105
114
|
import {
|
|
106
|
-
|
|
107
|
-
} from "../chunk-
|
|
108
|
-
import"../chunk-5gd7tpv6.js";
|
|
109
|
-
import"../chunk-rafagrwr.js";
|
|
115
|
+
workflowAgentStepActorId2
|
|
116
|
+
} from "../chunk-m3z3x9v0.js";
|
|
110
117
|
import {
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
import"../chunk-ka3a2ft3.js";
|
|
115
|
-
import"../chunk-w1tvjszy.js";
|
|
118
|
+
BrokerError2,
|
|
119
|
+
InMemoryBroker2
|
|
120
|
+
} from "../chunk-0rdrecsb.js";
|
|
116
121
|
import {
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
import"../chunk-
|
|
121
|
-
import"../chunk-dbc80ad7.js";
|
|
122
|
-
import"../chunk-ry24jbr1.js";
|
|
123
|
-
import"../chunk-p2vqaxkc.js";
|
|
124
|
-
import"../chunk-trxxmgnf.js";
|
|
125
|
-
import"../chunk-zcnhxkvd.js";
|
|
122
|
+
QueueError2,
|
|
123
|
+
InMemoryQueues2
|
|
124
|
+
} from "../chunk-r29fxdhn.js";
|
|
125
|
+
import"../chunk-qhcpj9wc.js";
|
|
126
126
|
import {
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
import"../chunk-
|
|
131
|
-
import"../chunk-
|
|
132
|
-
import"../chunk-
|
|
133
|
-
import"../chunk-qw9gvjv5.js";
|
|
134
|
-
import"../chunk-yt8wphsx.js";
|
|
135
|
-
import"../chunk-5e3pq99w.js";
|
|
136
|
-
import"../chunk-7y0f6rf1.js";
|
|
137
|
-
import"../chunk-d8qkxt2v.js";
|
|
127
|
+
SandboxNotRunningError2
|
|
128
|
+
} from "../chunk-z3y411fq.js";
|
|
129
|
+
import"../chunk-xfbydgzy.js";
|
|
130
|
+
import"../chunk-xyr8kppc.js";
|
|
131
|
+
import"../chunk-7n30ybym.js";
|
|
132
|
+
import"../chunk-r4tfx1sf.js";
|
|
138
133
|
import {
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
import"../chunk-
|
|
134
|
+
createTestingScope
|
|
135
|
+
} from "../chunk-38zv5rkr.js";
|
|
136
|
+
import"../chunk-x9v4cx1d.js";
|
|
137
|
+
import"../chunk-1enhpacz.js";
|
|
138
|
+
import"../chunk-jjy0fhrn.js";
|
|
139
|
+
import"../chunk-h1gfhhbh.js";
|
|
143
140
|
import {
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
link,
|
|
147
|
-
prop,
|
|
148
|
-
stringEnum
|
|
149
|
-
} from "../chunk-2dw777qw.js";
|
|
150
|
-
import"../chunk-19jp6g9d.js";
|
|
151
|
-
import"../chunk-xwnf87e1.js";
|
|
141
|
+
LakeStorageError2
|
|
142
|
+
} from "../chunk-9qsh3p5y.js";
|
|
152
143
|
import {
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
} from "../chunk-p1x242ad.js";
|
|
144
|
+
ObjectQueryPlanningError2,
|
|
145
|
+
normalizeObjectQuery2
|
|
146
|
+
} from "../chunk-5hz0fnca.js";
|
|
157
147
|
import {
|
|
158
|
-
|
|
159
|
-
} from "../chunk-
|
|
160
|
-
import"../chunk-
|
|
161
|
-
import"../chunk-
|
|
162
|
-
import"../chunk-
|
|
148
|
+
restoreTrustedPrimitiveExecutionScope
|
|
149
|
+
} from "../chunk-17kfctj6.js";
|
|
150
|
+
import"../chunk-br3k6qbf.js";
|
|
151
|
+
import"../chunk-s3csryxe.js";
|
|
152
|
+
import"../chunk-653vwrzr.js";
|
|
153
|
+
import"../chunk-72w2pxk7.js";
|
|
154
|
+
import"../chunk-f0rwz2vh.js";
|
|
163
155
|
import {
|
|
164
|
-
|
|
165
|
-
} from "../chunk-
|
|
166
|
-
import"../chunk-2xns679x.js";
|
|
167
|
-
import"../chunk-n6jxh8sw.js";
|
|
168
|
-
import"../chunk-y64skrwp.js";
|
|
156
|
+
blobIdFromDigest2
|
|
157
|
+
} from "../chunk-h3v76ams.js";
|
|
169
158
|
|
|
170
159
|
// src/testing/action-execution.ts
|
|
171
160
|
async function createTestActionExecution(executions, input) {
|
|
@@ -183,6 +172,7 @@ async function createTestActionExecution(executions, input) {
|
|
|
183
172
|
if (!parent) {
|
|
184
173
|
await executions.create({
|
|
185
174
|
id: parentExecutionId,
|
|
175
|
+
requesterGroupIds: input.requesterGroupIds ?? [],
|
|
186
176
|
projectId: input.projectId,
|
|
187
177
|
executor: { type: "request", requestId: `test_request:${input.runId}` },
|
|
188
178
|
source: { type: "http", requestId: `test_request:${input.runId}` },
|
|
@@ -192,6 +182,7 @@ async function createTestActionExecution(executions, input) {
|
|
|
192
182
|
}
|
|
193
183
|
await executions.create({
|
|
194
184
|
id: executionId,
|
|
185
|
+
requesterGroupIds: input.requesterGroupIds ?? [],
|
|
195
186
|
projectId: input.projectId,
|
|
196
187
|
executor: { type: "primitive", kind: primitive.kind, runId: primitive.runId },
|
|
197
188
|
source: { type: "execution", executionId: parentExecutionId },
|
|
@@ -206,9 +197,11 @@ async function queueTestActionRun(storage, input) {
|
|
|
206
197
|
const executionId = await createTestActionExecution(storage.executions, {
|
|
207
198
|
projectId: input.projectId,
|
|
208
199
|
actionId: input.actionId,
|
|
209
|
-
runId: input.id
|
|
200
|
+
runId: input.id,
|
|
201
|
+
requesterGroupIds: input.requesterGroupIds
|
|
210
202
|
});
|
|
211
|
-
|
|
203
|
+
const { requesterGroupIds: _groups, ...run } = input;
|
|
204
|
+
return storage.actionRuns.queue({ ...run, executionId });
|
|
212
205
|
}
|
|
213
206
|
// src/testing/agent-execution.ts
|
|
214
207
|
async function createTestAgentExecution(storage, input) {
|
|
@@ -216,7 +209,7 @@ async function createTestAgentExecution(storage, input) {
|
|
|
216
209
|
if (authority === "managed" && input.actorId === undefined) {
|
|
217
210
|
throw new Error("Managed Agent execution fixtures require an agent id.");
|
|
218
211
|
}
|
|
219
|
-
const serviceAccountId = input.actorId ?
|
|
212
|
+
const serviceAccountId = input.actorId ? agentServiceAccountId2(input.actorId) : undefined;
|
|
220
213
|
if (authority === "managed") {
|
|
221
214
|
const auth = storage.auth;
|
|
222
215
|
if (!auth)
|
|
@@ -234,12 +227,12 @@ async function createTestAgentExecution(storage, input) {
|
|
|
234
227
|
name: `Test Agent ${input.actorId}`,
|
|
235
228
|
description: `Test service account for Agent '${input.actorId}'.`,
|
|
236
229
|
status: "active",
|
|
237
|
-
createdByPrincipal:
|
|
230
|
+
createdByPrincipal: SYSTEM_PRINCIPAL2,
|
|
238
231
|
createdAt: now,
|
|
239
232
|
updatedAt: now
|
|
240
233
|
});
|
|
241
234
|
} catch (error) {
|
|
242
|
-
if (!(error instanceof
|
|
235
|
+
if (!(error instanceof AuthStorageError2) || error.code !== "duplicate_service_account") {
|
|
243
236
|
throw error;
|
|
244
237
|
}
|
|
245
238
|
}
|
|
@@ -260,6 +253,7 @@ async function createTestAgentExecution(storage, input) {
|
|
|
260
253
|
if (!parent) {
|
|
261
254
|
parent = await storage.executions.create({
|
|
262
255
|
id: sourceExecutionId,
|
|
256
|
+
requesterGroupIds: input.requesterGroupIds ?? [],
|
|
263
257
|
projectId: input.projectId,
|
|
264
258
|
executor: { type: "request", requestId: `test_request:${input.runId}` },
|
|
265
259
|
source: { type: "http", requestId: `test_request:${input.runId}` },
|
|
@@ -269,6 +263,7 @@ async function createTestAgentExecution(storage, input) {
|
|
|
269
263
|
}
|
|
270
264
|
await storage.executions.create({
|
|
271
265
|
id: executionId,
|
|
266
|
+
requesterGroupIds: parent.requesterGroupIds,
|
|
272
267
|
projectId: input.projectId,
|
|
273
268
|
executor: { type: "agent", runId: input.runId },
|
|
274
269
|
source: { type: "execution", executionId: sourceExecutionId },
|
|
@@ -297,7 +292,7 @@ function at(value) {
|
|
|
297
292
|
return new Date(value);
|
|
298
293
|
}
|
|
299
294
|
async function expectAgentError(promise, code) {
|
|
300
|
-
await expect(promise).rejects.toBeInstanceOf(
|
|
295
|
+
await expect(promise).rejects.toBeInstanceOf(AgentStorageError2);
|
|
301
296
|
await expect(promise).rejects.toMatchObject({ code });
|
|
302
297
|
}
|
|
303
298
|
function threadInput(overrides = {}) {
|
|
@@ -320,7 +315,6 @@ function runInput(overrides = {}) {
|
|
|
320
315
|
triggerMessageId: "msg_user_1",
|
|
321
316
|
spec: { model: { provider: "test", modelId: "large" } },
|
|
322
317
|
executionId: "test_agent_execution:run_1",
|
|
323
|
-
requesterGroupIds: ["support", "engineering", "support"],
|
|
324
318
|
execution: execution("exec_1"),
|
|
325
319
|
createdAt: at("2026-06-23T10:00:10.000Z"),
|
|
326
320
|
...overrides
|
|
@@ -619,7 +613,6 @@ function runAgentStorageContractSuite(label, options) {
|
|
|
619
613
|
spawnKey: "research-orders",
|
|
620
614
|
status: "queued",
|
|
621
615
|
attempt: 0,
|
|
622
|
-
requesterGroupIds: ["engineering", "support"],
|
|
623
616
|
spec: input.spec
|
|
624
617
|
});
|
|
625
618
|
expect(child).not.toHaveProperty("threadId");
|
|
@@ -749,7 +742,6 @@ function runAgentStorageContractSuite(label, options) {
|
|
|
749
742
|
const run = await createAndStartRun(storage, fixture, runInput({ id: "run_1" }));
|
|
750
743
|
expect(run).toMatchObject({ status: "running", attempt: 1, threadId: "thr_1" });
|
|
751
744
|
expect(run.executionId).toBe("test_agent_execution:run_1");
|
|
752
|
-
expect(run.requesterGroupIds).toEqual(["engineering", "support"]);
|
|
753
745
|
expect(run.execution?.token).toBe("exec_1");
|
|
754
746
|
await expect(storage.threads.getById({ projectId, id: "thr_1" })).resolves.toMatchObject({
|
|
755
747
|
activeRunId: "run_1"
|
|
@@ -769,7 +761,7 @@ function runAgentStorageContractSuite(label, options) {
|
|
|
769
761
|
const rejected = results.filter((result) => result.status === "rejected");
|
|
770
762
|
expect(fulfilled).toHaveLength(1);
|
|
771
763
|
expect(rejected).toHaveLength(1);
|
|
772
|
-
expect(rejected[0].reason).toBeInstanceOf(
|
|
764
|
+
expect(rejected[0].reason).toBeInstanceOf(AgentStorageError2);
|
|
773
765
|
expect(rejected[0].reason.code).toBe("active_run_exists");
|
|
774
766
|
});
|
|
775
767
|
});
|
|
@@ -835,10 +827,8 @@ function runAgentStorageContractSuite(label, options) {
|
|
|
835
827
|
mutableExecution.token = "mutated";
|
|
836
828
|
mutableExecution.queueLeaseExpiresAt.setTime(0);
|
|
837
829
|
}
|
|
838
|
-
run.requesterGroupIds.push("mutated");
|
|
839
830
|
const reread = await storage.runs.getById({ projectId, id: "run_1" });
|
|
840
831
|
expect(reread?.execution?.token).toBe("exec_1");
|
|
841
|
-
expect(reread?.requesterGroupIds).toEqual(["engineering", "support"]);
|
|
842
832
|
});
|
|
843
833
|
});
|
|
844
834
|
test("releasing a run only clears its own thread's active pointer", async () => {
|
|
@@ -1023,7 +1013,7 @@ function runAgentStorageContractSuite(label, options) {
|
|
|
1023
1013
|
seq: 1,
|
|
1024
1014
|
role: "user",
|
|
1025
1015
|
runId: null,
|
|
1026
|
-
contentVersion:
|
|
1016
|
+
contentVersion: AGENT_MESSAGE_CONTENT_VERSION2
|
|
1027
1017
|
});
|
|
1028
1018
|
expect(userMessage.authorPrincipal).toEqual(owner);
|
|
1029
1019
|
const run = await createAndStartRun(storage, fixture, runInput({ id: "run_1" }));
|
|
@@ -1620,7 +1610,7 @@ function runAiCostStorageContractSuite(name, options) {
|
|
|
1620
1610
|
try {
|
|
1621
1611
|
const missing = ratedCost("missing");
|
|
1622
1612
|
const missingError = await storage.recordModelCallCost(missing).catch((value) => value);
|
|
1623
|
-
expect2(missingError).toBeInstanceOf(
|
|
1613
|
+
expect2(missingError).toBeInstanceOf(AiCostStorageError2);
|
|
1624
1614
|
expect2(missingError.code).toBe("missing_usage");
|
|
1625
1615
|
const base = ratedCost();
|
|
1626
1616
|
const mismatch = ratedCost("usage_1", {
|
|
@@ -1631,7 +1621,7 @@ function runAiCostStorageContractSuite(name, options) {
|
|
|
1631
1621
|
]
|
|
1632
1622
|
});
|
|
1633
1623
|
const mismatchError = await storage.recordModelCallCost(mismatch).catch((value) => value);
|
|
1634
|
-
expect2(mismatchError).toBeInstanceOf(
|
|
1624
|
+
expect2(mismatchError).toBeInstanceOf(AiCostStorageError2);
|
|
1635
1625
|
expect2(mismatchError.code).toBe("cost_mismatch");
|
|
1636
1626
|
await expect2(storage.recordModelCallCost({
|
|
1637
1627
|
...base,
|
|
@@ -1753,7 +1743,7 @@ function runAiLimitStorageContractSuite(label, options) {
|
|
|
1753
1743
|
};
|
|
1754
1744
|
describe3(label, () => {
|
|
1755
1745
|
test3("uses inclusive-start, exclusive-end UTC calendar months", () => {
|
|
1756
|
-
expect3(
|
|
1746
|
+
expect3(aiLimitCalendarMonth2(at2("2026-12-31T23:59:59.999-05:00"))).toEqual({
|
|
1757
1747
|
kind: "calendarMonth",
|
|
1758
1748
|
start: at2("2027-01-01T00:00:00.000Z"),
|
|
1759
1749
|
end: at2("2027-02-01T00:00:00.000Z"),
|
|
@@ -2283,12 +2273,12 @@ function runAiLimitStorageContractSuite(label, options) {
|
|
|
2283
2273
|
test3("derives each subject's actuals from immutable execution and usage attribution", async () => {
|
|
2284
2274
|
await withStorage(async (storage) => {
|
|
2285
2275
|
const engineering = { type: "group", id: "engineering" };
|
|
2286
|
-
const
|
|
2276
|
+
const serviceAccount = { type: "serviceAccount", id: "automation" };
|
|
2287
2277
|
await recordUsage(storage.aiUsage, "usage-all-subjects", "all-subjects", 7, {
|
|
2288
2278
|
requesterGroupIds: ["support", "engineering"]
|
|
2289
2279
|
});
|
|
2290
2280
|
const serviceExecutionId = "exec_ai_limit_service";
|
|
2291
|
-
await seedPrincipalExecution(storage.auth, storage.executions, serviceExecutionId,
|
|
2281
|
+
await seedPrincipalExecution(storage.auth, storage.executions, serviceExecutionId, serviceAccount);
|
|
2292
2282
|
await recordUsage(storage.aiUsage, "usage-service-account", "service-account", 3, {
|
|
2293
2283
|
executionId: serviceExecutionId,
|
|
2294
2284
|
requesterGroupIds: []
|
|
@@ -2298,7 +2288,7 @@ function runAiLimitStorageContractSuite(label, options) {
|
|
|
2298
2288
|
["support-subject", support],
|
|
2299
2289
|
["engineering-subject", engineering],
|
|
2300
2290
|
["user-subject", user],
|
|
2301
|
-
["service-account-subject",
|
|
2291
|
+
["service-account-subject", serviceAccount]
|
|
2302
2292
|
]) {
|
|
2303
2293
|
await storage.aiLimits.createPolicy({
|
|
2304
2294
|
id,
|
|
@@ -2672,7 +2662,7 @@ import { describe as describe4, expect as expect4, test as test4 } from "bun:tes
|
|
|
2672
2662
|
// src/testing/workflow-execution.ts
|
|
2673
2663
|
async function createTestWorkflowExecution(executions, input) {
|
|
2674
2664
|
const parentExecutionId = `test_request_execution:${input.runId}`;
|
|
2675
|
-
const
|
|
2665
|
+
const executionId = input.executionId ?? `test_workflow_execution:${input.runId}`;
|
|
2676
2666
|
const primitive = {
|
|
2677
2667
|
kind: "workflow",
|
|
2678
2668
|
id: input.workflowId,
|
|
@@ -2680,6 +2670,7 @@ async function createTestWorkflowExecution(executions, input) {
|
|
|
2680
2670
|
};
|
|
2681
2671
|
await executions.create({
|
|
2682
2672
|
id: parentExecutionId,
|
|
2673
|
+
requesterGroupIds: input.requesterGroupIds ?? [],
|
|
2683
2674
|
projectId: input.projectId,
|
|
2684
2675
|
executor: { type: "request", requestId: `test_request:${input.runId}` },
|
|
2685
2676
|
source: { type: "http", requestId: `test_request:${input.runId}` },
|
|
@@ -2688,7 +2679,8 @@ async function createTestWorkflowExecution(executions, input) {
|
|
|
2688
2679
|
authorizationRef: input.requestedBy === undefined ? { type: "disabled" } : { type: "principal", principal: structuredClone(input.requestedBy) }
|
|
2689
2680
|
});
|
|
2690
2681
|
await executions.create({
|
|
2691
|
-
id:
|
|
2682
|
+
id: executionId,
|
|
2683
|
+
requesterGroupIds: input.requesterGroupIds ?? [],
|
|
2692
2684
|
projectId: input.projectId,
|
|
2693
2685
|
executor: { type: "primitive", kind: primitive.kind, runId: primitive.runId },
|
|
2694
2686
|
source: { type: "execution", executionId: parentExecutionId },
|
|
@@ -2696,24 +2688,25 @@ async function createTestWorkflowExecution(executions, input) {
|
|
|
2696
2688
|
correlationId: `test_correlation:${input.runId}`,
|
|
2697
2689
|
authorizationRef: { type: "trustedPrimitive", primitive }
|
|
2698
2690
|
});
|
|
2699
|
-
return
|
|
2691
|
+
return executionId;
|
|
2700
2692
|
}
|
|
2701
2693
|
async function createTestAutomaticWorkflowExecution(executions, input) {
|
|
2702
|
-
const
|
|
2694
|
+
const executionId = input.executionId ?? `test_workflow_execution:${input.runId}`;
|
|
2703
2695
|
const primitive = {
|
|
2704
2696
|
kind: "workflow",
|
|
2705
2697
|
id: input.workflowId,
|
|
2706
2698
|
runId: input.runId
|
|
2707
2699
|
};
|
|
2708
2700
|
await executions.create({
|
|
2709
|
-
id:
|
|
2701
|
+
id: executionId,
|
|
2702
|
+
requesterGroupIds: [],
|
|
2710
2703
|
projectId: input.projectId,
|
|
2711
2704
|
executor: { type: "primitive", kind: primitive.kind, runId: primitive.runId },
|
|
2712
2705
|
source: input.source ?? { type: "event", eventId: `test_event:${input.runId}` },
|
|
2713
2706
|
correlationId: input.correlationId ?? `test_correlation:${input.runId}`,
|
|
2714
2707
|
authorizationRef: { type: "trustedPrimitive", primitive }
|
|
2715
2708
|
});
|
|
2716
|
-
return
|
|
2709
|
+
return executionId;
|
|
2717
2710
|
}
|
|
2718
2711
|
|
|
2719
2712
|
// src/testing/ai-model-call-groups-contract.ts
|
|
@@ -2725,6 +2718,71 @@ var range = {
|
|
|
2725
2718
|
};
|
|
2726
2719
|
function runAiModelCallGroupsContractSuite(name, options) {
|
|
2727
2720
|
describe4(name, () => {
|
|
2721
|
+
test4("attributes direct calls and retries to requests, actions, and workflows", async () => {
|
|
2722
|
+
const storage = await options.createStorage();
|
|
2723
|
+
try {
|
|
2724
|
+
await options.setup?.(storage);
|
|
2725
|
+
const expected = [
|
|
2726
|
+
{ kind: "request", requestId: "request" },
|
|
2727
|
+
{ kind: "action", actionId: "summarize", actionRunId: "action" },
|
|
2728
|
+
{ kind: "workflow", workflowId: "summarize", workflowRunId: "workflow" }
|
|
2729
|
+
];
|
|
2730
|
+
for (const attribution of expected) {
|
|
2731
|
+
const kind = attribution.kind;
|
|
2732
|
+
const primitive = {
|
|
2733
|
+
kind: kind === "action" ? "action" : "workflow",
|
|
2734
|
+
id: "summarize",
|
|
2735
|
+
runId: kind
|
|
2736
|
+
};
|
|
2737
|
+
const execution = await storage.executions.create({
|
|
2738
|
+
projectId: projectId4,
|
|
2739
|
+
id: kind,
|
|
2740
|
+
executor: kind === "request" ? { type: "request", requestId: kind } : { type: "primitive", kind, runId: kind },
|
|
2741
|
+
source: kind === "request" ? { type: "http", requestId: kind } : { type: "event", eventId: kind },
|
|
2742
|
+
correlationId: kind,
|
|
2743
|
+
authorizationRef: kind === "request" ? { type: "disabled" } : { type: "trustedPrimitive", primitive }
|
|
2744
|
+
});
|
|
2745
|
+
for (const attempt of [1, 2]) {
|
|
2746
|
+
await storage.aiUsage.recordModelCall({
|
|
2747
|
+
projectId: projectId4,
|
|
2748
|
+
id: `${kind}:${attempt}`,
|
|
2749
|
+
executionId: execution.id,
|
|
2750
|
+
attempt,
|
|
2751
|
+
callId: `${kind}:${attempt}`,
|
|
2752
|
+
requesterGroupIds: execution.requesterGroupIds,
|
|
2753
|
+
providerId: "test",
|
|
2754
|
+
requestedModelId: "small",
|
|
2755
|
+
responseId: `${kind}:${attempt}`,
|
|
2756
|
+
usage: { inputTokens: 2, outputTokens: 3 },
|
|
2757
|
+
occurredAt: new Date("2026-09-01T12:00:00Z")
|
|
2758
|
+
});
|
|
2759
|
+
}
|
|
2760
|
+
const calls = await storage.aiCosts.listModelCalls({
|
|
2761
|
+
...range,
|
|
2762
|
+
executionId: execution.id
|
|
2763
|
+
});
|
|
2764
|
+
expect4(calls.total).toBe(2);
|
|
2765
|
+
expect4(calls.items.map((call) => call.attribution)).toEqual([attribution, attribution]);
|
|
2766
|
+
}
|
|
2767
|
+
const groups = await storage.aiCosts.listModelCallGroups(range);
|
|
2768
|
+
expect4(groups.total).toBe(3);
|
|
2769
|
+
for (const attribution of expected) {
|
|
2770
|
+
const group = groups.items.find((item) => item.executionId === attribution.kind);
|
|
2771
|
+
expect4(group).toMatchObject({
|
|
2772
|
+
attribution,
|
|
2773
|
+
modelCallCount: 2,
|
|
2774
|
+
totalTokens: 10,
|
|
2775
|
+
executions: [{ attribution, modelCallCount: 2 }]
|
|
2776
|
+
});
|
|
2777
|
+
}
|
|
2778
|
+
const overview = await storage.aiCosts.queryProjectOverview({ ...range, bucket: "day" });
|
|
2779
|
+
expect4(overview.totals.modelCallCount).toBe(6);
|
|
2780
|
+
expect4(overview.agents).toEqual([]);
|
|
2781
|
+
expect4(overview.workflows).toMatchObject([{ workflowId: "summarize", modelCallCount: 2 }]);
|
|
2782
|
+
} finally {
|
|
2783
|
+
await options.cleanup?.(storage);
|
|
2784
|
+
}
|
|
2785
|
+
});
|
|
2728
2786
|
test4("attributes workflow usage to step references and keeps same-named steps separate", async () => {
|
|
2729
2787
|
const storage = await options.createStorage();
|
|
2730
2788
|
try {
|
|
@@ -2879,8 +2937,7 @@ async function seedWorkflowCall(storage, workflowId, runId) {
|
|
|
2879
2937
|
id: runId,
|
|
2880
2938
|
workflowId,
|
|
2881
2939
|
executionId: sourceExecutionId,
|
|
2882
|
-
input: {}
|
|
2883
|
-
requesterGroupIds: []
|
|
2940
|
+
input: {}
|
|
2884
2941
|
});
|
|
2885
2942
|
await storage.workflowRuns.start({ projectId: projectId4, id: runId });
|
|
2886
2943
|
const nodeRunId = `${runId}:node:0`;
|
|
@@ -2895,8 +2952,8 @@ async function seedWorkflowCall(storage, workflowId, runId) {
|
|
|
2895
2952
|
nodeKey: "review",
|
|
2896
2953
|
input: {}
|
|
2897
2954
|
});
|
|
2898
|
-
const actorId =
|
|
2899
|
-
const
|
|
2955
|
+
const actorId = workflowAgentStepActorId2(workflowId, "review");
|
|
2956
|
+
const executionId = await createTestAgentExecution(storage, {
|
|
2900
2957
|
projectId: projectId4,
|
|
2901
2958
|
runId: nodeRunId,
|
|
2902
2959
|
actorId,
|
|
@@ -2905,14 +2962,14 @@ async function seedWorkflowCall(storage, workflowId, runId) {
|
|
|
2905
2962
|
await storage.workflowRuns.agentNodes.create({
|
|
2906
2963
|
projectId: projectId4,
|
|
2907
2964
|
nodeRunId,
|
|
2908
|
-
executionId
|
|
2965
|
+
executionId,
|
|
2909
2966
|
actorId,
|
|
2910
2967
|
prompt: "Review the task."
|
|
2911
2968
|
});
|
|
2912
2969
|
const { record } = await storage.aiUsage.recordModelCall({
|
|
2913
2970
|
projectId: projectId4,
|
|
2914
2971
|
id: `usage:${runId}`,
|
|
2915
|
-
executionId
|
|
2972
|
+
executionId,
|
|
2916
2973
|
attempt: 1,
|
|
2917
2974
|
callId: runId,
|
|
2918
2975
|
requesterGroupIds: [],
|
|
@@ -2946,7 +3003,7 @@ async function seed(storage) {
|
|
|
2946
3003
|
ownerPrincipal: { type: "user", id: "user" }
|
|
2947
3004
|
});
|
|
2948
3005
|
for (const runId of ["parent", "second"]) {
|
|
2949
|
-
const
|
|
3006
|
+
const executionId = await createTestAgentExecution(storage, {
|
|
2950
3007
|
projectId: projectId4,
|
|
2951
3008
|
runId,
|
|
2952
3009
|
executionId: `exec_${runId}`,
|
|
@@ -2955,11 +3012,10 @@ async function seed(storage) {
|
|
|
2955
3012
|
await storage.agents.runs.create({
|
|
2956
3013
|
id: runId,
|
|
2957
3014
|
projectId: projectId4,
|
|
2958
|
-
executionId
|
|
3015
|
+
executionId,
|
|
2959
3016
|
threadId: "thread",
|
|
2960
3017
|
triggerMessageId: `message_${runId}`,
|
|
2961
|
-
spec: { model: { provider: "parent-provider", modelId: "large" } }
|
|
2962
|
-
requesterGroupIds: []
|
|
3018
|
+
spec: { model: { provider: "parent-provider", modelId: "large" } }
|
|
2963
3019
|
});
|
|
2964
3020
|
await storage.agents.runs.start({
|
|
2965
3021
|
id: runId,
|
|
@@ -2972,7 +3028,7 @@ async function seed(storage) {
|
|
|
2972
3028
|
actorId: "child",
|
|
2973
3029
|
runId: "child",
|
|
2974
3030
|
executionId: "exec_child",
|
|
2975
|
-
sourceExecutionId:
|
|
3031
|
+
sourceExecutionId: executionId,
|
|
2976
3032
|
authority: "inherited"
|
|
2977
3033
|
});
|
|
2978
3034
|
await storage.agents.runs.createSubagent({
|
|
@@ -3421,7 +3477,7 @@ function runAiUsageStorageContractSuite(label, options) {
|
|
|
3421
3477
|
await withStorage(async (storage) => {
|
|
3422
3478
|
await storage.recordModelCall(modelCallInput());
|
|
3423
3479
|
const error = storage.recordModelCall(modelCallInput({ callId: "call_2", responseId: "response_2" }));
|
|
3424
|
-
await expect5(error).rejects.toBeInstanceOf(
|
|
3480
|
+
await expect5(error).rejects.toBeInstanceOf(AiUsageStorageError2);
|
|
3425
3481
|
await expect5(error).rejects.toMatchObject({ code: "duplicate_id" });
|
|
3426
3482
|
await expect5(storage.summarizeExecution({ projectId: projectId5, executionId: agentExecutionId })).resolves.toMatchObject({
|
|
3427
3483
|
modelCallCount: 1,
|
|
@@ -3432,7 +3488,7 @@ function runAiUsageStorageContractSuite(label, options) {
|
|
|
3432
3488
|
test5("rejects a model call whose durable execution does not exist", async () => {
|
|
3433
3489
|
await withStorage(async (storage) => {
|
|
3434
3490
|
const error = storage.recordModelCall(modelCallInput({ id: "usage_missing", executionId: "exec_missing" }));
|
|
3435
|
-
await expect5(error).rejects.toBeInstanceOf(
|
|
3491
|
+
await expect5(error).rejects.toBeInstanceOf(AiUsageStorageError2);
|
|
3436
3492
|
await expect5(error).rejects.toMatchObject({ code: "missing_execution" });
|
|
3437
3493
|
});
|
|
3438
3494
|
});
|
|
@@ -3509,7 +3565,7 @@ function sessionInput(id, tokenHash = `${id}-hash`, audience = "atlas", absolute
|
|
|
3509
3565
|
};
|
|
3510
3566
|
}
|
|
3511
3567
|
async function expectAuthError(promise, code) {
|
|
3512
|
-
await expect6(promise).rejects.toBeInstanceOf(
|
|
3568
|
+
await expect6(promise).rejects.toBeInstanceOf(AuthStorageError2);
|
|
3513
3569
|
await expect6(promise).rejects.toMatchObject({ code });
|
|
3514
3570
|
}
|
|
3515
3571
|
async function createUser(storage, input = {}) {
|
|
@@ -3533,10 +3589,10 @@ function runAuthStorageContractSuite(label, options) {
|
|
|
3533
3589
|
describe6(label, () => {
|
|
3534
3590
|
test6("creates users with normalized email and isolates projects", async () => {
|
|
3535
3591
|
await withStorage(async (storage) => {
|
|
3536
|
-
const
|
|
3592
|
+
const user = await createUser(storage, {
|
|
3537
3593
|
email: " Ava@Acme.COM "
|
|
3538
3594
|
});
|
|
3539
|
-
expect6(
|
|
3595
|
+
expect6(user.email).toBe("ava@acme.com");
|
|
3540
3596
|
await expectAuthError(storage.users.create({
|
|
3541
3597
|
id: "usr_duplicate",
|
|
3542
3598
|
projectId: projectId6,
|
|
@@ -4036,14 +4092,14 @@ function runAuthStorageContractSuite(label, options) {
|
|
|
4036
4092
|
});
|
|
4037
4093
|
test6("manages service accounts and their group memberships", async () => {
|
|
4038
4094
|
await withStorage(async (storage) => {
|
|
4039
|
-
const
|
|
4095
|
+
const serviceAccount = await storage.serviceAccounts.create({
|
|
4040
4096
|
id: "svc_ingest",
|
|
4041
4097
|
projectId: projectId6,
|
|
4042
4098
|
name: "Ingest worker",
|
|
4043
4099
|
description: "Reads source data into Sixb.",
|
|
4044
4100
|
createdAt: at4("2026-05-14T10:00:00.000Z")
|
|
4045
4101
|
});
|
|
4046
|
-
expect6(
|
|
4102
|
+
expect6(serviceAccount).toMatchObject({
|
|
4047
4103
|
id: "svc_ingest",
|
|
4048
4104
|
name: "Ingest worker",
|
|
4049
4105
|
status: "active"
|
|
@@ -5220,7 +5276,7 @@ function runBlobStorageContractSuite(label, options) {
|
|
|
5220
5276
|
logicalPath: "reports/report.bin"
|
|
5221
5277
|
});
|
|
5222
5278
|
expect7(fileRef.sizeBytes).toBe(13);
|
|
5223
|
-
expect7(fileRef.blobId).toBe(
|
|
5279
|
+
expect7(fileRef.blobId).toBe(blobIdFromDigest2(fileRef.digest));
|
|
5224
5280
|
expect7(fileRef.fileName).toBe("report.bin");
|
|
5225
5281
|
expect7(fileRef.mediaType).toBe("application/octet-stream");
|
|
5226
5282
|
expect7(fileRef.logicalPath).toBe("reports/report.bin");
|
|
@@ -5230,7 +5286,7 @@ function runBlobStorageContractSuite(label, options) {
|
|
|
5230
5286
|
test7("rejects an expected size mismatch without publishing a blob", async () => {
|
|
5231
5287
|
await withStorage(async (storage) => {
|
|
5232
5288
|
const bytes = encoder.encode("wrong size");
|
|
5233
|
-
const blobId =
|
|
5289
|
+
const blobId = blobIdFromDigest2(computeBlobDigest2(bytes));
|
|
5234
5290
|
await expect7(storage.put({ body: bytes, expectedSizeBytes: bytes.byteLength + 1 })).rejects.toThrow(`Blob size mismatch: expected ${bytes.byteLength + 1} bytes, received ${bytes.byteLength}.`);
|
|
5235
5291
|
await expect7(storage.stat(blobId)).resolves.toBeNull();
|
|
5236
5292
|
});
|
|
@@ -5250,7 +5306,7 @@ function runBlobStorageContractSuite(label, options) {
|
|
|
5250
5306
|
const abort = new AbortController;
|
|
5251
5307
|
let bodyCancelled = false;
|
|
5252
5308
|
const firstChunk = encoder.encode("partial");
|
|
5253
|
-
const blobId =
|
|
5309
|
+
const blobId = blobIdFromDigest2(computeBlobDigest2(firstChunk));
|
|
5254
5310
|
const body = new ReadableStream({
|
|
5255
5311
|
start(controller) {
|
|
5256
5312
|
controller.enqueue(firstChunk);
|
|
@@ -5346,12 +5402,12 @@ function runBrokerContractSuite(label, options) {
|
|
|
5346
5402
|
projectId: " ",
|
|
5347
5403
|
stream: eventsStream,
|
|
5348
5404
|
records: [{ payload: { ok: true } }]
|
|
5349
|
-
})).rejects.toBeInstanceOf(
|
|
5405
|
+
})).rejects.toBeInstanceOf(BrokerError2);
|
|
5350
5406
|
await expect8(appendRecords(broker, {
|
|
5351
5407
|
projectId: "project-a",
|
|
5352
5408
|
stream: { id: " " },
|
|
5353
5409
|
records: [{ payload: { ok: true } }]
|
|
5354
|
-
})).rejects.toBeInstanceOf(
|
|
5410
|
+
})).rejects.toBeInstanceOf(BrokerError2);
|
|
5355
5411
|
});
|
|
5356
5412
|
});
|
|
5357
5413
|
test8("rejects payloads that are not JSON values", async () => {
|
|
@@ -5366,12 +5422,12 @@ function runBrokerContractSuite(label, options) {
|
|
|
5366
5422
|
}
|
|
5367
5423
|
}
|
|
5368
5424
|
]
|
|
5369
|
-
})).rejects.toBeInstanceOf(
|
|
5425
|
+
})).rejects.toBeInstanceOf(BrokerError2);
|
|
5370
5426
|
await expect8(appendRecords(broker, {
|
|
5371
5427
|
projectId: "project-a",
|
|
5372
5428
|
stream: eventsStream,
|
|
5373
5429
|
records: [{ payload: { value: Number.NaN } }]
|
|
5374
|
-
})).rejects.toBeInstanceOf(
|
|
5430
|
+
})).rejects.toBeInstanceOf(BrokerError2);
|
|
5375
5431
|
});
|
|
5376
5432
|
});
|
|
5377
5433
|
test8("requires streams to be ensured before appending records", async () => {
|
|
@@ -5380,7 +5436,7 @@ function runBrokerContractSuite(label, options) {
|
|
|
5380
5436
|
projectId: "project-a",
|
|
5381
5437
|
streamId: "missing",
|
|
5382
5438
|
records: [{ payload: "one" }]
|
|
5383
|
-
})).rejects.toBeInstanceOf(
|
|
5439
|
+
})).rejects.toBeInstanceOf(BrokerError2);
|
|
5384
5440
|
});
|
|
5385
5441
|
});
|
|
5386
5442
|
});
|
|
@@ -5594,7 +5650,7 @@ function runBrokerContractSuite(label, options) {
|
|
|
5594
5650
|
describe8("subscribe", () => {
|
|
5595
5651
|
test8("requires streams to be ensured before subscribing", async () => {
|
|
5596
5652
|
await withBroker(async (broker) => {
|
|
5597
|
-
await expect8(broker.subscribe({ projectId: "project-a", streamId: "missing" }, () => {})).rejects.toBeInstanceOf(
|
|
5653
|
+
await expect8(broker.subscribe({ projectId: "project-a", streamId: "missing" }, () => {})).rejects.toBeInstanceOf(BrokerError2);
|
|
5598
5654
|
});
|
|
5599
5655
|
});
|
|
5600
5656
|
test8("defaults to latest and receives only new records", async () => {
|
|
@@ -5746,9 +5802,9 @@ function runBrokerContractSuite(label, options) {
|
|
|
5746
5802
|
await broker.append({
|
|
5747
5803
|
projectId: "project-a",
|
|
5748
5804
|
streamId: stream.id,
|
|
5749
|
-
records: ["one", "two", "three"].map((
|
|
5750
|
-
name:
|
|
5751
|
-
payload: { label
|
|
5805
|
+
records: ["one", "two", "three"].map((label) => ({
|
|
5806
|
+
name: label,
|
|
5807
|
+
payload: { label, body: "x".repeat(600) }
|
|
5752
5808
|
}))
|
|
5753
5809
|
});
|
|
5754
5810
|
const records = await broker.read({
|
|
@@ -5790,19 +5846,19 @@ function runBrokerContractSuite(label, options) {
|
|
|
5790
5846
|
projectId: "project-a",
|
|
5791
5847
|
stream: retainedStream,
|
|
5792
5848
|
afterCursor: first?.cursor
|
|
5793
|
-
})).rejects.toBeInstanceOf(
|
|
5849
|
+
})).rejects.toBeInstanceOf(BrokerError2);
|
|
5794
5850
|
await expect8(broker.tail({
|
|
5795
5851
|
projectId: "project-a",
|
|
5796
5852
|
streamId: retainedStream.id,
|
|
5797
5853
|
beforeCursor: first?.cursor
|
|
5798
|
-
})).rejects.toBeInstanceOf(
|
|
5854
|
+
})).rejects.toBeInstanceOf(BrokerError2);
|
|
5799
5855
|
await expect8(broker.subscribe({
|
|
5800
5856
|
projectId: "project-a",
|
|
5801
5857
|
streamId: retainedStream.id,
|
|
5802
5858
|
afterCursor: first?.cursor
|
|
5803
5859
|
}, () => {
|
|
5804
5860
|
return;
|
|
5805
|
-
})).rejects.toBeInstanceOf(
|
|
5861
|
+
})).rejects.toBeInstanceOf(BrokerError2);
|
|
5806
5862
|
});
|
|
5807
5863
|
});
|
|
5808
5864
|
test8("retains only records within maxAgeMs", async () => {
|
|
@@ -6645,12 +6701,12 @@ import { describe as describe10, expect as expect10, test as test10 } from "bun:
|
|
|
6645
6701
|
|
|
6646
6702
|
// src/testing/materializer-fixture.ts
|
|
6647
6703
|
function createMaterializerTestFixture(input) {
|
|
6648
|
-
const projections = new
|
|
6704
|
+
const projections = new ProjectionRegistry2({
|
|
6649
6705
|
projections: [],
|
|
6650
6706
|
ontology: input.ontology,
|
|
6651
6707
|
datasetsById: new Map
|
|
6652
6708
|
});
|
|
6653
|
-
const materializer =
|
|
6709
|
+
const materializer = createOntologyMaterializer2({
|
|
6654
6710
|
projectId: input.projectId,
|
|
6655
6711
|
ontology: input.ontology,
|
|
6656
6712
|
projections,
|
|
@@ -6687,9 +6743,9 @@ function createMaterializerTestFixture(input) {
|
|
|
6687
6743
|
materializer,
|
|
6688
6744
|
commit,
|
|
6689
6745
|
appendTelemetry,
|
|
6690
|
-
async seed(
|
|
6746
|
+
async seed(seed) {
|
|
6691
6747
|
const operations = [];
|
|
6692
|
-
for (const object of
|
|
6748
|
+
for (const object of seed.objects ?? []) {
|
|
6693
6749
|
operations.push({
|
|
6694
6750
|
id: `seed-object:${operations.length}`,
|
|
6695
6751
|
kind: "object.upsert",
|
|
@@ -6697,18 +6753,18 @@ function createMaterializerTestFixture(input) {
|
|
|
6697
6753
|
properties: object.properties
|
|
6698
6754
|
});
|
|
6699
6755
|
}
|
|
6700
|
-
for (const
|
|
6756
|
+
for (const link of seed.links ?? []) {
|
|
6701
6757
|
operations.push({
|
|
6702
6758
|
id: `seed-link:${operations.length}`,
|
|
6703
6759
|
kind: "link.upsert",
|
|
6704
|
-
ref:
|
|
6705
|
-
...
|
|
6760
|
+
ref: link.ref,
|
|
6761
|
+
...link.properties === undefined ? {} : { properties: link.properties }
|
|
6706
6762
|
});
|
|
6707
6763
|
}
|
|
6708
6764
|
if (operations.length > 0)
|
|
6709
6765
|
await commit(operations);
|
|
6710
|
-
if (
|
|
6711
|
-
await appendTelemetry(
|
|
6766
|
+
if (seed.telemetry && seed.telemetry.length > 0) {
|
|
6767
|
+
await appendTelemetry(seed.telemetry);
|
|
6712
6768
|
}
|
|
6713
6769
|
}
|
|
6714
6770
|
};
|
|
@@ -6716,35 +6772,35 @@ function createMaterializerTestFixture(input) {
|
|
|
6716
6772
|
|
|
6717
6773
|
// src/testing/effective-storage-contract.ts
|
|
6718
6774
|
var projectId8 = "effective-storage-contract";
|
|
6719
|
-
var Device =
|
|
6775
|
+
var Device = defineObjectType2({
|
|
6720
6776
|
id: "EffectiveStorageDevice",
|
|
6721
6777
|
name: "Device",
|
|
6722
6778
|
properties: [
|
|
6723
|
-
|
|
6724
|
-
|
|
6725
|
-
|
|
6779
|
+
prop2("id", "string", { primary: true, required: true }),
|
|
6780
|
+
prop2("name", "string", { required: true }),
|
|
6781
|
+
prop2("temperature", "double", { mode: "telemetry" })
|
|
6726
6782
|
],
|
|
6727
|
-
links: [
|
|
6783
|
+
links: [link2.self("peers", { cardinality: "many" })]
|
|
6728
6784
|
});
|
|
6729
|
-
var OpaqueA =
|
|
6785
|
+
var OpaqueA = defineObjectType2({
|
|
6730
6786
|
id: "A",
|
|
6731
6787
|
name: "Opaque A",
|
|
6732
6788
|
properties: [
|
|
6733
|
-
|
|
6734
|
-
|
|
6789
|
+
prop2("id", "string", { primary: true, required: true }),
|
|
6790
|
+
prop2("name", "string", { required: true })
|
|
6735
6791
|
],
|
|
6736
|
-
links: [
|
|
6792
|
+
links: [link2.self("D", { cardinality: "many" })]
|
|
6737
6793
|
});
|
|
6738
|
-
var OpaqueAB =
|
|
6794
|
+
var OpaqueAB = defineObjectType2({
|
|
6739
6795
|
id: "A:B",
|
|
6740
6796
|
name: "Opaque AB",
|
|
6741
6797
|
properties: [
|
|
6742
|
-
|
|
6743
|
-
|
|
6798
|
+
prop2("id", "string", { primary: true, required: true }),
|
|
6799
|
+
prop2("name", "string", { required: true })
|
|
6744
6800
|
],
|
|
6745
|
-
links: [
|
|
6801
|
+
links: [link2.self("D", { cardinality: "many" })]
|
|
6746
6802
|
});
|
|
6747
|
-
var ontology = new
|
|
6803
|
+
var ontology = new OntologyRegistry2({ sources: [Device, OpaqueA, OpaqueAB] });
|
|
6748
6804
|
function runEffectiveStorageContractSuite(name, provider) {
|
|
6749
6805
|
const withStorage = async (body) => {
|
|
6750
6806
|
const storage = await provider.createStorage();
|
|
@@ -6775,7 +6831,7 @@ function runEffectiveStorageContractSuite(name, provider) {
|
|
|
6775
6831
|
{ objectTypeId: Device.id, primaryId: "missing" }
|
|
6776
6832
|
]
|
|
6777
6833
|
});
|
|
6778
|
-
expect10([...batch.keys()]).toEqual([
|
|
6834
|
+
expect10([...batch.keys()]).toEqual([objectBatchKey2(Device.id, "a")]);
|
|
6779
6835
|
const selectedProperties = await storage.objects.selectsObjectProperties({
|
|
6780
6836
|
projectId: projectId8,
|
|
6781
6837
|
items: [
|
|
@@ -6807,13 +6863,13 @@ function runEffectiveStorageContractSuite(name, provider) {
|
|
|
6807
6863
|
projectId: projectId8,
|
|
6808
6864
|
items: [{ objectTypeId: Device.id, objectId: "a", linkId: "peers" }]
|
|
6809
6865
|
});
|
|
6810
|
-
expect10(linksByScope.get(
|
|
6866
|
+
expect10(linksByScope.get(linkBatchKey2(Device.id, "a", "peers"))).toHaveLength(2);
|
|
6811
6867
|
const incomingByScope = await storage.objects.listLinksBatch({
|
|
6812
6868
|
projectId: projectId8,
|
|
6813
6869
|
direction: "incoming",
|
|
6814
6870
|
items: [{ objectTypeId: Device.id, objectId: "b", linkId: "peers" }]
|
|
6815
6871
|
});
|
|
6816
|
-
expect10(incomingByScope.get(
|
|
6872
|
+
expect10(incomingByScope.get(linkBatchKey2(Device.id, "b", "peers"))).toMatchObject([
|
|
6817
6873
|
{ sourceId: "a", targetId: "b" }
|
|
6818
6874
|
]);
|
|
6819
6875
|
const bothDirectionsByScope = await storage.objects.listLinksBatch({
|
|
@@ -6824,8 +6880,8 @@ function runEffectiveStorageContractSuite(name, provider) {
|
|
|
6824
6880
|
{ objectTypeId: Device.id, objectId: "b", linkId: "peers" }
|
|
6825
6881
|
]
|
|
6826
6882
|
});
|
|
6827
|
-
expect10(bothDirectionsByScope.get(
|
|
6828
|
-
expect10(bothDirectionsByScope.get(
|
|
6883
|
+
expect10(bothDirectionsByScope.get(linkBatchKey2(Device.id, "a", "peers"))).toHaveLength(2);
|
|
6884
|
+
expect10(bothDirectionsByScope.get(linkBatchKey2(Device.id, "b", "peers"))).toMatchObject([
|
|
6829
6885
|
{ sourceId: "a", targetId: "b" }
|
|
6830
6886
|
]);
|
|
6831
6887
|
});
|
|
@@ -6848,7 +6904,7 @@ function runEffectiveStorageContractSuite(name, provider) {
|
|
|
6848
6904
|
direction: "outgoing",
|
|
6849
6905
|
linkId: "peers",
|
|
6850
6906
|
endpointObjectTypeIds: [Device.id],
|
|
6851
|
-
after:
|
|
6907
|
+
after: objectLinkCursor2(first.links[0]),
|
|
6852
6908
|
limit: 1
|
|
6853
6909
|
});
|
|
6854
6910
|
expect10(second.links.map((row) => row.targetId)).toEqual(["c"]);
|
|
@@ -6937,8 +6993,8 @@ function runEffectiveStorageContractSuite(name, provider) {
|
|
|
6937
6993
|
{ objectTypeId: OpaqueAB.id, primaryId: "C" }
|
|
6938
6994
|
]
|
|
6939
6995
|
});
|
|
6940
|
-
expect10(objects.get(
|
|
6941
|
-
expect10(objects.get(
|
|
6996
|
+
expect10(objects.get(objectBatchKey2(OpaqueA.id, "B:C"))?.properties.name).toBe("First");
|
|
6997
|
+
expect10(objects.get(objectBatchKey2(OpaqueAB.id, "C"))?.properties.name).toBe("Second");
|
|
6942
6998
|
const links = await storage.objects.listLinksBatch({
|
|
6943
6999
|
projectId: opaqueProjectId,
|
|
6944
7000
|
direction: "both",
|
|
@@ -6947,8 +7003,8 @@ function runEffectiveStorageContractSuite(name, provider) {
|
|
|
6947
7003
|
{ objectTypeId: OpaqueAB.id, objectId: "C", linkId: "D" }
|
|
6948
7004
|
]
|
|
6949
7005
|
});
|
|
6950
|
-
expect10(links.get(
|
|
6951
|
-
expect10(links.get(
|
|
7006
|
+
expect10(links.get(linkBatchKey2(OpaqueA.id, "B:C", "D"))).toHaveLength(1);
|
|
7007
|
+
expect10(links.get(linkBatchKey2(OpaqueAB.id, "C", "D"))).toHaveLength(1);
|
|
6952
7008
|
});
|
|
6953
7009
|
});
|
|
6954
7010
|
test10("preserves distinct incident links when opaque ids contain delimiters", async () => {
|
|
@@ -7065,19 +7121,19 @@ function peer(sourceId, targetId) {
|
|
|
7065
7121
|
}
|
|
7066
7122
|
};
|
|
7067
7123
|
}
|
|
7068
|
-
function temperature(objectId, value,
|
|
7124
|
+
function temperature(objectId, value, at) {
|
|
7069
7125
|
return {
|
|
7070
7126
|
series: {
|
|
7071
7127
|
object: { objectTypeId: Device.id, primaryId: objectId },
|
|
7072
7128
|
propertyId: "temperature"
|
|
7073
7129
|
},
|
|
7074
7130
|
value,
|
|
7075
|
-
at
|
|
7131
|
+
at
|
|
7076
7132
|
};
|
|
7077
7133
|
}
|
|
7078
7134
|
// src/testing/execution.ts
|
|
7079
7135
|
function createTestSixb(hostOrOptions, options = {}) {
|
|
7080
|
-
const host = "withScope" in hostOrOptions ? hostOrOptions : new
|
|
7136
|
+
const host = "withScope" in hostOrOptions ? hostOrOptions : new SixbHost2(hostOrOptions);
|
|
7081
7137
|
const sixb = host.withScope(createTestingScope({
|
|
7082
7138
|
projectId: host.id,
|
|
7083
7139
|
...options.authorization === undefined ? {} : { context: options.authorization },
|
|
@@ -7088,6 +7144,10 @@ function createTestSixb(hostOrOptions, options = {}) {
|
|
|
7088
7144
|
if (!isBoundSixb(sixb)) {
|
|
7089
7145
|
throw new Error("[Sixb] Test host did not return an execution-bound Sixb SDK.");
|
|
7090
7146
|
}
|
|
7147
|
+
bindModelExecutionAttempt(sixb.models, {
|
|
7148
|
+
attempt: 1,
|
|
7149
|
+
signal: options.signal ?? new AbortController().signal
|
|
7150
|
+
});
|
|
7091
7151
|
return sixb;
|
|
7092
7152
|
}
|
|
7093
7153
|
// src/testing/execution-storage-contract.ts
|
|
@@ -7105,6 +7165,50 @@ function runExecutionStorageContractSuite(label, options) {
|
|
|
7105
7165
|
}
|
|
7106
7166
|
};
|
|
7107
7167
|
describe11(label, () => {
|
|
7168
|
+
test11("captures memberships once and inherits them independently of current authority", async () => {
|
|
7169
|
+
await withStorage(async (storage) => {
|
|
7170
|
+
await seedAuth(storage.auth);
|
|
7171
|
+
for (const groupId of ["support", "finance"]) {
|
|
7172
|
+
await storage.auth.groupMemberships.upsert({
|
|
7173
|
+
projectId: projectId9,
|
|
7174
|
+
userId: "user-one",
|
|
7175
|
+
groupId,
|
|
7176
|
+
source: "manual"
|
|
7177
|
+
});
|
|
7178
|
+
}
|
|
7179
|
+
const parent = await storage.executions.create({
|
|
7180
|
+
...principalRequest({ id: "parent" }),
|
|
7181
|
+
requesterGroupIds: undefined
|
|
7182
|
+
});
|
|
7183
|
+
expect11(parent.requesterGroupIds).toEqual(["finance", "support"]);
|
|
7184
|
+
await storage.auth.groupMemberships.remove({
|
|
7185
|
+
projectId: projectId9,
|
|
7186
|
+
userId: "user-one",
|
|
7187
|
+
groupId: "finance"
|
|
7188
|
+
});
|
|
7189
|
+
const childInput = trustedPrimitive("child", {
|
|
7190
|
+
source: { type: "execution", executionId: parent.id },
|
|
7191
|
+
correlationId: parent.correlationId
|
|
7192
|
+
});
|
|
7193
|
+
const child = await storage.executions.create({
|
|
7194
|
+
...childInput,
|
|
7195
|
+
requesterGroupIds: undefined
|
|
7196
|
+
});
|
|
7197
|
+
expect11(child.requesterGroupIds).toEqual(["finance", "support"]);
|
|
7198
|
+
child.requesterGroupIds.push("mutated");
|
|
7199
|
+
await expect11(storage.executions.getById({ projectId: projectId9, id: child.id })).resolves.toMatchObject({ requesterGroupIds: ["finance", "support"] });
|
|
7200
|
+
await expect11(storage.executions.create({
|
|
7201
|
+
...childInput,
|
|
7202
|
+
id: "wrong-groups",
|
|
7203
|
+
requesterGroupIds: ["support"]
|
|
7204
|
+
})).rejects.toMatchObject({ code: "invalid_parent_execution" });
|
|
7205
|
+
const next = await storage.executions.create({
|
|
7206
|
+
...principalRequest({ id: "next" }),
|
|
7207
|
+
requesterGroupIds: undefined
|
|
7208
|
+
});
|
|
7209
|
+
expect11(next.requesterGroupIds).toEqual(["support"]);
|
|
7210
|
+
});
|
|
7211
|
+
});
|
|
7108
7212
|
test11("round-trips every durable executor and authority shape", async () => {
|
|
7109
7213
|
await withStorage(async (storage) => {
|
|
7110
7214
|
await seedAuth(storage.auth);
|
|
@@ -7129,7 +7233,10 @@ function runExecutionStorageContractSuite(label, options) {
|
|
|
7129
7233
|
const creationStartedAt = new Date;
|
|
7130
7234
|
const created = await storage.executions.create(input);
|
|
7131
7235
|
const { createdAt: persistedAt, ...persistedInput } = created;
|
|
7132
|
-
expect11(persistedInput).toEqual(
|
|
7236
|
+
expect11(persistedInput).toEqual({
|
|
7237
|
+
...input,
|
|
7238
|
+
requesterGroupIds: input.requesterGroupIds ?? []
|
|
7239
|
+
});
|
|
7133
7240
|
expect11(Number.isFinite(persistedAt.getTime())).toBe(true);
|
|
7134
7241
|
expect11(persistedAt.getTime()).toBeGreaterThanOrEqual(creationStartedAt.getTime());
|
|
7135
7242
|
expect11(await storage.executions.getById({ projectId: input.projectId, id: input.id })).toEqual(created);
|
|
@@ -7399,6 +7506,7 @@ function principalRequest(input) {
|
|
|
7399
7506
|
id: input.id,
|
|
7400
7507
|
projectId: projectId9,
|
|
7401
7508
|
requestedBy: principal,
|
|
7509
|
+
requesterGroupIds: [],
|
|
7402
7510
|
executor: { type: "request", requestId: `request-${input.id}` },
|
|
7403
7511
|
source: { type: "http", requestId: `request-${input.id}` },
|
|
7404
7512
|
correlationId: input.id === "parent" ? "correlation-parent" : `correlation-${input.id}`,
|
|
@@ -7413,6 +7521,7 @@ function disabledRequest(id, inputProjectId = projectId9) {
|
|
|
7413
7521
|
return {
|
|
7414
7522
|
id,
|
|
7415
7523
|
projectId: inputProjectId,
|
|
7524
|
+
requesterGroupIds: [],
|
|
7416
7525
|
executor: { type: "request", requestId: `request-${id}` },
|
|
7417
7526
|
source: { type: "http", requestId: `request-${id}` },
|
|
7418
7527
|
correlationId: `correlation-${id}`,
|
|
@@ -7442,6 +7551,7 @@ function trustedPrimitive(id, overrides = {}, kind = "action") {
|
|
|
7442
7551
|
id,
|
|
7443
7552
|
projectId: projectId9,
|
|
7444
7553
|
requestedBy: { type: "user", id: "user-one" },
|
|
7554
|
+
requesterGroupIds: [],
|
|
7445
7555
|
executor: { type: "primitive", kind, runId },
|
|
7446
7556
|
source: trustedPrimitiveSource(kind, id),
|
|
7447
7557
|
correlationId: `correlation-${id}`,
|
|
@@ -7482,6 +7592,7 @@ function agentExecution(id) {
|
|
|
7482
7592
|
id,
|
|
7483
7593
|
projectId: projectId9,
|
|
7484
7594
|
requestedBy: { type: "user", id: "user-one" },
|
|
7595
|
+
requesterGroupIds: [],
|
|
7485
7596
|
executor: { type: "agent", runId: `run-${id}` },
|
|
7486
7597
|
source: { type: "execution", executionId: "principal-request" },
|
|
7487
7598
|
correlationId: "correlation-principal-request",
|
|
@@ -7497,6 +7608,7 @@ function kernelExecution(id) {
|
|
|
7497
7608
|
id,
|
|
7498
7609
|
projectId: projectId9,
|
|
7499
7610
|
executor: { type: "kernel", operation },
|
|
7611
|
+
requesterGroupIds: [],
|
|
7500
7612
|
source: { type: "event", eventId: `event-${id}` },
|
|
7501
7613
|
correlationId: `correlation-${id}`,
|
|
7502
7614
|
authorizationRef: { type: "kernel", operation }
|
|
@@ -7507,17 +7619,17 @@ import { describe as describe13, expect as expect13, test as test13 } from "bun:
|
|
|
7507
7619
|
|
|
7508
7620
|
// src/testing/dataset-sequence-contract.ts
|
|
7509
7621
|
import { describe as describe12, expect as expect12, test as test12 } from "bun:test";
|
|
7510
|
-
var dataset =
|
|
7622
|
+
var dataset = defineDataset2("contract.source_order", {
|
|
7511
7623
|
schema: [
|
|
7512
|
-
|
|
7513
|
-
|
|
7514
|
-
|
|
7515
|
-
|
|
7624
|
+
col2("id", "string"),
|
|
7625
|
+
col2("revision", "int64"),
|
|
7626
|
+
col2("name", "string"),
|
|
7627
|
+
col2("details", "json", { nullable: true })
|
|
7516
7628
|
],
|
|
7517
7629
|
primaryKey: "id",
|
|
7518
7630
|
sequenceBy: "revision"
|
|
7519
7631
|
});
|
|
7520
|
-
var upsert = (revision, name = "Sam", id = "42") =>
|
|
7632
|
+
var upsert = (revision, name = "Sam", id = "42") => change2.upsert({ id, revision, name });
|
|
7521
7633
|
async function merge(storage, changes, definition = dataset) {
|
|
7522
7634
|
const session = await storage.beginMerge({ dataset: definition });
|
|
7523
7635
|
try {
|
|
@@ -7547,9 +7659,9 @@ function runDatasetSequenceContract(options) {
|
|
|
7547
7659
|
describe12("source ordering", () => {
|
|
7548
7660
|
test12("initializes empty snapshots and preserves versions across retries and reopen", async () => {
|
|
7549
7661
|
let storage = await options.createStorage();
|
|
7550
|
-
const snapshot = () =>
|
|
7662
|
+
const snapshot = () => writeDataset2({
|
|
7551
7663
|
lakeStorage: storage,
|
|
7552
|
-
blobStorage: new
|
|
7664
|
+
blobStorage: new InMemoryBlobStorage2,
|
|
7553
7665
|
dataset,
|
|
7554
7666
|
mode: "snapshot",
|
|
7555
7667
|
signal: new AbortController().signal,
|
|
@@ -7571,15 +7683,15 @@ function runDatasetSequenceContract(options) {
|
|
|
7571
7683
|
storage = await options.reopen(storage);
|
|
7572
7684
|
expect12(await storage.getLatestVersion(dataset.id)).toEqual(initial.version);
|
|
7573
7685
|
expect12(await snapshot()).toMatchObject({ outcome: "unchanged", version: initial.version });
|
|
7574
|
-
const concurrent =
|
|
7686
|
+
const concurrent = defineDataset2("contract.empty_race", {
|
|
7575
7687
|
schema: dataset.schema.columns,
|
|
7576
7688
|
primaryKey: "id",
|
|
7577
7689
|
sequenceBy: "revision"
|
|
7578
7690
|
});
|
|
7579
7691
|
let committed;
|
|
7580
|
-
const rebased = await
|
|
7692
|
+
const rebased = await writeDataset2({
|
|
7581
7693
|
lakeStorage: storage,
|
|
7582
|
-
blobStorage: new
|
|
7694
|
+
blobStorage: new InMemoryBlobStorage2,
|
|
7583
7695
|
dataset: concurrent,
|
|
7584
7696
|
mode: "snapshot",
|
|
7585
7697
|
signal: new AbortController().signal,
|
|
@@ -7595,25 +7707,25 @@ function runDatasetSequenceContract(options) {
|
|
|
7595
7707
|
}
|
|
7596
7708
|
});
|
|
7597
7709
|
test12("rejects lossy timestamps outside the ordering column before changing source state", () => withStorage(async (storage) => {
|
|
7598
|
-
const timestamps =
|
|
7599
|
-
schema: [...dataset.schema.columns,
|
|
7710
|
+
const timestamps = defineDataset2("contract.content_timestamps", {
|
|
7711
|
+
schema: [...dataset.schema.columns, col2("at", "timestamp", { nullable: true })],
|
|
7600
7712
|
primaryKey: "id",
|
|
7601
7713
|
sequenceBy: "revision"
|
|
7602
7714
|
});
|
|
7603
7715
|
await storage.createDataset(timestamps);
|
|
7604
|
-
const row = (
|
|
7716
|
+
const row = (at, id = "42") => change2.upsert({ id, revision: 1, name: "Sam", at });
|
|
7605
7717
|
const initial = await merge(storage, [row("2026-09-09T10:00:00.123Z")], timestamps);
|
|
7606
|
-
for (const
|
|
7718
|
+
for (const at of [
|
|
7607
7719
|
"2026-09-09T10:00:00.123001Z",
|
|
7608
7720
|
"2026-09-09T10:00:00.123999Z",
|
|
7609
7721
|
"2026-09-09T10:00:00",
|
|
7610
7722
|
"2026-02-30T00:00:00Z"
|
|
7611
7723
|
]) {
|
|
7612
|
-
await expect12(merge(storage, [row(
|
|
7724
|
+
await expect12(merge(storage, [row(at, "new")], timestamps)).rejects.toThrow("column 'at'");
|
|
7613
7725
|
expect12(await storage.getLatestVersion(timestamps.id)).toEqual(initial.version);
|
|
7614
7726
|
}
|
|
7615
|
-
for (const
|
|
7616
|
-
expect12((await merge(storage, [row(
|
|
7727
|
+
for (const at of ["2026-09-09T12:00:00.123+02:00", new Date("2026-09-09T10:00:00.123Z")]) {
|
|
7728
|
+
expect12((await merge(storage, [row(at)], timestamps)).outcome).toBe("unchanged");
|
|
7617
7729
|
}
|
|
7618
7730
|
await expect12(merge(storage, [row("2026-09-09T10:00:00.124Z")], timestamps)).rejects.toThrow("conflicting content");
|
|
7619
7731
|
await merge(storage, [row(null, "nullable")], timestamps);
|
|
@@ -7621,17 +7733,17 @@ function runDatasetSequenceContract(options) {
|
|
|
7621
7733
|
}));
|
|
7622
7734
|
test12("ingests through the bound SDK and preserves execution provenance", async () => {
|
|
7623
7735
|
let storage = await options.createStorage();
|
|
7624
|
-
const broker = new
|
|
7736
|
+
const broker = new InMemoryBroker2;
|
|
7625
7737
|
try {
|
|
7626
|
-
const host = new
|
|
7738
|
+
const host = new SixbHost2({
|
|
7627
7739
|
id: "ingest-contract",
|
|
7628
7740
|
ontology: [],
|
|
7629
7741
|
datasets: [dataset],
|
|
7630
7742
|
lakeStorage: storage,
|
|
7631
7743
|
broker,
|
|
7632
|
-
storage: new
|
|
7633
|
-
queues: new
|
|
7634
|
-
blobStorage: new
|
|
7744
|
+
storage: new InMemoryStorage2,
|
|
7745
|
+
queues: new InMemoryQueues2,
|
|
7746
|
+
blobStorage: new InMemoryBlobStorage2
|
|
7635
7747
|
});
|
|
7636
7748
|
const sixb = createTestSixb(host);
|
|
7637
7749
|
const result = await sixb.datasets.ingest(dataset, { changes: [upsert(8)] });
|
|
@@ -7663,11 +7775,11 @@ function runDatasetSequenceContract(options) {
|
|
|
7663
7775
|
expectedLatestVersionId: (await storage.getLatestVersion(dataset.id))?.versionId
|
|
7664
7776
|
});
|
|
7665
7777
|
await guarded.writeChanges([upsert(10)]);
|
|
7666
|
-
await merge(storage, [
|
|
7778
|
+
await merge(storage, [change2.delete({ id: "42" }, { sequence: 9 })]);
|
|
7667
7779
|
await expect12(guarded.commit({ retryOnConflict: true })).rejects.toThrow("Optimistic");
|
|
7668
7780
|
await guarded.abort();
|
|
7669
7781
|
const staleDelete = await storage.beginMerge({ dataset });
|
|
7670
|
-
await staleDelete.writeChanges([
|
|
7782
|
+
await staleDelete.writeChanges([change2.delete({ id: "42" }, { sequence: 9 })]);
|
|
7671
7783
|
await merge(storage, [upsert(10)]);
|
|
7672
7784
|
expect12((await staleDelete.commit({ retryOnConflict: true })).outcome).toBe("unchanged");
|
|
7673
7785
|
expect12((await storage.getLatestVersion(dataset.id))?.versionId).not.toBe(initial.version?.versionId);
|
|
@@ -7690,29 +7802,29 @@ function runDatasetSequenceContract(options) {
|
|
|
7690
7802
|
test12("retains absent-key deletions and protects their version boundary", () => withStorage(async (storage) => {
|
|
7691
7803
|
const staleSession = await storage.beginMerge({ dataset });
|
|
7692
7804
|
await staleSession.writeChanges([upsert(8)]);
|
|
7693
|
-
const deleted = await merge(storage, [
|
|
7805
|
+
const deleted = await merge(storage, [change2.delete({ id: "42" }, { sequence: 9 })]);
|
|
7694
7806
|
expect12(deleted).toMatchObject({ outcome: "created", version: { rowCount: 0 } });
|
|
7695
7807
|
await expect12(staleSession.commit()).rejects.toThrow("Optimistic");
|
|
7696
7808
|
await staleSession.abort();
|
|
7697
7809
|
expect12((await merge(storage, [upsert(8)])).outcome).toBe("unchanged");
|
|
7698
|
-
expect12((await merge(storage, [
|
|
7810
|
+
expect12((await merge(storage, [change2.delete({ id: "42" }, { sequence: "9" })])).outcome).toBe("unchanged");
|
|
7699
7811
|
await expect12(merge(storage, [upsert(9)])).rejects.toThrow("conflicting content");
|
|
7700
7812
|
await merge(storage, [upsert(10)]);
|
|
7701
7813
|
expect12(await rows(storage)).toHaveLength(1);
|
|
7702
|
-
expect12((await merge(storage, [
|
|
7703
|
-
await merge(storage, [
|
|
7814
|
+
expect12((await merge(storage, [change2.delete({ id: "42" }, { sequence: 9 })])).outcome).toBe("unchanged");
|
|
7815
|
+
await merge(storage, [change2.delete({ id: "42" }, { sequence: 11 })]);
|
|
7704
7816
|
expect12(await rows(storage)).toEqual([]);
|
|
7705
7817
|
}));
|
|
7706
7818
|
test12("compares canonical content across JSON order and nullable representations", () => withStorage(async (storage) => {
|
|
7707
7819
|
await merge(storage, [
|
|
7708
|
-
|
|
7820
|
+
change2.upsert({ id: "42", revision: 1, name: "Sam", details: { a: 1, b: 2 } })
|
|
7709
7821
|
]);
|
|
7710
7822
|
expect12((await merge(storage, [
|
|
7711
|
-
|
|
7823
|
+
change2.upsert({ id: "42", revision: "01", name: "Sam", details: { b: 2, a: 1 } })
|
|
7712
7824
|
])).outcome).toBe("unchanged");
|
|
7713
7825
|
await merge(storage, [upsert(2)]);
|
|
7714
7826
|
expect12((await merge(storage, [
|
|
7715
|
-
|
|
7827
|
+
change2.upsert({ id: "42", revision: "2", name: "Sam", details: null })
|
|
7716
7828
|
])).outcome).toBe("unchanged");
|
|
7717
7829
|
}));
|
|
7718
7830
|
test12("validates integer ranges and delete sequences at the provider boundary", () => withStorage(async (storage) => {
|
|
@@ -7725,20 +7837,20 @@ function runDatasetSequenceContract(options) {
|
|
|
7725
7837
|
"-9223372036854775809",
|
|
7726
7838
|
"1e3"
|
|
7727
7839
|
]) {
|
|
7728
|
-
await expect12(merge(storage, [
|
|
7840
|
+
await expect12(merge(storage, [change2.upsert({ id: "42", revision, name: "Sam" })])).rejects.toThrow("sequence");
|
|
7729
7841
|
}
|
|
7730
|
-
await expect12(merge(storage, [
|
|
7842
|
+
await expect12(merge(storage, [change2.delete({ id: "42" })])).rejects.toThrow("sequence");
|
|
7731
7843
|
await merge(storage, [upsert("-9223372036854775808"), upsert("9223372036854775807")]);
|
|
7732
7844
|
expect12((await rows(storage))[0]?.revision?.toString()).toBe("9223372036854775807");
|
|
7733
7845
|
}));
|
|
7734
7846
|
test12("normalizes timezone-aware timestamps without discarding precision", () => withStorage(async (storage) => {
|
|
7735
|
-
const timestamps =
|
|
7736
|
-
schema: [
|
|
7847
|
+
const timestamps = defineDataset2("contract.source_timestamps", {
|
|
7848
|
+
schema: [col2("id", "string"), col2("updated", "timestamp"), col2("name", "string")],
|
|
7737
7849
|
primaryKey: "id",
|
|
7738
7850
|
sequenceBy: "updated"
|
|
7739
7851
|
});
|
|
7740
7852
|
await storage.createDataset(timestamps);
|
|
7741
|
-
const row = (updated, name = "Sam") =>
|
|
7853
|
+
const row = (updated, name = "Sam") => change2.upsert({ id: "42", updated, name });
|
|
7742
7854
|
await merge(storage, [row("2026-09-09T10:00:00.123Z")], timestamps);
|
|
7743
7855
|
for (const updated of [
|
|
7744
7856
|
"2026-09-09T12:00:00.123+02:00",
|
|
@@ -7754,7 +7866,7 @@ function runDatasetSequenceContract(options) {
|
|
|
7754
7866
|
]) {
|
|
7755
7867
|
await expect12(merge(storage, [row(updated)], timestamps)).rejects.toThrow("sequence");
|
|
7756
7868
|
}
|
|
7757
|
-
await merge(storage, [
|
|
7869
|
+
await merge(storage, [change2.delete({ id: "42" }, { sequence: "2026-09-09T10:00:00.124Z" })], timestamps);
|
|
7758
7870
|
expect12((await merge(storage, [row("2026-09-09T10:00:00.123Z")], timestamps)).outcome).toBe("unchanged");
|
|
7759
7871
|
}));
|
|
7760
7872
|
test12("round-trips immutable sequencing and rejects writes that bypass ordering", () => withStorage(async (storage) => {
|
|
@@ -7776,7 +7888,7 @@ function runDatasetSequenceContract(options) {
|
|
|
7776
7888
|
await storage.createDataset(dataset);
|
|
7777
7889
|
await merge(storage, [
|
|
7778
7890
|
upsert(8, "visible", "visible"),
|
|
7779
|
-
|
|
7891
|
+
change2.delete({ id: "42" }, { sequence: 9 })
|
|
7780
7892
|
]);
|
|
7781
7893
|
storage = await reopen(storage);
|
|
7782
7894
|
expect12((await storage.getDataset(dataset.id))?.sequenceBy).toBe("revision");
|
|
@@ -7792,16 +7904,16 @@ function runDatasetSequenceContract(options) {
|
|
|
7792
7904
|
}
|
|
7793
7905
|
|
|
7794
7906
|
// src/testing/lake-merge-storage-contract.ts
|
|
7795
|
-
var invoices =
|
|
7796
|
-
schema: [
|
|
7907
|
+
var invoices = defineDataset2("contract.merges.invoices", {
|
|
7908
|
+
schema: [col2("id", "string"), col2("status", "string"), col2("note", "string", { nullable: true })],
|
|
7797
7909
|
primaryKey: "id"
|
|
7798
7910
|
});
|
|
7799
|
-
var lineItems =
|
|
7800
|
-
schema: [
|
|
7911
|
+
var lineItems = defineDataset2("contract.merges.line_items", {
|
|
7912
|
+
schema: [col2("invoiceId", "string"), col2("lineItemId", "string"), col2("description", "string")],
|
|
7801
7913
|
primaryKey: ["invoiceId", "lineItemId"]
|
|
7802
7914
|
});
|
|
7803
|
-
var unkeyed =
|
|
7804
|
-
schema: [
|
|
7915
|
+
var unkeyed = defineDataset2("contract.merges.unkeyed", {
|
|
7916
|
+
schema: [col2("id", "string")]
|
|
7805
7917
|
});
|
|
7806
7918
|
function runLakeMergeStorageContractSuite(label, options) {
|
|
7807
7919
|
const withStorage = async (body) => {
|
|
@@ -7817,17 +7929,17 @@ function runLakeMergeStorageContractSuite(label, options) {
|
|
|
7817
7929
|
test13("creates an initial merge version from async changes", async () => {
|
|
7818
7930
|
await withStorage(async (storage) => {
|
|
7819
7931
|
await storage.createDataset(invoices);
|
|
7820
|
-
const
|
|
7932
|
+
const merge = await storage.beginMerge({
|
|
7821
7933
|
dataset: invoices,
|
|
7822
7934
|
producer: { kind: "sync", id: "sync-invoices", runId: "run_1" },
|
|
7823
7935
|
inputs: [{ datasetId: "source.events", versionId: "cursor_1" }]
|
|
7824
7936
|
});
|
|
7825
7937
|
async function* changes() {
|
|
7826
|
-
yield
|
|
7827
|
-
yield
|
|
7938
|
+
yield change2.upsert({ id: "inv_1", status: "open", note: null });
|
|
7939
|
+
yield change2.upsert({ id: "inv_2", status: "paid", note: "settled" });
|
|
7828
7940
|
}
|
|
7829
|
-
await
|
|
7830
|
-
const result = await
|
|
7941
|
+
await merge.writeChanges(changes());
|
|
7942
|
+
const result = await merge.commit({ commitMessage: "initial invoice changes" });
|
|
7831
7943
|
const version = expectCreated(result);
|
|
7832
7944
|
expect13(version).toMatchObject({
|
|
7833
7945
|
datasetId: invoices.id,
|
|
@@ -7846,19 +7958,19 @@ function runLakeMergeStorageContractSuite(label, options) {
|
|
|
7846
7958
|
test13("inserts, updates, and deletes while preserving the parent version", async () => {
|
|
7847
7959
|
await withStorage(async (storage) => {
|
|
7848
7960
|
await storage.createDataset(invoices);
|
|
7849
|
-
const
|
|
7850
|
-
await
|
|
7961
|
+
const seed = await storage.beginWrite({ dataset: invoices, mode: "snapshot" });
|
|
7962
|
+
await seed.writeRows([
|
|
7851
7963
|
{ id: "inv_1", status: "open", note: null },
|
|
7852
7964
|
{ id: "inv_2", status: "open", note: null }
|
|
7853
7965
|
]);
|
|
7854
|
-
const parent = await
|
|
7855
|
-
const
|
|
7856
|
-
await
|
|
7857
|
-
|
|
7858
|
-
|
|
7859
|
-
|
|
7966
|
+
const parent = await seed.commit();
|
|
7967
|
+
const merge = await storage.beginMerge({ dataset: invoices });
|
|
7968
|
+
await merge.writeChanges([
|
|
7969
|
+
change2.upsert({ id: "inv_1", status: "paid", note: null }),
|
|
7970
|
+
change2.delete({ id: "inv_2" }),
|
|
7971
|
+
change2.upsert({ id: "inv_2_moved", status: "open", note: "moved" })
|
|
7860
7972
|
]);
|
|
7861
|
-
const version = expectCreated(await
|
|
7973
|
+
const version = expectCreated(await merge.commit());
|
|
7862
7974
|
expect13(version.parentVersionId).toBe(parent.versionId);
|
|
7863
7975
|
expect13(version.mode).toBe("merge");
|
|
7864
7976
|
await expect13(collectRows(storage.readRows({ datasetId: invoices.id }))).resolves.toEqual([
|
|
@@ -7874,16 +7986,16 @@ function runLakeMergeStorageContractSuite(label, options) {
|
|
|
7874
7986
|
test13("applies the final change for repeated single and composite keys", async () => {
|
|
7875
7987
|
await withStorage(async (storage) => {
|
|
7876
7988
|
await storage.createDataset(lineItems);
|
|
7877
|
-
const
|
|
7878
|
-
await
|
|
7879
|
-
|
|
7880
|
-
|
|
7989
|
+
const merge = await storage.beginMerge({ dataset: lineItems });
|
|
7990
|
+
await merge.writeChanges([
|
|
7991
|
+
change2.upsert({ invoiceId: "a|b", lineItemId: "c", description: "first" }),
|
|
7992
|
+
change2.upsert({ invoiceId: "a", lineItemId: "b|c", description: "other key" })
|
|
7881
7993
|
]);
|
|
7882
|
-
await
|
|
7883
|
-
|
|
7884
|
-
|
|
7994
|
+
await merge.writeChanges([
|
|
7995
|
+
change2.delete({ invoiceId: "a|b", lineItemId: "c" }),
|
|
7996
|
+
change2.upsert({ invoiceId: "a|b", lineItemId: "c", description: "final" })
|
|
7885
7997
|
]);
|
|
7886
|
-
expectCreated(await
|
|
7998
|
+
expectCreated(await merge.commit());
|
|
7887
7999
|
await expect13(collectRows(storage.readRows({ datasetId: lineItems.id }))).resolves.toEqual([
|
|
7888
8000
|
{ invoiceId: "a|b", lineItemId: "c", description: "final" },
|
|
7889
8001
|
{ invoiceId: "a", lineItemId: "b|c", description: "other key" }
|
|
@@ -7896,23 +8008,23 @@ function runLakeMergeStorageContractSuite(label, options) {
|
|
|
7896
8008
|
const empty = await storage.beginMerge({ dataset: invoices });
|
|
7897
8009
|
expect13(await empty.commit()).toEqual({ outcome: "unchanged", version: null });
|
|
7898
8010
|
const initialNoOp = await storage.beginMerge({ dataset: invoices });
|
|
7899
|
-
await initialNoOp.writeChanges([
|
|
8011
|
+
await initialNoOp.writeChanges([change2.delete({ id: "missing" })]);
|
|
7900
8012
|
expect13(await initialNoOp.commit()).toEqual({ outcome: "unchanged", version: null });
|
|
7901
8013
|
expect13(await storage.listVersions(invoices.id)).toEqual([]);
|
|
7902
|
-
const
|
|
7903
|
-
await
|
|
7904
|
-
const seedVersion = expectCreated(await
|
|
8014
|
+
const seed = await storage.beginMerge({ dataset: invoices });
|
|
8015
|
+
await seed.writeChanges([change2.upsert({ id: "inv_1", status: "open", note: null })]);
|
|
8016
|
+
const seedVersion = expectCreated(await seed.commit());
|
|
7905
8017
|
const identical = await storage.beginMerge({ dataset: invoices });
|
|
7906
|
-
await identical.writeChanges([
|
|
8018
|
+
await identical.writeChanges([change2.upsert({ id: "inv_1", status: "open", note: null })]);
|
|
7907
8019
|
expect13(await identical.commit()).toMatchObject({
|
|
7908
8020
|
outcome: "unchanged",
|
|
7909
8021
|
version: { versionId: seedVersion.versionId }
|
|
7910
8022
|
});
|
|
7911
8023
|
const laterNoOp = await storage.beginMerge({ dataset: invoices });
|
|
7912
8024
|
await laterNoOp.writeChanges([
|
|
7913
|
-
|
|
7914
|
-
|
|
7915
|
-
|
|
8025
|
+
change2.upsert({ id: "inv_1", status: "paid", note: null }),
|
|
8026
|
+
change2.upsert({ id: "inv_1", status: "open" }),
|
|
8027
|
+
change2.delete({ id: "missing" })
|
|
7916
8028
|
]);
|
|
7917
8029
|
const noOpResult = await laterNoOp.commit();
|
|
7918
8030
|
expect13(noOpResult).toMatchObject({ outcome: "unchanged" });
|
|
@@ -7925,9 +8037,9 @@ function runLakeMergeStorageContractSuite(label, options) {
|
|
|
7925
8037
|
await storage.createDataset(invoices);
|
|
7926
8038
|
const first = await storage.beginMerge({ dataset: invoices });
|
|
7927
8039
|
const stale = await storage.beginMerge({ dataset: invoices });
|
|
7928
|
-
await first.writeChanges([
|
|
8040
|
+
await first.writeChanges([change2.upsert({ id: "inv_1", status: "open", note: null })]);
|
|
7929
8041
|
await first.commit();
|
|
7930
|
-
await stale.writeChanges([
|
|
8042
|
+
await stale.writeChanges([change2.upsert({ id: "inv_2", status: "open" })]);
|
|
7931
8043
|
await expect13(stale.commit()).rejects.toThrow("Optimistic merge commit failed");
|
|
7932
8044
|
await expect13(collectRows(storage.readRows({ datasetId: invoices.id }))).resolves.toEqual([
|
|
7933
8045
|
{ id: "inv_1", status: "open", note: null }
|
|
@@ -7937,9 +8049,9 @@ function runLakeMergeStorageContractSuite(label, options) {
|
|
|
7937
8049
|
test13("checks an explicit latest-version guard against the captured merge base", async () => {
|
|
7938
8050
|
await withStorage(async (storage) => {
|
|
7939
8051
|
await storage.createDataset(invoices);
|
|
7940
|
-
const
|
|
7941
|
-
await
|
|
7942
|
-
const version = expectCreated(await
|
|
8052
|
+
const seed = await storage.beginMerge({ dataset: invoices });
|
|
8053
|
+
await seed.writeChanges([change2.upsert({ id: "inv_1", status: "open" })]);
|
|
8054
|
+
const version = expectCreated(await seed.commit());
|
|
7943
8055
|
await expect13(storage.beginMerge({ dataset: invoices, expectedLatestVersionId: "stale-version" })).rejects.toThrow("Optimistic merge start failed");
|
|
7944
8056
|
const guarded = await storage.beginMerge({
|
|
7945
8057
|
dataset: invoices,
|
|
@@ -7953,8 +8065,8 @@ function runLakeMergeStorageContractSuite(label, options) {
|
|
|
7953
8065
|
await storage.createDataset(invoices);
|
|
7954
8066
|
const left = await storage.beginMerge({ dataset: invoices });
|
|
7955
8067
|
const right = await storage.beginMerge({ dataset: invoices });
|
|
7956
|
-
await left.writeChanges([
|
|
7957
|
-
await right.writeChanges([
|
|
8068
|
+
await left.writeChanges([change2.upsert({ id: "inv_left", status: "open" })]);
|
|
8069
|
+
await right.writeChanges([change2.upsert({ id: "inv_right", status: "open" })]);
|
|
7958
8070
|
const results = await Promise.allSettled([left.commit(), right.commit()]);
|
|
7959
8071
|
expect13(results.filter((result) => result.status === "fulfilled")).toHaveLength(1);
|
|
7960
8072
|
expect13(results.filter((result) => result.status === "rejected")).toHaveLength(1);
|
|
@@ -7967,11 +8079,11 @@ function runLakeMergeStorageContractSuite(label, options) {
|
|
|
7967
8079
|
await storage.createDataset(unkeyed);
|
|
7968
8080
|
await expect13(storage.beginMerge({ dataset: unkeyed })).rejects.toThrow("must define a primaryKey");
|
|
7969
8081
|
await storage.createDataset(invoices);
|
|
7970
|
-
const
|
|
7971
|
-
await expect13(
|
|
7972
|
-
await expect13(
|
|
7973
|
-
await expect13(
|
|
7974
|
-
await
|
|
8082
|
+
const merge = await storage.beginMerge({ dataset: invoices });
|
|
8083
|
+
await expect13(merge.writeChanges([change2.upsert({ id: "inv_1" })])).rejects.toThrow("missing required column 'status'");
|
|
8084
|
+
await expect13(merge.writeChanges([change2.delete({})])).rejects.toThrow("missing primary-key column 'id'");
|
|
8085
|
+
await expect13(merge.writeChanges([{ kind: "delete", key: { id: "inv_1", extra: "x" } }])).rejects.toThrow("unknown column 'extra'");
|
|
8086
|
+
await merge.abort();
|
|
7975
8087
|
});
|
|
7976
8088
|
});
|
|
7977
8089
|
test13("enforces unique keys for snapshot and append baselines", async () => {
|
|
@@ -7983,9 +8095,9 @@ function runLakeMergeStorageContractSuite(label, options) {
|
|
|
7983
8095
|
{ id: "inv_1", status: "paid" }
|
|
7984
8096
|
])).rejects.toThrow("duplicate primary key");
|
|
7985
8097
|
await duplicateSnapshot.abort();
|
|
7986
|
-
const
|
|
7987
|
-
await
|
|
7988
|
-
await
|
|
8098
|
+
const seed = await storage.beginWrite({ dataset: invoices, mode: "snapshot" });
|
|
8099
|
+
await seed.writeRows([{ id: "inv_1", status: "open" }]);
|
|
8100
|
+
await seed.commit();
|
|
7989
8101
|
const conflictingAppend = await storage.beginWrite({ dataset: invoices, mode: "append" });
|
|
7990
8102
|
await conflictingAppend.writeRows([{ id: "inv_1", status: "paid" }]);
|
|
7991
8103
|
await expect13(conflictingAppend.commit()).rejects.toThrow("duplicate primary key");
|
|
@@ -7995,17 +8107,17 @@ function runLakeMergeStorageContractSuite(label, options) {
|
|
|
7995
8107
|
await withStorage(async (storage) => {
|
|
7996
8108
|
await storage.createDataset(invoices);
|
|
7997
8109
|
const row = { id: "inv_1", status: "open", note: null };
|
|
7998
|
-
const
|
|
7999
|
-
await
|
|
8110
|
+
const merge = await storage.beginMerge({ dataset: invoices });
|
|
8111
|
+
await merge.writeChanges([change2.upsert(row)]);
|
|
8000
8112
|
row.status = "paid";
|
|
8001
|
-
expectCreated(await
|
|
8002
|
-
await
|
|
8003
|
-
await expect13(
|
|
8113
|
+
expectCreated(await merge.commit());
|
|
8114
|
+
await merge.abort();
|
|
8115
|
+
await expect13(merge.writeChanges([])).rejects.toThrow("already closed");
|
|
8004
8116
|
await expect13(collectRows(storage.readRows({ datasetId: invoices.id }))).resolves.toEqual([
|
|
8005
8117
|
{ id: "inv_1", status: "open", note: null }
|
|
8006
8118
|
]);
|
|
8007
8119
|
const aborted = await storage.beginMerge({ dataset: invoices });
|
|
8008
|
-
await aborted.writeChanges([
|
|
8120
|
+
await aborted.writeChanges([change2.delete({ id: "inv_1" })]);
|
|
8009
8121
|
await aborted.abort();
|
|
8010
8122
|
await aborted.abort();
|
|
8011
8123
|
expect13(await storage.listVersions(invoices.id)).toHaveLength(1);
|
|
@@ -8020,39 +8132,39 @@ function expectCreated(result) {
|
|
|
8020
8132
|
}
|
|
8021
8133
|
return result.version;
|
|
8022
8134
|
}
|
|
8023
|
-
async function collectRows(
|
|
8135
|
+
async function collectRows(rows) {
|
|
8024
8136
|
const result = [];
|
|
8025
|
-
for await (const row of
|
|
8137
|
+
for await (const row of rows) {
|
|
8026
8138
|
result.push(row);
|
|
8027
8139
|
}
|
|
8028
8140
|
return result;
|
|
8029
8141
|
}
|
|
8030
8142
|
// src/testing/lake-storage-contract.ts
|
|
8031
8143
|
import { describe as describe14, expect as expect14, test as test14 } from "bun:test";
|
|
8032
|
-
var definitionDataset =
|
|
8033
|
-
schema: [
|
|
8144
|
+
var definitionDataset = defineDataset2("contract.definitions.orders", {
|
|
8145
|
+
schema: [col2("orderId", "string"), col2("customerName", "string")],
|
|
8034
8146
|
description: "Contract orders"
|
|
8035
8147
|
});
|
|
8036
|
-
var reorderedDefinitionDataset =
|
|
8037
|
-
schema: [
|
|
8148
|
+
var reorderedDefinitionDataset = defineDataset2("contract.definitions.orders", {
|
|
8149
|
+
schema: [col2("customerName", "string"), col2("orderId", "string")],
|
|
8038
8150
|
description: "Contract orders"
|
|
8039
8151
|
});
|
|
8040
|
-
var keyedDefinitionDataset =
|
|
8041
|
-
schema: [
|
|
8152
|
+
var keyedDefinitionDataset = defineDataset2("contract.definitions.keyed_orders", {
|
|
8153
|
+
schema: [col2("tenantId", "string"), col2("orderId", "string"), col2("customerName", "string")],
|
|
8042
8154
|
primaryKey: ["tenantId", "orderId"],
|
|
8043
8155
|
description: "Contract keyed orders"
|
|
8044
8156
|
});
|
|
8045
|
-
var
|
|
8046
|
-
schema: [
|
|
8157
|
+
var writeDataset = defineDataset2("contract.writes.orders", {
|
|
8158
|
+
schema: [col2("orderId", "string"), col2("customerName", "string")]
|
|
8047
8159
|
});
|
|
8048
|
-
var nullableWriteDataset =
|
|
8049
|
-
schema: [
|
|
8160
|
+
var nullableWriteDataset = defineDataset2("contract.writes.nullable_orders", {
|
|
8161
|
+
schema: [col2("orderId", "string"), col2("note", "string", { nullable: true })]
|
|
8050
8162
|
});
|
|
8051
|
-
var decimalWriteDataset =
|
|
8052
|
-
schema: [
|
|
8163
|
+
var decimalWriteDataset = defineDataset2("contract.writes.decimals", {
|
|
8164
|
+
schema: [col2("id", "string"), col2("amount", "decimal", { nullable: true })]
|
|
8053
8165
|
});
|
|
8054
|
-
var fileRefDataset =
|
|
8055
|
-
schema: [
|
|
8166
|
+
var fileRefDataset = defineDataset2("contract.files.documents", {
|
|
8167
|
+
schema: [col2("id", "string"), col2("attachment", "fileRef", { nullable: true })]
|
|
8056
8168
|
});
|
|
8057
8169
|
var invoiceRef = {
|
|
8058
8170
|
blobId: `blob_${"a".repeat(64)}`,
|
|
@@ -8110,11 +8222,11 @@ function runLakeStorageContractSuite(label, options) {
|
|
|
8110
8222
|
});
|
|
8111
8223
|
test14("persists compatible metadata additions", async () => {
|
|
8112
8224
|
await withStorage(async (storage) => {
|
|
8113
|
-
const minimalDataset =
|
|
8114
|
-
schema: [
|
|
8225
|
+
const minimalDataset = defineDataset2("contract.definitions.metadata", {
|
|
8226
|
+
schema: [col2("orderId", "string"), col2("orderDate", "date")]
|
|
8115
8227
|
});
|
|
8116
|
-
const documentedDataset =
|
|
8117
|
-
schema: [
|
|
8228
|
+
const documentedDataset = defineDataset2("contract.definitions.metadata", {
|
|
8229
|
+
schema: [col2("orderId", "string"), col2("orderDate", "date")],
|
|
8118
8230
|
partitionBy: ["orderDate"],
|
|
8119
8231
|
description: "Contract metadata"
|
|
8120
8232
|
});
|
|
@@ -8127,26 +8239,26 @@ function runLakeStorageContractSuite(label, options) {
|
|
|
8127
8239
|
});
|
|
8128
8240
|
test14("rejects incompatible definition changes without mutating the stored definition", async () => {
|
|
8129
8241
|
await withStorage(async (storage) => {
|
|
8130
|
-
const changedDataset =
|
|
8131
|
-
schema: [
|
|
8242
|
+
const changedDataset = defineDataset2(definitionDataset.id, {
|
|
8243
|
+
schema: [col2("orderId", "int64"), col2("customerName", "string")],
|
|
8132
8244
|
description: "Contract orders"
|
|
8133
8245
|
});
|
|
8134
8246
|
await storage.createDataset(definitionDataset);
|
|
8135
8247
|
await expect14(storage.assertDatasetDefinitionsCompatible([changedDataset])).rejects.toThrow("changing column 'orderId' type");
|
|
8136
|
-
await expect14(storage.createDataset(changedDataset)).rejects.toBeInstanceOf(
|
|
8248
|
+
await expect14(storage.createDataset(changedDataset)).rejects.toBeInstanceOf(LakeStorageError2);
|
|
8137
8249
|
expect14(await storage.getDataset(definitionDataset.id)).toEqual(definitionDataset);
|
|
8138
8250
|
});
|
|
8139
8251
|
});
|
|
8140
8252
|
test14("checks provider schema evolution policy", async () => {
|
|
8141
8253
|
await withStorage(async (storage) => {
|
|
8142
|
-
const initialDataset =
|
|
8143
|
-
schema: [
|
|
8254
|
+
const initialDataset = defineDataset2("contract.definitions.schema_evolution", {
|
|
8255
|
+
schema: [col2("invoiceId", "string")]
|
|
8144
8256
|
});
|
|
8145
|
-
const requestedDataset =
|
|
8146
|
-
schema: [
|
|
8257
|
+
const requestedDataset = defineDataset2("contract.definitions.schema_evolution", {
|
|
8258
|
+
schema: [col2("currency", "string", { nullable: true }), col2("invoiceId", "string")]
|
|
8147
8259
|
});
|
|
8148
|
-
const storedDataset =
|
|
8149
|
-
schema: [
|
|
8260
|
+
const storedDataset = defineDataset2("contract.definitions.schema_evolution", {
|
|
8261
|
+
schema: [col2("invoiceId", "string"), col2("currency", "string", { nullable: true })]
|
|
8150
8262
|
});
|
|
8151
8263
|
await storage.createDataset(initialDataset);
|
|
8152
8264
|
if (schemaEvolution === "strict") {
|
|
@@ -8179,8 +8291,8 @@ function runLakeStorageContractSuite(label, options) {
|
|
|
8179
8291
|
describe14("catalog state", () => {
|
|
8180
8292
|
test14("reports materialized state and latest version summaries in bulk", async () => {
|
|
8181
8293
|
await withStorage(async (storage) => {
|
|
8182
|
-
await storage.createDataset(
|
|
8183
|
-
const write = await storage.beginWrite({ dataset:
|
|
8294
|
+
await storage.createDataset(writeDataset);
|
|
8295
|
+
const write = await storage.beginWrite({ dataset: writeDataset, mode: "snapshot" });
|
|
8184
8296
|
await write.writeRows([
|
|
8185
8297
|
{ orderId: "ord_1", customerName: "Ada" },
|
|
8186
8298
|
{ orderId: "ord_2", customerName: "Grace" }
|
|
@@ -8190,17 +8302,17 @@ function runLakeStorageContractSuite(label, options) {
|
|
|
8190
8302
|
const version = commit;
|
|
8191
8303
|
await storage.createDataset(definitionDataset);
|
|
8192
8304
|
const state = await storage.listDatasetCatalogState([
|
|
8193
|
-
|
|
8305
|
+
writeDataset.id,
|
|
8194
8306
|
definitionDataset.id,
|
|
8195
8307
|
"contract.missing.dataset"
|
|
8196
8308
|
]);
|
|
8197
8309
|
const byId = new Map(state.map((entry) => [entry.datasetId, entry]));
|
|
8198
|
-
expect14(byId.get(
|
|
8199
|
-
datasetId:
|
|
8310
|
+
expect14(byId.get(writeDataset.id)).toMatchObject({
|
|
8311
|
+
datasetId: writeDataset.id,
|
|
8200
8312
|
materialized: true
|
|
8201
8313
|
});
|
|
8202
|
-
expect14(byId.get(
|
|
8203
|
-
datasetId:
|
|
8314
|
+
expect14(byId.get(writeDataset.id)?.latestVersion).toMatchObject({
|
|
8315
|
+
datasetId: writeDataset.id,
|
|
8204
8316
|
versionId: version.versionId,
|
|
8205
8317
|
mode: "snapshot",
|
|
8206
8318
|
rowCount: 2
|
|
@@ -8226,8 +8338,8 @@ function runLakeStorageContractSuite(label, options) {
|
|
|
8226
8338
|
describe14("writes and reads", () => {
|
|
8227
8339
|
test14("keeps immutable-version row order and offsets stable", async () => {
|
|
8228
8340
|
await withStorage(async (storage) => {
|
|
8229
|
-
await storage.createDataset(
|
|
8230
|
-
const write = await storage.beginWrite({ dataset:
|
|
8341
|
+
await storage.createDataset(writeDataset);
|
|
8342
|
+
const write = await storage.beginWrite({ dataset: writeDataset, mode: "snapshot" });
|
|
8231
8343
|
const expected = [
|
|
8232
8344
|
{ orderId: "ord_3", customerName: "Katherine" },
|
|
8233
8345
|
{ orderId: "ord_1", customerName: "Ada" },
|
|
@@ -8237,7 +8349,7 @@ function runLakeStorageContractSuite(label, options) {
|
|
|
8237
8349
|
];
|
|
8238
8350
|
await write.writeRows(expected);
|
|
8239
8351
|
const version = await write.commit();
|
|
8240
|
-
const pinned = { datasetId:
|
|
8352
|
+
const pinned = { datasetId: writeDataset.id, versionId: version.versionId };
|
|
8241
8353
|
await expect14(collectRows2(storage.readRows(pinned))).resolves.toEqual(expected);
|
|
8242
8354
|
await expect14(collectRows2(storage.readRows(pinned))).resolves.toEqual(expected);
|
|
8243
8355
|
for (const offset of [0, 2, expected.length, expected.length + 3]) {
|
|
@@ -8248,14 +8360,14 @@ function runLakeStorageContractSuite(label, options) {
|
|
|
8248
8360
|
});
|
|
8249
8361
|
test14("rejects writes for unknown datasets", async () => {
|
|
8250
8362
|
await withStorage(async (storage) => {
|
|
8251
|
-
await expect14(storage.beginWrite({ dataset:
|
|
8363
|
+
await expect14(storage.beginWrite({ dataset: writeDataset })).rejects.toThrow("Unknown dataset");
|
|
8252
8364
|
});
|
|
8253
8365
|
});
|
|
8254
8366
|
test14("commits snapshot and append versions with versioned reads", async () => {
|
|
8255
8367
|
await withStorage(async (storage) => {
|
|
8256
|
-
await storage.createDataset(
|
|
8368
|
+
await storage.createDataset(writeDataset);
|
|
8257
8369
|
const snapshotWrite = await storage.beginWrite({
|
|
8258
|
-
dataset:
|
|
8370
|
+
dataset: writeDataset,
|
|
8259
8371
|
mode: "snapshot",
|
|
8260
8372
|
producer: { kind: "sync", id: "contract-sync", runId: "run_1" }
|
|
8261
8373
|
});
|
|
@@ -8267,27 +8379,27 @@ function runLakeStorageContractSuite(label, options) {
|
|
|
8267
8379
|
expect14(snapshotCommit.outcome).toBe("created");
|
|
8268
8380
|
const version1 = snapshotCommit;
|
|
8269
8381
|
expect14(version1).toMatchObject({
|
|
8270
|
-
datasetId:
|
|
8382
|
+
datasetId: writeDataset.id,
|
|
8271
8383
|
mode: "snapshot",
|
|
8272
|
-
schema:
|
|
8384
|
+
schema: writeDataset.schema,
|
|
8273
8385
|
producer: { kind: "sync", id: "contract-sync", runId: "run_1" },
|
|
8274
8386
|
rowCount: 2
|
|
8275
8387
|
});
|
|
8276
8388
|
expect14(version1.parentVersionId).toBeUndefined();
|
|
8277
|
-
expect14(await storage.getLatestVersion(
|
|
8389
|
+
expect14(await storage.getLatestVersion(writeDataset.id)).toMatchObject({
|
|
8278
8390
|
versionId: version1.versionId
|
|
8279
8391
|
});
|
|
8280
|
-
expect14(await storage.getVersion(
|
|
8281
|
-
datasetId:
|
|
8392
|
+
expect14(await storage.getVersion(writeDataset.id, version1.versionId)).toMatchObject({
|
|
8393
|
+
datasetId: writeDataset.id,
|
|
8282
8394
|
versionId: version1.versionId,
|
|
8283
8395
|
mode: "snapshot",
|
|
8284
8396
|
rowCount: 2
|
|
8285
8397
|
});
|
|
8286
8398
|
await Bun.sleep(2);
|
|
8287
8399
|
const appendWrite = await storage.beginWrite({
|
|
8288
|
-
dataset:
|
|
8400
|
+
dataset: writeDataset,
|
|
8289
8401
|
mode: "append",
|
|
8290
|
-
inputs: [{ datasetId:
|
|
8402
|
+
inputs: [{ datasetId: writeDataset.id, versionId: version1.versionId }]
|
|
8291
8403
|
});
|
|
8292
8404
|
await appendWrite.writeRows([{ orderId: "ord_3", customerName: "Katherine" }]);
|
|
8293
8405
|
const appendCommit = await appendWrite.commit({
|
|
@@ -8296,144 +8408,144 @@ function runLakeStorageContractSuite(label, options) {
|
|
|
8296
8408
|
expect14(appendCommit.outcome).toBe("created");
|
|
8297
8409
|
const version2 = appendCommit;
|
|
8298
8410
|
expect14(version2).toMatchObject({
|
|
8299
|
-
datasetId:
|
|
8411
|
+
datasetId: writeDataset.id,
|
|
8300
8412
|
parentVersionId: version1.versionId,
|
|
8301
8413
|
mode: "append",
|
|
8302
|
-
schema:
|
|
8303
|
-
inputs: [{ datasetId:
|
|
8414
|
+
schema: writeDataset.schema,
|
|
8415
|
+
inputs: [{ datasetId: writeDataset.id, versionId: version1.versionId }],
|
|
8304
8416
|
rowCount: 3
|
|
8305
8417
|
});
|
|
8306
|
-
expect14(await storage.getLatestVersion(
|
|
8418
|
+
expect14(await storage.getLatestVersion(writeDataset.id)).toMatchObject({
|
|
8307
8419
|
versionId: version2.versionId
|
|
8308
8420
|
});
|
|
8309
|
-
await expect14(collectRows2(storage.readRows({ datasetId:
|
|
8421
|
+
await expect14(collectRows2(storage.readRows({ datasetId: writeDataset.id }))).resolves.toEqual([
|
|
8310
8422
|
{ orderId: "ord_1", customerName: "Ada" },
|
|
8311
8423
|
{ orderId: "ord_2", customerName: "Grace" },
|
|
8312
8424
|
{ orderId: "ord_3", customerName: "Katherine" }
|
|
8313
8425
|
]);
|
|
8314
|
-
await expect14(collectRows2(storage.readRows({ datasetId:
|
|
8426
|
+
await expect14(collectRows2(storage.readRows({ datasetId: writeDataset.id, versionId: version1.versionId }))).resolves.toEqual([
|
|
8315
8427
|
{ orderId: "ord_1", customerName: "Ada" },
|
|
8316
8428
|
{ orderId: "ord_2", customerName: "Grace" }
|
|
8317
8429
|
]);
|
|
8318
8430
|
await expect14(collectRows2(storage.readRows({
|
|
8319
|
-
datasetId:
|
|
8431
|
+
datasetId: writeDataset.id,
|
|
8320
8432
|
columns: ["orderId"],
|
|
8321
8433
|
limit: 2
|
|
8322
8434
|
}))).resolves.toEqual([{ orderId: "ord_1" }, { orderId: "ord_2" }]);
|
|
8323
8435
|
await expect14(collectRows2(storage.readRows({
|
|
8324
|
-
datasetId:
|
|
8436
|
+
datasetId: writeDataset.id,
|
|
8325
8437
|
columns: ["orderId"],
|
|
8326
8438
|
limit: 1,
|
|
8327
8439
|
offset: 1
|
|
8328
8440
|
}))).resolves.toEqual([{ orderId: "ord_2" }]);
|
|
8329
8441
|
await expect14(collectRows2(storage.readRows({
|
|
8330
|
-
datasetId:
|
|
8442
|
+
datasetId: writeDataset.id,
|
|
8331
8443
|
columns: ["orderId"],
|
|
8332
8444
|
offset: 1
|
|
8333
8445
|
}))).resolves.toEqual([{ orderId: "ord_2" }, { orderId: "ord_3" }]);
|
|
8334
|
-
expect14((await storage.listVersions(
|
|
8335
|
-
expect14((await storage.listVersions(
|
|
8446
|
+
expect14((await storage.listVersions(writeDataset.id)).map((version) => version.versionId)).toEqual([version2.versionId, version1.versionId]);
|
|
8447
|
+
expect14((await storage.listVersions(writeDataset.id, 1)).map((version) => version.versionId)).toEqual([version2.versionId]);
|
|
8336
8448
|
expect14(await storage.listVersions("missing.dataset")).toEqual([]);
|
|
8337
8449
|
expect14(await storage.getLatestVersion("missing.dataset")).toBeNull();
|
|
8338
|
-
expect14(await storage.getVersion(
|
|
8450
|
+
expect14(await storage.getVersion(writeDataset.id, missingVersionId)).toBeNull();
|
|
8339
8451
|
});
|
|
8340
8452
|
});
|
|
8341
8453
|
test14("creates an initial empty snapshot version", async () => {
|
|
8342
8454
|
await withStorage(async (storage) => {
|
|
8343
|
-
await storage.createDataset(
|
|
8344
|
-
const write = await storage.beginWrite({ dataset:
|
|
8455
|
+
await storage.createDataset(writeDataset);
|
|
8456
|
+
const write = await storage.beginWrite({ dataset: writeDataset, mode: "snapshot" });
|
|
8345
8457
|
const version = await write.commit();
|
|
8346
8458
|
expect14(version).toMatchObject({
|
|
8347
|
-
datasetId:
|
|
8459
|
+
datasetId: writeDataset.id,
|
|
8348
8460
|
mode: "snapshot",
|
|
8349
8461
|
outcome: "created",
|
|
8350
8462
|
rowCount: 0
|
|
8351
8463
|
});
|
|
8352
|
-
expect14(await storage.getLatestVersion(
|
|
8464
|
+
expect14(await storage.getLatestVersion(writeDataset.id)).toMatchObject({
|
|
8353
8465
|
versionId: version.versionId
|
|
8354
8466
|
});
|
|
8355
|
-
expect14(await storage.listVersions(
|
|
8467
|
+
expect14(await storage.listVersions(writeDataset.id)).toHaveLength(1);
|
|
8356
8468
|
const repeatedWrite = await storage.beginWrite({
|
|
8357
|
-
dataset:
|
|
8469
|
+
dataset: writeDataset,
|
|
8358
8470
|
mode: "snapshot"
|
|
8359
8471
|
});
|
|
8360
8472
|
const repeatedVersion = await repeatedWrite.commit();
|
|
8361
8473
|
expect14(repeatedVersion.outcome).toBe("unchanged");
|
|
8362
8474
|
expect14(repeatedVersion.versionId).toBe(version.versionId);
|
|
8363
|
-
expect14(await storage.listVersions(
|
|
8364
|
-
await expect14(collectRows2(storage.readRows({ datasetId:
|
|
8475
|
+
expect14(await storage.listVersions(writeDataset.id)).toHaveLength(1);
|
|
8476
|
+
await expect14(collectRows2(storage.readRows({ datasetId: writeDataset.id }))).resolves.toEqual([]);
|
|
8365
8477
|
});
|
|
8366
8478
|
});
|
|
8367
8479
|
test14("guards initial and existing versions before accepting even an unchanged write", () => withStorage(async (storage) => {
|
|
8368
|
-
await storage.createDataset(
|
|
8369
|
-
const first = await storage.beginWrite({ dataset:
|
|
8370
|
-
const stale = await storage.beginWrite({ dataset:
|
|
8480
|
+
await storage.createDataset(writeDataset);
|
|
8481
|
+
const first = await storage.beginWrite({ dataset: writeDataset });
|
|
8482
|
+
const stale = await storage.beginWrite({ dataset: writeDataset });
|
|
8371
8483
|
const initial = await first.commit({ expectedLatestVersionId: null });
|
|
8372
8484
|
await expect14(stale.commit({ expectedLatestVersionId: null })).rejects.toThrow("Optimistic");
|
|
8373
8485
|
await stale.abort();
|
|
8374
|
-
const replacement = await storage.beginWrite({ dataset:
|
|
8486
|
+
const replacement = await storage.beginWrite({ dataset: writeDataset });
|
|
8375
8487
|
await replacement.writeRows([{ orderId: "ord_1", customerName: "Ada" }]);
|
|
8376
8488
|
const next = await replacement.commit({ expectedLatestVersionId: initial.versionId });
|
|
8377
|
-
const identical = await storage.beginWrite({ dataset:
|
|
8489
|
+
const identical = await storage.beginWrite({ dataset: writeDataset });
|
|
8378
8490
|
await identical.writeRows([{ orderId: "ord_1", customerName: "Ada" }]);
|
|
8379
8491
|
await expect14(identical.commit({ expectedLatestVersionId: initial.versionId })).rejects.toThrow("Optimistic");
|
|
8380
8492
|
await identical.abort();
|
|
8381
|
-
expect14((await storage.getLatestVersion(
|
|
8493
|
+
expect14((await storage.getLatestVersion(writeDataset.id))?.versionId).toBe(next.versionId);
|
|
8382
8494
|
}));
|
|
8383
8495
|
test14("versions changed input lineage even when output rows are identical", () => withStorage(async (storage) => {
|
|
8384
|
-
await storage.createDataset(
|
|
8496
|
+
await storage.createDataset(writeDataset);
|
|
8385
8497
|
await storage.createDataset(definitionDataset);
|
|
8386
8498
|
const sourceWrite = await storage.beginWrite({ dataset: definitionDataset });
|
|
8387
8499
|
const source1 = await sourceWrite.commit();
|
|
8388
|
-
const
|
|
8500
|
+
const rows = [{ orderId: "ord_1", customerName: "Ada" }];
|
|
8389
8501
|
const ref1 = { datasetId: definitionDataset.id, versionId: source1.versionId };
|
|
8390
|
-
const first = await storage.beginWrite({ dataset:
|
|
8391
|
-
await first.writeRows(
|
|
8502
|
+
const first = await storage.beginWrite({ dataset: writeDataset, inputs: [ref1] });
|
|
8503
|
+
await first.writeRows(rows);
|
|
8392
8504
|
const initial = await first.commit({ expectedLatestVersionId: null });
|
|
8393
|
-
const stale = await storage.beginWrite({ dataset:
|
|
8505
|
+
const stale = await storage.beginWrite({ dataset: writeDataset, inputs: [ref1] });
|
|
8394
8506
|
await stale.writeRows([{ orderId: "ord_1", customerName: "Stale" }]);
|
|
8395
8507
|
const sourceUpdate = await storage.beginWrite({ dataset: definitionDataset });
|
|
8396
8508
|
await sourceUpdate.writeRows([{ orderId: "source", customerName: "Changed" }]);
|
|
8397
8509
|
const source2 = await sourceUpdate.commit();
|
|
8398
8510
|
const ref2 = { datasetId: definitionDataset.id, versionId: source2.versionId };
|
|
8399
|
-
const update = await storage.beginWrite({ dataset:
|
|
8400
|
-
await update.writeRows(
|
|
8511
|
+
const update = await storage.beginWrite({ dataset: writeDataset, inputs: [ref2] });
|
|
8512
|
+
await update.writeRows(rows);
|
|
8401
8513
|
const newer = await update.commit({ expectedLatestVersionId: initial.versionId });
|
|
8402
8514
|
expect14(newer).toMatchObject({ outcome: "created", inputs: [ref2] });
|
|
8403
8515
|
await expect14(stale.commit({ expectedLatestVersionId: initial.versionId })).rejects.toThrow("Optimistic");
|
|
8404
8516
|
await stale.abort();
|
|
8405
|
-
const same = await storage.beginWrite({ dataset:
|
|
8406
|
-
await same.writeRows(
|
|
8517
|
+
const same = await storage.beginWrite({ dataset: writeDataset, inputs: [ref2] });
|
|
8518
|
+
await same.writeRows(rows);
|
|
8407
8519
|
const unchanged = await same.commit({ expectedLatestVersionId: newer.versionId });
|
|
8408
8520
|
expect14(unchanged).toMatchObject({ outcome: "unchanged", versionId: newer.versionId });
|
|
8409
|
-
expect14(await collectRows2(storage.readRows({ datasetId:
|
|
8521
|
+
expect14(await collectRows2(storage.readRows({ datasetId: writeDataset.id }))).toEqual(rows);
|
|
8410
8522
|
}));
|
|
8411
8523
|
test14("creates an initial empty append version", async () => {
|
|
8412
8524
|
await withStorage(async (storage) => {
|
|
8413
|
-
await storage.createDataset(
|
|
8414
|
-
const write = await storage.beginWrite({ dataset:
|
|
8525
|
+
await storage.createDataset(writeDataset);
|
|
8526
|
+
const write = await storage.beginWrite({ dataset: writeDataset, mode: "append" });
|
|
8415
8527
|
const version = await write.commit();
|
|
8416
8528
|
expect14(version).toMatchObject({
|
|
8417
|
-
datasetId:
|
|
8529
|
+
datasetId: writeDataset.id,
|
|
8418
8530
|
mode: "append",
|
|
8419
8531
|
outcome: "created"
|
|
8420
8532
|
});
|
|
8421
8533
|
expect14(version.parentVersionId).toBeUndefined();
|
|
8422
|
-
expect14(await storage.getLatestVersion(
|
|
8534
|
+
expect14(await storage.getLatestVersion(writeDataset.id)).toMatchObject({
|
|
8423
8535
|
versionId: version.versionId
|
|
8424
8536
|
});
|
|
8425
|
-
expect14(await storage.listVersions(
|
|
8426
|
-
await expect14(collectRows2(storage.readRows({ datasetId:
|
|
8537
|
+
expect14(await storage.listVersions(writeDataset.id)).toHaveLength(1);
|
|
8538
|
+
await expect14(collectRows2(storage.readRows({ datasetId: writeDataset.id }))).resolves.toEqual([]);
|
|
8427
8539
|
});
|
|
8428
8540
|
});
|
|
8429
8541
|
test14("snapshot writes replace the visible latest rows", async () => {
|
|
8430
8542
|
await withStorage(async (storage) => {
|
|
8431
|
-
await storage.createDataset(
|
|
8432
|
-
const firstWrite = await storage.beginWrite({ dataset:
|
|
8543
|
+
await storage.createDataset(writeDataset);
|
|
8544
|
+
const firstWrite = await storage.beginWrite({ dataset: writeDataset, mode: "snapshot" });
|
|
8433
8545
|
await firstWrite.writeRows([{ orderId: "ord_1", customerName: "Ada" }]);
|
|
8434
8546
|
const firstVersion = await firstWrite.commit();
|
|
8435
8547
|
const replacementWrite = await storage.beginWrite({
|
|
8436
|
-
dataset:
|
|
8548
|
+
dataset: writeDataset,
|
|
8437
8549
|
mode: "snapshot"
|
|
8438
8550
|
});
|
|
8439
8551
|
await replacementWrite.writeRows([{ orderId: "ord_9", customerName: "Dorothy" }]);
|
|
@@ -8441,14 +8553,14 @@ function runLakeStorageContractSuite(label, options) {
|
|
|
8441
8553
|
expect14(replacementVersion.versionId).not.toBe(firstVersion.versionId);
|
|
8442
8554
|
expect14(replacementVersion.parentVersionId).toBeUndefined();
|
|
8443
8555
|
expect14(replacementVersion.rowCount).toBe(1);
|
|
8444
|
-
await expect14(collectRows2(storage.readRows({ datasetId:
|
|
8445
|
-
await expect14(collectRows2(storage.readRows({ datasetId:
|
|
8556
|
+
await expect14(collectRows2(storage.readRows({ datasetId: writeDataset.id }))).resolves.toEqual([{ orderId: "ord_9", customerName: "Dorothy" }]);
|
|
8557
|
+
await expect14(collectRows2(storage.readRows({ datasetId: writeDataset.id, versionId: firstVersion.versionId }))).resolves.toEqual([{ orderId: "ord_1", customerName: "Ada" }]);
|
|
8446
8558
|
});
|
|
8447
8559
|
});
|
|
8448
8560
|
test14("reuses the latest version when a snapshot commits identical content", async () => {
|
|
8449
8561
|
await withStorage(async (storage) => {
|
|
8450
|
-
await storage.createDataset(
|
|
8451
|
-
const seedWrite = await storage.beginWrite({ dataset:
|
|
8562
|
+
await storage.createDataset(writeDataset);
|
|
8563
|
+
const seedWrite = await storage.beginWrite({ dataset: writeDataset, mode: "snapshot" });
|
|
8452
8564
|
await seedWrite.writeRows([
|
|
8453
8565
|
{ orderId: "ord_1", customerName: "Ada" },
|
|
8454
8566
|
{ orderId: "ord_2", customerName: "Grace" }
|
|
@@ -8456,7 +8568,7 @@ function runLakeStorageContractSuite(label, options) {
|
|
|
8456
8568
|
const seedVersion = await seedWrite.commit();
|
|
8457
8569
|
expect14(seedVersion.outcome).toBe("created");
|
|
8458
8570
|
const identicalWrite = await storage.beginWrite({
|
|
8459
|
-
dataset:
|
|
8571
|
+
dataset: writeDataset,
|
|
8460
8572
|
mode: "snapshot"
|
|
8461
8573
|
});
|
|
8462
8574
|
await identicalWrite.writeRows([
|
|
@@ -8466,12 +8578,12 @@ function runLakeStorageContractSuite(label, options) {
|
|
|
8466
8578
|
const identicalVersion = await identicalWrite.commit();
|
|
8467
8579
|
expect14(identicalVersion.outcome).toBe("unchanged");
|
|
8468
8580
|
expect14(identicalVersion.versionId).toBe(seedVersion.versionId);
|
|
8469
|
-
expect14((await storage.listVersions(
|
|
8470
|
-
expect14(await storage.getLatestVersion(
|
|
8581
|
+
expect14((await storage.listVersions(writeDataset.id)).map((version) => version.versionId)).toEqual([seedVersion.versionId]);
|
|
8582
|
+
expect14(await storage.getLatestVersion(writeDataset.id)).toMatchObject({
|
|
8471
8583
|
versionId: seedVersion.versionId
|
|
8472
8584
|
});
|
|
8473
8585
|
await Bun.sleep(2);
|
|
8474
|
-
const changedWrite = await storage.beginWrite({ dataset:
|
|
8586
|
+
const changedWrite = await storage.beginWrite({ dataset: writeDataset, mode: "snapshot" });
|
|
8475
8587
|
await changedWrite.writeRows([
|
|
8476
8588
|
{ orderId: "ord_1", customerName: "Ada" },
|
|
8477
8589
|
{ orderId: "ord_2", customerName: "Hopper" }
|
|
@@ -8479,19 +8591,19 @@ function runLakeStorageContractSuite(label, options) {
|
|
|
8479
8591
|
const changedVersion = await changedWrite.commit();
|
|
8480
8592
|
expect14(changedVersion.outcome).toBe("created");
|
|
8481
8593
|
expect14(changedVersion.versionId).not.toBe(seedVersion.versionId);
|
|
8482
|
-
expect14((await storage.listVersions(
|
|
8594
|
+
expect14((await storage.listVersions(writeDataset.id)).map((version) => version.versionId)).toEqual([changedVersion.versionId, seedVersion.versionId]);
|
|
8483
8595
|
});
|
|
8484
8596
|
});
|
|
8485
8597
|
test14("snapshot content comparison respects row multiplicities", async () => {
|
|
8486
8598
|
await withStorage(async (storage) => {
|
|
8487
|
-
await storage.createDataset(
|
|
8599
|
+
await storage.createDataset(writeDataset);
|
|
8488
8600
|
const rowA = { orderId: "ord_1", customerName: "Ada" };
|
|
8489
8601
|
const rowB = { orderId: "ord_2", customerName: "Grace" };
|
|
8490
|
-
const seedWrite = await storage.beginWrite({ dataset:
|
|
8602
|
+
const seedWrite = await storage.beginWrite({ dataset: writeDataset, mode: "snapshot" });
|
|
8491
8603
|
await seedWrite.writeRows([rowA, rowA, rowB]);
|
|
8492
8604
|
const seedVersion = await seedWrite.commit();
|
|
8493
8605
|
await Bun.sleep(2);
|
|
8494
|
-
const shiftedWrite = await storage.beginWrite({ dataset:
|
|
8606
|
+
const shiftedWrite = await storage.beginWrite({ dataset: writeDataset, mode: "snapshot" });
|
|
8495
8607
|
await shiftedWrite.writeRows([rowA, rowB, rowB]);
|
|
8496
8608
|
const shiftedVersion = await shiftedWrite.commit();
|
|
8497
8609
|
expect14(shiftedVersion.outcome).toBe("created");
|
|
@@ -8519,35 +8631,35 @@ function runLakeStorageContractSuite(label, options) {
|
|
|
8519
8631
|
});
|
|
8520
8632
|
test14("reuses the latest version when an append commits zero rows", async () => {
|
|
8521
8633
|
await withStorage(async (storage) => {
|
|
8522
|
-
await storage.createDataset(
|
|
8523
|
-
const seedWrite = await storage.beginWrite({ dataset:
|
|
8634
|
+
await storage.createDataset(writeDataset);
|
|
8635
|
+
const seedWrite = await storage.beginWrite({ dataset: writeDataset, mode: "snapshot" });
|
|
8524
8636
|
await seedWrite.writeRows([{ orderId: "ord_1", customerName: "Ada" }]);
|
|
8525
8637
|
const seedVersion = await seedWrite.commit();
|
|
8526
|
-
const emptyAppend = await storage.beginWrite({ dataset:
|
|
8638
|
+
const emptyAppend = await storage.beginWrite({ dataset: writeDataset, mode: "append" });
|
|
8527
8639
|
const appendVersion = await emptyAppend.commit();
|
|
8528
8640
|
expect14(appendVersion.outcome).toBe("unchanged");
|
|
8529
8641
|
expect14(appendVersion.versionId).toBe(seedVersion.versionId);
|
|
8530
8642
|
expect14(appendVersion.rowCount).toBe(1);
|
|
8531
|
-
expect14((await storage.listVersions(
|
|
8532
|
-
await expect14(collectRows2(storage.readRows({ datasetId:
|
|
8643
|
+
expect14((await storage.listVersions(writeDataset.id)).map((version) => version.versionId)).toEqual([seedVersion.versionId]);
|
|
8644
|
+
await expect14(collectRows2(storage.readRows({ datasetId: writeDataset.id }))).resolves.toEqual([{ orderId: "ord_1", customerName: "Ada" }]);
|
|
8533
8645
|
});
|
|
8534
8646
|
});
|
|
8535
8647
|
test14("fails stale optimistic commits", async () => {
|
|
8536
8648
|
await withStorage(async (storage) => {
|
|
8537
|
-
await storage.createDataset(
|
|
8538
|
-
const seedWrite = await storage.beginWrite({ dataset:
|
|
8649
|
+
await storage.createDataset(writeDataset);
|
|
8650
|
+
const seedWrite = await storage.beginWrite({ dataset: writeDataset, mode: "snapshot" });
|
|
8539
8651
|
await seedWrite.writeRows([{ orderId: "ord_1", customerName: "Ada" }]);
|
|
8540
8652
|
const initialVersion = await seedWrite.commit();
|
|
8541
|
-
const delayedWrite = await storage.beginWrite({ dataset:
|
|
8653
|
+
const delayedWrite = await storage.beginWrite({ dataset: writeDataset, mode: "append" });
|
|
8542
8654
|
await delayedWrite.writeRows([{ orderId: "ord_2", customerName: "Grace" }]);
|
|
8543
8655
|
const competingWrite = await storage.beginWrite({
|
|
8544
|
-
dataset:
|
|
8656
|
+
dataset: writeDataset,
|
|
8545
8657
|
mode: "append"
|
|
8546
8658
|
});
|
|
8547
8659
|
await competingWrite.writeRows([{ orderId: "ord_3", customerName: "Katherine" }]);
|
|
8548
8660
|
await competingWrite.commit({ expectedLatestVersionId: initialVersion.versionId });
|
|
8549
8661
|
await expect14(delayedWrite.commit({ expectedLatestVersionId: initialVersion.versionId })).rejects.toThrow("Optimistic commit failed");
|
|
8550
|
-
await expect14(collectRows2(storage.readRows({ datasetId:
|
|
8662
|
+
await expect14(collectRows2(storage.readRows({ datasetId: writeDataset.id }))).resolves.toEqual([
|
|
8551
8663
|
{ orderId: "ord_1", customerName: "Ada" },
|
|
8552
8664
|
{ orderId: "ord_3", customerName: "Katherine" }
|
|
8553
8665
|
]);
|
|
@@ -8555,20 +8667,20 @@ function runLakeStorageContractSuite(label, options) {
|
|
|
8555
8667
|
});
|
|
8556
8668
|
test14("abort closes a write session without committing rows", async () => {
|
|
8557
8669
|
await withStorage(async (storage) => {
|
|
8558
|
-
await storage.createDataset(
|
|
8559
|
-
const write = await storage.beginWrite({ dataset:
|
|
8670
|
+
await storage.createDataset(writeDataset);
|
|
8671
|
+
const write = await storage.beginWrite({ dataset: writeDataset, mode: "snapshot" });
|
|
8560
8672
|
await write.writeRows([{ orderId: "ord_1", customerName: "Ada" }]);
|
|
8561
8673
|
await write.abort();
|
|
8562
8674
|
await write.abort();
|
|
8563
|
-
expect14(await storage.getLatestVersion(
|
|
8564
|
-
expect14(await storage.listVersions(
|
|
8565
|
-
await expect14(collectRows2(storage.readRows({ datasetId:
|
|
8675
|
+
expect14(await storage.getLatestVersion(writeDataset.id)).toBeNull();
|
|
8676
|
+
expect14(await storage.listVersions(writeDataset.id)).toEqual([]);
|
|
8677
|
+
await expect14(collectRows2(storage.readRows({ datasetId: writeDataset.id }))).rejects.toThrow("No committed version found");
|
|
8566
8678
|
});
|
|
8567
8679
|
});
|
|
8568
8680
|
test14("commit closes a write session and leaves abort idempotent", async () => {
|
|
8569
8681
|
await withStorage(async (storage) => {
|
|
8570
|
-
await storage.createDataset(
|
|
8571
|
-
const write = await storage.beginWrite({ dataset:
|
|
8682
|
+
await storage.createDataset(writeDataset);
|
|
8683
|
+
const write = await storage.beginWrite({ dataset: writeDataset, mode: "snapshot" });
|
|
8572
8684
|
await write.writeRows([{ orderId: "ord_1", customerName: "Ada" }]);
|
|
8573
8685
|
await write.commit();
|
|
8574
8686
|
await write.abort();
|
|
@@ -8577,8 +8689,8 @@ function runLakeStorageContractSuite(label, options) {
|
|
|
8577
8689
|
});
|
|
8578
8690
|
test14("rejects rows that do not match the dataset schema", async () => {
|
|
8579
8691
|
await withStorage(async (storage) => {
|
|
8580
|
-
await storage.createDataset(
|
|
8581
|
-
const write = await storage.beginWrite({ dataset:
|
|
8692
|
+
await storage.createDataset(writeDataset);
|
|
8693
|
+
const write = await storage.beginWrite({ dataset: writeDataset, mode: "snapshot" });
|
|
8582
8694
|
await expect14(write.writeRows([{ orderId: "ord_1" }])).rejects.toThrow("missing required column");
|
|
8583
8695
|
await expect14(write.writeRows([{ orderId: "ord_1", customerName: "Ada", unexpected: true }])).rejects.toThrow("unknown column");
|
|
8584
8696
|
await write.abort();
|
|
@@ -8623,9 +8735,9 @@ function runLakeStorageContractSuite(label, options) {
|
|
|
8623
8735
|
});
|
|
8624
8736
|
});
|
|
8625
8737
|
}
|
|
8626
|
-
async function collectRows2(
|
|
8738
|
+
async function collectRows2(rows) {
|
|
8627
8739
|
const result = [];
|
|
8628
|
-
for await (const row of
|
|
8740
|
+
for await (const row of rows) {
|
|
8629
8741
|
result.push(row);
|
|
8630
8742
|
}
|
|
8631
8743
|
return result;
|
|
@@ -8725,7 +8837,7 @@ async function commitExactObject(storage, id, options = {}) {
|
|
|
8725
8837
|
propertyChanges: {}
|
|
8726
8838
|
}
|
|
8727
8839
|
};
|
|
8728
|
-
const eventId =
|
|
8840
|
+
const eventId = createEventId2(header.commit.projectId, id, 0);
|
|
8729
8841
|
const envelope = {
|
|
8730
8842
|
...draft,
|
|
8731
8843
|
id: eventId,
|
|
@@ -8829,9 +8941,9 @@ function runMaterializationFailureContractSuite(label, options) {
|
|
|
8829
8941
|
try {
|
|
8830
8942
|
await options.setup?.(storage);
|
|
8831
8943
|
const before = await options.captureState(storage);
|
|
8832
|
-
const
|
|
8833
|
-
await options.injectFailure(storage, boundary,
|
|
8834
|
-
await expect15(commitExactObject(storage, `failure-${boundary}`)).rejects.toThrow(
|
|
8944
|
+
const failure = new Error(`contract injected ${boundary}`);
|
|
8945
|
+
await options.injectFailure(storage, boundary, failure);
|
|
8946
|
+
await expect15(commitExactObject(storage, `failure-${boundary}`)).rejects.toThrow(failure.message);
|
|
8835
8947
|
await options.clearFailure?.(storage);
|
|
8836
8948
|
expect15(await options.captureState(storage)).toEqual(before);
|
|
8837
8949
|
} finally {
|
|
@@ -8847,17 +8959,17 @@ import { expect as expect16, test as test16 } from "bun:test";
|
|
|
8847
8959
|
|
|
8848
8960
|
// src/testing/projection-execution.ts
|
|
8849
8961
|
async function createTestProjectionExecution(executions, input) {
|
|
8850
|
-
const
|
|
8851
|
-
const existing = await executions.getById({ projectId: input.projectId, id:
|
|
8962
|
+
const executionId = input.executionId ?? `test_projection_execution:${input.runId}`;
|
|
8963
|
+
const existing = await executions.getById({ projectId: input.projectId, id: executionId });
|
|
8852
8964
|
if (existing)
|
|
8853
|
-
return
|
|
8965
|
+
return executionId;
|
|
8854
8966
|
const primitive = {
|
|
8855
8967
|
kind: "projection",
|
|
8856
8968
|
id: input.projectionId,
|
|
8857
8969
|
runId: input.runId
|
|
8858
8970
|
};
|
|
8859
8971
|
await executions.create({
|
|
8860
|
-
id:
|
|
8972
|
+
id: executionId,
|
|
8861
8973
|
projectId: input.projectId,
|
|
8862
8974
|
executor: { type: "primitive", kind: primitive.kind, runId: primitive.runId },
|
|
8863
8975
|
source: {
|
|
@@ -8868,19 +8980,19 @@ async function createTestProjectionExecution(executions, input) {
|
|
|
8868
8980
|
correlationId: `test_correlation:${input.runId}`,
|
|
8869
8981
|
authorizationRef: { type: "trustedPrimitive", primitive }
|
|
8870
8982
|
});
|
|
8871
|
-
return
|
|
8983
|
+
return executionId;
|
|
8872
8984
|
}
|
|
8873
8985
|
async function queueTestProjectionRun(storage, input) {
|
|
8874
8986
|
if (!storage.projectionRuns)
|
|
8875
8987
|
throw new Error("Projection run storage is not configured for this test.");
|
|
8876
|
-
const
|
|
8988
|
+
const executionId = await createTestProjectionExecution(storage.executions, {
|
|
8877
8989
|
projectId: input.projectId,
|
|
8878
8990
|
projectionId: input.identity.projectionId,
|
|
8879
8991
|
runId: input.id,
|
|
8880
8992
|
datasetId: input.identity.datasetVersion.datasetId,
|
|
8881
8993
|
datasetVersionId: input.identity.datasetVersion.versionId
|
|
8882
8994
|
});
|
|
8883
|
-
return storage.projectionRuns.queue({ ...input, executionId
|
|
8995
|
+
return storage.projectionRuns.queue({ ...input, executionId });
|
|
8884
8996
|
}
|
|
8885
8997
|
async function startTestProjectionRun(storage, input) {
|
|
8886
8998
|
const projectionRuns = storage.projectionRuns;
|
|
@@ -8905,58 +9017,58 @@ async function claimTestProjectionRun(storage, input) {
|
|
|
8905
9017
|
}
|
|
8906
9018
|
|
|
8907
9019
|
// src/testing/materializer-storage-contract.ts
|
|
8908
|
-
var Device2 =
|
|
9020
|
+
var Device2 = defineObjectType2({
|
|
8909
9021
|
id: "StorageContractDevice",
|
|
8910
9022
|
name: "Device",
|
|
8911
9023
|
properties: [
|
|
8912
|
-
|
|
8913
|
-
|
|
8914
|
-
|
|
9024
|
+
prop2("id", "string", { primary: true, required: true }),
|
|
9025
|
+
prop2("name", "string", { required: true }),
|
|
9026
|
+
prop2("temperature", "double", { mode: "telemetry" })
|
|
8915
9027
|
],
|
|
8916
|
-
links: [
|
|
9028
|
+
links: [link2.self("parent", { cardinality: "one" }), link2.self("peers", { cardinality: "many" })]
|
|
8917
9029
|
});
|
|
8918
|
-
var devices =
|
|
9030
|
+
var devices = defineDataset2("storage_contract_devices", {
|
|
8919
9031
|
schema: [
|
|
8920
|
-
|
|
8921
|
-
|
|
8922
|
-
|
|
9032
|
+
col2("id", "string"),
|
|
9033
|
+
col2("name", "string"),
|
|
9034
|
+
col2("parent_id", "string", { nullable: true })
|
|
8923
9035
|
]
|
|
8924
9036
|
});
|
|
8925
|
-
var readings =
|
|
8926
|
-
schema: [
|
|
9037
|
+
var readings = defineDataset2("storage_contract_readings", {
|
|
9038
|
+
schema: [col2("device_id", "string"), col2("at", "timestamp"), col2("value", "float64")]
|
|
8927
9039
|
});
|
|
8928
|
-
var devicePeers =
|
|
8929
|
-
schema: [
|
|
9040
|
+
var devicePeers = defineDataset2("storage_contract_device_peers", {
|
|
9041
|
+
schema: [col2("source_id", "string"), col2("target_id", "string")]
|
|
8930
9042
|
});
|
|
8931
|
-
var ConflictDevice =
|
|
9043
|
+
var ConflictDevice = defineObjectType2({
|
|
8932
9044
|
id: "StorageContractConflictDevice",
|
|
8933
9045
|
name: "Conflict device",
|
|
8934
9046
|
properties: [
|
|
8935
|
-
|
|
8936
|
-
|
|
8937
|
-
|
|
9047
|
+
prop2("id", "string", { primary: true, required: true }),
|
|
9048
|
+
prop2("name", "string", { required: true }),
|
|
9049
|
+
prop2("state", "string", { required: true })
|
|
8938
9050
|
]
|
|
8939
9051
|
});
|
|
8940
|
-
var conflictDevices =
|
|
9052
|
+
var conflictDevices = defineDataset2("storage_contract_conflict_devices", {
|
|
8941
9053
|
schema: [
|
|
8942
|
-
|
|
8943
|
-
|
|
8944
|
-
|
|
8945
|
-
|
|
9054
|
+
col2("id", "string"),
|
|
9055
|
+
col2("name", "string"),
|
|
9056
|
+
col2("state", "string"),
|
|
9057
|
+
col2("updated_at", "timestamp")
|
|
8946
9058
|
]
|
|
8947
9059
|
});
|
|
8948
|
-
var deviceProjection =
|
|
9060
|
+
var deviceProjection = defineProjection2("storage_contract_devices", Device2).fromDataset(devices).properties({ id: "id", name: "name" }).withLinks({
|
|
8949
9061
|
parent: {
|
|
8950
9062
|
link: Device2.l.parent,
|
|
8951
9063
|
sourceField: "parent_id",
|
|
8952
9064
|
target: Device2
|
|
8953
9065
|
}
|
|
8954
9066
|
});
|
|
8955
|
-
var temperatureProjection =
|
|
8956
|
-
var devicePeersProjection =
|
|
8957
|
-
var conflictDeviceProjection =
|
|
8958
|
-
var ontology2 = new
|
|
8959
|
-
var projections = new
|
|
9067
|
+
var temperatureProjection = defineProjection2("storage_contract_temperatures", Device2.p.temperature).fromDataset(readings).points({ objectId: "device_id", at: "at", value: "value" });
|
|
9068
|
+
var devicePeersProjection = defineProjection2("storage_contract_device_peers", Device2.l.peers).fromDataset(devicePeers).sourceField("source_id").targetField("target_id");
|
|
9069
|
+
var conflictDeviceProjection = defineProjection2("storage_contract_conflict_devices", ConflictDevice).fromDataset(conflictDevices).properties({ id: "id", name: "name", state: "state" }).resolveConflicts({ strategy: "mostRecent", sourceTimestamp: "updated_at" });
|
|
9070
|
+
var ontology2 = new OntologyRegistry2({ sources: [Device2, ConflictDevice] });
|
|
9071
|
+
var projections = new ProjectionRegistry2({
|
|
8960
9072
|
projections: [
|
|
8961
9073
|
deviceProjection,
|
|
8962
9074
|
temperatureProjection,
|
|
@@ -8976,7 +9088,7 @@ function runMaterializerStorageContractSuite(name, provider) {
|
|
|
8976
9088
|
const createdStorage = await provider.createStorage();
|
|
8977
9089
|
const storage = requireContractStorage(createdStorage);
|
|
8978
9090
|
let materializationOrdinal = 0;
|
|
8979
|
-
const materializer =
|
|
9091
|
+
const materializer = createOntologyMaterializer2({
|
|
8980
9092
|
projectId: "materializer-storage-contract",
|
|
8981
9093
|
ontology: ontology2,
|
|
8982
9094
|
projections,
|
|
@@ -9197,7 +9309,7 @@ function runMaterializerStorageContractSuite(name, provider) {
|
|
|
9197
9309
|
const storage = requireContractStorage(createdStorage);
|
|
9198
9310
|
let materializationOrdinal = 0;
|
|
9199
9311
|
let now = new Date("2026-02-01T00:00:10.000Z");
|
|
9200
|
-
const materializer =
|
|
9312
|
+
const materializer = createOntologyMaterializer2({
|
|
9201
9313
|
projectId: "materializer-storage-contract",
|
|
9202
9314
|
ontology: ontology2,
|
|
9203
9315
|
projections,
|
|
@@ -9210,13 +9322,13 @@ function runMaterializerStorageContractSuite(name, provider) {
|
|
|
9210
9322
|
});
|
|
9211
9323
|
const runtimeMaterializer = materializer.withScope(runtimeScope());
|
|
9212
9324
|
const ref = { objectTypeId: ConflictDevice.id, primaryId: "one" };
|
|
9213
|
-
const replace = async (versionId, sourceUpdatedAt,
|
|
9325
|
+
const replace = async (versionId, sourceUpdatedAt, name, state) => {
|
|
9214
9326
|
const datasetVersion = {
|
|
9215
9327
|
datasetId: conflictDevices.id,
|
|
9216
9328
|
versionId,
|
|
9217
9329
|
createdAt: sourceUpdatedAt
|
|
9218
9330
|
};
|
|
9219
|
-
const
|
|
9331
|
+
const execution = await claim(storage, {
|
|
9220
9332
|
runId: `conflict-${versionId}`,
|
|
9221
9333
|
projectionId: conflictDeviceProjection.id,
|
|
9222
9334
|
protocol: "replacement",
|
|
@@ -9226,11 +9338,11 @@ function runMaterializerStorageContractSuite(name, provider) {
|
|
|
9226
9338
|
await projectionMaterializerForRun.projections.replace({
|
|
9227
9339
|
source: { projectionId: conflictDeviceProjection.id },
|
|
9228
9340
|
datasetVersion,
|
|
9229
|
-
execution
|
|
9341
|
+
execution,
|
|
9230
9342
|
entries: entries([
|
|
9231
9343
|
{
|
|
9232
9344
|
root: { kind: "object", ref },
|
|
9233
|
-
assertions: [{ kind: "object", ref, properties: { name
|
|
9345
|
+
assertions: [{ kind: "object", ref, properties: { name, state }, sourceUpdatedAt }]
|
|
9234
9346
|
}
|
|
9235
9347
|
])
|
|
9236
9348
|
});
|
|
@@ -9272,7 +9384,7 @@ function runMaterializerStorageContractSuite(name, provider) {
|
|
|
9272
9384
|
const createdStorage = await provider.createStorage();
|
|
9273
9385
|
const storage = requireContractStorage(createdStorage);
|
|
9274
9386
|
let materializationOrdinal = 0;
|
|
9275
|
-
const materializer =
|
|
9387
|
+
const materializer = createOntologyMaterializer2({
|
|
9276
9388
|
projectId: "materializer-storage-contract",
|
|
9277
9389
|
ontology: ontology2,
|
|
9278
9390
|
projections,
|
|
@@ -9295,7 +9407,7 @@ function runMaterializerStorageContractSuite(name, provider) {
|
|
|
9295
9407
|
versionId,
|
|
9296
9408
|
createdAt: `2026-01-0${versionId.slice(1)}T00:00:00.000Z`
|
|
9297
9409
|
};
|
|
9298
|
-
const
|
|
9410
|
+
const execution = await claim(storage, {
|
|
9299
9411
|
runId: `scope-${versionId}`,
|
|
9300
9412
|
projectionId: deviceProjection.id,
|
|
9301
9413
|
protocol: "replacement",
|
|
@@ -9305,7 +9417,7 @@ function runMaterializerStorageContractSuite(name, provider) {
|
|
|
9305
9417
|
await projectionMaterializerForRun.projections.replace({
|
|
9306
9418
|
source: { projectionId: deviceProjection.id },
|
|
9307
9419
|
datasetVersion,
|
|
9308
|
-
execution
|
|
9420
|
+
execution,
|
|
9309
9421
|
entries: entries([
|
|
9310
9422
|
sourceEntry("document", "Document", parentId),
|
|
9311
9423
|
sourceEntry("rockland", "Rockland"),
|
|
@@ -9362,7 +9474,7 @@ function runMaterializerStorageContractSuite(name, provider) {
|
|
|
9362
9474
|
const createdStorage = await provider.createStorage();
|
|
9363
9475
|
const storage = requireContractStorage(createdStorage);
|
|
9364
9476
|
let materializationOrdinal = 0;
|
|
9365
|
-
const materializer =
|
|
9477
|
+
const materializer = createOntologyMaterializer2({
|
|
9366
9478
|
projectId: "materializer-storage-contract",
|
|
9367
9479
|
ontology: ontology2,
|
|
9368
9480
|
projections,
|
|
@@ -9375,11 +9487,11 @@ function runMaterializerStorageContractSuite(name, provider) {
|
|
|
9375
9487
|
});
|
|
9376
9488
|
const runtimeMaterializer = materializer.withScope(runtimeScope());
|
|
9377
9489
|
const source = { objectTypeId: Device2.id, primaryId: "source" };
|
|
9378
|
-
const
|
|
9490
|
+
const peer = (primaryId) => ({ objectTypeId: Device2.id, primaryId });
|
|
9379
9491
|
const linkRef = (targetId) => ({
|
|
9380
9492
|
source,
|
|
9381
9493
|
linkId: "peers",
|
|
9382
|
-
target:
|
|
9494
|
+
target: peer(targetId)
|
|
9383
9495
|
});
|
|
9384
9496
|
try {
|
|
9385
9497
|
await runtimeMaterializer.edits.commit({
|
|
@@ -9388,7 +9500,7 @@ function runMaterializerStorageContractSuite(name, provider) {
|
|
|
9388
9500
|
operations: ["source", "peer-a", "peer-b", "peer-c"].map((primaryId) => ({
|
|
9389
9501
|
id: `create-${primaryId}`,
|
|
9390
9502
|
kind: "object.create",
|
|
9391
|
-
ref:
|
|
9503
|
+
ref: peer(primaryId),
|
|
9392
9504
|
properties: { name: primaryId }
|
|
9393
9505
|
})),
|
|
9394
9506
|
expectedObjects: [],
|
|
@@ -9400,7 +9512,7 @@ function runMaterializerStorageContractSuite(name, provider) {
|
|
|
9400
9512
|
versionId: "many-links-v1",
|
|
9401
9513
|
createdAt: "2026-02-01T00:00:00.000Z"
|
|
9402
9514
|
};
|
|
9403
|
-
const
|
|
9515
|
+
const execution = await claim(storage, {
|
|
9404
9516
|
runId: "many-links-v1",
|
|
9405
9517
|
projectionId: devicePeersProjection.id,
|
|
9406
9518
|
protocol: "replacement",
|
|
@@ -9410,7 +9522,7 @@ function runMaterializerStorageContractSuite(name, provider) {
|
|
|
9410
9522
|
await (await projectionMaterializer(materializer, storage, devicePeersProjection.id, "many-links-v1")).projections.replace({
|
|
9411
9523
|
source: { projectionId: devicePeersProjection.id },
|
|
9412
9524
|
datasetVersion,
|
|
9413
|
-
execution
|
|
9525
|
+
execution,
|
|
9414
9526
|
entries: entries(projectedLinks.map((ref) => ({
|
|
9415
9527
|
root: { kind: "link", ref },
|
|
9416
9528
|
assertions: [{ kind: "link", ref }]
|
|
@@ -9422,7 +9534,7 @@ function runMaterializerStorageContractSuite(name, provider) {
|
|
|
9422
9534
|
objectId: source.primaryId,
|
|
9423
9535
|
linkId: "peers"
|
|
9424
9536
|
});
|
|
9425
|
-
const fingerprint =
|
|
9537
|
+
const fingerprint = createLinkScopeFingerprint2(observedLinks.map((row) => {
|
|
9426
9538
|
if (row.lastCommitId === undefined) {
|
|
9427
9539
|
throw new Error("Projected contract link is missing materializer provenance.");
|
|
9428
9540
|
}
|
|
@@ -9433,7 +9545,7 @@ function runMaterializerStorageContractSuite(name, provider) {
|
|
|
9433
9545
|
lastCommitId: row.lastCommitId
|
|
9434
9546
|
};
|
|
9435
9547
|
}));
|
|
9436
|
-
const commitObservation = async (runId,
|
|
9548
|
+
const commitObservation = async (runId, name) => {
|
|
9437
9549
|
await queueTestActionRun(storage, {
|
|
9438
9550
|
id: runId,
|
|
9439
9551
|
projectId: "materializer-storage-contract",
|
|
@@ -9456,7 +9568,7 @@ function runMaterializerStorageContractSuite(name, provider) {
|
|
|
9456
9568
|
id: `record-${runId}`,
|
|
9457
9569
|
kind: "object.patch",
|
|
9458
9570
|
ref: source,
|
|
9459
|
-
set: { name
|
|
9571
|
+
set: { name },
|
|
9460
9572
|
unset: [],
|
|
9461
9573
|
reset: []
|
|
9462
9574
|
}
|
|
@@ -9509,14 +9621,14 @@ async function primitiveMaterializer(materializer, storage, primitive) {
|
|
|
9509
9621
|
projectId: "materializer-storage-contract",
|
|
9510
9622
|
id: primitive.runId
|
|
9511
9623
|
});
|
|
9512
|
-
const
|
|
9513
|
-
const
|
|
9624
|
+
const executionId = run?.executionId ?? `test_${primitive.kind}_execution:${primitive.runId}`;
|
|
9625
|
+
const execution = await storage.executions.getById({
|
|
9514
9626
|
projectId: "materializer-storage-contract",
|
|
9515
|
-
id:
|
|
9627
|
+
id: executionId
|
|
9516
9628
|
});
|
|
9517
|
-
if (!
|
|
9518
|
-
throw new Error(`Test execution '${
|
|
9519
|
-
return materializer.withScope(restoreTrustedPrimitiveExecutionScope({ execution
|
|
9629
|
+
if (!execution)
|
|
9630
|
+
throw new Error(`Test execution '${executionId}' is missing.`);
|
|
9631
|
+
return materializer.withScope(restoreTrustedPrimitiveExecutionScope({ execution, primitive }));
|
|
9520
9632
|
}
|
|
9521
9633
|
function requireContractStorage(storage) {
|
|
9522
9634
|
if (!storage.actionRuns) {
|
|
@@ -9565,16 +9677,16 @@ async function claim(storage, input) {
|
|
|
9565
9677
|
projectId: "materializer-storage-contract"
|
|
9566
9678
|
};
|
|
9567
9679
|
if (definition._tag === "TelemetryProjectionDefinition") {
|
|
9568
|
-
const
|
|
9680
|
+
const claim = await startTestProjectionRun(storage, {
|
|
9569
9681
|
...common,
|
|
9570
9682
|
identity: { ...identityBase, projectionKind: "telemetry", protocol: "telemetry" },
|
|
9571
9683
|
target: { objectTypeId: definition.objectTypeId },
|
|
9572
9684
|
fixedBatchSize: input.fixedBatchSize ?? 1
|
|
9573
9685
|
});
|
|
9574
|
-
return
|
|
9686
|
+
return claim.execution;
|
|
9575
9687
|
}
|
|
9576
9688
|
if (definition._tag === "LinkProjectionDefinition") {
|
|
9577
|
-
const
|
|
9689
|
+
const claim = await startTestProjectionRun(storage, {
|
|
9578
9690
|
...common,
|
|
9579
9691
|
identity: { ...identityBase, projectionKind: "link", protocol: "replacement" },
|
|
9580
9692
|
target: {
|
|
@@ -9582,106 +9694,106 @@ async function claim(storage, input) {
|
|
|
9582
9694
|
targetObjectTypeId: definition.targetObjectTypeId
|
|
9583
9695
|
}
|
|
9584
9696
|
});
|
|
9585
|
-
return
|
|
9697
|
+
return claim.execution;
|
|
9586
9698
|
}
|
|
9587
|
-
const
|
|
9699
|
+
const claim = await startTestProjectionRun(storage, {
|
|
9588
9700
|
...common,
|
|
9589
9701
|
identity: { ...identityBase, projectionKind: "object", protocol: "replacement" },
|
|
9590
9702
|
target: { objectTypeId: definition.objectTypeId }
|
|
9591
9703
|
});
|
|
9592
|
-
return
|
|
9704
|
+
return claim.execution;
|
|
9593
9705
|
}
|
|
9594
9706
|
// src/testing/object-query-contract.ts
|
|
9595
9707
|
import { describe as describe16, expect as expect17, test as test17 } from "bun:test";
|
|
9596
9708
|
var projectId10 = "object-query-contract";
|
|
9597
|
-
var Device3 =
|
|
9709
|
+
var Device3 = defineObjectType2({
|
|
9598
9710
|
id: "ContractDevice",
|
|
9599
9711
|
name: "Contract Device",
|
|
9600
9712
|
properties: [
|
|
9601
|
-
|
|
9713
|
+
prop2("id", "string", {
|
|
9602
9714
|
required: true,
|
|
9603
9715
|
primary: true,
|
|
9604
9716
|
query: { searchable: true, filterable: true, exact: true, sortable: true }
|
|
9605
9717
|
}),
|
|
9606
|
-
|
|
9718
|
+
prop2("name", "string", {
|
|
9607
9719
|
query: { searchable: true, text: true, filterable: true, exact: true, sortable: true }
|
|
9608
9720
|
})
|
|
9609
9721
|
],
|
|
9610
9722
|
search: { defaultText: ["name"] }
|
|
9611
9723
|
});
|
|
9612
|
-
var Room =
|
|
9724
|
+
var Room = defineObjectType2({
|
|
9613
9725
|
id: "ContractRoom",
|
|
9614
9726
|
name: "Contract Room",
|
|
9615
9727
|
properties: [
|
|
9616
|
-
|
|
9728
|
+
prop2("id", "string", {
|
|
9617
9729
|
required: true,
|
|
9618
9730
|
primary: true,
|
|
9619
9731
|
query: { searchable: true, filterable: true, exact: true, sortable: true }
|
|
9620
9732
|
}),
|
|
9621
|
-
|
|
9733
|
+
prop2("name", "string", {
|
|
9622
9734
|
query: { searchable: true, text: true, filterable: true, exact: true, sortable: true }
|
|
9623
9735
|
}),
|
|
9624
|
-
|
|
9736
|
+
prop2("description", "string", {
|
|
9625
9737
|
query: { searchable: true, text: true }
|
|
9626
9738
|
}),
|
|
9627
|
-
|
|
9739
|
+
prop2("floor", "string", {
|
|
9628
9740
|
nullable: true,
|
|
9629
9741
|
query: { searchable: true, filterable: true, exact: true, sortable: true }
|
|
9630
9742
|
}),
|
|
9631
|
-
|
|
9743
|
+
prop2("capacity", "double", {
|
|
9632
9744
|
query: { searchable: true, filterable: true, sortable: true }
|
|
9633
9745
|
}),
|
|
9634
|
-
|
|
9746
|
+
prop2("occupied", "boolean", {
|
|
9635
9747
|
query: { searchable: true, filterable: true, exact: true, facet: true }
|
|
9636
9748
|
}),
|
|
9637
|
-
|
|
9749
|
+
prop2("status", stringEnum2(["active", "paused"]), {
|
|
9638
9750
|
query: { searchable: true, filterable: true, exact: true, facet: true }
|
|
9639
9751
|
}),
|
|
9640
|
-
|
|
9641
|
-
|
|
9642
|
-
|
|
9752
|
+
prop2("tags", { type: "array", items: "string" }, { query: { searchable: true, filterable: true } }),
|
|
9753
|
+
prop2("metadata", { type: "map", keySchema: "string", valueSchema: "string" }, { query: { searchable: true, filterable: true } }),
|
|
9754
|
+
prop2("embedding", { type: "array", items: "double" }, { query: { searchable: true, vector: true } })
|
|
9643
9755
|
],
|
|
9644
|
-
links: [
|
|
9756
|
+
links: [link2("hasDevice", Device3)],
|
|
9645
9757
|
search: {
|
|
9646
9758
|
defaultText: ["name", "description"],
|
|
9647
9759
|
vector: { property: "embedding", source: ["name", "description"] }
|
|
9648
9760
|
}
|
|
9649
9761
|
});
|
|
9650
|
-
var Zone =
|
|
9762
|
+
var Zone = defineObjectType2({
|
|
9651
9763
|
id: "ContractZone",
|
|
9652
9764
|
name: "Contract Zone",
|
|
9653
|
-
properties: [
|
|
9654
|
-
links: [
|
|
9765
|
+
properties: [prop2("id", "string", { required: true, primary: true })],
|
|
9766
|
+
links: [link2("hasDevice", Device3)]
|
|
9655
9767
|
});
|
|
9656
|
-
var Asset =
|
|
9768
|
+
var Asset = defineObjectType2({
|
|
9657
9769
|
id: "ContractAsset",
|
|
9658
9770
|
name: "Contract Asset",
|
|
9659
|
-
properties: [
|
|
9771
|
+
properties: [prop2("id", "string", { required: true, primary: true })]
|
|
9660
9772
|
});
|
|
9661
|
-
var LaptopAsset =
|
|
9773
|
+
var LaptopAsset = defineObjectType2({
|
|
9662
9774
|
id: "ContractLaptopAsset",
|
|
9663
9775
|
name: "Contract Laptop Asset",
|
|
9664
9776
|
extends: Asset,
|
|
9665
9777
|
properties: []
|
|
9666
9778
|
});
|
|
9667
|
-
var DefaultTextBase =
|
|
9779
|
+
var DefaultTextBase = defineObjectType2({
|
|
9668
9780
|
id: "ContractDefaultTextBase",
|
|
9669
9781
|
name: "Contract Default Text Base",
|
|
9670
9782
|
properties: [
|
|
9671
|
-
|
|
9672
|
-
|
|
9673
|
-
|
|
9783
|
+
prop2("id", "string", { required: true, primary: true }),
|
|
9784
|
+
prop2("name", "string", { query: { searchable: true, text: true } }),
|
|
9785
|
+
prop2("alias", "string")
|
|
9674
9786
|
],
|
|
9675
9787
|
search: { defaultText: ["name"] }
|
|
9676
9788
|
});
|
|
9677
|
-
var DefaultTextChild =
|
|
9789
|
+
var DefaultTextChild = defineObjectType2({
|
|
9678
9790
|
id: "ContractDefaultTextChild",
|
|
9679
9791
|
name: "Contract Default Text Child",
|
|
9680
9792
|
extends: DefaultTextBase,
|
|
9681
|
-
properties: [
|
|
9793
|
+
properties: [prop2("alias", "string", { query: { searchable: true, text: true } })],
|
|
9682
9794
|
search: { defaultText: ["alias"] }
|
|
9683
9795
|
});
|
|
9684
|
-
var objectQueryContractOntology = new
|
|
9796
|
+
var objectQueryContractOntology = new OntologyRegistry2({
|
|
9685
9797
|
sources: [Room, Device3, Zone, Asset, LaptopAsset, DefaultTextBase, DefaultTextChild]
|
|
9686
9798
|
});
|
|
9687
9799
|
function runObjectQueryProviderContractSuite(label, options) {
|
|
@@ -9702,7 +9814,7 @@ function runObjectQueryProviderContractSuite(label, options) {
|
|
|
9702
9814
|
};
|
|
9703
9815
|
describe16(label, () => {
|
|
9704
9816
|
test17("normalizes query shape and resolves search profile defaults", () => {
|
|
9705
|
-
const normalized =
|
|
9817
|
+
const normalized = normalizeObjectQuery2({
|
|
9706
9818
|
kind: "limit",
|
|
9707
9819
|
limit: 10,
|
|
9708
9820
|
input: {
|
|
@@ -9732,7 +9844,7 @@ function runObjectQueryProviderContractSuite(label, options) {
|
|
|
9732
9844
|
if (normalized.input.input.kind !== "text")
|
|
9733
9845
|
return;
|
|
9734
9846
|
expect17(normalized.input.input.fields).toEqual(["name", "description"]);
|
|
9735
|
-
const validated =
|
|
9847
|
+
const validated = validateObjectQuery2({ kind: "text", query: "alpha", input: { kind: "start", objectTypeId: Room.id } }, { ontology: objectQueryContractOntology });
|
|
9736
9848
|
expect17(validated.query.kind).toBe("text");
|
|
9737
9849
|
if (validated.query.kind === "text") {
|
|
9738
9850
|
expect17(validated.query.fields).toBeUndefined();
|
|
@@ -9742,7 +9854,7 @@ function runObjectQueryProviderContractSuite(label, options) {
|
|
|
9742
9854
|
}
|
|
9743
9855
|
});
|
|
9744
9856
|
test17("collects validation failures before provider planning", () => {
|
|
9745
|
-
const issues =
|
|
9857
|
+
const issues = collectObjectQueryValidationIssues2({
|
|
9746
9858
|
kind: "filter",
|
|
9747
9859
|
predicate: { op: "eq", propertyId: "missing", value: "x" },
|
|
9748
9860
|
input: {
|
|
@@ -9805,7 +9917,7 @@ function runObjectQueryProviderContractSuite(label, options) {
|
|
|
9805
9917
|
test17("pushes down scalar predicates, boolean groups, sorting, limits, and projections", async () => {
|
|
9806
9918
|
await withStorage(async ({ objects: storage, fixture }) => {
|
|
9807
9919
|
await seedObjectQueryContractData(fixture);
|
|
9808
|
-
const result = await
|
|
9920
|
+
const result = await executeObjectQuery2({
|
|
9809
9921
|
projectId: projectId10,
|
|
9810
9922
|
query: {
|
|
9811
9923
|
kind: "project",
|
|
@@ -9864,7 +9976,7 @@ function runObjectQueryProviderContractSuite(label, options) {
|
|
|
9864
9976
|
objectSeed(Asset.id, issue298, { id: issue298 })
|
|
9865
9977
|
]
|
|
9866
9978
|
});
|
|
9867
|
-
const refs = await
|
|
9979
|
+
const refs = await executeObjectQuery2({
|
|
9868
9980
|
projectId: projectId10,
|
|
9869
9981
|
query: {
|
|
9870
9982
|
kind: "refs",
|
|
@@ -9887,7 +9999,7 @@ function runObjectQueryProviderContractSuite(label, options) {
|
|
|
9887
9999
|
{ objectTypeId: Room.id, primaryId: "missing" },
|
|
9888
10000
|
{ objectTypeId: Room.id, primaryId: "room-alpha" }
|
|
9889
10001
|
];
|
|
9890
|
-
const first = await
|
|
10002
|
+
const first = await executeObjectQuery2({
|
|
9891
10003
|
projectId: projectId10,
|
|
9892
10004
|
query: {
|
|
9893
10005
|
kind: "project",
|
|
@@ -9895,7 +10007,7 @@ function runObjectQueryProviderContractSuite(label, options) {
|
|
|
9895
10007
|
input: { kind: "page", pageSize: 2, input: { kind: "refs", refs } }
|
|
9896
10008
|
}
|
|
9897
10009
|
}, { ontology: objectQueryContractOntology, storage });
|
|
9898
|
-
const second = await
|
|
10010
|
+
const second = await executeObjectQuery2({
|
|
9899
10011
|
projectId: projectId10,
|
|
9900
10012
|
query: {
|
|
9901
10013
|
kind: "project",
|
|
@@ -9908,7 +10020,7 @@ function runObjectQueryProviderContractSuite(label, options) {
|
|
|
9908
10020
|
}
|
|
9909
10021
|
}
|
|
9910
10022
|
}, { ontology: objectQueryContractOntology, storage });
|
|
9911
|
-
const count = await
|
|
10023
|
+
const count = await countObjects2({ projectId: projectId10, query: { kind: "refs", refs } }, { ontology: objectQueryContractOntology, storage });
|
|
9912
10024
|
const expectedMode = storage.queryCapabilities().nodes?.refs === true ? "pushdown" : "fallback";
|
|
9913
10025
|
expect17(first.plan.mode).toBe(expectedMode);
|
|
9914
10026
|
expect17(ids(first)).toEqual(["device-sensor", "room-alpha"]);
|
|
@@ -9931,7 +10043,7 @@ function runObjectQueryProviderContractSuite(label, options) {
|
|
|
9931
10043
|
if (storage.queryCapabilities().nodes?.refs !== true)
|
|
9932
10044
|
return;
|
|
9933
10045
|
await seedObjectQueryContractData(fixture);
|
|
9934
|
-
const result = await
|
|
10046
|
+
const result = await executeObjectQuery2({
|
|
9935
10047
|
projectId: projectId10,
|
|
9936
10048
|
query: {
|
|
9937
10049
|
kind: "traverse",
|
|
@@ -9954,14 +10066,14 @@ function runObjectQueryProviderContractSuite(label, options) {
|
|
|
9954
10066
|
kind: "refs",
|
|
9955
10067
|
refs: [{ objectTypeId: Device3.id, primaryId: "device-projector" }]
|
|
9956
10068
|
};
|
|
9957
|
-
const first = await
|
|
10069
|
+
const first = await executeObjectQueryLinks2({
|
|
9958
10070
|
projectId: projectId10,
|
|
9959
10071
|
query,
|
|
9960
10072
|
direction: "incoming",
|
|
9961
10073
|
includeObjects: true,
|
|
9962
10074
|
pageSize: 1
|
|
9963
10075
|
}, { ontology: objectQueryContractOntology, storage });
|
|
9964
|
-
const second = await
|
|
10076
|
+
const second = await executeObjectQueryLinks2({
|
|
9965
10077
|
projectId: projectId10,
|
|
9966
10078
|
query,
|
|
9967
10079
|
direction: "incoming",
|
|
@@ -10000,7 +10112,7 @@ function runObjectQueryProviderContractSuite(label, options) {
|
|
|
10000
10112
|
test17("does not admit a provider page probe into the link selector", async () => {
|
|
10001
10113
|
await withStorage(async ({ objects: storage, fixture }) => {
|
|
10002
10114
|
await seedObjectQueryContractData(fixture);
|
|
10003
|
-
const result = await
|
|
10115
|
+
const result = await executeObjectQueryLinks2({
|
|
10004
10116
|
projectId: projectId10,
|
|
10005
10117
|
query: {
|
|
10006
10118
|
kind: "page",
|
|
@@ -10021,7 +10133,7 @@ function runObjectQueryProviderContractSuite(label, options) {
|
|
|
10021
10133
|
test17("matches null, missing, neq, in, and not predicate semantics", async () => {
|
|
10022
10134
|
await withStorage(async ({ objects: storage, fixture }) => {
|
|
10023
10135
|
await seedObjectQueryContractData(fixture);
|
|
10024
|
-
const nullable = await
|
|
10136
|
+
const nullable = await executeObjectQuery2({
|
|
10025
10137
|
projectId: projectId10,
|
|
10026
10138
|
query: {
|
|
10027
10139
|
kind: "sort",
|
|
@@ -10039,7 +10151,7 @@ function runObjectQueryProviderContractSuite(label, options) {
|
|
|
10039
10151
|
}
|
|
10040
10152
|
}
|
|
10041
10153
|
}, { ontology: objectQueryContractOntology, storage });
|
|
10042
|
-
const notTwoOrNull = await
|
|
10154
|
+
const notTwoOrNull = await executeObjectQuery2({
|
|
10043
10155
|
projectId: projectId10,
|
|
10044
10156
|
query: {
|
|
10045
10157
|
kind: "sort",
|
|
@@ -10057,7 +10169,7 @@ function runObjectQueryProviderContractSuite(label, options) {
|
|
|
10057
10169
|
}
|
|
10058
10170
|
}
|
|
10059
10171
|
}, { ontology: objectQueryContractOntology, storage });
|
|
10060
|
-
const notNullFloor = await
|
|
10172
|
+
const notNullFloor = await executeObjectQuery2({
|
|
10061
10173
|
projectId: projectId10,
|
|
10062
10174
|
query: {
|
|
10063
10175
|
kind: "sort",
|
|
@@ -10069,7 +10181,7 @@ function runObjectQueryProviderContractSuite(label, options) {
|
|
|
10069
10181
|
}
|
|
10070
10182
|
}
|
|
10071
10183
|
}, { ontology: objectQueryContractOntology, storage });
|
|
10072
|
-
const notFloorTwo = await
|
|
10184
|
+
const notFloorTwo = await executeObjectQuery2({
|
|
10073
10185
|
projectId: projectId10,
|
|
10074
10186
|
query: {
|
|
10075
10187
|
kind: "sort",
|
|
@@ -10104,7 +10216,7 @@ function runObjectQueryProviderContractSuite(label, options) {
|
|
|
10104
10216
|
input: { kind: "start", objectTypeId: Room.id }
|
|
10105
10217
|
}
|
|
10106
10218
|
};
|
|
10107
|
-
const page1 = await
|
|
10219
|
+
const page1 = await executeObjectQuery2({
|
|
10108
10220
|
projectId: projectId10,
|
|
10109
10221
|
query: {
|
|
10110
10222
|
kind: "project",
|
|
@@ -10112,7 +10224,7 @@ function runObjectQueryProviderContractSuite(label, options) {
|
|
|
10112
10224
|
input: { kind: "page", pageSize: 2, input }
|
|
10113
10225
|
}
|
|
10114
10226
|
}, { ontology: objectQueryContractOntology, storage });
|
|
10115
|
-
const page2 = await
|
|
10227
|
+
const page2 = await executeObjectQuery2({
|
|
10116
10228
|
projectId: projectId10,
|
|
10117
10229
|
query: {
|
|
10118
10230
|
kind: "project",
|
|
@@ -10134,17 +10246,17 @@ function runObjectQueryProviderContractSuite(label, options) {
|
|
|
10134
10246
|
test17("omits totals when requested without losing hasMore", async () => {
|
|
10135
10247
|
await withStorage(async ({ objects: storage, fixture }) => {
|
|
10136
10248
|
await seedObjectQueryContractData(fixture);
|
|
10137
|
-
const limited = await
|
|
10249
|
+
const limited = await executeObjectQuery2({
|
|
10138
10250
|
projectId: projectId10,
|
|
10139
10251
|
includeTotal: false,
|
|
10140
10252
|
query: { kind: "limit", limit: 2, input: { kind: "start", objectTypeId: Room.id } }
|
|
10141
10253
|
}, { ontology: objectQueryContractOntology, storage });
|
|
10142
|
-
const page = await
|
|
10254
|
+
const page = await executeObjectQuery2({
|
|
10143
10255
|
projectId: projectId10,
|
|
10144
10256
|
includeTotal: false,
|
|
10145
10257
|
query: { kind: "page", pageSize: 2, input: { kind: "start", objectTypeId: Room.id } }
|
|
10146
10258
|
}, { ontology: objectQueryContractOntology, storage });
|
|
10147
|
-
const sortedLimited = await
|
|
10259
|
+
const sortedLimited = await executeObjectQuery2({
|
|
10148
10260
|
projectId: projectId10,
|
|
10149
10261
|
includeTotal: false,
|
|
10150
10262
|
query: {
|
|
@@ -10169,7 +10281,7 @@ function runObjectQueryProviderContractSuite(label, options) {
|
|
|
10169
10281
|
test17("counts matching objects without returning rows", async () => {
|
|
10170
10282
|
await withStorage(async ({ objects: storage, fixture }) => {
|
|
10171
10283
|
await seedObjectQueryContractData(fixture);
|
|
10172
|
-
const active = await
|
|
10284
|
+
const active = await countObjects2({
|
|
10173
10285
|
projectId: projectId10,
|
|
10174
10286
|
query: {
|
|
10175
10287
|
kind: "filter",
|
|
@@ -10177,7 +10289,7 @@ function runObjectQueryProviderContractSuite(label, options) {
|
|
|
10177
10289
|
input: { kind: "start", objectTypeId: Room.id }
|
|
10178
10290
|
}
|
|
10179
10291
|
}, { ontology: objectQueryContractOntology, storage });
|
|
10180
|
-
const limited = await
|
|
10292
|
+
const limited = await countObjects2({
|
|
10181
10293
|
projectId: projectId10,
|
|
10182
10294
|
query: { kind: "limit", limit: 2, input: { kind: "start", objectTypeId: Room.id } }
|
|
10183
10295
|
}, { ontology: objectQueryContractOntology, storage });
|
|
@@ -10189,7 +10301,7 @@ function runObjectQueryProviderContractSuite(label, options) {
|
|
|
10189
10301
|
test17("checks existence without returning rows", async () => {
|
|
10190
10302
|
await withStorage(async ({ objects: storage, fixture }) => {
|
|
10191
10303
|
await seedObjectQueryContractData(fixture);
|
|
10192
|
-
const active = await
|
|
10304
|
+
const active = await existsObjects2({
|
|
10193
10305
|
projectId: projectId10,
|
|
10194
10306
|
query: {
|
|
10195
10307
|
kind: "filter",
|
|
@@ -10197,7 +10309,7 @@ function runObjectQueryProviderContractSuite(label, options) {
|
|
|
10197
10309
|
input: { kind: "start", objectTypeId: Room.id }
|
|
10198
10310
|
}
|
|
10199
10311
|
}, { ontology: objectQueryContractOntology, storage });
|
|
10200
|
-
const missing = await
|
|
10312
|
+
const missing = await existsObjects2({
|
|
10201
10313
|
projectId: projectId10,
|
|
10202
10314
|
query: {
|
|
10203
10315
|
kind: "filter",
|
|
@@ -10205,7 +10317,7 @@ function runObjectQueryProviderContractSuite(label, options) {
|
|
|
10205
10317
|
input: { kind: "start", objectTypeId: Room.id }
|
|
10206
10318
|
}
|
|
10207
10319
|
}, { ontology: objectQueryContractOntology, storage });
|
|
10208
|
-
const limited = await
|
|
10320
|
+
const limited = await existsObjects2({
|
|
10209
10321
|
projectId: projectId10,
|
|
10210
10322
|
query: { kind: "limit", limit: 0, input: { kind: "start", objectTypeId: Room.id } }
|
|
10211
10323
|
}, { ontology: objectQueryContractOntology, storage });
|
|
@@ -10227,8 +10339,8 @@ function runObjectQueryProviderContractSuite(label, options) {
|
|
|
10227
10339
|
input: { kind: "start", objectTypeId: Room.id }
|
|
10228
10340
|
}
|
|
10229
10341
|
};
|
|
10230
|
-
const count = await
|
|
10231
|
-
const exists = await
|
|
10342
|
+
const count = await countObjects2({ projectId: projectId10, query }, { ontology: objectQueryContractOntology, storage });
|
|
10343
|
+
const exists = await existsObjects2({ projectId: projectId10, query }, { ontology: objectQueryContractOntology, storage });
|
|
10232
10344
|
expect17(count.plan.mode).toBe("pushdown");
|
|
10233
10345
|
if (count.plan.mode !== "pushdown")
|
|
10234
10346
|
return;
|
|
@@ -10244,7 +10356,7 @@ function runObjectQueryProviderContractSuite(label, options) {
|
|
|
10244
10356
|
test17("counts matching objects by facetable properties without returning rows", async () => {
|
|
10245
10357
|
await withStorage(async ({ objects: storage, fixture }) => {
|
|
10246
10358
|
await seedObjectQueryContractData(fixture);
|
|
10247
|
-
const status = await
|
|
10359
|
+
const status = await facetObjects2({
|
|
10248
10360
|
projectId: projectId10,
|
|
10249
10361
|
query: { kind: "start", objectTypeId: Room.id },
|
|
10250
10362
|
facets: [
|
|
@@ -10252,7 +10364,7 @@ function runObjectQueryProviderContractSuite(label, options) {
|
|
|
10252
10364
|
{ propertyId: "occupied", limit: 10 }
|
|
10253
10365
|
]
|
|
10254
10366
|
}, { ontology: objectQueryContractOntology, storage });
|
|
10255
|
-
const limited = await
|
|
10367
|
+
const limited = await facetObjects2({
|
|
10256
10368
|
projectId: projectId10,
|
|
10257
10369
|
query: { kind: "limit", limit: 0, input: { kind: "start", objectTypeId: Room.id } },
|
|
10258
10370
|
facets: [
|
|
@@ -10283,7 +10395,7 @@ function runObjectQueryProviderContractSuite(label, options) {
|
|
|
10283
10395
|
test17("pushes down traversal and set operations", async () => {
|
|
10284
10396
|
await withStorage(async ({ objects: storage, fixture }) => {
|
|
10285
10397
|
await seedObjectQueryContractData(fixture);
|
|
10286
|
-
const outgoing = await
|
|
10398
|
+
const outgoing = await executeObjectQuery2({
|
|
10287
10399
|
projectId: projectId10,
|
|
10288
10400
|
query: {
|
|
10289
10401
|
kind: "traverse",
|
|
@@ -10296,7 +10408,7 @@ function runObjectQueryProviderContractSuite(label, options) {
|
|
|
10296
10408
|
}
|
|
10297
10409
|
}
|
|
10298
10410
|
}, { ontology: objectQueryContractOntology, storage });
|
|
10299
|
-
const incoming = await
|
|
10411
|
+
const incoming = await executeObjectQuery2({
|
|
10300
10412
|
projectId: projectId10,
|
|
10301
10413
|
query: {
|
|
10302
10414
|
kind: "traverse",
|
|
@@ -10305,7 +10417,7 @@ function runObjectQueryProviderContractSuite(label, options) {
|
|
|
10305
10417
|
input: { kind: "start", objectTypeId: Device3.id }
|
|
10306
10418
|
}
|
|
10307
10419
|
}, { ontology: objectQueryContractOntology, storage });
|
|
10308
|
-
const incomingRooms = await
|
|
10420
|
+
const incomingRooms = await executeObjectQuery2({
|
|
10309
10421
|
projectId: projectId10,
|
|
10310
10422
|
query: {
|
|
10311
10423
|
kind: "traverse",
|
|
@@ -10315,7 +10427,7 @@ function runObjectQueryProviderContractSuite(label, options) {
|
|
|
10315
10427
|
input: { kind: "start", objectTypeId: Device3.id }
|
|
10316
10428
|
}
|
|
10317
10429
|
}, { ontology: objectQueryContractOntology, storage });
|
|
10318
|
-
const incomingZones = await
|
|
10430
|
+
const incomingZones = await executeObjectQuery2({
|
|
10319
10431
|
projectId: projectId10,
|
|
10320
10432
|
query: {
|
|
10321
10433
|
kind: "traverse",
|
|
@@ -10325,7 +10437,7 @@ function runObjectQueryProviderContractSuite(label, options) {
|
|
|
10325
10437
|
input: { kind: "start", objectTypeId: Device3.id }
|
|
10326
10438
|
}
|
|
10327
10439
|
}, { ontology: objectQueryContractOntology, storage });
|
|
10328
|
-
const intersect = await
|
|
10440
|
+
const intersect = await executeObjectQuery2({
|
|
10329
10441
|
projectId: projectId10,
|
|
10330
10442
|
query: {
|
|
10331
10443
|
kind: "set",
|
|
@@ -10344,7 +10456,7 @@ function runObjectQueryProviderContractSuite(label, options) {
|
|
|
10344
10456
|
]
|
|
10345
10457
|
}
|
|
10346
10458
|
}, { ontology: objectQueryContractOntology, storage });
|
|
10347
|
-
const subtract = await
|
|
10459
|
+
const subtract = await executeObjectQuery2({
|
|
10348
10460
|
projectId: projectId10,
|
|
10349
10461
|
query: {
|
|
10350
10462
|
kind: "set",
|
|
@@ -10377,7 +10489,7 @@ function runObjectQueryProviderContractSuite(label, options) {
|
|
|
10377
10489
|
test17("hydrates expand links identically via pushdown or bounded fallback", async () => {
|
|
10378
10490
|
await withStorage(async ({ objects: storage, fixture }) => {
|
|
10379
10491
|
await seedObjectQueryContractData(fixture);
|
|
10380
|
-
const outgoing = await
|
|
10492
|
+
const outgoing = await executeObjectQuery2({
|
|
10381
10493
|
projectId: projectId10,
|
|
10382
10494
|
query: {
|
|
10383
10495
|
kind: "expand",
|
|
@@ -10397,7 +10509,7 @@ function runObjectQueryProviderContractSuite(label, options) {
|
|
|
10397
10509
|
expect17(outgoing.plan.mode).toBe(expandMode);
|
|
10398
10510
|
expect17(expandedIds(outgoing, "room-alpha", "hasDevice")).toEqual(["device-projector"]);
|
|
10399
10511
|
expect17(expandedIds(outgoing, "room-beta", "hasDevice")).toEqual(["device-sensor"]);
|
|
10400
|
-
const incoming = await
|
|
10512
|
+
const incoming = await executeObjectQuery2({
|
|
10401
10513
|
projectId: projectId10,
|
|
10402
10514
|
query: {
|
|
10403
10515
|
kind: "expand",
|
|
@@ -10420,7 +10532,7 @@ function runObjectQueryProviderContractSuite(label, options) {
|
|
|
10420
10532
|
test17("expands includeSubtypes outside storage when the expanded query can push down", async () => {
|
|
10421
10533
|
await withStorage(async ({ objects: storage, fixture }) => {
|
|
10422
10534
|
await seedObjectQueryContractData(fixture);
|
|
10423
|
-
const result = await
|
|
10535
|
+
const result = await executeObjectQuery2({
|
|
10424
10536
|
projectId: projectId10,
|
|
10425
10537
|
query: {
|
|
10426
10538
|
kind: "limit",
|
|
@@ -10435,7 +10547,7 @@ function runObjectQueryProviderContractSuite(label, options) {
|
|
|
10435
10547
|
test17("pushes down basic text search using search profile defaults", async () => {
|
|
10436
10548
|
await withStorage(async ({ objects: storage, fixture }) => {
|
|
10437
10549
|
await seedObjectQueryContractData(fixture);
|
|
10438
|
-
const result = await
|
|
10550
|
+
const result = await executeObjectQuery2({
|
|
10439
10551
|
projectId: projectId10,
|
|
10440
10552
|
query: {
|
|
10441
10553
|
kind: "sort",
|
|
@@ -10465,7 +10577,7 @@ function runObjectQueryProviderContractSuite(label, options) {
|
|
|
10465
10577
|
}
|
|
10466
10578
|
]
|
|
10467
10579
|
});
|
|
10468
|
-
const result = await
|
|
10580
|
+
const result = await executeObjectQuery2({
|
|
10469
10581
|
projectId: projectId10,
|
|
10470
10582
|
query: {
|
|
10471
10583
|
kind: "text",
|
|
@@ -10493,12 +10605,12 @@ function runObjectQueryProviderContractSuite(label, options) {
|
|
|
10493
10605
|
}
|
|
10494
10606
|
};
|
|
10495
10607
|
if (storage.queryCapabilities().sortKinds?.relevance === true) {
|
|
10496
|
-
const result = await
|
|
10608
|
+
const result = await executeObjectQuery2({ projectId: projectId10, query }, { ontology: objectQueryContractOntology, storage });
|
|
10497
10609
|
expect17(result.plan.mode).toBe("pushdown");
|
|
10498
10610
|
expect17(ids(result)).toEqual(["room-alpha"]);
|
|
10499
10611
|
return;
|
|
10500
10612
|
}
|
|
10501
|
-
await expectPlanningIssue(
|
|
10613
|
+
await expectPlanningIssue(executeObjectQuery2({ projectId: projectId10, query }, { ontology: objectQueryContractOntology, storage }), "sort_kind_not_supported");
|
|
10502
10614
|
});
|
|
10503
10615
|
});
|
|
10504
10616
|
test17("executes or rejects vector search according to provider capabilities", async () => {
|
|
@@ -10512,19 +10624,19 @@ function runObjectQueryProviderContractSuite(label, options) {
|
|
|
10512
10624
|
input: { kind: "start", objectTypeId: Room.id }
|
|
10513
10625
|
};
|
|
10514
10626
|
if (storage.queryCapabilities().nodes?.vector === true) {
|
|
10515
|
-
const result = await
|
|
10627
|
+
const result = await executeObjectQuery2({ projectId: projectId10, query }, { ontology: objectQueryContractOntology, storage });
|
|
10516
10628
|
expect17(result.plan.mode).toBe("pushdown");
|
|
10517
10629
|
expect17(ids(result)).toEqual(["room-alpha", "room-beta"]);
|
|
10518
10630
|
return;
|
|
10519
10631
|
}
|
|
10520
|
-
await expectPlanningIssue(
|
|
10632
|
+
await expectPlanningIssue(executeObjectQuery2({ projectId: projectId10, query }, { ontology: objectQueryContractOntology, storage }), "query_node_not_supported");
|
|
10521
10633
|
});
|
|
10522
10634
|
});
|
|
10523
10635
|
test17("executes bounded fallback when pushdown is disabled for a safe query", async () => {
|
|
10524
10636
|
await withStorage(async ({ objects: storage, fixture }) => {
|
|
10525
10637
|
await seedObjectQueryContractData(fixture);
|
|
10526
10638
|
const fallbackStorage = withoutQueryPushdown(storage);
|
|
10527
|
-
const result = await
|
|
10639
|
+
const result = await executeObjectQuery2({
|
|
10528
10640
|
projectId: projectId10,
|
|
10529
10641
|
query: {
|
|
10530
10642
|
kind: "limit",
|
|
@@ -10548,7 +10660,7 @@ function runObjectQueryProviderContractSuite(label, options) {
|
|
|
10548
10660
|
await withStorage(async ({ objects: storage, fixture }) => {
|
|
10549
10661
|
await seedObjectQueryContractData(fixture);
|
|
10550
10662
|
const fallbackStorage = withoutQueryPushdown(storage);
|
|
10551
|
-
await expectPlanningIssue(
|
|
10663
|
+
await expectPlanningIssue(executeObjectQuery2({
|
|
10552
10664
|
projectId: projectId10,
|
|
10553
10665
|
query: {
|
|
10554
10666
|
kind: "limit",
|
|
@@ -10687,8 +10799,8 @@ async function expectPlanningIssue(promise, code) {
|
|
|
10687
10799
|
try {
|
|
10688
10800
|
await promise;
|
|
10689
10801
|
} catch (error) {
|
|
10690
|
-
expect17(error).toBeInstanceOf(
|
|
10691
|
-
if (error instanceof
|
|
10802
|
+
expect17(error).toBeInstanceOf(ObjectQueryPlanningError2);
|
|
10803
|
+
if (error instanceof ObjectQueryPlanningError2) {
|
|
10692
10804
|
expect17(error.issues.map((issue) => issue.code)).toContain(code);
|
|
10693
10805
|
}
|
|
10694
10806
|
return;
|
|
@@ -10699,54 +10811,54 @@ async function expectPlanningIssue(promise, code) {
|
|
|
10699
10811
|
import { describe as describe17, expect as expect18, test as test18 } from "bun:test";
|
|
10700
10812
|
var projectId11 = "object-read-scope-contract";
|
|
10701
10813
|
var otherProjectId3 = "object-read-scope-contract-other";
|
|
10702
|
-
var Product =
|
|
10814
|
+
var Product = defineObjectType2({
|
|
10703
10815
|
id: "ScopeProduct",
|
|
10704
10816
|
name: "Scope Product",
|
|
10705
10817
|
properties: [
|
|
10706
|
-
|
|
10707
|
-
|
|
10708
|
-
|
|
10818
|
+
prop2("id", "string", { required: true, primary: true }),
|
|
10819
|
+
prop2("name", "string", { query: { searchable: true, text: true } }),
|
|
10820
|
+
prop2("internal", "string")
|
|
10709
10821
|
],
|
|
10710
10822
|
search: { defaultText: ["name"] }
|
|
10711
10823
|
});
|
|
10712
|
-
var LineItem =
|
|
10824
|
+
var LineItem = defineObjectType2({
|
|
10713
10825
|
id: "ScopeLineItem",
|
|
10714
10826
|
name: "Scope Line Item",
|
|
10715
10827
|
properties: [
|
|
10716
|
-
|
|
10717
|
-
|
|
10718
|
-
|
|
10719
|
-
|
|
10720
|
-
|
|
10828
|
+
prop2("id", "string", { required: true, primary: true }),
|
|
10829
|
+
prop2("name", "string", { query: { searchable: true, text: true, sortable: true } }),
|
|
10830
|
+
prop2("price", "double", { query: { searchable: true, filterable: true, sortable: true } }),
|
|
10831
|
+
prop2("reviewNote", "string"),
|
|
10832
|
+
prop2("internal", "string")
|
|
10721
10833
|
],
|
|
10722
|
-
links: [
|
|
10834
|
+
links: [link2("product", Product, { cardinality: "one" })],
|
|
10723
10835
|
search: { defaultText: ["name"] }
|
|
10724
10836
|
});
|
|
10725
|
-
var Proposal =
|
|
10837
|
+
var Proposal = defineObjectType2({
|
|
10726
10838
|
id: "ScopeProposal",
|
|
10727
10839
|
name: "Scope Proposal",
|
|
10728
10840
|
properties: [
|
|
10729
|
-
|
|
10730
|
-
|
|
10841
|
+
prop2("id", "string", { required: true, primary: true }),
|
|
10842
|
+
prop2("title", "string", {
|
|
10731
10843
|
query: { searchable: true, text: true, filterable: true, sortable: true }
|
|
10732
10844
|
}),
|
|
10733
|
-
|
|
10734
|
-
|
|
10735
|
-
|
|
10736
|
-
|
|
10845
|
+
prop2("rank", "double", { query: { searchable: true, filterable: true, sortable: true } }),
|
|
10846
|
+
prop2("category", "string", { query: { searchable: true, filterable: true, facet: true } }),
|
|
10847
|
+
prop2("embedding", { type: "array", items: "double" }, { query: { searchable: true, vector: true } }),
|
|
10848
|
+
prop2("secret", "string", { query: { searchable: true, filterable: true, facet: true } })
|
|
10737
10849
|
],
|
|
10738
10850
|
links: [
|
|
10739
|
-
|
|
10740
|
-
properties: [
|
|
10851
|
+
link2("items", LineItem, {
|
|
10852
|
+
properties: [prop2("position", "double"), prop2("label", "string"), prop2("internal", "string")]
|
|
10741
10853
|
}),
|
|
10742
|
-
|
|
10743
|
-
|
|
10744
|
-
|
|
10745
|
-
|
|
10854
|
+
link2("reviewers", LineItem),
|
|
10855
|
+
link2.self("related"),
|
|
10856
|
+
link2("aPrivate", Product),
|
|
10857
|
+
link2("zVisible", Product)
|
|
10746
10858
|
],
|
|
10747
10859
|
search: { defaultText: ["title"] }
|
|
10748
10860
|
});
|
|
10749
|
-
var objectReadScopeContractOntology = new
|
|
10861
|
+
var objectReadScopeContractOntology = new OntologyRegistry2({
|
|
10750
10862
|
sources: [Proposal, LineItem, Product]
|
|
10751
10863
|
});
|
|
10752
10864
|
var limits = {
|
|
@@ -10870,10 +10982,10 @@ function runObjectReadScopeContractSuite(label, options) {
|
|
|
10870
10982
|
})).toMatchObject({ objects: [], total: 0 });
|
|
10871
10983
|
const reader = createReader(harness.objectReadScopeFactory);
|
|
10872
10984
|
const queryObjects = reader.queryObjects?.bind(reader);
|
|
10873
|
-
const
|
|
10874
|
-
const
|
|
10875
|
-
const
|
|
10876
|
-
if (!queryObjects || !
|
|
10985
|
+
const countObjects = reader.countObjects?.bind(reader);
|
|
10986
|
+
const existsObjects = reader.existsObjects?.bind(reader);
|
|
10987
|
+
const facetObjects = reader.facetObjects?.bind(reader);
|
|
10988
|
+
if (!queryObjects || !countObjects || !existsObjects || !facetObjects) {
|
|
10877
10989
|
throw new Error("Selected object-read scope contract requires every query terminal.");
|
|
10878
10990
|
}
|
|
10879
10991
|
const crossProjectCalls = [
|
|
@@ -10881,15 +10993,15 @@ function runObjectReadScopeContractSuite(label, options) {
|
|
|
10881
10993
|
projectId: otherProjectId3,
|
|
10882
10994
|
query: { kind: "start", objectTypeId: Proposal.id }
|
|
10883
10995
|
}),
|
|
10884
|
-
() =>
|
|
10996
|
+
() => countObjects({
|
|
10885
10997
|
projectId: otherProjectId3,
|
|
10886
10998
|
query: { kind: "start", objectTypeId: Proposal.id }
|
|
10887
10999
|
}),
|
|
10888
|
-
() =>
|
|
11000
|
+
() => existsObjects({
|
|
10889
11001
|
projectId: otherProjectId3,
|
|
10890
11002
|
query: { kind: "start", objectTypeId: Proposal.id }
|
|
10891
11003
|
}),
|
|
10892
|
-
() =>
|
|
11004
|
+
() => facetObjects({
|
|
10893
11005
|
projectId: otherProjectId3,
|
|
10894
11006
|
query: { kind: "start", objectTypeId: Proposal.id },
|
|
10895
11007
|
facets: [{ propertyId: "category", limit: 1 }]
|
|
@@ -10977,29 +11089,29 @@ function runObjectReadScopeContractSuite(label, options) {
|
|
|
10977
11089
|
]
|
|
10978
11090
|
});
|
|
10979
11091
|
expect18([...objects.keys()]).toEqual([
|
|
10980
|
-
|
|
10981
|
-
|
|
11092
|
+
objectBatchKey2(Proposal.id, "proposal-1"),
|
|
11093
|
+
objectBatchKey2(LineItem.id, "item:opaque|1")
|
|
10982
11094
|
]);
|
|
10983
|
-
expect18(objects.get(
|
|
11095
|
+
expect18(objects.get(objectBatchKey2(Proposal.id, "proposal-1"))?.properties).toEqual({
|
|
10984
11096
|
id: "proposal-1",
|
|
10985
11097
|
title: "Visible proposal",
|
|
10986
11098
|
rank: 50,
|
|
10987
11099
|
category: "visible",
|
|
10988
11100
|
embedding: [0, 1]
|
|
10989
11101
|
});
|
|
10990
|
-
expect18(objects.get(
|
|
10991
|
-
expect18(objects.get(
|
|
11102
|
+
expect18(objects.get(objectBatchKey2(Proposal.id, "proposal-1"))?.links).toBeUndefined();
|
|
11103
|
+
expect18(objects.get(objectBatchKey2(LineItem.id, "item:opaque|1"))?.properties).toEqual({
|
|
10992
11104
|
id: "item:opaque|1",
|
|
10993
11105
|
name: "Visible item",
|
|
10994
11106
|
reviewNote: "Property union"
|
|
10995
11107
|
});
|
|
10996
|
-
expect18(objects.get(
|
|
11108
|
+
expect18(objects.get(objectBatchKey2(LineItem.id, "item:opaque|1"))?.links).toBeUndefined();
|
|
10997
11109
|
const outgoing = await reader.listLinksBatch({
|
|
10998
11110
|
projectId: projectId11,
|
|
10999
11111
|
direction: "outgoing",
|
|
11000
11112
|
items: [{ objectTypeId: Proposal.id, objectId: "proposal-1", linkId: "items" }]
|
|
11001
11113
|
});
|
|
11002
|
-
const outgoingRows = outgoing.get(
|
|
11114
|
+
const outgoingRows = outgoing.get(linkBatchKey2(Proposal.id, "proposal-1", "items"));
|
|
11003
11115
|
expect18(outgoingRows).toHaveLength(1);
|
|
11004
11116
|
expect18(outgoingRows?.[0]?.targetId).toBe("item:opaque|1");
|
|
11005
11117
|
expect18(outgoingRows?.[0]?.properties).toEqual({ position: 1, label: "primary" });
|
|
@@ -11027,16 +11139,16 @@ function runObjectReadScopeContractSuite(label, options) {
|
|
|
11027
11139
|
direction: "incoming",
|
|
11028
11140
|
items: [{ objectTypeId: LineItem.id, objectId: "item:opaque|1", linkId: "items" }]
|
|
11029
11141
|
});
|
|
11030
|
-
const incomingRows = incoming.get(
|
|
11142
|
+
const incomingRows = incoming.get(linkBatchKey2(LineItem.id, "item:opaque|1", "items"));
|
|
11031
11143
|
expect18(incomingRows).toHaveLength(1);
|
|
11032
11144
|
expect18(incomingRows?.[0]?.properties).toEqual({ position: 1, label: "primary" });
|
|
11033
|
-
expect18(incoming.has(
|
|
11145
|
+
expect18(incoming.has(linkBatchKey2(Proposal.id, "proposal-1", "items"))).toBe(false);
|
|
11034
11146
|
const selfLoop = await reader.listLinksBatch({
|
|
11035
11147
|
projectId: projectId11,
|
|
11036
11148
|
direction: "both",
|
|
11037
11149
|
items: [{ objectTypeId: Proposal.id, objectId: "proposal-1", linkId: "related" }]
|
|
11038
11150
|
});
|
|
11039
|
-
expect18(selfLoop.get(
|
|
11151
|
+
expect18(selfLoop.get(linkBatchKey2(Proposal.id, "proposal-1", "related"))).toHaveLength(1);
|
|
11040
11152
|
});
|
|
11041
11153
|
});
|
|
11042
11154
|
test18("applies scope before query ordering, pagination, predicates, and aggregate terminals", async () => {
|
|
@@ -11172,7 +11284,7 @@ function runObjectReadScopeContractSuite(label, options) {
|
|
|
11172
11284
|
objectTypeId: Product.id,
|
|
11173
11285
|
primaryId: "product-review"
|
|
11174
11286
|
})).toBeNull();
|
|
11175
|
-
const expanded = await
|
|
11287
|
+
const expanded = await executeObjectQuery2({
|
|
11176
11288
|
projectId: projectId11,
|
|
11177
11289
|
query: {
|
|
11178
11290
|
kind: "expand",
|
|
@@ -11255,11 +11367,11 @@ function runObjectReadScopeContractSuite(label, options) {
|
|
|
11255
11367
|
await expect18(facetBound.facetObjects?.({
|
|
11256
11368
|
projectId: projectId11,
|
|
11257
11369
|
query: { kind: "start", objectTypeId: Proposal.id },
|
|
11258
|
-
facets: Array.from({ length:
|
|
11370
|
+
facets: Array.from({ length: MAX_OBJECT_READ_FACETS2 + 1 }, (_, index) => ({
|
|
11259
11371
|
propertyId: `facet-${index}`,
|
|
11260
11372
|
limit: 1
|
|
11261
11373
|
}))
|
|
11262
|
-
})).rejects.toThrow(`between 0 and ${
|
|
11374
|
+
})).rejects.toThrow(`between 0 and ${MAX_OBJECT_READ_FACETS2} facets`);
|
|
11263
11375
|
});
|
|
11264
11376
|
});
|
|
11265
11377
|
});
|
|
@@ -11267,7 +11379,7 @@ function runObjectReadScopeContractSuite(label, options) {
|
|
|
11267
11379
|
function createReader(factory, scope = proposalScope(), executionLimits = limits) {
|
|
11268
11380
|
return factory.createSelectedReadScope({
|
|
11269
11381
|
projectId: projectId11,
|
|
11270
|
-
scope:
|
|
11382
|
+
scope: compileSelectedObjectReadScope2(scope),
|
|
11271
11383
|
limits: executionLimits
|
|
11272
11384
|
});
|
|
11273
11385
|
}
|
|
@@ -11606,13 +11718,13 @@ function runOntologyStorageContractSuite(label, options) {
|
|
|
11606
11718
|
identity,
|
|
11607
11719
|
target: { objectTypeId: "ContractDevice" }
|
|
11608
11720
|
});
|
|
11609
|
-
const
|
|
11721
|
+
const execution = claimed.execution;
|
|
11610
11722
|
const source = { projectionId: identity.projectionId };
|
|
11611
11723
|
await expect19(storage.ontology.sources.beginMaterialization({
|
|
11612
11724
|
projectId: "contract-project",
|
|
11613
11725
|
source,
|
|
11614
11726
|
materializationId: "mismatched-candidate",
|
|
11615
|
-
execution
|
|
11727
|
+
execution,
|
|
11616
11728
|
projectionKind: "link",
|
|
11617
11729
|
protocol: "replacement",
|
|
11618
11730
|
datasetVersion: identity.datasetVersion,
|
|
@@ -11625,7 +11737,7 @@ function runOntologyStorageContractSuite(label, options) {
|
|
|
11625
11737
|
projectId: "contract-project",
|
|
11626
11738
|
source,
|
|
11627
11739
|
materializationId: "staging-candidate",
|
|
11628
|
-
execution
|
|
11740
|
+
execution,
|
|
11629
11741
|
projectionKind: "object",
|
|
11630
11742
|
protocol: "replacement",
|
|
11631
11743
|
datasetVersion: identity.datasetVersion,
|
|
@@ -11651,21 +11763,21 @@ function runOntologyStorageContractSuite(label, options) {
|
|
|
11651
11763
|
projectId: "contract-project",
|
|
11652
11764
|
source,
|
|
11653
11765
|
materializationId: "staging-candidate",
|
|
11654
|
-
execution
|
|
11766
|
+
execution,
|
|
11655
11767
|
rows: [row]
|
|
11656
11768
|
})).toEqual({ inserted: 1, unchanged: 0 });
|
|
11657
11769
|
expect19(await storage.ontology.sources.stageRows({
|
|
11658
11770
|
projectId: "contract-project",
|
|
11659
11771
|
source,
|
|
11660
11772
|
materializationId: "staging-candidate",
|
|
11661
|
-
execution
|
|
11773
|
+
execution,
|
|
11662
11774
|
rows: [row]
|
|
11663
11775
|
})).toEqual({ inserted: 0, unchanged: 1 });
|
|
11664
11776
|
await expect19(storage.ontology.sources.stageRows({
|
|
11665
11777
|
projectId: "contract-project",
|
|
11666
11778
|
source,
|
|
11667
11779
|
materializationId: "staging-candidate",
|
|
11668
|
-
execution
|
|
11780
|
+
execution,
|
|
11669
11781
|
rows: [
|
|
11670
11782
|
{
|
|
11671
11783
|
...row,
|
|
@@ -11677,7 +11789,7 @@ function runOntologyStorageContractSuite(label, options) {
|
|
|
11677
11789
|
projectId: "contract-project",
|
|
11678
11790
|
source,
|
|
11679
11791
|
materializationId: "staging-candidate",
|
|
11680
|
-
execution
|
|
11792
|
+
execution,
|
|
11681
11793
|
rootCount: 1,
|
|
11682
11794
|
assertionCount: 1,
|
|
11683
11795
|
readyAt: "2026-01-01T00:01:00.000Z"
|
|
@@ -11693,14 +11805,14 @@ function runOntologyStorageContractSuite(label, options) {
|
|
|
11693
11805
|
projectId: "contract-project",
|
|
11694
11806
|
source,
|
|
11695
11807
|
materializationId: "staging-candidate",
|
|
11696
|
-
execution
|
|
11808
|
+
execution,
|
|
11697
11809
|
rows: []
|
|
11698
11810
|
})).rejects.toMatchObject({ kind: "execution-lost" });
|
|
11699
11811
|
await expect19(storage.ontology.sources.markReady({
|
|
11700
11812
|
projectId: "contract-project",
|
|
11701
11813
|
source,
|
|
11702
11814
|
materializationId: "staging-candidate",
|
|
11703
|
-
execution
|
|
11815
|
+
execution,
|
|
11704
11816
|
rootCount: 1,
|
|
11705
11817
|
assertionCount: 1,
|
|
11706
11818
|
readyAt: "2026-01-01T00:03:00.000Z"
|
|
@@ -11710,7 +11822,7 @@ function runOntologyStorageContractSuite(label, options) {
|
|
|
11710
11822
|
projectId: "contract-project",
|
|
11711
11823
|
source,
|
|
11712
11824
|
materializationId: "staging-candidate",
|
|
11713
|
-
execution
|
|
11825
|
+
execution,
|
|
11714
11826
|
abandonedAt: "2026-01-01T00:03:00.000Z"
|
|
11715
11827
|
})).rejects.toMatchObject({ kind: "execution-lost" });
|
|
11716
11828
|
const abandoned = await storage.ontology.sources.abandon({
|
|
@@ -12059,13 +12171,13 @@ async function createReadyEmptyCandidate(storage, runId, materializationId, vers
|
|
|
12059
12171
|
identity,
|
|
12060
12172
|
target: { objectTypeId: "ContractDevice" }
|
|
12061
12173
|
});
|
|
12062
|
-
const
|
|
12174
|
+
const execution = run.execution;
|
|
12063
12175
|
const source = { projectionId: identity.projectionId };
|
|
12064
12176
|
await storage.ontology.sources.beginMaterialization({
|
|
12065
12177
|
projectId: run.run.projectId,
|
|
12066
12178
|
source,
|
|
12067
12179
|
materializationId,
|
|
12068
|
-
execution
|
|
12180
|
+
execution,
|
|
12069
12181
|
projectionKind: "object",
|
|
12070
12182
|
protocol: "replacement",
|
|
12071
12183
|
datasetVersion: identity.datasetVersion,
|
|
@@ -12078,12 +12190,12 @@ async function createReadyEmptyCandidate(storage, runId, materializationId, vers
|
|
|
12078
12190
|
projectId: run.run.projectId,
|
|
12079
12191
|
source,
|
|
12080
12192
|
materializationId,
|
|
12081
|
-
execution
|
|
12193
|
+
execution,
|
|
12082
12194
|
rootCount: 0,
|
|
12083
12195
|
assertionCount: 0,
|
|
12084
12196
|
readyAt: new Date(Date.parse(identity.datasetVersion.createdAt) + 1000).toISOString()
|
|
12085
12197
|
});
|
|
12086
|
-
return { identity, execution
|
|
12198
|
+
return { identity, execution, materializationId, source, executionId: run.run.executionId };
|
|
12087
12199
|
}
|
|
12088
12200
|
async function activateEmptyCandidate(storage, candidate, expectedActive, commitId, committedAt) {
|
|
12089
12201
|
const expected = {
|
|
@@ -12166,7 +12278,7 @@ async function activateEmptyCandidate(storage, candidate, expectedActive, commit
|
|
|
12166
12278
|
await tx.ontology.materializations.finalize({ session, finalization });
|
|
12167
12279
|
});
|
|
12168
12280
|
}
|
|
12169
|
-
function telemetryHeader(identity, projectionRunId,
|
|
12281
|
+
function telemetryHeader(identity, projectionRunId, executionId) {
|
|
12170
12282
|
if (identity.protocol !== "telemetry")
|
|
12171
12283
|
throw new Error("Expected telemetry identity");
|
|
12172
12284
|
return {
|
|
@@ -12175,7 +12287,7 @@ function telemetryHeader(identity, projectionRunId, executionId3) {
|
|
|
12175
12287
|
id: "telemetry-commit",
|
|
12176
12288
|
idempotencyKey: "telemetry:telemetry-run:0",
|
|
12177
12289
|
requestHash: "hash:telemetry-run:0",
|
|
12178
|
-
executionId
|
|
12290
|
+
executionId,
|
|
12179
12291
|
origin: {
|
|
12180
12292
|
kind: "telemetry",
|
|
12181
12293
|
source: {
|
|
@@ -12211,34 +12323,34 @@ function telemetryHeader(identity, projectionRunId, executionId3) {
|
|
|
12211
12323
|
}
|
|
12212
12324
|
// src/testing/pipeline-execution.ts
|
|
12213
12325
|
async function createTestPipelineExecution(executions, input) {
|
|
12214
|
-
const
|
|
12215
|
-
const existing = await executions.getById({ projectId: input.projectId, id:
|
|
12326
|
+
const executionId = input.executionId ?? `test_pipeline_execution:${input.runId}`;
|
|
12327
|
+
const existing = await executions.getById({ projectId: input.projectId, id: executionId });
|
|
12216
12328
|
if (existing)
|
|
12217
|
-
return
|
|
12329
|
+
return executionId;
|
|
12218
12330
|
const primitive = {
|
|
12219
12331
|
kind: "pipeline",
|
|
12220
12332
|
id: input.pipelineId,
|
|
12221
12333
|
runId: input.runId
|
|
12222
12334
|
};
|
|
12223
12335
|
await executions.create({
|
|
12224
|
-
id:
|
|
12336
|
+
id: executionId,
|
|
12225
12337
|
projectId: input.projectId,
|
|
12226
12338
|
executor: { type: "primitive", kind: primitive.kind, runId: primitive.runId },
|
|
12227
12339
|
source: { type: "event", eventId: `test_event:${input.runId}` },
|
|
12228
12340
|
correlationId: `test_correlation:${input.runId}`,
|
|
12229
12341
|
authorizationRef: { type: "trustedPrimitive", primitive }
|
|
12230
12342
|
});
|
|
12231
|
-
return
|
|
12343
|
+
return executionId;
|
|
12232
12344
|
}
|
|
12233
12345
|
async function queueTestPipelineRun(storage, input) {
|
|
12234
12346
|
if (!storage.pipelineRuns)
|
|
12235
12347
|
throw new Error("Pipeline run storage is not configured for this test.");
|
|
12236
|
-
const
|
|
12348
|
+
const executionId = await createTestPipelineExecution(storage.executions, {
|
|
12237
12349
|
projectId: input.projectId,
|
|
12238
12350
|
pipelineId: input.pipelineId,
|
|
12239
12351
|
runId: input.id
|
|
12240
12352
|
});
|
|
12241
|
-
return storage.pipelineRuns.queue({ ...input, executionId
|
|
12353
|
+
return storage.pipelineRuns.queue({ ...input, executionId });
|
|
12242
12354
|
}
|
|
12243
12355
|
async function startTestPipelineRun(storage, input) {
|
|
12244
12356
|
const { startedAt, ...queuedRun } = input;
|
|
@@ -12400,12 +12512,12 @@ function runProjectionRunStorageContractSuite(label, options) {
|
|
|
12400
12512
|
const storage = context.projectionRuns;
|
|
12401
12513
|
const input = replacementInput("identity-run");
|
|
12402
12514
|
await admitProjectionRun(context, input);
|
|
12403
|
-
const
|
|
12515
|
+
const claim = await storage.startOrReclaim(input);
|
|
12404
12516
|
const changedIdentity = { ...replacementIdentity2, ownershipHash: "different-ownership" };
|
|
12405
12517
|
await expect20(storage.startOrReclaim({ ...input, identity: changedIdentity })).rejects.toThrow("identity does not match");
|
|
12406
12518
|
await expect20(storage.startOrReclaim({ ...input, target: { objectTypeId: "OtherDevice" } })).rejects.toThrow("target object types do not match");
|
|
12407
12519
|
await expect20(storage.lockForMaterialization({
|
|
12408
|
-
...executionInput(
|
|
12520
|
+
...executionInput(claim),
|
|
12409
12521
|
identity: changedIdentity
|
|
12410
12522
|
})).rejects.toThrow("identity does not match");
|
|
12411
12523
|
});
|
|
@@ -12414,17 +12526,17 @@ function runProjectionRunStorageContractSuite(label, options) {
|
|
|
12414
12526
|
await withStorage(async (context) => {
|
|
12415
12527
|
const storage = context.projectionRuns;
|
|
12416
12528
|
await admitProjectionRun(context, replacementInput("progress-run"));
|
|
12417
|
-
const
|
|
12418
|
-
const
|
|
12529
|
+
const claim = await storage.startOrReclaim(replacementInput("progress-run"));
|
|
12530
|
+
const execution = executionInput(claim);
|
|
12419
12531
|
await expect20(storage.update({
|
|
12420
|
-
...
|
|
12532
|
+
...execution,
|
|
12421
12533
|
progress: { sourceRowsRead: 1, sourceRowsSkipped: 2 }
|
|
12422
12534
|
})).rejects.toThrow("sourceRowsSkipped must not exceed sourceRowsRead");
|
|
12423
12535
|
await storage.update({
|
|
12424
|
-
...
|
|
12536
|
+
...execution,
|
|
12425
12537
|
progress: { sourceRowsRead: 5, sourceRowsSkipped: 1 }
|
|
12426
12538
|
});
|
|
12427
|
-
await expect20(storage.update({ ...
|
|
12539
|
+
await expect20(storage.update({ ...execution, progress: { sourceRowsRead: 4 } })).rejects.toThrow("must not decrease");
|
|
12428
12540
|
});
|
|
12429
12541
|
});
|
|
12430
12542
|
test20("rejects immutable dataset-version metadata reuse", async () => {
|
|
@@ -12453,9 +12565,9 @@ function runProjectionRunStorageContractSuite(label, options) {
|
|
|
12453
12565
|
fixedBatchSize: 3
|
|
12454
12566
|
};
|
|
12455
12567
|
await admitProjectionRun(context, input);
|
|
12456
|
-
const
|
|
12457
|
-
const
|
|
12458
|
-
expect20(
|
|
12568
|
+
const claim = await storage.startOrReclaim(input);
|
|
12569
|
+
const execution = executionInput(claim);
|
|
12570
|
+
expect20(claim.run).toMatchObject({
|
|
12459
12571
|
telemetryCheckpoint: {
|
|
12460
12572
|
fixedBatchSize: 3,
|
|
12461
12573
|
nextBatchOrdinal: 0,
|
|
@@ -12463,30 +12575,30 @@ function runProjectionRunStorageContractSuite(label, options) {
|
|
|
12463
12575
|
inputExhausted: false
|
|
12464
12576
|
}
|
|
12465
12577
|
});
|
|
12466
|
-
await expect20(storage.update({ ...
|
|
12578
|
+
await expect20(storage.update({ ...execution, progress: { sourceRowsRead: 1 } })).rejects.toThrow("can only advance with its checkpoint");
|
|
12467
12579
|
await storage.advanceTelemetryCheckpoint({
|
|
12468
|
-
...
|
|
12580
|
+
...execution,
|
|
12469
12581
|
batchOrdinal: 0,
|
|
12470
12582
|
batchRowCount: 3,
|
|
12471
12583
|
batchRowsSkipped: 1,
|
|
12472
12584
|
inputExhausted: false
|
|
12473
12585
|
});
|
|
12474
12586
|
await expect20(storage.advanceTelemetryCheckpoint({
|
|
12475
|
-
...
|
|
12587
|
+
...execution,
|
|
12476
12588
|
batchOrdinal: 2,
|
|
12477
12589
|
batchRowCount: 1,
|
|
12478
12590
|
batchRowsSkipped: 0,
|
|
12479
12591
|
inputExhausted: true
|
|
12480
12592
|
})).rejects.toThrow("expected batch ordinal 1");
|
|
12481
12593
|
await expect20(storage.advanceTelemetryCheckpoint({
|
|
12482
|
-
...
|
|
12594
|
+
...execution,
|
|
12483
12595
|
batchOrdinal: 1,
|
|
12484
12596
|
batchRowCount: 1,
|
|
12485
12597
|
batchRowsSkipped: 0,
|
|
12486
12598
|
inputExhausted: false
|
|
12487
12599
|
})).rejects.toThrow("partial non-final batch");
|
|
12488
12600
|
const exhausted = await storage.advanceTelemetryCheckpoint({
|
|
12489
|
-
...
|
|
12601
|
+
...execution,
|
|
12490
12602
|
batchOrdinal: 1,
|
|
12491
12603
|
batchRowCount: 2,
|
|
12492
12604
|
batchRowsSkipped: 1,
|
|
@@ -12509,8 +12621,8 @@ function runProjectionRunStorageContractSuite(label, options) {
|
|
|
12509
12621
|
fixedBatchSize: 2
|
|
12510
12622
|
};
|
|
12511
12623
|
await admitProjectionRun(context, input);
|
|
12512
|
-
const
|
|
12513
|
-
const
|
|
12624
|
+
const claim = await storage.startOrReclaim(input);
|
|
12625
|
+
const execution = executionInput(claim);
|
|
12514
12626
|
const firstSeenAt = new Date("2026-06-01T12:00:00.000Z");
|
|
12515
12627
|
const missingTarget = {
|
|
12516
12628
|
objectTypeId: "Device",
|
|
@@ -12518,15 +12630,15 @@ function runProjectionRunStorageContractSuite(label, options) {
|
|
|
12518
12630
|
batchOrdinal: 0,
|
|
12519
12631
|
firstSeenAt
|
|
12520
12632
|
};
|
|
12521
|
-
const waiting = await storage.recordMissingTarget({ ...
|
|
12633
|
+
const waiting = await storage.recordMissingTarget({ ...execution, missingTarget });
|
|
12522
12634
|
expect20(waiting.missingTarget).toEqual(missingTarget);
|
|
12523
12635
|
expect20((await storage.getById({ projectId: projectId12, id: "telemetry-missing-target-run" }))?.missingTarget).toEqual(missingTarget);
|
|
12524
12636
|
await expect20(storage.recordMissingTarget({
|
|
12525
|
-
...
|
|
12637
|
+
...execution,
|
|
12526
12638
|
missingTarget: { ...missingTarget, batchOrdinal: 1 }
|
|
12527
12639
|
})).rejects.toThrow("cannot wait on batch 1");
|
|
12528
12640
|
await expect20(storage.recordMissingTarget({
|
|
12529
|
-
...
|
|
12641
|
+
...execution,
|
|
12530
12642
|
missingTarget: { ...missingTarget, objectTypeId: "Building" }
|
|
12531
12643
|
})).rejects.toThrow("cannot wait on 'Building'");
|
|
12532
12644
|
for (const partial of [
|
|
@@ -12535,17 +12647,17 @@ function runProjectionRunStorageContractSuite(label, options) {
|
|
|
12535
12647
|
{ firstSeenAt: new Date(Number.NaN) }
|
|
12536
12648
|
]) {
|
|
12537
12649
|
await expect20(storage.recordMissingTarget({
|
|
12538
|
-
...
|
|
12650
|
+
...execution,
|
|
12539
12651
|
missingTarget: { ...missingTarget, ...partial }
|
|
12540
12652
|
})).rejects.toThrow();
|
|
12541
12653
|
}
|
|
12542
12654
|
const rerecorded = await storage.recordMissingTarget({
|
|
12543
|
-
...
|
|
12655
|
+
...execution,
|
|
12544
12656
|
missingTarget: { ...missingTarget, firstSeenAt: new Date("2026-06-01T12:01:00.000Z") }
|
|
12545
12657
|
});
|
|
12546
12658
|
expect20(rerecorded.missingTarget?.firstSeenAt).toEqual(new Date("2026-06-01T12:01:00.000Z"));
|
|
12547
12659
|
const advanced = await storage.advanceTelemetryCheckpoint({
|
|
12548
|
-
...
|
|
12660
|
+
...execution,
|
|
12549
12661
|
batchOrdinal: 0,
|
|
12550
12662
|
batchRowCount: 2,
|
|
12551
12663
|
batchRowsSkipped: 0,
|
|
@@ -12565,18 +12677,18 @@ function runProjectionRunStorageContractSuite(label, options) {
|
|
|
12565
12677
|
fixedBatchSize: 10
|
|
12566
12678
|
};
|
|
12567
12679
|
await admitProjectionRun(context, input);
|
|
12568
|
-
const
|
|
12680
|
+
const claim = await storage.startOrReclaim(input);
|
|
12569
12681
|
await expect20(storage.finish({
|
|
12570
|
-
...executionInput(
|
|
12682
|
+
...executionInput(claim),
|
|
12571
12683
|
protocol: "telemetry",
|
|
12572
12684
|
status: "succeeded"
|
|
12573
12685
|
})).rejects.toThrow("cannot succeed before input exhaustion");
|
|
12574
|
-
await expect20(storage.getById({ projectId: projectId12, id:
|
|
12686
|
+
await expect20(storage.getById({ projectId: projectId12, id: claim.run.id })).resolves.toMatchObject({
|
|
12575
12687
|
status: "running",
|
|
12576
12688
|
telemetryCheckpoint: { inputExhausted: false }
|
|
12577
12689
|
});
|
|
12578
12690
|
const finished = await storage.finish({
|
|
12579
|
-
...executionInput(
|
|
12691
|
+
...executionInput(claim),
|
|
12580
12692
|
protocol: "telemetry",
|
|
12581
12693
|
status: "succeeded",
|
|
12582
12694
|
inputExhausted: true
|
|
@@ -12586,16 +12698,16 @@ function runProjectionRunStorageContractSuite(label, options) {
|
|
|
12586
12698
|
progress: { sourceRowsRead: 0 },
|
|
12587
12699
|
telemetryCheckpoint: { inputExhausted: true }
|
|
12588
12700
|
});
|
|
12589
|
-
await expect20(storage.lockForMaterialization(executionInput(
|
|
12701
|
+
await expect20(storage.lockForMaterialization(executionInput(claim))).rejects.toThrow("already terminal");
|
|
12590
12702
|
});
|
|
12591
12703
|
});
|
|
12592
12704
|
test20("validates, detaches, and persists scoped failures", async () => {
|
|
12593
12705
|
await withStorage(async (context) => {
|
|
12594
12706
|
const storage = context.projectionRuns;
|
|
12595
12707
|
await admitProjectionRun(context, replacementInput("failed-run"));
|
|
12596
|
-
const
|
|
12708
|
+
const claim = await storage.startOrReclaim(replacementInput("failed-run"));
|
|
12597
12709
|
const finished = await storage.finish({
|
|
12598
|
-
...executionInput(
|
|
12710
|
+
...executionInput(claim),
|
|
12599
12711
|
protocol: "replacement",
|
|
12600
12712
|
status: "failed",
|
|
12601
12713
|
finishedAt: new Date(failure2.at),
|
|
@@ -12637,9 +12749,9 @@ function runProjectionRunStorageContractSuite(label, options) {
|
|
|
12637
12749
|
});
|
|
12638
12750
|
}
|
|
12639
12751
|
async function admitProjectionRun(context, input) {
|
|
12640
|
-
const
|
|
12752
|
+
const executionId = `execution:${input.projectId}:${input.id}`;
|
|
12641
12753
|
await context.executions.create({
|
|
12642
|
-
id:
|
|
12754
|
+
id: executionId,
|
|
12643
12755
|
projectId: input.projectId,
|
|
12644
12756
|
executor: { type: "primitive", kind: "projection", runId: input.id },
|
|
12645
12757
|
source: {
|
|
@@ -12655,7 +12767,7 @@ async function admitProjectionRun(context, input) {
|
|
|
12655
12767
|
});
|
|
12656
12768
|
const admission = {
|
|
12657
12769
|
...input,
|
|
12658
|
-
executionId
|
|
12770
|
+
executionId,
|
|
12659
12771
|
queuedAt: new Date("2026-01-01T00:00:01.000Z")
|
|
12660
12772
|
};
|
|
12661
12773
|
await context.projectionRuns.queue(admission);
|
|
@@ -12664,12 +12776,12 @@ async function admitProjectionRun(context, input) {
|
|
|
12664
12776
|
function replacementInput(id) {
|
|
12665
12777
|
return { id, projectId: projectId12, identity: replacementIdentity2, target: objectTarget };
|
|
12666
12778
|
}
|
|
12667
|
-
function executionInput(
|
|
12779
|
+
function executionInput(claim) {
|
|
12668
12780
|
return {
|
|
12669
|
-
id:
|
|
12670
|
-
projectId:
|
|
12671
|
-
identity:
|
|
12672
|
-
executionToken:
|
|
12781
|
+
id: claim.run.id,
|
|
12782
|
+
projectId: claim.run.projectId,
|
|
12783
|
+
identity: claim.run.identity,
|
|
12784
|
+
executionToken: claim.execution.executionToken
|
|
12673
12785
|
};
|
|
12674
12786
|
}
|
|
12675
12787
|
// src/testing/queues-contract.ts
|
|
@@ -12779,7 +12891,7 @@ function runQueueContractSuite(label, options) {
|
|
|
12779
12891
|
await expect21(queues.syncRuns.enqueue({
|
|
12780
12892
|
projectId: " ",
|
|
12781
12893
|
jobs: [{ type: "sync.run.requested", payload: { runId: "sync-1" } }]
|
|
12782
|
-
})).rejects.toBeInstanceOf(
|
|
12894
|
+
})).rejects.toBeInstanceOf(QueueError2);
|
|
12783
12895
|
});
|
|
12784
12896
|
});
|
|
12785
12897
|
});
|
|
@@ -12826,8 +12938,8 @@ function runQueueContractSuite(label, options) {
|
|
|
12826
12938
|
projectId: "project-a",
|
|
12827
12939
|
jobs: [{ type: "sync.run.requested", payload: { runId: "s-1" } }]
|
|
12828
12940
|
});
|
|
12829
|
-
await expect21(queues.syncRuns.claim({ projectId: "project-a", workerId: "w-1", leaseMs: 0 })).rejects.toBeInstanceOf(
|
|
12830
|
-
await expect21(queues.syncRuns.claim({ projectId: "project-a", workerId: "w-1", leaseMs: -1 })).rejects.toBeInstanceOf(
|
|
12941
|
+
await expect21(queues.syncRuns.claim({ projectId: "project-a", workerId: "w-1", leaseMs: 0 })).rejects.toBeInstanceOf(QueueError2);
|
|
12942
|
+
await expect21(queues.syncRuns.claim({ projectId: "project-a", workerId: "w-1", leaseMs: -1 })).rejects.toBeInstanceOf(QueueError2);
|
|
12831
12943
|
});
|
|
12832
12944
|
});
|
|
12833
12945
|
test21("respects delayed visibility via availableAt", async () => {
|
|
@@ -12989,14 +13101,14 @@ function runQueueContractSuite(label, options) {
|
|
|
12989
13101
|
projectId: "project-a",
|
|
12990
13102
|
jobs: [{ type: "sync.run.requested", payload: { runId: "s-1" } }]
|
|
12991
13103
|
});
|
|
12992
|
-
const [
|
|
13104
|
+
const [claim] = await queues.syncRuns.claim({
|
|
12993
13105
|
projectId: "project-a",
|
|
12994
13106
|
workerId: "worker-1"
|
|
12995
13107
|
});
|
|
12996
13108
|
await queues.syncRuns.complete({
|
|
12997
13109
|
projectId: "project-a",
|
|
12998
13110
|
jobId: job.id,
|
|
12999
|
-
leaseId:
|
|
13111
|
+
leaseId: claim.leaseId
|
|
13000
13112
|
});
|
|
13001
13113
|
const later = await queues.syncRuns.claim({
|
|
13002
13114
|
projectId: "project-a",
|
|
@@ -13021,7 +13133,7 @@ function runQueueContractSuite(label, options) {
|
|
|
13021
13133
|
projectId: "project-a",
|
|
13022
13134
|
jobId: job.id,
|
|
13023
13135
|
leaseId: "not-the-right-lease"
|
|
13024
|
-
})).rejects.toBeInstanceOf(
|
|
13136
|
+
})).rejects.toBeInstanceOf(QueueError2);
|
|
13025
13137
|
});
|
|
13026
13138
|
});
|
|
13027
13139
|
});
|
|
@@ -13060,7 +13172,7 @@ function runQueueContractSuite(label, options) {
|
|
|
13060
13172
|
projectId: "project-a",
|
|
13061
13173
|
jobs: [{ type: "sync.run.requested", payload: { runId: "s-1" } }]
|
|
13062
13174
|
});
|
|
13063
|
-
const [
|
|
13175
|
+
const [claim] = await queues.syncRuns.claim({
|
|
13064
13176
|
projectId: "project-a",
|
|
13065
13177
|
workerId: "worker-1",
|
|
13066
13178
|
leaseMs: shortLeaseMs * 10
|
|
@@ -13068,9 +13180,9 @@ function runQueueContractSuite(label, options) {
|
|
|
13068
13180
|
await expect21(queues.syncRuns.retry({
|
|
13069
13181
|
projectId: "project-a",
|
|
13070
13182
|
jobId: job.id,
|
|
13071
|
-
leaseId:
|
|
13183
|
+
leaseId: claim.leaseId,
|
|
13072
13184
|
availableAt: "not-a-timestamp"
|
|
13073
|
-
})).rejects.toBeInstanceOf(
|
|
13185
|
+
})).rejects.toBeInstanceOf(QueueError2);
|
|
13074
13186
|
});
|
|
13075
13187
|
});
|
|
13076
13188
|
});
|
|
@@ -13081,14 +13193,14 @@ function runQueueContractSuite(label, options) {
|
|
|
13081
13193
|
projectId: "project-a",
|
|
13082
13194
|
jobs: [{ type: "pipeline.run.requested", payload: { runId: "p-1" } }]
|
|
13083
13195
|
});
|
|
13084
|
-
const [
|
|
13196
|
+
const [claim] = await queues.pipelines.claim({
|
|
13085
13197
|
projectId: "project-a",
|
|
13086
13198
|
workerId: "pipeline-worker-1"
|
|
13087
13199
|
});
|
|
13088
13200
|
await queues.pipelines.fail({
|
|
13089
13201
|
projectId: "project-a",
|
|
13090
13202
|
jobId: job.id,
|
|
13091
|
-
leaseId:
|
|
13203
|
+
leaseId: claim.leaseId,
|
|
13092
13204
|
failure: TERMINAL_FAILURE
|
|
13093
13205
|
});
|
|
13094
13206
|
const later = await queues.pipelines.claim({
|
|
@@ -13107,7 +13219,7 @@ function runQueueContractSuite(label, options) {
|
|
|
13107
13219
|
projectId: "project-a",
|
|
13108
13220
|
jobs: [{ type: "sync.run.requested", payload: { runId: "s-1" } }]
|
|
13109
13221
|
});
|
|
13110
|
-
const [
|
|
13222
|
+
const [claim] = await queues.syncRuns.claim({
|
|
13111
13223
|
projectId: "project-a",
|
|
13112
13224
|
workerId: "worker-1",
|
|
13113
13225
|
leaseMs: shortLeaseMs + 20
|
|
@@ -13115,12 +13227,12 @@ function runQueueContractSuite(label, options) {
|
|
|
13115
13227
|
const renewed = await queues.syncRuns.renewLease?.({
|
|
13116
13228
|
projectId: "project-a",
|
|
13117
13229
|
jobId: job.id,
|
|
13118
|
-
leaseId:
|
|
13230
|
+
leaseId: claim.leaseId,
|
|
13119
13231
|
leaseMs: shortLeaseMs * 5
|
|
13120
13232
|
});
|
|
13121
13233
|
expect21(renewed?.job.id).toBe(job?.id);
|
|
13122
|
-
expect21(renewed?.leaseId).toBe(
|
|
13123
|
-
expect21(Date.parse(renewed.leaseExpiresAt)).toBeGreaterThan(Date.parse(
|
|
13234
|
+
expect21(renewed?.leaseId).toBe(claim?.leaseId);
|
|
13235
|
+
expect21(Date.parse(renewed.leaseExpiresAt)).toBeGreaterThan(Date.parse(claim.leaseExpiresAt));
|
|
13124
13236
|
});
|
|
13125
13237
|
});
|
|
13126
13238
|
test21("returns null for unknown jobId", async () => {
|
|
@@ -13184,7 +13296,7 @@ function runQueueContractSuite(label, options) {
|
|
|
13184
13296
|
projectId: "project-a",
|
|
13185
13297
|
jobs: [{ type: "sync.run.requested", payload: { runId: "s-1" } }]
|
|
13186
13298
|
});
|
|
13187
|
-
const [
|
|
13299
|
+
const [claim] = await queues.syncRuns.claim({
|
|
13188
13300
|
projectId: "project-a",
|
|
13189
13301
|
workerId: "worker-1",
|
|
13190
13302
|
leaseMs: shortLeaseMs
|
|
@@ -13193,8 +13305,8 @@ function runQueueContractSuite(label, options) {
|
|
|
13193
13305
|
await expect21(queues.syncRuns.complete({
|
|
13194
13306
|
projectId: "project-a",
|
|
13195
13307
|
jobId: job.id,
|
|
13196
|
-
leaseId:
|
|
13197
|
-
})).rejects.toBeInstanceOf(
|
|
13308
|
+
leaseId: claim.leaseId
|
|
13309
|
+
})).rejects.toBeInstanceOf(QueueError2);
|
|
13198
13310
|
});
|
|
13199
13311
|
});
|
|
13200
13312
|
});
|
|
@@ -13283,7 +13395,7 @@ function runSandboxesContractSuite(label, options) {
|
|
|
13283
13395
|
try {
|
|
13284
13396
|
await sandbox.stop();
|
|
13285
13397
|
expect22(sandbox.status).toBe("stopped");
|
|
13286
|
-
await expect22(sandbox.runCommand("echo", ["nope"])).rejects.toBeInstanceOf(
|
|
13398
|
+
await expect22(sandbox.runCommand("echo", ["nope"])).rejects.toBeInstanceOf(SandboxNotRunningError2);
|
|
13287
13399
|
} finally {
|
|
13288
13400
|
await sandbox.destroy();
|
|
13289
13401
|
}
|
|
@@ -13292,7 +13404,7 @@ function runSandboxesContractSuite(label, options) {
|
|
|
13292
13404
|
const sandbox = await factory.create();
|
|
13293
13405
|
await sandbox.destroy();
|
|
13294
13406
|
await sandbox.destroy();
|
|
13295
|
-
await expect22(sandbox.runCommand("echo", ["x"])).rejects.toBeInstanceOf(
|
|
13407
|
+
await expect22(sandbox.runCommand("echo", ["x"])).rejects.toBeInstanceOf(SandboxNotRunningError2);
|
|
13296
13408
|
});
|
|
13297
13409
|
});
|
|
13298
13410
|
describe21("working directory", () => {
|
|
@@ -13471,7 +13583,7 @@ echo ran
|
|
|
13471
13583
|
const sandbox = await factory.create();
|
|
13472
13584
|
await sandbox.stop();
|
|
13473
13585
|
try {
|
|
13474
|
-
await expect22(sandbox.writeFiles([{ path: `${sandbox.workingDirectory}/x.txt`, contents: "x" }])).rejects.toThrow(
|
|
13586
|
+
await expect22(sandbox.writeFiles([{ path: `${sandbox.workingDirectory}/x.txt`, contents: "x" }])).rejects.toThrow(SandboxNotRunningError2);
|
|
13475
13587
|
} finally {
|
|
13476
13588
|
await sandbox.destroy();
|
|
13477
13589
|
}
|
|
@@ -13975,34 +14087,34 @@ function renewalInput(overrides = {}) {
|
|
|
13975
14087
|
}
|
|
13976
14088
|
// src/testing/sync-execution.ts
|
|
13977
14089
|
async function createTestSyncExecution(executions, input) {
|
|
13978
|
-
const
|
|
13979
|
-
const existing = await executions.getById({ projectId: input.projectId, id:
|
|
14090
|
+
const executionId = input.executionId ?? `test_sync_execution:${input.runId}`;
|
|
14091
|
+
const existing = await executions.getById({ projectId: input.projectId, id: executionId });
|
|
13980
14092
|
if (existing)
|
|
13981
|
-
return
|
|
14093
|
+
return executionId;
|
|
13982
14094
|
const primitive = {
|
|
13983
14095
|
kind: "sync",
|
|
13984
14096
|
id: input.syncId,
|
|
13985
14097
|
runId: input.runId
|
|
13986
14098
|
};
|
|
13987
14099
|
await executions.create({
|
|
13988
|
-
id:
|
|
14100
|
+
id: executionId,
|
|
13989
14101
|
projectId: input.projectId,
|
|
13990
14102
|
executor: { type: "primitive", kind: primitive.kind, runId: primitive.runId },
|
|
13991
14103
|
source: { type: "event", eventId: `test_event:${input.runId}` },
|
|
13992
14104
|
correlationId: `test_correlation:${input.runId}`,
|
|
13993
14105
|
authorizationRef: { type: "trustedPrimitive", primitive }
|
|
13994
14106
|
});
|
|
13995
|
-
return
|
|
14107
|
+
return executionId;
|
|
13996
14108
|
}
|
|
13997
14109
|
async function queueTestSyncRun(storage, input) {
|
|
13998
14110
|
if (!storage.syncRuns)
|
|
13999
14111
|
throw new Error("Sync run storage is not configured for this test.");
|
|
14000
|
-
const
|
|
14112
|
+
const executionId = await createTestSyncExecution(storage.executions, {
|
|
14001
14113
|
projectId: input.projectId,
|
|
14002
14114
|
syncId: input.syncId,
|
|
14003
14115
|
runId: input.id
|
|
14004
14116
|
});
|
|
14005
|
-
return storage.syncRuns.queue({ ...input, executionId
|
|
14117
|
+
return storage.syncRuns.queue({ ...input, executionId });
|
|
14006
14118
|
}
|
|
14007
14119
|
async function startTestSyncRun(storage, input) {
|
|
14008
14120
|
const { startedAt, ...queuedRun } = input;
|
|
@@ -14015,34 +14127,34 @@ async function startTestSyncRun(storage, input) {
|
|
|
14015
14127
|
}
|
|
14016
14128
|
// src/testing/webhook-execution.ts
|
|
14017
14129
|
async function createTestWebhookExecution(executions, input) {
|
|
14018
|
-
const
|
|
14019
|
-
const existing = await executions.getById({ projectId: input.projectId, id:
|
|
14130
|
+
const executionId = input.executionId ?? `test_webhook_execution:${input.runId}`;
|
|
14131
|
+
const existing = await executions.getById({ projectId: input.projectId, id: executionId });
|
|
14020
14132
|
if (existing)
|
|
14021
|
-
return
|
|
14133
|
+
return executionId;
|
|
14022
14134
|
const primitive = {
|
|
14023
14135
|
kind: "webhook",
|
|
14024
14136
|
id: input.route,
|
|
14025
14137
|
runId: input.runId
|
|
14026
14138
|
};
|
|
14027
14139
|
await executions.create({
|
|
14028
|
-
id:
|
|
14140
|
+
id: executionId,
|
|
14029
14141
|
projectId: input.projectId,
|
|
14030
14142
|
executor: { type: "primitive", kind: primitive.kind, runId: primitive.runId },
|
|
14031
14143
|
source: { type: "webhook", deliveryId: input.runId },
|
|
14032
14144
|
correlationId: `test_correlation:${input.runId}`,
|
|
14033
14145
|
authorizationRef: { type: "trustedPrimitive", primitive }
|
|
14034
14146
|
});
|
|
14035
|
-
return
|
|
14147
|
+
return executionId;
|
|
14036
14148
|
}
|
|
14037
14149
|
async function startTestWebhookRun(storage, input) {
|
|
14038
14150
|
if (!storage.webhookRuns)
|
|
14039
14151
|
throw new Error("Webhook run storage is not configured for this test.");
|
|
14040
|
-
const
|
|
14152
|
+
const executionId = await createTestWebhookExecution(storage.executions, {
|
|
14041
14153
|
projectId: input.projectId,
|
|
14042
14154
|
route: input.route,
|
|
14043
14155
|
runId: input.id
|
|
14044
14156
|
});
|
|
14045
|
-
return storage.webhookRuns.start({ ...input, executionId
|
|
14157
|
+
return storage.webhookRuns.start({ ...input, executionId });
|
|
14046
14158
|
}
|
|
14047
14159
|
// src/testing/webhook-run-storage-contract.ts
|
|
14048
14160
|
import { describe as describe24, expect as expect25, test as test25 } from "bun:test";
|
|
@@ -14235,57 +14347,57 @@ function disabledRequestExecution(id) {
|
|
|
14235
14347
|
};
|
|
14236
14348
|
}
|
|
14237
14349
|
export {
|
|
14238
|
-
|
|
14239
|
-
startTestSyncRun,
|
|
14240
|
-
startTestProjectionRun,
|
|
14241
|
-
startTestPipelineRun,
|
|
14242
|
-
seedObjectQueryContractData,
|
|
14243
|
-
seedAiUsageStorageContractExecutions,
|
|
14244
|
-
seedAiLimitStorageContractExecution,
|
|
14245
|
-
seedAiCostStorageContractUsage,
|
|
14246
|
-
runWebhookRunStorageContractSuite,
|
|
14247
|
-
runShareSessionStorageContractSuite,
|
|
14248
|
-
runShareGrantStorageContractSuite,
|
|
14249
|
-
runSandboxesContractSuite,
|
|
14250
|
-
runQueueContractSuite,
|
|
14251
|
-
runProjectionRunStorageContractSuite,
|
|
14252
|
-
runOntologyStorageContractSuite,
|
|
14253
|
-
runObjectReadScopeContractSuite,
|
|
14254
|
-
runObjectQueryProviderContractSuite,
|
|
14255
|
-
runMaterializerStorageContractSuite,
|
|
14256
|
-
runMaterializationFailureContractSuite,
|
|
14257
|
-
runLakeStorageContractSuite,
|
|
14258
|
-
runLakeMergeStorageContractSuite,
|
|
14259
|
-
runExecutionStorageContractSuite,
|
|
14260
|
-
runEffectiveStorageContractSuite,
|
|
14261
|
-
runConnectorConnectionStorageContractSuite,
|
|
14262
|
-
runBrokerContractSuite,
|
|
14263
|
-
runBlobStorageContractSuite,
|
|
14264
|
-
runAuthStorageContractSuite,
|
|
14265
|
-
runAiUsageStorageContractSuite,
|
|
14266
|
-
runAiModelCallGroupsContractSuite,
|
|
14267
|
-
runAiLimitStorageContractSuite,
|
|
14268
|
-
runAiCostStorageContractSuite,
|
|
14269
|
-
runAgentStorageContractSuite,
|
|
14270
|
-
queueTestSyncRun,
|
|
14271
|
-
queueTestProjectionRun,
|
|
14272
|
-
queueTestPipelineRun,
|
|
14273
|
-
queueTestActionRun,
|
|
14274
|
-
objectReadScopeContractOntology,
|
|
14275
|
-
objectQueryContractOntology,
|
|
14276
|
-
createTestWorkflowExecution,
|
|
14277
|
-
createTestWebhookExecution,
|
|
14278
|
-
createTestSyncExecution,
|
|
14279
|
-
createTestSixb,
|
|
14280
|
-
createTestProjectionExecution,
|
|
14281
|
-
createTestPipelineExecution,
|
|
14282
|
-
createTestAutomaticWorkflowExecution,
|
|
14283
|
-
createTestAgentExecution,
|
|
14284
|
-
createTestActionExecution,
|
|
14285
|
-
createShareSessionStorageContractInput,
|
|
14286
|
-
createShareGrantStorageContractInput,
|
|
14350
|
+
claimTestProjectionRun,
|
|
14287
14351
|
createMaterializerTestFixture,
|
|
14288
|
-
|
|
14352
|
+
createShareGrantStorageContractInput,
|
|
14353
|
+
createShareSessionStorageContractInput,
|
|
14354
|
+
createTestActionExecution,
|
|
14355
|
+
createTestAgentExecution,
|
|
14356
|
+
createTestAutomaticWorkflowExecution,
|
|
14357
|
+
createTestPipelineExecution,
|
|
14358
|
+
createTestProjectionExecution,
|
|
14359
|
+
createTestSixb,
|
|
14360
|
+
createTestSyncExecution,
|
|
14361
|
+
createTestWebhookExecution,
|
|
14362
|
+
createTestWorkflowExecution,
|
|
14363
|
+
objectQueryContractOntology,
|
|
14364
|
+
objectReadScopeContractOntology,
|
|
14365
|
+
queueTestActionRun,
|
|
14366
|
+
queueTestPipelineRun,
|
|
14367
|
+
queueTestProjectionRun,
|
|
14368
|
+
queueTestSyncRun,
|
|
14369
|
+
runAgentStorageContractSuite,
|
|
14370
|
+
runAiCostStorageContractSuite,
|
|
14371
|
+
runAiLimitStorageContractSuite,
|
|
14372
|
+
runAiModelCallGroupsContractSuite,
|
|
14373
|
+
runAiUsageStorageContractSuite,
|
|
14374
|
+
runAuthStorageContractSuite,
|
|
14375
|
+
runBlobStorageContractSuite,
|
|
14376
|
+
runBrokerContractSuite,
|
|
14377
|
+
runConnectorConnectionStorageContractSuite,
|
|
14378
|
+
runEffectiveStorageContractSuite,
|
|
14379
|
+
runExecutionStorageContractSuite,
|
|
14380
|
+
runLakeMergeStorageContractSuite,
|
|
14381
|
+
runLakeStorageContractSuite,
|
|
14382
|
+
runMaterializationFailureContractSuite,
|
|
14383
|
+
runMaterializerStorageContractSuite,
|
|
14384
|
+
runObjectQueryProviderContractSuite,
|
|
14385
|
+
runObjectReadScopeContractSuite,
|
|
14386
|
+
runOntologyStorageContractSuite,
|
|
14387
|
+
runProjectionRunStorageContractSuite,
|
|
14388
|
+
runQueueContractSuite,
|
|
14389
|
+
runSandboxesContractSuite,
|
|
14390
|
+
runShareGrantStorageContractSuite,
|
|
14391
|
+
runShareSessionStorageContractSuite,
|
|
14392
|
+
runWebhookRunStorageContractSuite,
|
|
14393
|
+
seedAiCostStorageContractUsage,
|
|
14394
|
+
seedAiLimitStorageContractExecution,
|
|
14395
|
+
seedAiUsageStorageContractExecutions,
|
|
14396
|
+
seedObjectQueryContractData,
|
|
14397
|
+
startTestPipelineRun,
|
|
14398
|
+
startTestProjectionRun,
|
|
14399
|
+
startTestSyncRun,
|
|
14400
|
+
startTestWebhookRun
|
|
14289
14401
|
};
|
|
14290
14402
|
|
|
14291
|
-
//# debugId=
|
|
14403
|
+
//# debugId=4F3927DB98A42FED64756E2164756E21
|