@fantastic.dev/better-stripe 0.90.0 → 0.92.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (239) hide show
  1. package/CHANGELOG.md +12 -0
  2. package/README.md +1 -1
  3. package/dist/client/billing/renewalAttach/internal/acquisition/ownedAcquisition.d.ts +41 -0
  4. package/dist/client/billing/renewalAttach/internal/acquisition/ownedAcquisition.d.ts.map +1 -0
  5. package/dist/client/billing/renewalAttach/internal/acquisition/ownedAcquisition.js +187 -0
  6. package/dist/client/billing/renewalAttach/internal/acquisition/ownedAcquisition.js.map +1 -0
  7. package/dist/client/billing/renewalAttach/internal/acquisition/rawAcquisition.d.ts +2 -23
  8. package/dist/client/billing/renewalAttach/internal/acquisition/rawAcquisition.d.ts.map +1 -1
  9. package/dist/client/billing/renewalAttach/internal/acquisition/rawAcquisition.js +1 -112
  10. package/dist/client/billing/renewalAttach/internal/acquisition/rawAcquisition.js.map +1 -1
  11. package/dist/client/billing/renewalAttach/internal/acquisition/rawWireSource.d.ts +8 -3
  12. package/dist/client/billing/renewalAttach/internal/acquisition/rawWireSource.d.ts.map +1 -1
  13. package/dist/client/billing/renewalAttach/internal/acquisition/rawWireSource.js +1 -0
  14. package/dist/client/billing/renewalAttach/internal/acquisition/rawWireSource.js.map +1 -1
  15. package/dist/client/billing/renewalAttach/internal/acquisition/test-fixtures/sourcePort.d.mts +1 -1
  16. package/dist/client/billing/renewalAttach/internal/configure/actor.d.ts +14 -0
  17. package/dist/client/billing/renewalAttach/internal/configure/actor.d.ts.map +1 -0
  18. package/dist/client/billing/renewalAttach/internal/configure/actor.js +444 -0
  19. package/dist/client/billing/renewalAttach/internal/configure/actor.js.map +1 -0
  20. package/dist/client/billing/renewalAttach/internal/configure/capture.d.ts +12 -0
  21. package/dist/client/billing/renewalAttach/internal/configure/capture.d.ts.map +1 -0
  22. package/dist/client/billing/renewalAttach/internal/configure/capture.js +99 -0
  23. package/dist/client/billing/renewalAttach/internal/configure/capture.js.map +1 -0
  24. package/dist/client/billing/renewalAttach/internal/configure/output.d.ts +16 -0
  25. package/dist/client/billing/renewalAttach/internal/configure/output.d.ts.map +1 -0
  26. package/dist/client/billing/renewalAttach/internal/configure/output.js +274 -0
  27. package/dist/client/billing/renewalAttach/internal/configure/output.js.map +1 -0
  28. package/dist/client/billing/renewalAttach/internal/configure/ownedContinuation.d.ts +3 -0
  29. package/dist/client/billing/renewalAttach/internal/configure/ownedContinuation.d.ts.map +1 -0
  30. package/dist/client/billing/renewalAttach/internal/configure/ownedContinuation.js +61 -0
  31. package/dist/client/billing/renewalAttach/internal/configure/ownedContinuation.js.map +1 -0
  32. package/dist/client/billing/renewalAttach/internal/configure/replay.d.ts +3 -0
  33. package/dist/client/billing/renewalAttach/internal/configure/replay.d.ts.map +1 -0
  34. package/dist/client/billing/renewalAttach/internal/configure/replay.js +9 -0
  35. package/dist/client/billing/renewalAttach/internal/configure/replay.js.map +1 -0
  36. package/dist/client/billing/renewalAttach/internal/configure/request.d.ts +39 -0
  37. package/dist/client/billing/renewalAttach/internal/configure/request.d.ts.map +1 -0
  38. package/dist/client/billing/renewalAttach/internal/configure/request.js +245 -0
  39. package/dist/client/billing/renewalAttach/internal/configure/request.js.map +1 -0
  40. package/dist/client/billing/renewalAttach/internal/configure/transport.d.ts +88 -0
  41. package/dist/client/billing/renewalAttach/internal/configure/transport.d.ts.map +1 -0
  42. package/dist/client/billing/renewalAttach/internal/configure/transport.js +289 -0
  43. package/dist/client/billing/renewalAttach/internal/configure/transport.js.map +1 -0
  44. package/dist/client/billing/renewalAttach/internal/observation/actor.d.ts +16 -0
  45. package/dist/client/billing/renewalAttach/internal/observation/actor.d.ts.map +1 -0
  46. package/dist/client/billing/renewalAttach/internal/observation/actor.js +383 -0
  47. package/dist/client/billing/renewalAttach/internal/observation/actor.js.map +1 -0
  48. package/dist/client/billing/renewalAttach/internal/observation/capture.d.ts +9 -0
  49. package/dist/client/billing/renewalAttach/internal/observation/capture.d.ts.map +1 -0
  50. package/dist/client/billing/renewalAttach/internal/observation/capture.js +216 -0
  51. package/dist/client/billing/renewalAttach/internal/observation/capture.js.map +1 -0
  52. package/dist/client/billing/renewalAttach/internal/observation/configureAcknowledgement.d.ts +5 -0
  53. package/dist/client/billing/renewalAttach/internal/observation/configureAcknowledgement.d.ts.map +1 -0
  54. package/dist/client/billing/renewalAttach/internal/observation/configureAcknowledgement.js +11 -0
  55. package/dist/client/billing/renewalAttach/internal/observation/configureAcknowledgement.js.map +1 -0
  56. package/dist/client/billing/renewalAttach/internal/observation/profile.d.ts +7 -0
  57. package/dist/client/billing/renewalAttach/internal/observation/profile.d.ts.map +1 -0
  58. package/dist/client/billing/renewalAttach/internal/observation/profile.js +190 -0
  59. package/dist/client/billing/renewalAttach/internal/observation/profile.js.map +1 -0
  60. package/dist/client/billing/renewalAttach/internal/observation/record.d.ts +5 -0
  61. package/dist/client/billing/renewalAttach/internal/observation/record.d.ts.map +1 -0
  62. package/dist/client/billing/renewalAttach/internal/observation/record.js +317 -0
  63. package/dist/client/billing/renewalAttach/internal/observation/record.js.map +1 -0
  64. package/dist/client/billing/renewalAttach/internal/observation/types.d.ts +84 -0
  65. package/dist/client/billing/renewalAttach/internal/observation/types.d.ts.map +1 -0
  66. package/dist/client/billing/renewalAttach/internal/observation/types.js +27 -0
  67. package/dist/client/billing/renewalAttach/internal/observation/types.js.map +1 -0
  68. package/dist/client/billing/renewalAttach/internal/operations/configureReadTransport.d.ts +18 -0
  69. package/dist/client/billing/renewalAttach/internal/operations/configureReadTransport.d.ts.map +1 -0
  70. package/dist/client/billing/renewalAttach/internal/operations/configureReadTransport.js +229 -0
  71. package/dist/client/billing/renewalAttach/internal/operations/configureReadTransport.js.map +1 -0
  72. package/dist/client/billing/renewalAttach/internal/operations/fixedTransport.d.ts +163 -0
  73. package/dist/client/billing/renewalAttach/internal/operations/fixedTransport.d.ts.map +1 -0
  74. package/dist/client/billing/renewalAttach/internal/operations/fixedTransport.js +443 -0
  75. package/dist/client/billing/renewalAttach/internal/operations/fixedTransport.js.map +1 -0
  76. package/dist/client/billing/renewalAttach/internal/operations/initialAttach.d.ts +8 -0
  77. package/dist/client/billing/renewalAttach/internal/operations/initialAttach.d.ts.map +1 -0
  78. package/dist/client/billing/renewalAttach/internal/operations/initialAttach.js +467 -0
  79. package/dist/client/billing/renewalAttach/internal/operations/initialAttach.js.map +1 -0
  80. package/dist/client/billing/renewalAttach/internal/operations/ownedAwait.d.ts +6 -0
  81. package/dist/client/billing/renewalAttach/internal/operations/ownedAwait.d.ts.map +1 -0
  82. package/dist/client/billing/renewalAttach/internal/operations/ownedAwait.js +59 -0
  83. package/dist/client/billing/renewalAttach/internal/operations/ownedAwait.js.map +1 -0
  84. package/dist/client/billing/renewalAttach/internal/operations/providerFailure.d.ts +10 -0
  85. package/dist/client/billing/renewalAttach/internal/operations/providerFailure.d.ts.map +1 -0
  86. package/dist/client/billing/renewalAttach/internal/operations/providerFailure.js +48 -0
  87. package/dist/client/billing/renewalAttach/internal/operations/providerFailure.js.map +1 -0
  88. package/dist/client/billing/renewalAttach/internal/operations/sourceOperations.d.ts +20 -0
  89. package/dist/client/billing/renewalAttach/internal/operations/sourceOperations.d.ts.map +1 -0
  90. package/dist/client/billing/renewalAttach/internal/operations/sourceOperations.js +44 -0
  91. package/dist/client/billing/renewalAttach/internal/operations/sourceOperations.js.map +1 -0
  92. package/dist/client/billing/renewalAttach/internal/operations/types.d.ts +42 -0
  93. package/dist/client/billing/renewalAttach/internal/operations/types.d.ts.map +1 -0
  94. package/dist/client/billing/renewalAttach/internal/operations/types.js +158 -0
  95. package/dist/client/billing/renewalAttach/internal/operations/types.js.map +1 -0
  96. package/dist/client/billing/renewalAttach/internal/preflight/configurePreflight.d.ts +5 -0
  97. package/dist/client/billing/renewalAttach/internal/preflight/configurePreflight.d.ts.map +1 -0
  98. package/dist/client/billing/renewalAttach/internal/preflight/configurePreflight.js +214 -0
  99. package/dist/client/billing/renewalAttach/internal/preflight/configurePreflight.js.map +1 -0
  100. package/dist/client/billing/renewalAttach/internal/preflight/grammar.d.ts +33 -0
  101. package/dist/client/billing/renewalAttach/internal/preflight/grammar.d.ts.map +1 -0
  102. package/dist/client/billing/renewalAttach/internal/preflight/grammar.js +208 -0
  103. package/dist/client/billing/renewalAttach/internal/preflight/grammar.js.map +1 -0
  104. package/dist/client/billing/renewalAttach/internal/preflight/output.d.ts +4 -0
  105. package/dist/client/billing/renewalAttach/internal/preflight/output.d.ts.map +1 -0
  106. package/dist/client/billing/renewalAttach/internal/preflight/output.js +25 -0
  107. package/dist/client/billing/renewalAttach/internal/preflight/output.js.map +1 -0
  108. package/dist/client/billing/renewalAttach/internal/preflight/record.d.ts +16 -0
  109. package/dist/client/billing/renewalAttach/internal/preflight/record.d.ts.map +1 -0
  110. package/dist/client/billing/renewalAttach/internal/preflight/record.js +93 -0
  111. package/dist/client/billing/renewalAttach/internal/preflight/record.js.map +1 -0
  112. package/dist/client/billing/renewalAttach/internal/preflight/relations.d.ts +7 -0
  113. package/dist/client/billing/renewalAttach/internal/preflight/relations.d.ts.map +1 -0
  114. package/dist/client/billing/renewalAttach/internal/preflight/relations.js +153 -0
  115. package/dist/client/billing/renewalAttach/internal/preflight/relations.js.map +1 -0
  116. package/dist/client/billing/renewalAttach/internal/recovery/material.d.ts +22 -0
  117. package/dist/client/billing/renewalAttach/internal/recovery/material.d.ts.map +1 -0
  118. package/dist/client/billing/renewalAttach/internal/recovery/material.js +221 -0
  119. package/dist/client/billing/renewalAttach/internal/recovery/material.js.map +1 -0
  120. package/dist/client/billing/renewalAttach/internal/recovery/output.d.ts +8 -0
  121. package/dist/client/billing/renewalAttach/internal/recovery/output.d.ts.map +1 -0
  122. package/dist/client/billing/renewalAttach/internal/recovery/output.js +101 -0
  123. package/dist/client/billing/renewalAttach/internal/recovery/output.js.map +1 -0
  124. package/dist/client/billing/renewalAttach/internal/recovery/record.d.ts +12 -0
  125. package/dist/client/billing/renewalAttach/internal/recovery/record.d.ts.map +1 -0
  126. package/dist/client/billing/renewalAttach/internal/recovery/record.js +186 -0
  127. package/dist/client/billing/renewalAttach/internal/recovery/record.js.map +1 -0
  128. package/dist/client/billing/renewalAttach/internal/recovery/recoveryActor.d.ts +5 -0
  129. package/dist/client/billing/renewalAttach/internal/recovery/recoveryActor.d.ts.map +1 -0
  130. package/dist/client/billing/renewalAttach/internal/recovery/recoveryActor.js +498 -0
  131. package/dist/client/billing/renewalAttach/internal/recovery/recoveryActor.js.map +1 -0
  132. package/dist/client/billing/renewalAttach/internal/recovery/relation.d.ts +21 -0
  133. package/dist/client/billing/renewalAttach/internal/recovery/relation.d.ts.map +1 -0
  134. package/dist/client/billing/renewalAttach/internal/recovery/relation.js +119 -0
  135. package/dist/client/billing/renewalAttach/internal/recovery/relation.js.map +1 -0
  136. package/dist/client/connect/payoutExecutionTestHelpers.d.ts +16 -16
  137. package/dist/client/connect/payoutLargeAdoptionTestHelpers.d.ts +32 -32
  138. package/dist/component/balanceFunding/internal/actions.d.ts +11 -11
  139. package/dist/component/financialObservations/settlementHelpers.d.ts +3 -3
  140. package/dist/component/usage/allowance.fixtures.d.ts +16 -16
  141. package/dist/component/usageCredits/accounting.fixtures.d.ts +16 -16
  142. package/docs/renewal-context-reads.md +26 -8
  143. package/docs/renewal-material-observation.md +58 -0
  144. package/docs/renewal-phase-assembly.md +68 -0
  145. package/docs/renewal-raw-acquisition.md +19 -5
  146. package/package.json +1 -1
  147. package/src/client/billing/renewalAttach/internal/acquisition/ownedAcquisition.ts +304 -0
  148. package/src/client/billing/renewalAttach/internal/acquisition/rawAcquisition.ts +2 -160
  149. package/src/client/billing/renewalAttach/internal/acquisition/rawWireSource.ts +15 -3
  150. package/src/client/billing/renewalAttach/internal/configure/actor.ts +586 -0
  151. package/src/client/billing/renewalAttach/internal/configure/capture.ts +117 -0
  152. package/src/client/billing/renewalAttach/internal/configure/dispatch.integration.test.ts +32 -0
  153. package/src/client/billing/renewalAttach/internal/configure/limits.test.ts +510 -0
  154. package/src/client/billing/renewalAttach/internal/configure/order.integration.test.ts +207 -0
  155. package/src/client/billing/renewalAttach/internal/configure/output.ts +372 -0
  156. package/src/client/billing/renewalAttach/internal/configure/ownedContinuation.ts +56 -0
  157. package/src/client/billing/renewalAttach/internal/configure/ownership.integration.test.ts +148 -0
  158. package/src/client/billing/renewalAttach/internal/configure/replay.integration.test.ts +173 -0
  159. package/src/client/billing/renewalAttach/internal/configure/replay.ts +13 -0
  160. package/src/client/billing/renewalAttach/internal/configure/request.ts +312 -0
  161. package/src/client/billing/renewalAttach/internal/configure/transport.integration.test.ts +507 -0
  162. package/src/client/billing/renewalAttach/internal/configure/transport.ts +348 -0
  163. package/src/client/billing/renewalAttach/internal/observation/actor.ts +487 -0
  164. package/src/client/billing/renewalAttach/internal/observation/capture.ts +251 -0
  165. package/src/client/billing/renewalAttach/internal/observation/configureAcknowledgement.ts +20 -0
  166. package/src/client/billing/renewalAttach/internal/observation/observation.integration.test.ts +220 -0
  167. package/src/client/billing/renewalAttach/internal/observation/observationConfigureACK.integration.test.ts +36 -0
  168. package/src/client/billing/renewalAttach/internal/observation/observationConfigureACKControls.integration.test.ts +48 -0
  169. package/src/client/billing/renewalAttach/internal/observation/observationConfigureACKLifecycle.integration.test.ts +44 -0
  170. package/src/client/billing/renewalAttach/internal/observation/observationConfiguredHistory.integration.test.ts +34 -0
  171. package/src/client/billing/renewalAttach/internal/observation/observationRetirement.integration.test.ts +60 -0
  172. package/src/client/billing/renewalAttach/internal/observation/profile.ts +264 -0
  173. package/src/client/billing/renewalAttach/internal/observation/record.ts +408 -0
  174. package/src/client/billing/renewalAttach/internal/observation/types.ts +107 -0
  175. package/src/client/billing/renewalAttach/internal/operations/configureReadTransport.ts +285 -0
  176. package/src/client/billing/renewalAttach/internal/operations/defaultBindings.test.ts +69 -0
  177. package/src/client/billing/renewalAttach/internal/operations/fixedTransport.ts +574 -0
  178. package/src/client/billing/renewalAttach/internal/operations/initialAttach.integration.test.ts +34 -0
  179. package/src/client/billing/renewalAttach/internal/operations/initialAttach.ts +535 -0
  180. package/src/client/billing/renewalAttach/internal/operations/ownedAwait.ts +63 -0
  181. package/src/client/billing/renewalAttach/internal/operations/providerFailure.integration.test.ts +61 -0
  182. package/src/client/billing/renewalAttach/internal/operations/providerFailure.ts +66 -0
  183. package/src/client/billing/renewalAttach/internal/operations/sourceOperations.ts +50 -0
  184. package/src/client/billing/renewalAttach/internal/operations/transport.integration.test.ts +116 -0
  185. package/src/client/billing/renewalAttach/internal/operations/types.ts +223 -0
  186. package/src/client/billing/renewalAttach/internal/preflight/configurePreflight.integration.test.ts +285 -0
  187. package/src/client/billing/renewalAttach/internal/preflight/configurePreflight.ts +258 -0
  188. package/src/client/billing/renewalAttach/internal/preflight/configureReads.integration.test.ts +139 -0
  189. package/src/client/billing/renewalAttach/internal/preflight/grammar.ts +257 -0
  190. package/src/client/billing/renewalAttach/internal/preflight/output.ts +42 -0
  191. package/src/client/billing/renewalAttach/internal/preflight/owner.integration.test.ts +82 -0
  192. package/src/client/billing/renewalAttach/internal/preflight/preflight.integration.test.ts +354 -0
  193. package/src/client/billing/renewalAttach/internal/preflight/record.ts +127 -0
  194. package/src/client/billing/renewalAttach/internal/preflight/relations.ts +209 -0
  195. package/src/client/billing/renewalAttach/internal/recovery/material.ts +311 -0
  196. package/src/client/billing/renewalAttach/internal/recovery/output.ts +136 -0
  197. package/src/client/billing/renewalAttach/internal/recovery/record.ts +230 -0
  198. package/src/client/billing/renewalAttach/internal/recovery/recovery.integration.test.ts +463 -0
  199. package/src/client/billing/renewalAttach/internal/recovery/recoveryActor.ts +599 -0
  200. package/src/client/billing/renewalAttach/internal/recovery/relation.ts +175 -0
  201. package/src/client/billing/renewalAttach/internal/test-fixtures/attachEntries.ts +217 -0
  202. package/src/client/billing/renewalAttach/internal/test-fixtures/attachObservations.ts +226 -0
  203. package/src/client/billing/renewalAttach/internal/test-fixtures/attachScenario.ts +556 -0
  204. package/src/client/billing/renewalAttach/internal/test-fixtures/attachScenarioAssertions.ts +180 -0
  205. package/src/client/billing/renewalAttach/internal/test-fixtures/attachScenarioBarriers.ts +144 -0
  206. package/src/client/billing/renewalAttach/internal/test-fixtures/configurePreflightAssertions.ts +122 -0
  207. package/src/client/billing/renewalAttach/internal/test-fixtures/configurePreflightBarriers.ts +330 -0
  208. package/src/client/billing/renewalAttach/internal/test-fixtures/configurePreflightControls.ts +139 -0
  209. package/src/client/billing/renewalAttach/internal/test-fixtures/configurePreflightOperation.ts +513 -0
  210. package/src/client/billing/renewalAttach/internal/test-fixtures/configureReadNativeBaseline.ts +344 -0
  211. package/src/client/billing/renewalAttach/internal/test-fixtures/configureReadOperation.ts +278 -0
  212. package/src/client/billing/renewalAttach/internal/test-fixtures/configureReadPort.ts +17 -0
  213. package/src/client/billing/renewalAttach/internal/test-fixtures/configureWriteAssertions.ts +537 -0
  214. package/src/client/billing/renewalAttach/internal/test-fixtures/configureWriteBarriers.ts +125 -0
  215. package/src/client/billing/renewalAttach/internal/test-fixtures/configureWriteDeclarations.ts +325 -0
  216. package/src/client/billing/renewalAttach/internal/test-fixtures/configureWriteDelegate.ts +38 -0
  217. package/src/client/billing/renewalAttach/internal/test-fixtures/configureWriteHistory.ts +471 -0
  218. package/src/client/billing/renewalAttach/internal/test-fixtures/configureWriteObservations.ts +515 -0
  219. package/src/client/billing/renewalAttach/internal/test-fixtures/configureWriteOperation.ts +587 -0
  220. package/src/client/billing/renewalAttach/internal/test-fixtures/observationAssertions.ts +211 -0
  221. package/src/client/billing/renewalAttach/internal/test-fixtures/observationConfigureACKAssertions.ts +115 -0
  222. package/src/client/billing/renewalAttach/internal/test-fixtures/observationConfigureACKDeclarations.ts +141 -0
  223. package/src/client/billing/renewalAttach/internal/test-fixtures/observationConfigureACKLifecycleAssertions.ts +74 -0
  224. package/src/client/billing/renewalAttach/internal/test-fixtures/observationConfigureACKLifecycleDeclarations.ts +79 -0
  225. package/src/client/billing/renewalAttach/internal/test-fixtures/observationConfigureACKLifecycleInstrumentation.ts +207 -0
  226. package/src/client/billing/renewalAttach/internal/test-fixtures/observationConfigureACKLifecycleOperation.ts +494 -0
  227. package/src/client/billing/renewalAttach/internal/test-fixtures/observationConfigureACKOperation.ts +452 -0
  228. package/src/client/billing/renewalAttach/internal/test-fixtures/observationConfiguredHistoryAssertions.ts +88 -0
  229. package/src/client/billing/renewalAttach/internal/test-fixtures/observationConfiguredHistoryDeclarations.ts +170 -0
  230. package/src/client/billing/renewalAttach/internal/test-fixtures/observationConfiguredHistoryNative.ts +99 -0
  231. package/src/client/billing/renewalAttach/internal/test-fixtures/observationConfiguredHistoryOperation.ts +411 -0
  232. package/src/client/billing/renewalAttach/internal/test-fixtures/observationDeclarations.ts +192 -0
  233. package/src/client/billing/renewalAttach/internal/test-fixtures/observationHTTP.ts +197 -0
  234. package/src/client/billing/renewalAttach/internal/test-fixtures/observationObservations.ts +269 -0
  235. package/src/client/billing/renewalAttach/internal/test-fixtures/observationOperation.ts +262 -0
  236. package/src/client/billing/renewalAttach/internal/test-fixtures/observationProbe.ts +319 -0
  237. package/src/client/billing/renewalAttach/internal/test-fixtures/ownedOperations.ts +94 -0
  238. package/src/client/billing/renewalAttach/internal/test-fixtures/sourceOperationPort.ts +16 -0
  239. package/src/client/billing/renewalAttach/internal/test-fixtures/stockHttp.ts +21 -0
@@ -0,0 +1,285 @@
1
+ import assert from "node:assert/strict";
2
+ import { it, vi } from "vitest";
3
+ import { configurePreflightFixture } from "../test-fixtures/configurePreflightOperation.js";
4
+ import {
5
+ assertPreflightPositive,
6
+ assertNoPreflightWrites,
7
+ assertFit,
8
+ expectedPreflightOutput,
9
+ metrics,
10
+ } from "../test-fixtures/configurePreflightAssertions.js";
11
+ import {
12
+ data,
13
+ type PreflightCase,
14
+ } from "../test-fixtures/configurePreflightControls.js";
15
+ import {
16
+ cleanPreflightMocks,
17
+ installEmptyPreflightSpies,
18
+ } from "../test-fixtures/configurePreflightBarriers.js";
19
+
20
+ it("owned configure preflight returns full evidence after actual initial ACK", async () => {
21
+ const h = await configurePreflightFixture();
22
+ try {
23
+ const handle = h.capture();
24
+ const out = await handle.invoke();
25
+ assertPreflightPositive(h, out);
26
+ await assert.rejects(handle.invoke());
27
+ assertNoPreflightWrites(h);
28
+ } finally {
29
+ await h.cleanup();
30
+ }
31
+ });
32
+
33
+ it("normal configure preflight registry refuses before Source or Owner effects", async () => {
34
+ vi.resetModules();
35
+ const counts = installEmptyPreflightSpies();
36
+ try {
37
+ const { captureOwnedConfigurePreflightV2 } =
38
+ await import("./configurePreflight.js");
39
+ assert.throws(() => captureOwnedConfigurePreflightV2(), {
40
+ message: "CONFIGURE_PREFLIGHT_SOURCE_UNBOUND",
41
+ });
42
+ assert.deepEqual(counts, {
43
+ Source: 0,
44
+ Owner: 0,
45
+ check: 0,
46
+ sample: 0,
47
+ client: 0,
48
+ capture: 0,
49
+ api: 0,
50
+ read: 0,
51
+ });
52
+ } finally {
53
+ cleanPreflightMocks();
54
+ }
55
+ });
56
+
57
+ for (const name of [
58
+ "foreign-owner",
59
+ "foreign-origin",
60
+ "foreign-entry",
61
+ "foreign-preflight-entry",
62
+ "foreign-delegate",
63
+ "foreign-ack",
64
+ "foreign-pair",
65
+ "retired-capture",
66
+ ] as const)
67
+ it("owned configure preflight rejects " + name, async () => {
68
+ const h = await configurePreflightFixture(name);
69
+ try {
70
+ await assert.rejects(async () => h.capture().invoke());
71
+ assert.equal(h.deltas().GET, 0);
72
+ assert.equal(h.state.operationLoads, name === "retired-capture" ? 0 : 1);
73
+ assert.equal(h.state.readonlyCalls, 0);
74
+ assert.equal(h.state.releaseEntries, 0);
75
+ const pairFrontier =
76
+ name === "foreign-pair" || name === "foreign-delegate";
77
+ assert.equal(h.state.c6, pairFrontier ? 1 : 0);
78
+ assert.equal(h.state.c3, pairFrontier ? 1 : 0);
79
+ assert.equal(h.state.pairLoads, pairFrontier ? 1 : 0);
80
+ assertNoPreflightWrites(
81
+ h,
82
+ name === "retired-capture" ? "retired" : "live",
83
+ );
84
+ } finally {
85
+ await h.cleanup();
86
+ }
87
+ });
88
+
89
+ // The remaining four retained-receipt slots are immutable actual ACK custody inputs.
90
+ // Their direct release/capture value controls remain in the existing seven helper units.
91
+ for (let index = 0; index < 5; index++)
92
+ it(
93
+ "owned configure preflight rejects retained request token " + index,
94
+ async () => {
95
+ const h = await configurePreflightFixture("record-token", index);
96
+ try {
97
+ await assert.rejects(async () => h.capture().invoke());
98
+ assert.equal(h.state.c6, 1);
99
+ assert.equal(h.state.c3, 1);
100
+ assert.equal(h.deltas().GET, 0);
101
+ assert.equal(h.state.releaseEntries, 0);
102
+ assertNoPreflightWrites(h);
103
+ } finally {
104
+ await h.cleanup();
105
+ }
106
+ },
107
+ );
108
+
109
+ it("original public C6 Failure preserves its exact object before record proof or reads", async () => {
110
+ const h = await configurePreflightFixture("original-failure");
111
+ try {
112
+ const oracle = await h.directOriginal();
113
+ assert.notEqual(oracle.status, "projected_configure_request");
114
+ const out = await h.capture().invoke();
115
+ assert.deepEqual(out, oracle);
116
+ assert.equal(out, h.state.c6Results[0]);
117
+ assert.equal(h.state.c6, 1);
118
+ assert.equal(h.state.c3, 0);
119
+ assert.equal(h.state.pairLoads, 0);
120
+ assert.equal(h.state.coverage, 0);
121
+ assert.equal(h.state.releaseEntries, 0);
122
+ assert.equal(h.deltas().GET, 0);
123
+ assertNoPreflightWrites(h);
124
+ } finally {
125
+ await h.cleanup();
126
+ }
127
+ });
128
+
129
+ it("owned configure preflight capture-once and exact arity reject before extra work", async () => {
130
+ const h = await configurePreflightFixture();
131
+ try {
132
+ assert.throws(() => Reflect.apply(h.capture, undefined, [{}]));
133
+ assert.equal(h.state.operationLoads, 0);
134
+ const handle = h.capture();
135
+ assert.equal(h.state.operationLoads, 1);
136
+ assert.throws(() => h.capture());
137
+ await assert.rejects(Reflect.apply(handle.invoke, handle, [{}]));
138
+ assert.equal(h.state.operationLoads, 1);
139
+ assert.equal(h.state.c6, 0);
140
+ assert.equal(h.state.readonlyCalls, 0);
141
+ assert.equal(h.deltas().GET, 0);
142
+ assertNoPreflightWrites(h);
143
+ } finally {
144
+ await h.cleanup();
145
+ }
146
+ });
147
+
148
+ it("retired original Owner rejects Source tuple Proxy before any trap or Source load", async () => {
149
+ const h = await configurePreflightFixture("retired-proxy");
150
+ try {
151
+ assert.throws(() => h.capture());
152
+ assert.equal(h.state.tupleTraps, 0);
153
+ assert.equal(h.state.operationLoads, h.beforeCapture.operationLoads);
154
+ assert.equal(h.state.samples, h.beforeCapture.samples);
155
+ assert.equal(h.state.c6, 0);
156
+ assert.equal(h.state.pairLoads, 0);
157
+ assert.equal(h.state.readonlyCalls, 0);
158
+ assert.equal(h.deltas().GET, 0);
159
+ assertNoPreflightWrites(h, "retired");
160
+ } finally {
161
+ await h.cleanup();
162
+ }
163
+ });
164
+
165
+ it("same readonly delegate retargeted during original C6 cannot replace its captured method", async () => {
166
+ const h = await configurePreflightFixture("method-retarget");
167
+ try {
168
+ await assert.rejects(async () => h.capture().invoke());
169
+ assert.equal(h.state.methodRetargets, 1);
170
+ assert.equal(h.state.operationLoads, 1);
171
+ assert.equal(h.state.c6, 1);
172
+ assert.equal(h.state.c3, 1);
173
+ assert.equal(h.state.pairLoads, 1);
174
+ assert.equal(h.state.pairCreations, 1);
175
+ assert.equal(h.state.readerBindings, 0);
176
+ assert.equal(h.state.readonlyCalls, 0);
177
+ assert.equal(h.deltas().GET, 0);
178
+ assertNoPreflightWrites(h);
179
+ } finally {
180
+ await h.cleanup();
181
+ }
182
+ });
183
+
184
+ for (const name of [
185
+ "subscription-drift",
186
+ "price-drift",
187
+ "customer-drift",
188
+ "coupon-drift",
189
+ "reference-drift",
190
+ "schedule-opaque",
191
+ "schedule-default",
192
+ "schedule-phase",
193
+ ] as const)
194
+ it("owned configure preflight refuses complete raw " + name, async () => {
195
+ const h = await configurePreflightFixture(name);
196
+ try {
197
+ await assert.rejects(async () => h.capture().invoke());
198
+ assert.equal(h.state.c6, 1);
199
+ assert.equal(h.state.releaseEntries, 0);
200
+ assertNoPreflightWrites(h);
201
+ } finally {
202
+ await h.cleanup();
203
+ }
204
+ });
205
+
206
+ for (const name of [
207
+ "hold-schedule",
208
+ "hold-original",
209
+ "hold-fresh",
210
+ ] satisfies PreflightCase[])
211
+ it(
212
+ "owned configure preflight stops retired outer continuation at " + name,
213
+ async () => {
214
+ const h = await configurePreflightFixture(name);
215
+ const pending = h.capture().invoke();
216
+ const observed = pending.then(
217
+ (value) => ({ ok: true, value }),
218
+ (error: unknown) => ({ ok: false, error }),
219
+ );
220
+ try {
221
+ await h.gates.enterOrSettled(pending);
222
+ h.OWNER.retire();
223
+ h.gates.release();
224
+ assert.equal((await observed).ok, false);
225
+ assert.equal(h.state.releaseEntries, 0);
226
+ if (name === "hold-original") assert.equal(h.deltas().GET, 0);
227
+ if (name === "hold-schedule") assert.equal(h.state.c6, 1);
228
+ assertNoPreflightWrites(h, "retired");
229
+ } finally {
230
+ h.gates.release();
231
+ await observed;
232
+ await h.cleanup();
233
+ }
234
+ },
235
+ );
236
+
237
+ it("later original Owner liveness sample does not replace Schedule observedAt", async () => {
238
+ const h = await configurePreflightFixture("later-sample");
239
+ try {
240
+ const out = await h.capture().invoke();
241
+ assertPreflightPositive(h, out);
242
+ assert.equal(h.OWNER.check().wallMs, h.declared.laterAt);
243
+ assert.notEqual(
244
+ data(data(out).currentEvidence).observedAt,
245
+ h.OWNER.check().nowSeconds,
246
+ );
247
+ } finally {
248
+ await h.cleanup();
249
+ }
250
+ });
251
+
252
+ it("whole duplicate-inclusive preflight output refuses after fitting earlier components", async () => {
253
+ const h = await configurePreflightFixture("output-overflow");
254
+ try {
255
+ assertFit(h.expectedRecord);
256
+ assertFit(h.expectedEvidence);
257
+ const expected = expectedPreflightOutput(h),
258
+ whole = metrics(expected);
259
+ assert(
260
+ whole.chars > 500000 || whole.bytes > 500000,
261
+ "TEST_OUTPUT_ONLY_OVERFLOW_PREREQUISITE",
262
+ );
263
+ await assert.rejects(async () => h.capture().invoke());
264
+ assert.equal(h.state.c6, 2);
265
+ assert.equal(
266
+ data(h.state.c6Results[1]).status,
267
+ "projected_configure_request",
268
+ );
269
+ assert.equal(h.state.releaseEntries, 1);
270
+ assert.equal(h.state.coverage, 1);
271
+ assert.equal(
272
+ h.deltas().GET,
273
+ 4 + h.declared.original.originalBundle.couponReads.length,
274
+ );
275
+ assertNoPreflightWrites(h);
276
+ console.log(
277
+ JSON.stringify({
278
+ kind: "PREFLIGHT_OUTPUT_ONLY_OVERFLOW_FRONTIER",
279
+ ...whole,
280
+ }),
281
+ );
282
+ } finally {
283
+ await h.cleanup();
284
+ }
285
+ });
@@ -0,0 +1,258 @@
1
+ import { types } from "node:util";
2
+ import { OWNER } from "../originalOwner.js";
3
+ import {
4
+ COMPILED_PREFLIGHT_ENTRIES as ENTRIES,
5
+ loadOwnedConfigureOperation,
6
+ ORIGINAL_ORIGIN_ASSOCIATION,
7
+ } from "../operations/sourceOperations.js";
8
+ import {
9
+ projectRenewalConfigurationV2,
10
+ constructRenewalScheduleAttachmentReceiptV2,
11
+ } from "../../../renewalV2/index.js";
12
+ import { closed, need } from "../operations/types.js";
13
+ import { equal } from "../../../renewalAggregate/shared.js";
14
+ import { capturePreflightRecord } from "./record.js";
15
+ import { verifyPreflightRecord, verifyCurrentPreflight } from "./relations.js";
16
+ import { releasePreflight } from "./output.js";
17
+ import { bindConfigureReadAcquisitionFromSource } from "../acquisition/ownedAcquisition.js";
18
+ import { createConfigureOwnedReadTransport } from "../operations/configureReadTransport.js";
19
+ import type { Bundle } from "../material/capture.js";
20
+ import type { PreflightRecord } from "./grammar.js";
21
+
22
+ const stop = (): never => {
23
+ throw Error("CONFIGURE_PREFLIGHT_STOP");
24
+ };
25
+ let capturedOnce = false;
26
+ function ownMethod(
27
+ object: unknown,
28
+ name: string,
29
+ ): (...args: unknown[]) => unknown {
30
+ need(object !== null && typeof object === "object" && !types.isProxy(object));
31
+ const descriptor = Object.getOwnPropertyDescriptor(object, name);
32
+ need(
33
+ descriptor &&
34
+ descriptor.enumerable &&
35
+ "value" in descriptor &&
36
+ typeof descriptor.value === "function" &&
37
+ !types.isProxy(descriptor.value),
38
+ );
39
+ return descriptor.value as (...args: unknown[]) => unknown;
40
+ }
41
+ function expectedPlan(record: PreflightRecord) {
42
+ const expected = record.configuration.preparation.expected;
43
+ const customer = record.originalBundle.wireBillingCustomer.id;
44
+ need(typeof customer === "string");
45
+ const query =
46
+ "?" +
47
+ new URLSearchParams(
48
+ ["discounts", "items.data.discounts", "items.data.price"].map(
49
+ (value, index) => ["expand[" + index + "]", value],
50
+ ),
51
+ );
52
+ const resources = [
53
+ {
54
+ resource: "subscription",
55
+ path:
56
+ "/v1/subscriptions/" +
57
+ encodeURIComponent(expected.subscriptionId) +
58
+ query,
59
+ },
60
+ {
61
+ resource: "price",
62
+ path: "/v1/prices/" + encodeURIComponent(expected.targetPriceId),
63
+ },
64
+ {
65
+ resource: "customer",
66
+ path: "/v1/customers/" + encodeURIComponent(customer),
67
+ },
68
+ ...record.originalBundle.couponReads.map((row) => {
69
+ need(typeof row.couponId === "string");
70
+ return {
71
+ resource: "coupon",
72
+ path: "/v1/coupons/" + encodeURIComponent(row.couponId),
73
+ };
74
+ }),
75
+ {
76
+ resource: "schedule",
77
+ path:
78
+ "/v1/subscription_schedules/" +
79
+ encodeURIComponent(record.attachReceipt.scheduleId),
80
+ },
81
+ ];
82
+ return Object.freeze(
83
+ resources.map((row, index) =>
84
+ Object.freeze({
85
+ ...row,
86
+ ordinal: index + 1,
87
+ method: "GET",
88
+ body: undefined,
89
+ options: Object.freeze({
90
+ apiVersion: "2026-09-30.endive",
91
+ maxNetworkRetries: 0,
92
+ }),
93
+ }),
94
+ ),
95
+ );
96
+ }
97
+ /** Complete raw equality to the verified typed baseline, not a schema cast or Source proof. */
98
+ function matchesCurrentBundle(
99
+ value: unknown,
100
+ record: PreflightRecord,
101
+ ): value is Bundle {
102
+ return equal(value, {
103
+ ...record.originalBundle,
104
+ wireSubscription: record.configuration.freshSubscription,
105
+ });
106
+ }
107
+
108
+ /** Internal readonly consistency invocation; detached output grants no write authority. */
109
+ export function captureOwnedConfigurePreflightV2() {
110
+ if (arguments.length !== 0) stop();
111
+ need(!types.isProxy(ENTRIES) && Array.isArray(ENTRIES));
112
+ if (ENTRIES.length === 0) throw Error("CONFIGURE_PREFLIGHT_SOURCE_UNBOUND");
113
+ if (capturedOnce) stop();
114
+ capturedOnce = true;
115
+ OWNER.check();
116
+ const live = loadOwnedConfigureOperation();
117
+ OWNER.check();
118
+ const op = closed(live, [
119
+ "owner",
120
+ "originAssociation",
121
+ "originalEntry",
122
+ "preflightEntry",
123
+ "actualAcknowledgement",
124
+ "record",
125
+ "readTransport",
126
+ ]);
127
+ need(
128
+ op.owner === OWNER &&
129
+ op.originAssociation !== null &&
130
+ typeof op.originAssociation === "object" &&
131
+ !types.isProxy(op.originAssociation) &&
132
+ op.originAssociation === ORIGINAL_ORIGIN_ASSOCIATION &&
133
+ ENTRIES.includes(op.preflightEntry),
134
+ );
135
+ const coverage = closed(op.preflightEntry, [
136
+ "originalEntry",
137
+ "coversPreflight",
138
+ ]);
139
+ need(
140
+ op.originalEntry !== null &&
141
+ typeof op.originalEntry === "object" &&
142
+ !types.isProxy(op.originalEntry) &&
143
+ coverage.originalEntry === op.originalEntry,
144
+ );
145
+ const covers = ownMethod(op.preflightEntry, "coversPreflight");
146
+ const rawRecord = closed(op.record, [
147
+ "configuration",
148
+ "request",
149
+ "attachReceipt",
150
+ "originalBundle",
151
+ ]);
152
+ need(rawRecord.attachReceipt === op.actualAcknowledgement);
153
+ const readMethod = ownMethod(op.readTransport, "rawRequest"),
154
+ retained = capturePreflightRecord(op.record);
155
+ OWNER.check();
156
+ let consumed = false;
157
+ return Object.freeze({
158
+ async invoke() {
159
+ if (arguments.length !== 0 || consumed) stop();
160
+ consumed = true;
161
+ OWNER.check();
162
+ let original: Awaited<ReturnType<typeof projectRenewalConfigurationV2>>;
163
+ try {
164
+ original = await projectRenewalConfigurationV2(retained.configuration);
165
+ } catch (error) {
166
+ OWNER.check();
167
+ throw error;
168
+ }
169
+ OWNER.check();
170
+ if (original.status !== "projected_configure_request") return original;
171
+ let ack: Awaited<
172
+ ReturnType<typeof constructRenewalScheduleAttachmentReceiptV2>
173
+ >;
174
+ try {
175
+ ack = await constructRenewalScheduleAttachmentReceiptV2(
176
+ retained.configuration.attachReceipt,
177
+ );
178
+ } catch (error) {
179
+ OWNER.check();
180
+ throw error;
181
+ }
182
+ OWNER.check();
183
+ const record = verifyPreflightRecord(retained, original, ack);
184
+ OWNER.check();
185
+ const pair = createConfigureOwnedReadTransport();
186
+ OWNER.check();
187
+ need(
188
+ pair.capability.assertSourceOperationBinding(
189
+ live,
190
+ expectedPlan(record),
191
+ op.readTransport,
192
+ readMethod,
193
+ ),
194
+ );
195
+ OWNER.check();
196
+ need(pair.capability.reserveAcquisition());
197
+ OWNER.check();
198
+ const reader = bindConfigureReadAcquisitionFromSource(
199
+ OWNER,
200
+ pair.transport.readTransport,
201
+ Object.freeze({
202
+ expected: record.configuration.preparation.expected,
203
+ scheduleId: ack.scheduleId,
204
+ }),
205
+ );
206
+ OWNER.check();
207
+ let acquired: Awaited<ReturnType<typeof reader.acquire>>;
208
+ try {
209
+ acquired = await reader.acquire();
210
+ } catch (error) {
211
+ OWNER.check();
212
+ throw error;
213
+ }
214
+ OWNER.check();
215
+ need(acquired.ok);
216
+ need(matchesCurrentBundle(acquired.bundle, record));
217
+ const evidence = Object.freeze({
218
+ bundle: acquired.bundle,
219
+ schedule: acquired.schedule,
220
+ observedAt: acquired.observedAt,
221
+ });
222
+ verifyCurrentPreflight(record, evidence);
223
+ OWNER.check();
224
+ const configuration = {
225
+ ...record.configuration,
226
+ freshSubscription: evidence.bundle.wireSubscription,
227
+ targetPrice: evidence.bundle.wireTargetPrice,
228
+ ...(Object.prototype.hasOwnProperty.call(
229
+ record.configuration,
230
+ "billingCustomer",
231
+ )
232
+ ? { billingCustomer: evidence.bundle.wireBillingCustomer }
233
+ : {}),
234
+ schedule: evidence.schedule,
235
+ observedAt: evidence.observedAt,
236
+ };
237
+ OWNER.check();
238
+ let fresh: Awaited<ReturnType<typeof projectRenewalConfigurationV2>>;
239
+ try {
240
+ fresh = await projectRenewalConfigurationV2(configuration);
241
+ } catch (error) {
242
+ OWNER.check();
243
+ throw error;
244
+ }
245
+ OWNER.check();
246
+ if (fresh.status !== "projected_configure_request") return fresh;
247
+ need(equal(fresh, original) && equal(fresh, record.request));
248
+ need(
249
+ Reflect.apply(covers, op.preflightEntry, [record, evidence, fresh]) ===
250
+ true,
251
+ );
252
+ OWNER.check();
253
+ const output = releasePreflight(record, evidence, fresh, original, ack);
254
+ OWNER.check();
255
+ return output;
256
+ },
257
+ });
258
+ }
@@ -0,0 +1,139 @@
1
+ import { afterEach, expect, it, vi } from "vitest";
2
+ import {
3
+ configureReadOperationFixture,
4
+ configureReadMetrics,
5
+ } from "../test-fixtures/configureReadOperation.js";
6
+
7
+ afterEach(() => {
8
+ vi.doUnmock("../sourceBindings.js");
9
+ vi.doUnmock("../acquisition/readLifetime.js");
10
+ vi.resetModules();
11
+ vi.unstubAllGlobals();
12
+ vi.restoreAllMocks();
13
+ });
14
+
15
+ it("configure read profile retains the complete Schedule before its single child finish", async () => {
16
+ vi.resetModules();
17
+ const h = await configureReadOperationFixture();
18
+ const { bindConfigureReadAcquisitionFromSource } =
19
+ await import("../acquisition/ownedAcquisition.js");
20
+ const originalBasis = h.OWNER.basis;
21
+ h.OWNER.check();
22
+ const reader = bindConfigureReadAcquisitionFromSource(
23
+ h.OWNER,
24
+ h.transport,
25
+ h.scope,
26
+ );
27
+ const result = await reader.acquire();
28
+ const later = h.OWNER.check();
29
+ expect(result.ok).toBe(true);
30
+ if (result.ok !== true) throw Error("READ_PROFILE_PREREQUISITE");
31
+ expect(result.dataOnly).toBe(true);
32
+ expect(result.bundle).toEqual(h.expectedBundle);
33
+ expect(result.sourceFulfillmentEstablished).toBe(false);
34
+ expect(result.clockProvenanceEstablished).toBe(false);
35
+ expect(result.operatorReady).toBe(false);
36
+ expect(h.OWNER.basis).toBe(originalBasis);
37
+ expect(later.retired).toBe(false);
38
+ expect(h.counts()).toEqual({
39
+ children: 1,
40
+ begins: 1,
41
+ finishes: 1,
42
+ failures: 0,
43
+ });
44
+ expect(h.httpCalls.length).toBeGreaterThanOrEqual(5);
45
+ expect(h.httpCalls.length).toBeLessThanOrEqual(6);
46
+ expect(h.httpCalls.slice(0, 5)).toEqual(
47
+ h.paths.slice(0, 5).map((path) => ({
48
+ url: "https://api.stripe.com" + path,
49
+ method: "GET",
50
+ redirect: "error",
51
+ })),
52
+ );
53
+ expect(h.mechanics.slice(0, 5).map((x) => x.path)).toEqual(
54
+ h.paths.slice(0, 5),
55
+ );
56
+ for (const call of h.mechanics) {
57
+ expect(call.method).toBe("GET");
58
+ expect(call.body).toBe(undefined);
59
+ expect(call.options).toEqual({
60
+ apiVersion: "2026-09-30.endive",
61
+ maxNetworkRetries: 0,
62
+ });
63
+ expect(h.paths.includes(call.path)).toBe(true);
64
+ }
65
+ const rawSchedule: unknown = Object.getOwnPropertyDescriptor(
66
+ result,
67
+ "schedule",
68
+ )?.value;
69
+ console.log(
70
+ JSON.stringify({
71
+ kind: "CONFIGURE_READ_PROFILE_PREREQUISITES",
72
+ actualHTTPGETs: h.httpCalls.length,
73
+ childBegins: h.counts().begins,
74
+ childFinishes: h.counts().finishes,
75
+ schedulePresent: rawSchedule !== undefined,
76
+ bundleMetrics: configureReadMetrics(result.bundle),
77
+ actualPOSTs: h.mechanics.filter((x) => x.method !== "GET").length,
78
+ receiptCustodyEstablished: false,
79
+ }),
80
+ );
81
+
82
+ // Sole intended RED target. The current completed43 reader has no Schedule field.
83
+ expect(rawSchedule).toEqual(h.schedule);
84
+
85
+ // These unchanged assertions must all pass after the separately scoped real44 implementation.
86
+ expect(Object.keys(result).sort()).toEqual(
87
+ [
88
+ "ok",
89
+ "dataOnly",
90
+ "bundle",
91
+ "schedule",
92
+ "observedAt",
93
+ "sourceFulfillmentEstablished",
94
+ "clockProvenanceEstablished",
95
+ "operatorReady",
96
+ ].sort(),
97
+ );
98
+ expect(Object.isFrozen(result)).toBe(true);
99
+ expect(Object.isFrozen(rawSchedule)).toBe(true);
100
+ expect(h.httpCalls).toEqual(
101
+ h.paths.map((path) => ({
102
+ url: "https://api.stripe.com" + path,
103
+ method: "GET",
104
+ redirect: "error",
105
+ })),
106
+ );
107
+ expect(h.mechanics).toHaveLength(6);
108
+ const schedulePath = h.paths[h.paths.length - 1]!;
109
+ const scheduleRequest = h.events.findIndex(
110
+ (x) => x.kind === "request" && x.path === schedulePath,
111
+ );
112
+ const scheduleReply = h.events.findIndex(
113
+ (x) => x.kind === "reply" && x.path === schedulePath,
114
+ );
115
+ const finish = h.events.findIndex((x) => x.kind === "finish");
116
+ expect(scheduleRequest).toBeGreaterThanOrEqual(0);
117
+ expect(scheduleReply).toBeGreaterThan(scheduleRequest);
118
+ expect(finish).toBeGreaterThan(scheduleReply);
119
+ expect(h.events.filter((x) => x.kind === "create")).toHaveLength(1);
120
+ expect(h.events.filter((x) => x.kind === "finish")).toHaveLength(1);
121
+ expect(h.events.every((x) => x.child === 1)).toBe(true);
122
+ expect(result.observedAt).toBe(Math.floor(h.scheduleAt / 1000));
123
+ expect(result.observedAt).not.toBe(Math.floor(h.baseAt / 1000));
124
+ expect(later.wallMs).toBe(h.laterAt);
125
+ expect(result.observedAt).not.toBe(later.nowSeconds);
126
+ const m = configureReadMetrics(result);
127
+ expect(m.chars).toBeLessThanOrEqual(500000);
128
+ expect(m.bytes).toBeLessThanOrEqual(500000);
129
+ expect(m.nodes).toBeLessThanOrEqual(10000);
130
+ expect(m.depth).toBeLessThanOrEqual(40);
131
+ expect(await reader.acquire()).toEqual({
132
+ ok: false,
133
+ complete: false,
134
+ code: "RAW_ACQUISITION_STOP",
135
+ });
136
+ expect(h.httpCalls).toHaveLength(6);
137
+ expect(h.OWNER.basis).toBe(originalBasis);
138
+ expect(h.OWNER.check().retired).toBe(false);
139
+ });