@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.
- package/CHANGELOG.md +12 -0
- package/README.md +1 -1
- package/dist/client/billing/renewalAttach/internal/acquisition/ownedAcquisition.d.ts +41 -0
- package/dist/client/billing/renewalAttach/internal/acquisition/ownedAcquisition.d.ts.map +1 -0
- package/dist/client/billing/renewalAttach/internal/acquisition/ownedAcquisition.js +187 -0
- package/dist/client/billing/renewalAttach/internal/acquisition/ownedAcquisition.js.map +1 -0
- package/dist/client/billing/renewalAttach/internal/acquisition/rawAcquisition.d.ts +2 -23
- package/dist/client/billing/renewalAttach/internal/acquisition/rawAcquisition.d.ts.map +1 -1
- package/dist/client/billing/renewalAttach/internal/acquisition/rawAcquisition.js +1 -112
- package/dist/client/billing/renewalAttach/internal/acquisition/rawAcquisition.js.map +1 -1
- package/dist/client/billing/renewalAttach/internal/acquisition/rawWireSource.d.ts +8 -3
- package/dist/client/billing/renewalAttach/internal/acquisition/rawWireSource.d.ts.map +1 -1
- package/dist/client/billing/renewalAttach/internal/acquisition/rawWireSource.js +1 -0
- package/dist/client/billing/renewalAttach/internal/acquisition/rawWireSource.js.map +1 -1
- package/dist/client/billing/renewalAttach/internal/acquisition/test-fixtures/sourcePort.d.mts +1 -1
- package/dist/client/billing/renewalAttach/internal/configure/actor.d.ts +14 -0
- package/dist/client/billing/renewalAttach/internal/configure/actor.d.ts.map +1 -0
- package/dist/client/billing/renewalAttach/internal/configure/actor.js +444 -0
- package/dist/client/billing/renewalAttach/internal/configure/actor.js.map +1 -0
- package/dist/client/billing/renewalAttach/internal/configure/capture.d.ts +12 -0
- package/dist/client/billing/renewalAttach/internal/configure/capture.d.ts.map +1 -0
- package/dist/client/billing/renewalAttach/internal/configure/capture.js +99 -0
- package/dist/client/billing/renewalAttach/internal/configure/capture.js.map +1 -0
- package/dist/client/billing/renewalAttach/internal/configure/output.d.ts +16 -0
- package/dist/client/billing/renewalAttach/internal/configure/output.d.ts.map +1 -0
- package/dist/client/billing/renewalAttach/internal/configure/output.js +274 -0
- package/dist/client/billing/renewalAttach/internal/configure/output.js.map +1 -0
- package/dist/client/billing/renewalAttach/internal/configure/ownedContinuation.d.ts +3 -0
- package/dist/client/billing/renewalAttach/internal/configure/ownedContinuation.d.ts.map +1 -0
- package/dist/client/billing/renewalAttach/internal/configure/ownedContinuation.js +61 -0
- package/dist/client/billing/renewalAttach/internal/configure/ownedContinuation.js.map +1 -0
- package/dist/client/billing/renewalAttach/internal/configure/replay.d.ts +3 -0
- package/dist/client/billing/renewalAttach/internal/configure/replay.d.ts.map +1 -0
- package/dist/client/billing/renewalAttach/internal/configure/replay.js +9 -0
- package/dist/client/billing/renewalAttach/internal/configure/replay.js.map +1 -0
- package/dist/client/billing/renewalAttach/internal/configure/request.d.ts +39 -0
- package/dist/client/billing/renewalAttach/internal/configure/request.d.ts.map +1 -0
- package/dist/client/billing/renewalAttach/internal/configure/request.js +245 -0
- package/dist/client/billing/renewalAttach/internal/configure/request.js.map +1 -0
- package/dist/client/billing/renewalAttach/internal/configure/transport.d.ts +88 -0
- package/dist/client/billing/renewalAttach/internal/configure/transport.d.ts.map +1 -0
- package/dist/client/billing/renewalAttach/internal/configure/transport.js +289 -0
- package/dist/client/billing/renewalAttach/internal/configure/transport.js.map +1 -0
- package/dist/client/billing/renewalAttach/internal/observation/actor.d.ts +16 -0
- package/dist/client/billing/renewalAttach/internal/observation/actor.d.ts.map +1 -0
- package/dist/client/billing/renewalAttach/internal/observation/actor.js +383 -0
- package/dist/client/billing/renewalAttach/internal/observation/actor.js.map +1 -0
- package/dist/client/billing/renewalAttach/internal/observation/capture.d.ts +9 -0
- package/dist/client/billing/renewalAttach/internal/observation/capture.d.ts.map +1 -0
- package/dist/client/billing/renewalAttach/internal/observation/capture.js +216 -0
- package/dist/client/billing/renewalAttach/internal/observation/capture.js.map +1 -0
- package/dist/client/billing/renewalAttach/internal/observation/configureAcknowledgement.d.ts +5 -0
- package/dist/client/billing/renewalAttach/internal/observation/configureAcknowledgement.d.ts.map +1 -0
- package/dist/client/billing/renewalAttach/internal/observation/configureAcknowledgement.js +11 -0
- package/dist/client/billing/renewalAttach/internal/observation/configureAcknowledgement.js.map +1 -0
- package/dist/client/billing/renewalAttach/internal/observation/profile.d.ts +7 -0
- package/dist/client/billing/renewalAttach/internal/observation/profile.d.ts.map +1 -0
- package/dist/client/billing/renewalAttach/internal/observation/profile.js +190 -0
- package/dist/client/billing/renewalAttach/internal/observation/profile.js.map +1 -0
- package/dist/client/billing/renewalAttach/internal/observation/record.d.ts +5 -0
- package/dist/client/billing/renewalAttach/internal/observation/record.d.ts.map +1 -0
- package/dist/client/billing/renewalAttach/internal/observation/record.js +317 -0
- package/dist/client/billing/renewalAttach/internal/observation/record.js.map +1 -0
- package/dist/client/billing/renewalAttach/internal/observation/types.d.ts +84 -0
- package/dist/client/billing/renewalAttach/internal/observation/types.d.ts.map +1 -0
- package/dist/client/billing/renewalAttach/internal/observation/types.js +27 -0
- package/dist/client/billing/renewalAttach/internal/observation/types.js.map +1 -0
- package/dist/client/billing/renewalAttach/internal/operations/configureReadTransport.d.ts +18 -0
- package/dist/client/billing/renewalAttach/internal/operations/configureReadTransport.d.ts.map +1 -0
- package/dist/client/billing/renewalAttach/internal/operations/configureReadTransport.js +229 -0
- package/dist/client/billing/renewalAttach/internal/operations/configureReadTransport.js.map +1 -0
- package/dist/client/billing/renewalAttach/internal/operations/fixedTransport.d.ts +163 -0
- package/dist/client/billing/renewalAttach/internal/operations/fixedTransport.d.ts.map +1 -0
- package/dist/client/billing/renewalAttach/internal/operations/fixedTransport.js +443 -0
- package/dist/client/billing/renewalAttach/internal/operations/fixedTransport.js.map +1 -0
- package/dist/client/billing/renewalAttach/internal/operations/initialAttach.d.ts +8 -0
- package/dist/client/billing/renewalAttach/internal/operations/initialAttach.d.ts.map +1 -0
- package/dist/client/billing/renewalAttach/internal/operations/initialAttach.js +467 -0
- package/dist/client/billing/renewalAttach/internal/operations/initialAttach.js.map +1 -0
- package/dist/client/billing/renewalAttach/internal/operations/ownedAwait.d.ts +6 -0
- package/dist/client/billing/renewalAttach/internal/operations/ownedAwait.d.ts.map +1 -0
- package/dist/client/billing/renewalAttach/internal/operations/ownedAwait.js +59 -0
- package/dist/client/billing/renewalAttach/internal/operations/ownedAwait.js.map +1 -0
- package/dist/client/billing/renewalAttach/internal/operations/providerFailure.d.ts +10 -0
- package/dist/client/billing/renewalAttach/internal/operations/providerFailure.d.ts.map +1 -0
- package/dist/client/billing/renewalAttach/internal/operations/providerFailure.js +48 -0
- package/dist/client/billing/renewalAttach/internal/operations/providerFailure.js.map +1 -0
- package/dist/client/billing/renewalAttach/internal/operations/sourceOperations.d.ts +20 -0
- package/dist/client/billing/renewalAttach/internal/operations/sourceOperations.d.ts.map +1 -0
- package/dist/client/billing/renewalAttach/internal/operations/sourceOperations.js +44 -0
- package/dist/client/billing/renewalAttach/internal/operations/sourceOperations.js.map +1 -0
- package/dist/client/billing/renewalAttach/internal/operations/types.d.ts +42 -0
- package/dist/client/billing/renewalAttach/internal/operations/types.d.ts.map +1 -0
- package/dist/client/billing/renewalAttach/internal/operations/types.js +158 -0
- package/dist/client/billing/renewalAttach/internal/operations/types.js.map +1 -0
- package/dist/client/billing/renewalAttach/internal/preflight/configurePreflight.d.ts +5 -0
- package/dist/client/billing/renewalAttach/internal/preflight/configurePreflight.d.ts.map +1 -0
- package/dist/client/billing/renewalAttach/internal/preflight/configurePreflight.js +214 -0
- package/dist/client/billing/renewalAttach/internal/preflight/configurePreflight.js.map +1 -0
- package/dist/client/billing/renewalAttach/internal/preflight/grammar.d.ts +33 -0
- package/dist/client/billing/renewalAttach/internal/preflight/grammar.d.ts.map +1 -0
- package/dist/client/billing/renewalAttach/internal/preflight/grammar.js +208 -0
- package/dist/client/billing/renewalAttach/internal/preflight/grammar.js.map +1 -0
- package/dist/client/billing/renewalAttach/internal/preflight/output.d.ts +4 -0
- package/dist/client/billing/renewalAttach/internal/preflight/output.d.ts.map +1 -0
- package/dist/client/billing/renewalAttach/internal/preflight/output.js +25 -0
- package/dist/client/billing/renewalAttach/internal/preflight/output.js.map +1 -0
- package/dist/client/billing/renewalAttach/internal/preflight/record.d.ts +16 -0
- package/dist/client/billing/renewalAttach/internal/preflight/record.d.ts.map +1 -0
- package/dist/client/billing/renewalAttach/internal/preflight/record.js +93 -0
- package/dist/client/billing/renewalAttach/internal/preflight/record.js.map +1 -0
- package/dist/client/billing/renewalAttach/internal/preflight/relations.d.ts +7 -0
- package/dist/client/billing/renewalAttach/internal/preflight/relations.d.ts.map +1 -0
- package/dist/client/billing/renewalAttach/internal/preflight/relations.js +153 -0
- package/dist/client/billing/renewalAttach/internal/preflight/relations.js.map +1 -0
- package/dist/client/billing/renewalAttach/internal/recovery/material.d.ts +22 -0
- package/dist/client/billing/renewalAttach/internal/recovery/material.d.ts.map +1 -0
- package/dist/client/billing/renewalAttach/internal/recovery/material.js +221 -0
- package/dist/client/billing/renewalAttach/internal/recovery/material.js.map +1 -0
- package/dist/client/billing/renewalAttach/internal/recovery/output.d.ts +8 -0
- package/dist/client/billing/renewalAttach/internal/recovery/output.d.ts.map +1 -0
- package/dist/client/billing/renewalAttach/internal/recovery/output.js +101 -0
- package/dist/client/billing/renewalAttach/internal/recovery/output.js.map +1 -0
- package/dist/client/billing/renewalAttach/internal/recovery/record.d.ts +12 -0
- package/dist/client/billing/renewalAttach/internal/recovery/record.d.ts.map +1 -0
- package/dist/client/billing/renewalAttach/internal/recovery/record.js +186 -0
- package/dist/client/billing/renewalAttach/internal/recovery/record.js.map +1 -0
- package/dist/client/billing/renewalAttach/internal/recovery/recoveryActor.d.ts +5 -0
- package/dist/client/billing/renewalAttach/internal/recovery/recoveryActor.d.ts.map +1 -0
- package/dist/client/billing/renewalAttach/internal/recovery/recoveryActor.js +498 -0
- package/dist/client/billing/renewalAttach/internal/recovery/recoveryActor.js.map +1 -0
- package/dist/client/billing/renewalAttach/internal/recovery/relation.d.ts +21 -0
- package/dist/client/billing/renewalAttach/internal/recovery/relation.d.ts.map +1 -0
- package/dist/client/billing/renewalAttach/internal/recovery/relation.js +119 -0
- package/dist/client/billing/renewalAttach/internal/recovery/relation.js.map +1 -0
- package/dist/client/connect/payoutExecutionTestHelpers.d.ts +16 -16
- package/dist/client/connect/payoutLargeAdoptionTestHelpers.d.ts +32 -32
- package/dist/component/balanceFunding/internal/actions.d.ts +11 -11
- package/dist/component/financialObservations/settlementHelpers.d.ts +3 -3
- package/dist/component/usage/allowance.fixtures.d.ts +16 -16
- package/dist/component/usageCredits/accounting.fixtures.d.ts +16 -16
- package/docs/renewal-context-reads.md +26 -8
- package/docs/renewal-material-observation.md +58 -0
- package/docs/renewal-phase-assembly.md +68 -0
- package/docs/renewal-raw-acquisition.md +19 -5
- package/package.json +1 -1
- package/src/client/billing/renewalAttach/internal/acquisition/ownedAcquisition.ts +304 -0
- package/src/client/billing/renewalAttach/internal/acquisition/rawAcquisition.ts +2 -160
- package/src/client/billing/renewalAttach/internal/acquisition/rawWireSource.ts +15 -3
- package/src/client/billing/renewalAttach/internal/configure/actor.ts +586 -0
- package/src/client/billing/renewalAttach/internal/configure/capture.ts +117 -0
- package/src/client/billing/renewalAttach/internal/configure/dispatch.integration.test.ts +32 -0
- package/src/client/billing/renewalAttach/internal/configure/limits.test.ts +510 -0
- package/src/client/billing/renewalAttach/internal/configure/order.integration.test.ts +207 -0
- package/src/client/billing/renewalAttach/internal/configure/output.ts +372 -0
- package/src/client/billing/renewalAttach/internal/configure/ownedContinuation.ts +56 -0
- package/src/client/billing/renewalAttach/internal/configure/ownership.integration.test.ts +148 -0
- package/src/client/billing/renewalAttach/internal/configure/replay.integration.test.ts +173 -0
- package/src/client/billing/renewalAttach/internal/configure/replay.ts +13 -0
- package/src/client/billing/renewalAttach/internal/configure/request.ts +312 -0
- package/src/client/billing/renewalAttach/internal/configure/transport.integration.test.ts +507 -0
- package/src/client/billing/renewalAttach/internal/configure/transport.ts +348 -0
- package/src/client/billing/renewalAttach/internal/observation/actor.ts +487 -0
- package/src/client/billing/renewalAttach/internal/observation/capture.ts +251 -0
- package/src/client/billing/renewalAttach/internal/observation/configureAcknowledgement.ts +20 -0
- package/src/client/billing/renewalAttach/internal/observation/observation.integration.test.ts +220 -0
- package/src/client/billing/renewalAttach/internal/observation/observationConfigureACK.integration.test.ts +36 -0
- package/src/client/billing/renewalAttach/internal/observation/observationConfigureACKControls.integration.test.ts +48 -0
- package/src/client/billing/renewalAttach/internal/observation/observationConfigureACKLifecycle.integration.test.ts +44 -0
- package/src/client/billing/renewalAttach/internal/observation/observationConfiguredHistory.integration.test.ts +34 -0
- package/src/client/billing/renewalAttach/internal/observation/observationRetirement.integration.test.ts +60 -0
- package/src/client/billing/renewalAttach/internal/observation/profile.ts +264 -0
- package/src/client/billing/renewalAttach/internal/observation/record.ts +408 -0
- package/src/client/billing/renewalAttach/internal/observation/types.ts +107 -0
- package/src/client/billing/renewalAttach/internal/operations/configureReadTransport.ts +285 -0
- package/src/client/billing/renewalAttach/internal/operations/defaultBindings.test.ts +69 -0
- package/src/client/billing/renewalAttach/internal/operations/fixedTransport.ts +574 -0
- package/src/client/billing/renewalAttach/internal/operations/initialAttach.integration.test.ts +34 -0
- package/src/client/billing/renewalAttach/internal/operations/initialAttach.ts +535 -0
- package/src/client/billing/renewalAttach/internal/operations/ownedAwait.ts +63 -0
- package/src/client/billing/renewalAttach/internal/operations/providerFailure.integration.test.ts +61 -0
- package/src/client/billing/renewalAttach/internal/operations/providerFailure.ts +66 -0
- package/src/client/billing/renewalAttach/internal/operations/sourceOperations.ts +50 -0
- package/src/client/billing/renewalAttach/internal/operations/transport.integration.test.ts +116 -0
- package/src/client/billing/renewalAttach/internal/operations/types.ts +223 -0
- package/src/client/billing/renewalAttach/internal/preflight/configurePreflight.integration.test.ts +285 -0
- package/src/client/billing/renewalAttach/internal/preflight/configurePreflight.ts +258 -0
- package/src/client/billing/renewalAttach/internal/preflight/configureReads.integration.test.ts +139 -0
- package/src/client/billing/renewalAttach/internal/preflight/grammar.ts +257 -0
- package/src/client/billing/renewalAttach/internal/preflight/output.ts +42 -0
- package/src/client/billing/renewalAttach/internal/preflight/owner.integration.test.ts +82 -0
- package/src/client/billing/renewalAttach/internal/preflight/preflight.integration.test.ts +354 -0
- package/src/client/billing/renewalAttach/internal/preflight/record.ts +127 -0
- package/src/client/billing/renewalAttach/internal/preflight/relations.ts +209 -0
- package/src/client/billing/renewalAttach/internal/recovery/material.ts +311 -0
- package/src/client/billing/renewalAttach/internal/recovery/output.ts +136 -0
- package/src/client/billing/renewalAttach/internal/recovery/record.ts +230 -0
- package/src/client/billing/renewalAttach/internal/recovery/recovery.integration.test.ts +463 -0
- package/src/client/billing/renewalAttach/internal/recovery/recoveryActor.ts +599 -0
- package/src/client/billing/renewalAttach/internal/recovery/relation.ts +175 -0
- package/src/client/billing/renewalAttach/internal/test-fixtures/attachEntries.ts +217 -0
- package/src/client/billing/renewalAttach/internal/test-fixtures/attachObservations.ts +226 -0
- package/src/client/billing/renewalAttach/internal/test-fixtures/attachScenario.ts +556 -0
- package/src/client/billing/renewalAttach/internal/test-fixtures/attachScenarioAssertions.ts +180 -0
- package/src/client/billing/renewalAttach/internal/test-fixtures/attachScenarioBarriers.ts +144 -0
- package/src/client/billing/renewalAttach/internal/test-fixtures/configurePreflightAssertions.ts +122 -0
- package/src/client/billing/renewalAttach/internal/test-fixtures/configurePreflightBarriers.ts +330 -0
- package/src/client/billing/renewalAttach/internal/test-fixtures/configurePreflightControls.ts +139 -0
- package/src/client/billing/renewalAttach/internal/test-fixtures/configurePreflightOperation.ts +513 -0
- package/src/client/billing/renewalAttach/internal/test-fixtures/configureReadNativeBaseline.ts +344 -0
- package/src/client/billing/renewalAttach/internal/test-fixtures/configureReadOperation.ts +278 -0
- package/src/client/billing/renewalAttach/internal/test-fixtures/configureReadPort.ts +17 -0
- package/src/client/billing/renewalAttach/internal/test-fixtures/configureWriteAssertions.ts +537 -0
- package/src/client/billing/renewalAttach/internal/test-fixtures/configureWriteBarriers.ts +125 -0
- package/src/client/billing/renewalAttach/internal/test-fixtures/configureWriteDeclarations.ts +325 -0
- package/src/client/billing/renewalAttach/internal/test-fixtures/configureWriteDelegate.ts +38 -0
- package/src/client/billing/renewalAttach/internal/test-fixtures/configureWriteHistory.ts +471 -0
- package/src/client/billing/renewalAttach/internal/test-fixtures/configureWriteObservations.ts +515 -0
- package/src/client/billing/renewalAttach/internal/test-fixtures/configureWriteOperation.ts +587 -0
- package/src/client/billing/renewalAttach/internal/test-fixtures/observationAssertions.ts +211 -0
- package/src/client/billing/renewalAttach/internal/test-fixtures/observationConfigureACKAssertions.ts +115 -0
- package/src/client/billing/renewalAttach/internal/test-fixtures/observationConfigureACKDeclarations.ts +141 -0
- package/src/client/billing/renewalAttach/internal/test-fixtures/observationConfigureACKLifecycleAssertions.ts +74 -0
- package/src/client/billing/renewalAttach/internal/test-fixtures/observationConfigureACKLifecycleDeclarations.ts +79 -0
- package/src/client/billing/renewalAttach/internal/test-fixtures/observationConfigureACKLifecycleInstrumentation.ts +207 -0
- package/src/client/billing/renewalAttach/internal/test-fixtures/observationConfigureACKLifecycleOperation.ts +494 -0
- package/src/client/billing/renewalAttach/internal/test-fixtures/observationConfigureACKOperation.ts +452 -0
- package/src/client/billing/renewalAttach/internal/test-fixtures/observationConfiguredHistoryAssertions.ts +88 -0
- package/src/client/billing/renewalAttach/internal/test-fixtures/observationConfiguredHistoryDeclarations.ts +170 -0
- package/src/client/billing/renewalAttach/internal/test-fixtures/observationConfiguredHistoryNative.ts +99 -0
- package/src/client/billing/renewalAttach/internal/test-fixtures/observationConfiguredHistoryOperation.ts +411 -0
- package/src/client/billing/renewalAttach/internal/test-fixtures/observationDeclarations.ts +192 -0
- package/src/client/billing/renewalAttach/internal/test-fixtures/observationHTTP.ts +197 -0
- package/src/client/billing/renewalAttach/internal/test-fixtures/observationObservations.ts +269 -0
- package/src/client/billing/renewalAttach/internal/test-fixtures/observationOperation.ts +262 -0
- package/src/client/billing/renewalAttach/internal/test-fixtures/observationProbe.ts +319 -0
- package/src/client/billing/renewalAttach/internal/test-fixtures/ownedOperations.ts +94 -0
- package/src/client/billing/renewalAttach/internal/test-fixtures/sourceOperationPort.ts +16 -0
- package/src/client/billing/renewalAttach/internal/test-fixtures/stockHttp.ts +21 -0
|
@@ -0,0 +1,262 @@
|
|
|
1
|
+
import assert from "node:assert/strict";
|
|
2
|
+
import { types } from "node:util";
|
|
3
|
+
import {
|
|
4
|
+
declareObservationPositive,
|
|
5
|
+
type ObservationControl,
|
|
6
|
+
} from "./observationDeclarations.js";
|
|
7
|
+
import { configurePreflightFixture } from "./configurePreflightOperation.js";
|
|
8
|
+
import { data, deepFreeze } from "./configurePreflightControls.js";
|
|
9
|
+
import { observationHTTP } from "./observationHTTP.js";
|
|
10
|
+
import {
|
|
11
|
+
observationState,
|
|
12
|
+
observeObservationAPI,
|
|
13
|
+
joinObservationWork,
|
|
14
|
+
cleanObservationAPI,
|
|
15
|
+
installTrustedExportCase,
|
|
16
|
+
} from "./observationObservations.js";
|
|
17
|
+
import { vi } from "vitest";
|
|
18
|
+
import { logObservationPrerequisites } from "./observationAssertions.js";
|
|
19
|
+
import { controlOperation } from "./observationProbe.js";
|
|
20
|
+
|
|
21
|
+
/** Complete positive setup; no module reset after actual Owner/ENTRY/ACK capture. */
|
|
22
|
+
export async function observationFixture(
|
|
23
|
+
controlCase: ObservationControl = "positive",
|
|
24
|
+
) {
|
|
25
|
+
const declaration = declareObservationPositive(controlCase);
|
|
26
|
+
const state = observationState();
|
|
27
|
+
const prerequisite = await configurePreflightFixture("positive");
|
|
28
|
+
try {
|
|
29
|
+
const { OWNER } = await import("../originalOwner.js");
|
|
30
|
+
assert.equal(OWNER, prerequisite.OWNER);
|
|
31
|
+
const basis = OWNER.basis;
|
|
32
|
+
assert.equal(basis, prerequisite.basis);
|
|
33
|
+
const source = await import("../operations/sourceOperations.js");
|
|
34
|
+
assert.equal(source.COMPILED_INITIAL_ENTRIES.length, 1);
|
|
35
|
+
const entry = source.COMPILED_INITIAL_ENTRIES[0];
|
|
36
|
+
assert(entry && typeof entry === "object" && !types.isProxy(entry));
|
|
37
|
+
const retained = Object.getOwnPropertyDescriptor(entry, "coversRetained");
|
|
38
|
+
assert(
|
|
39
|
+
retained && "value" in retained && typeof retained.value === "function",
|
|
40
|
+
);
|
|
41
|
+
const initialOperation = data(source.loadFixedInitialOperation());
|
|
42
|
+
assert.equal(initialOperation.owner, OWNER);
|
|
43
|
+
assert.equal(
|
|
44
|
+
initialOperation.originAssociation,
|
|
45
|
+
source.ORIGINAL_ORIGIN_ASSOCIATION,
|
|
46
|
+
);
|
|
47
|
+
assert(
|
|
48
|
+
source.ORIGINAL_ORIGIN_ASSOCIATION &&
|
|
49
|
+
!types.isProxy(source.ORIGINAL_ORIGIN_ASSOCIATION),
|
|
50
|
+
);
|
|
51
|
+
assert.deepEqual(prerequisite.declared, declaration.baseline);
|
|
52
|
+
assert.equal(
|
|
53
|
+
data(prerequisite.initialOutput).status,
|
|
54
|
+
"attach_acknowledged",
|
|
55
|
+
);
|
|
56
|
+
assert.equal(prerequisite.state.records.length, 3);
|
|
57
|
+
assert.equal(
|
|
58
|
+
prerequisite.state.calls.filter((r) => r.method === "POST").length,
|
|
59
|
+
1,
|
|
60
|
+
);
|
|
61
|
+
const record = prerequisite.expectedRecord;
|
|
62
|
+
assert.equal(record.attachReceipt, prerequisite.acknowledgement);
|
|
63
|
+
assert.equal(prerequisite.boundRecord, record);
|
|
64
|
+
assert.deepEqual(
|
|
65
|
+
record.originalBundle,
|
|
66
|
+
declaration.baseline.original.originalBundle,
|
|
67
|
+
);
|
|
68
|
+
assert.deepEqual(
|
|
69
|
+
data(prerequisite.acknowledgement).providerSnapshot,
|
|
70
|
+
declaration.reads.schedule,
|
|
71
|
+
);
|
|
72
|
+
const now = OWNER.check();
|
|
73
|
+
assert.equal(now.wallMs, declaration.expectedOwnerAt);
|
|
74
|
+
assert(now.wallMs > declaration.originalFirstAt + 60000);
|
|
75
|
+
assert.equal(now.nowSeconds - declaration.retentionEpoch, 61);
|
|
76
|
+
assert.equal(prerequisite.state.pairLoads, 0);
|
|
77
|
+
assert.equal(prerequisite.state.readonlyCalls, 0);
|
|
78
|
+
assert.equal(prerequisite.state.coverage, 0);
|
|
79
|
+
assert.deepEqual(prerequisite.deltas(), { GET: 0, POST: 0, records: 0 });
|
|
80
|
+
// No preflight capture/invoke is called: its readonly Schedule-last pair stays unused.
|
|
81
|
+
const { configuration: actual, observation: observer } =
|
|
82
|
+
await observeObservationAPI(state, OWNER, controlCase);
|
|
83
|
+
OWNER.check();
|
|
84
|
+
const desired = await actual.projectRenewalConfigurationV2(
|
|
85
|
+
record.configuration,
|
|
86
|
+
);
|
|
87
|
+
OWNER.check();
|
|
88
|
+
assert.equal(
|
|
89
|
+
desired.status,
|
|
90
|
+
"projected_configure_request",
|
|
91
|
+
"ACTUAL_CURRENT_C6_PREREQUISITE",
|
|
92
|
+
);
|
|
93
|
+
assert.deepEqual(desired, record.request);
|
|
94
|
+
const input = deepFreeze({
|
|
95
|
+
configuration: record.configuration,
|
|
96
|
+
reads: declaration.reads,
|
|
97
|
+
});
|
|
98
|
+
const oracle = await observer.inspectRenewalScheduleMaterialV2(input);
|
|
99
|
+
OWNER.check();
|
|
100
|
+
assert.deepEqual(
|
|
101
|
+
oracle,
|
|
102
|
+
declaration.expected,
|
|
103
|
+
"ACTUAL_CURRENT_OBSERVER_APPLICABILITY",
|
|
104
|
+
);
|
|
105
|
+
const http = await observationHTTP(declaration, OWNER);
|
|
106
|
+
OWNER.check();
|
|
107
|
+
const expectedOutput = deepFreeze({
|
|
108
|
+
status: "owned_observation_data",
|
|
109
|
+
observation: declaration.expected,
|
|
110
|
+
reads: declaration.reads,
|
|
111
|
+
observedAt: now.nowSeconds,
|
|
112
|
+
retainedConfigureAcknowledgement: "absent",
|
|
113
|
+
operationalAuthority: false,
|
|
114
|
+
});
|
|
115
|
+
const observationEntry = Object.freeze({
|
|
116
|
+
originalEntry: entry,
|
|
117
|
+
coversObservation(
|
|
118
|
+
candidateRecord: unknown,
|
|
119
|
+
candidateInput: unknown,
|
|
120
|
+
result: unknown,
|
|
121
|
+
) {
|
|
122
|
+
state.coverage++;
|
|
123
|
+
assert.deepEqual(candidateRecord, record);
|
|
124
|
+
assert.deepEqual(candidateInput, input);
|
|
125
|
+
assert.deepEqual(result, oracle);
|
|
126
|
+
return true;
|
|
127
|
+
},
|
|
128
|
+
});
|
|
129
|
+
// Prospective TEST tuple only, not registered in an alternate registry or Source.
|
|
130
|
+
const operation = Object.freeze({
|
|
131
|
+
owner: OWNER,
|
|
132
|
+
originAssociation: source.ORIGINAL_ORIGIN_ASSOCIATION,
|
|
133
|
+
originalEntry: entry,
|
|
134
|
+
observationEntry,
|
|
135
|
+
record,
|
|
136
|
+
actualAttachAcknowledgement: prerequisite.acknowledgement,
|
|
137
|
+
readTransport: http.delegate,
|
|
138
|
+
});
|
|
139
|
+
assert.equal(operation.originalEntry, source.COMPILED_INITIAL_ENTRIES[0]);
|
|
140
|
+
assert.equal(
|
|
141
|
+
operation.record.attachReceipt,
|
|
142
|
+
operation.actualAttachAcknowledgement,
|
|
143
|
+
);
|
|
144
|
+
assert.equal(
|
|
145
|
+
Object.prototype.hasOwnProperty.call(
|
|
146
|
+
operation,
|
|
147
|
+
"configureAcknowledgement",
|
|
148
|
+
),
|
|
149
|
+
false,
|
|
150
|
+
);
|
|
151
|
+
assert.deepEqual(
|
|
152
|
+
[
|
|
153
|
+
state.sourceLoads,
|
|
154
|
+
state.ownedC6,
|
|
155
|
+
state.ownedC3,
|
|
156
|
+
state.ownedC9,
|
|
157
|
+
state.ownedObserver,
|
|
158
|
+
state.coverage,
|
|
159
|
+
state.targetCalls,
|
|
160
|
+
],
|
|
161
|
+
[0, 0, 0, 0, 0, 0, 0],
|
|
162
|
+
);
|
|
163
|
+
assert.equal(OWNER.basis, basis);
|
|
164
|
+
logObservationPrerequisites({
|
|
165
|
+
initialOutput: prerequisite.initialOutput,
|
|
166
|
+
record,
|
|
167
|
+
input,
|
|
168
|
+
expectedOutput,
|
|
169
|
+
calls: http.calls.length,
|
|
170
|
+
targetCalls: state.targetCalls,
|
|
171
|
+
});
|
|
172
|
+
console.log(
|
|
173
|
+
JSON.stringify({
|
|
174
|
+
kind: "OBSERVATION_CONTROL_DECLARATION",
|
|
175
|
+
controlCase,
|
|
176
|
+
baselinePrerequisitesOnly: controlCase !== "positive",
|
|
177
|
+
expectedOwner: declaration.expectedOwner,
|
|
178
|
+
rawFaultRecipeDeclaredBeforeConstructors: true,
|
|
179
|
+
operationalAuthority: false,
|
|
180
|
+
}),
|
|
181
|
+
);
|
|
182
|
+
const sourceOperation = controlOperation(operation, declaration, state);
|
|
183
|
+
await installTrustedExportCase(state, OWNER, declaration);
|
|
184
|
+
OWNER.check();
|
|
185
|
+
// Fixed TEST Source only. Preserve the writer's and initial actor's aliases.
|
|
186
|
+
const normalSource = await vi.importActual<
|
|
187
|
+
typeof import("../operations/sourceOperations.js")
|
|
188
|
+
>("../operations/sourceOperations.js");
|
|
189
|
+
vi.doMock("../operations/sourceOperations.js", () => ({
|
|
190
|
+
...normalSource,
|
|
191
|
+
...source,
|
|
192
|
+
COMPILED_OBSERVATION_ENTRIES: Object.freeze([observationEntry]),
|
|
193
|
+
loadFixedObservationOperation() {
|
|
194
|
+
assert.equal(arguments.length, 0);
|
|
195
|
+
state.sourceLoads++;
|
|
196
|
+
return sourceOperation;
|
|
197
|
+
},
|
|
198
|
+
}));
|
|
199
|
+
const actor = await import("../observation/actor.js");
|
|
200
|
+
OWNER.check();
|
|
201
|
+
return {
|
|
202
|
+
prerequisite,
|
|
203
|
+
actual,
|
|
204
|
+
actor,
|
|
205
|
+
controlCase,
|
|
206
|
+
sourceOperation,
|
|
207
|
+
declaration,
|
|
208
|
+
state,
|
|
209
|
+
OWNER,
|
|
210
|
+
basis,
|
|
211
|
+
record,
|
|
212
|
+
input,
|
|
213
|
+
operation,
|
|
214
|
+
http,
|
|
215
|
+
expectedOutput,
|
|
216
|
+
capture(...args: unknown[]) {
|
|
217
|
+
const handle = Reflect.apply(
|
|
218
|
+
actor.captureOwnedRenewalObservationV2,
|
|
219
|
+
actor,
|
|
220
|
+
args,
|
|
221
|
+
) as ReturnType<typeof actor.captureOwnedRenewalObservationV2>;
|
|
222
|
+
return Object.freeze({
|
|
223
|
+
invoke(...invokeArgs: unknown[]) {
|
|
224
|
+
state.targetCalls++;
|
|
225
|
+
return Reflect.apply(
|
|
226
|
+
handle.invoke,
|
|
227
|
+
handle,
|
|
228
|
+
invokeArgs,
|
|
229
|
+
) as ReturnType<typeof handle.invoke>;
|
|
230
|
+
},
|
|
231
|
+
});
|
|
232
|
+
},
|
|
233
|
+
async cleanup() {
|
|
234
|
+
try {
|
|
235
|
+
await http.cleanup();
|
|
236
|
+
await joinObservationWork(state);
|
|
237
|
+
assert.equal(record.attachReceipt, prerequisite.acknowledgement);
|
|
238
|
+
if (declaration.expectedOwner === "retired")
|
|
239
|
+
assert.throws(() => OWNER.basis, {
|
|
240
|
+
name: "Error",
|
|
241
|
+
message: "ORIGINAL_OWNER_STOP",
|
|
242
|
+
});
|
|
243
|
+
else assert.equal(OWNER.basis, basis);
|
|
244
|
+
assert.equal(prerequisite.state.records.length, 3);
|
|
245
|
+
assert.equal(
|
|
246
|
+
prerequisite.state.calls.filter((r) => r.method === "POST").length,
|
|
247
|
+
1,
|
|
248
|
+
);
|
|
249
|
+
} finally {
|
|
250
|
+
http.hold.release.resolve();
|
|
251
|
+
cleanObservationAPI();
|
|
252
|
+
await prerequisite.cleanup();
|
|
253
|
+
}
|
|
254
|
+
},
|
|
255
|
+
};
|
|
256
|
+
} catch (error) {
|
|
257
|
+
cleanObservationAPI();
|
|
258
|
+
await prerequisite.cleanup();
|
|
259
|
+
throw error;
|
|
260
|
+
}
|
|
261
|
+
}
|
|
262
|
+
export type ObservationFixture = Awaited<ReturnType<typeof observationFixture>>;
|
|
@@ -0,0 +1,319 @@
|
|
|
1
|
+
import assert from "node:assert/strict";
|
|
2
|
+
import { vi } from "vitest";
|
|
3
|
+
import type { ObservationDeclaration } from "./observationDeclarations.js";
|
|
4
|
+
import type { ObservationState } from "./observationObservations.js";
|
|
5
|
+
|
|
6
|
+
export const MISSING_OBSERVATION_PORT =
|
|
7
|
+
"BTS306_REPOSITORY_OBSERVATION_ORCHESTRATION_MISSING";
|
|
8
|
+
/** Exact TEST missing-feature frontier. Never a fabricated successful actor. */
|
|
9
|
+
export function captureMissingObservationPort(state: { targetCalls: number }) {
|
|
10
|
+
assert.equal(arguments.length, 1);
|
|
11
|
+
let consumed = false;
|
|
12
|
+
return Object.freeze({
|
|
13
|
+
async invoke() {
|
|
14
|
+
assert.equal(arguments.length, 0);
|
|
15
|
+
assert.equal(consumed, false);
|
|
16
|
+
consumed = true;
|
|
17
|
+
state.targetCalls++;
|
|
18
|
+
throw Error(MISSING_OBSERVATION_PORT);
|
|
19
|
+
},
|
|
20
|
+
});
|
|
21
|
+
}
|
|
22
|
+
export const deferredLexicalProbe = Object.freeze({
|
|
23
|
+
normalPort:
|
|
24
|
+
"Await actual repository business Source; no copy body exists yet",
|
|
25
|
+
additivePort: "Await exact actor; require full import-only/additive inverses",
|
|
26
|
+
noExportedAuthority: true,
|
|
27
|
+
});
|
|
28
|
+
|
|
29
|
+
/** TEST diagnostics only. Does not inspect/unmask the normalized business error. */
|
|
30
|
+
export async function logObservationFailureFrontier(
|
|
31
|
+
h: import("./observationOperation.js").ObservationFixture,
|
|
32
|
+
) {
|
|
33
|
+
const descriptor = {
|
|
34
|
+
present: false,
|
|
35
|
+
data: false,
|
|
36
|
+
getter: false,
|
|
37
|
+
setter: false,
|
|
38
|
+
enumerable: false,
|
|
39
|
+
configurable: false,
|
|
40
|
+
inspectionFailed: false,
|
|
41
|
+
};
|
|
42
|
+
try {
|
|
43
|
+
// Same literal resolved module as the actor; inspect metadata without invoking getter.
|
|
44
|
+
const namespace = await import("../material/classifiers.js");
|
|
45
|
+
const own = Object.getOwnPropertyDescriptor(
|
|
46
|
+
namespace,
|
|
47
|
+
"classifyOwnedRetainedInitialAttachment",
|
|
48
|
+
);
|
|
49
|
+
descriptor.present = own !== undefined;
|
|
50
|
+
if (own) {
|
|
51
|
+
descriptor.data = Object.prototype.hasOwnProperty.call(own, "value");
|
|
52
|
+
descriptor.getter = typeof own.get === "function";
|
|
53
|
+
descriptor.setter = typeof own.set === "function";
|
|
54
|
+
descriptor.enumerable = own.enumerable === true;
|
|
55
|
+
descriptor.configurable = own.configurable === true;
|
|
56
|
+
}
|
|
57
|
+
} catch {
|
|
58
|
+
// Diagnostics must not replace the original failed test with an import error.
|
|
59
|
+
descriptor.inspectionFailed = true;
|
|
60
|
+
}
|
|
61
|
+
console.log(
|
|
62
|
+
JSON.stringify({
|
|
63
|
+
kind: "REPOSITORY_OBSERVATION_FAILURE_FRONTIER",
|
|
64
|
+
targetCalls: h.state.targetCalls,
|
|
65
|
+
sourceLoads: h.state.sourceLoads,
|
|
66
|
+
C6Entries: h.state.ownedC6,
|
|
67
|
+
C3Entries: h.state.ownedC3,
|
|
68
|
+
C3Fulfilled: h.state.C3Fulfilled,
|
|
69
|
+
C3Rejected: h.state.C3Rejected,
|
|
70
|
+
recordVerificationEntered: h.state.recordVerificationEntered,
|
|
71
|
+
recordVerificationCompleted: h.state.recordVerificationCompleted,
|
|
72
|
+
observerEntries: h.state.ownedObserver,
|
|
73
|
+
coverageEntries: h.state.coverage,
|
|
74
|
+
C9Entries: h.state.ownedC9,
|
|
75
|
+
readonlyHTTP: h.http.calls.length,
|
|
76
|
+
delegateArgCalls: h.http.argsSeen.length,
|
|
77
|
+
delegateEntriesAfterOwner: h.http.delegateEntriesAfterOwner(),
|
|
78
|
+
originalReadPromises: h.http.originals.length,
|
|
79
|
+
originalAPIPromises: h.state.originals.length,
|
|
80
|
+
registeredAPISideObservers: h.state.pending.length,
|
|
81
|
+
finalReadSampleRecorded: h.http.finalSample() !== null,
|
|
82
|
+
preflightPairLoads: h.prerequisite.state.pairLoads,
|
|
83
|
+
preflightReadonlyCalls: h.prerequisite.state.readonlyCalls,
|
|
84
|
+
appendedRecords: h.prerequisite.deltas().records,
|
|
85
|
+
POSTs: h.prerequisite.deltas().POST,
|
|
86
|
+
classifierExportDescriptor: descriptor,
|
|
87
|
+
operationalAuthority: false,
|
|
88
|
+
}),
|
|
89
|
+
);
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
/** Source fault recipes are selected before constructors; only this new TEST tuple changes. */
|
|
93
|
+
export function controlOperation<
|
|
94
|
+
T extends {
|
|
95
|
+
owner: unknown;
|
|
96
|
+
originAssociation: unknown;
|
|
97
|
+
originalEntry: unknown;
|
|
98
|
+
observationEntry: unknown;
|
|
99
|
+
actualAttachAcknowledgement: unknown;
|
|
100
|
+
record: Pick<
|
|
101
|
+
import("../preflight/grammar.js").PreflightRecord,
|
|
102
|
+
"configuration" | "request"
|
|
103
|
+
>;
|
|
104
|
+
readTransport: unknown;
|
|
105
|
+
},
|
|
106
|
+
>(op: T, d: ObservationDeclaration, s: ObservationState): unknown {
|
|
107
|
+
const mode = d.controlCase;
|
|
108
|
+
if (mode === "G02-owner") return Object.freeze({ ...op, owner: d.foreign });
|
|
109
|
+
if (mode === "G02-origin")
|
|
110
|
+
return Object.freeze({ ...op, originAssociation: d.foreign });
|
|
111
|
+
if (mode === "G02-entry")
|
|
112
|
+
return Object.freeze({ ...op, originalEntry: d.foreign });
|
|
113
|
+
if (mode === "G02-observation-entry")
|
|
114
|
+
return Object.freeze({ ...op, observationEntry: d.foreign });
|
|
115
|
+
if (mode === "G02-ack-clone")
|
|
116
|
+
return Object.freeze({
|
|
117
|
+
...op,
|
|
118
|
+
actualAttachAcknowledgement: structuredClone(
|
|
119
|
+
op.actualAttachAcknowledgement,
|
|
120
|
+
),
|
|
121
|
+
});
|
|
122
|
+
if (mode === "G02-tuple-proxy")
|
|
123
|
+
return new Proxy(op, {
|
|
124
|
+
get(target, key, receiver) {
|
|
125
|
+
s.tupleTraps++;
|
|
126
|
+
return Reflect.get(target, key, receiver);
|
|
127
|
+
},
|
|
128
|
+
ownKeys(target) {
|
|
129
|
+
s.tupleTraps++;
|
|
130
|
+
return Reflect.ownKeys(target);
|
|
131
|
+
},
|
|
132
|
+
getPrototypeOf(target) {
|
|
133
|
+
s.tupleTraps++;
|
|
134
|
+
return Reflect.getPrototypeOf(target);
|
|
135
|
+
},
|
|
136
|
+
getOwnPropertyDescriptor(target, key) {
|
|
137
|
+
s.tupleTraps++;
|
|
138
|
+
return Reflect.getOwnPropertyDescriptor(target, key);
|
|
139
|
+
},
|
|
140
|
+
});
|
|
141
|
+
if (mode === "G02-method-getter") {
|
|
142
|
+
const delegate = {};
|
|
143
|
+
Object.defineProperty(delegate, "rawRequest", {
|
|
144
|
+
enumerable: true,
|
|
145
|
+
get() {
|
|
146
|
+
s.methodGetterCalls++;
|
|
147
|
+
throw Error("TEST_UNEXPECTED_UNTRUSTED_GETTER");
|
|
148
|
+
},
|
|
149
|
+
});
|
|
150
|
+
return Object.freeze({ ...op, readTransport: Object.freeze(delegate) });
|
|
151
|
+
}
|
|
152
|
+
if (mode === "G02-optional-undefined")
|
|
153
|
+
return Object.freeze({ ...op, configureAcknowledgement: undefined });
|
|
154
|
+
if (mode === "G02-optional-null")
|
|
155
|
+
return Object.freeze({ ...op, configureAcknowledgement: null });
|
|
156
|
+
if (mode === "G02-optional-present")
|
|
157
|
+
return Object.freeze({
|
|
158
|
+
...op,
|
|
159
|
+
configureAcknowledgement: Object.freeze({
|
|
160
|
+
declared: "UNBOUND_OPTIONAL_ACK",
|
|
161
|
+
}),
|
|
162
|
+
});
|
|
163
|
+
if (mode === "G03-failure" || mode === "G03-retire") {
|
|
164
|
+
const original = op.record.request.logicalBinding;
|
|
165
|
+
const binding =
|
|
166
|
+
original.slice(0, -1) + (original.endsWith("a") ? "b" : "a");
|
|
167
|
+
return Object.freeze({
|
|
168
|
+
...op,
|
|
169
|
+
record: Object.freeze({
|
|
170
|
+
...op.record,
|
|
171
|
+
configuration: { ...op.record.configuration, apiVersion: d.invalidAPI },
|
|
172
|
+
request: { ...op.record.request, logicalBinding: binding },
|
|
173
|
+
}),
|
|
174
|
+
});
|
|
175
|
+
}
|
|
176
|
+
if (mode === "G03-structural") {
|
|
177
|
+
const configuration: Record<string, unknown> = {
|
|
178
|
+
...op.record.configuration,
|
|
179
|
+
};
|
|
180
|
+
delete configuration.preparation;
|
|
181
|
+
return Object.freeze({ ...op, record: { ...op.record, configuration } });
|
|
182
|
+
}
|
|
183
|
+
return op;
|
|
184
|
+
}
|
|
185
|
+
|
|
186
|
+
/** EMPTY is tested without constructing any initial fixture or client. */
|
|
187
|
+
export async function assertEmptyObservation() {
|
|
188
|
+
vi.resetModules();
|
|
189
|
+
const effects = {
|
|
190
|
+
source: 0,
|
|
191
|
+
owner: 0,
|
|
192
|
+
sample: 0,
|
|
193
|
+
client: 0,
|
|
194
|
+
record: 0,
|
|
195
|
+
api: 0,
|
|
196
|
+
read: 0,
|
|
197
|
+
};
|
|
198
|
+
const poison = (key: keyof typeof effects) => () => {
|
|
199
|
+
effects[key]++;
|
|
200
|
+
throw Error("EMPTY_EFFECT_" + key);
|
|
201
|
+
};
|
|
202
|
+
vi.doMock("../operations/sourceOperations.js", async () => {
|
|
203
|
+
const actual = await vi.importActual<
|
|
204
|
+
typeof import("../operations/sourceOperations.js")
|
|
205
|
+
>("../operations/sourceOperations.js");
|
|
206
|
+
return { ...actual, loadFixedObservationOperation: poison("source") };
|
|
207
|
+
});
|
|
208
|
+
vi.doMock("../originalOwner.js", () => ({
|
|
209
|
+
OWNER: Object.freeze({
|
|
210
|
+
check: poison("owner"),
|
|
211
|
+
sample: poison("sample"),
|
|
212
|
+
subscribe: poison("owner"),
|
|
213
|
+
retire: poison("owner"),
|
|
214
|
+
get basis() {
|
|
215
|
+
return poison("owner")();
|
|
216
|
+
},
|
|
217
|
+
}),
|
|
218
|
+
}));
|
|
219
|
+
vi.doMock("../observation/record.js", async () => {
|
|
220
|
+
const actual = await vi.importActual<
|
|
221
|
+
typeof import("../observation/record.js")
|
|
222
|
+
>("../observation/record.js");
|
|
223
|
+
return { ...actual, captureObservationRecord: poison("record") };
|
|
224
|
+
});
|
|
225
|
+
vi.doMock("../../../renewalV2/index.js", async () => {
|
|
226
|
+
const actual = await vi.importActual<
|
|
227
|
+
typeof import("../../../renewalV2/index.js")
|
|
228
|
+
>("../../../renewalV2/index.js");
|
|
229
|
+
return {
|
|
230
|
+
...actual,
|
|
231
|
+
projectRenewalConfigurationV2: poison("api"),
|
|
232
|
+
constructRenewalScheduleAttachmentReceiptV2: poison("api"),
|
|
233
|
+
constructRenewalConfigurationReceiptV2: poison("api"),
|
|
234
|
+
};
|
|
235
|
+
});
|
|
236
|
+
vi.doMock("../../../renewalV2/observation.js", async () => {
|
|
237
|
+
const actual = await vi.importActual<
|
|
238
|
+
typeof import("../../../renewalV2/observation.js")
|
|
239
|
+
>("../../../renewalV2/observation.js");
|
|
240
|
+
return { ...actual, inspectRenewalScheduleMaterialV2: poison("api") };
|
|
241
|
+
});
|
|
242
|
+
vi.doMock("../../../../helpers.js", async () => {
|
|
243
|
+
const actual = await vi.importActual<
|
|
244
|
+
typeof import("../../../../helpers.js")
|
|
245
|
+
>("../../../../helpers.js");
|
|
246
|
+
return { ...actual, getStripeClient: poison("client") };
|
|
247
|
+
});
|
|
248
|
+
vi.stubGlobal("fetch", poison("read"));
|
|
249
|
+
try {
|
|
250
|
+
const source = await import("../operations/sourceOperations.js");
|
|
251
|
+
assert.deepEqual(source.COMPILED_OBSERVATION_ENTRIES, []);
|
|
252
|
+
assert(Object.isFrozen(source.COMPILED_OBSERVATION_ENTRIES));
|
|
253
|
+
const actor = await import("../observation/actor.js");
|
|
254
|
+
const handle = actor.captureOwnedRenewalObservationV2();
|
|
255
|
+
assert.deepEqual(await handle.invoke(), {
|
|
256
|
+
status: "not_dispatched",
|
|
257
|
+
reason: "OWNED_OBSERVATION_SOURCE_UNBOUND",
|
|
258
|
+
operationalAuthority: false,
|
|
259
|
+
});
|
|
260
|
+
assert.deepEqual(effects, {
|
|
261
|
+
source: 0,
|
|
262
|
+
owner: 0,
|
|
263
|
+
sample: 0,
|
|
264
|
+
client: 0,
|
|
265
|
+
record: 0,
|
|
266
|
+
api: 0,
|
|
267
|
+
read: 0,
|
|
268
|
+
});
|
|
269
|
+
} finally {
|
|
270
|
+
for (const path of [
|
|
271
|
+
"../operations/sourceOperations.js",
|
|
272
|
+
"../originalOwner.js",
|
|
273
|
+
"../observation/record.js",
|
|
274
|
+
"../../../renewalV2/index.js",
|
|
275
|
+
"../../../renewalV2/observation.js",
|
|
276
|
+
"../../../../helpers.js",
|
|
277
|
+
])
|
|
278
|
+
vi.doUnmock(path);
|
|
279
|
+
vi.unstubAllGlobals();
|
|
280
|
+
vi.resetModules();
|
|
281
|
+
}
|
|
282
|
+
}
|
|
283
|
+
|
|
284
|
+
/** TEST-only finite latch; no clock or owner replacement. */
|
|
285
|
+
export function observationLatch() {
|
|
286
|
+
const deferred = () => {
|
|
287
|
+
let resolve!: () => void;
|
|
288
|
+
const promise = new Promise<void>((done) => {
|
|
289
|
+
resolve = done;
|
|
290
|
+
});
|
|
291
|
+
return { promise, resolve };
|
|
292
|
+
};
|
|
293
|
+
return { entered: deferred(), release: deferred() };
|
|
294
|
+
}
|
|
295
|
+
export async function retireObservationHeld(
|
|
296
|
+
h: import("./observationOperation.js").ObservationFixture,
|
|
297
|
+
promise: ReturnType<ReturnType<typeof h.capture>["invoke"]>,
|
|
298
|
+
) {
|
|
299
|
+
const observed = promise.then(
|
|
300
|
+
(value) => ({ ok: true as const, value }),
|
|
301
|
+
(error: unknown) => ({ ok: false as const, error }),
|
|
302
|
+
);
|
|
303
|
+
try {
|
|
304
|
+
const frontier = await Promise.race([
|
|
305
|
+
h.http.hold.entered.promise.then(() => "entered" as const),
|
|
306
|
+
observed.then(() => "settled" as const),
|
|
307
|
+
]);
|
|
308
|
+
assert.equal(
|
|
309
|
+
frontier,
|
|
310
|
+
"entered",
|
|
311
|
+
"actual held HTTP frontier must precede settlement",
|
|
312
|
+
);
|
|
313
|
+
assert.equal(h.http.originals.length, h.declaration.transport.ordinal);
|
|
314
|
+
h.OWNER.retire();
|
|
315
|
+
} finally {
|
|
316
|
+
h.http.hold.release.resolve();
|
|
317
|
+
}
|
|
318
|
+
return observed;
|
|
319
|
+
}
|
|
@@ -0,0 +1,94 @@
|
|
|
1
|
+
import { vi } from "vitest";
|
|
2
|
+
import { input } from "../../../../../../tests/renewalAggregate/rawRetention.js";
|
|
3
|
+
import { installReadRejection } from "./stockHttp.js";
|
|
4
|
+
|
|
5
|
+
/** TEST-only fixed Source bindings, declared before importing the actual singleton. */
|
|
6
|
+
export async function ownedReadFailureFixture() {
|
|
7
|
+
const api = await import("../../../renewalV2/index.js");
|
|
8
|
+
const preparation: Parameters<
|
|
9
|
+
typeof api.prepareRenewalPriceReplacementV2
|
|
10
|
+
>[0] = input();
|
|
11
|
+
const prepared = await api.prepareRenewalPriceReplacementV2(preparation);
|
|
12
|
+
const firstDispatchedAt = prepared.expected.periodStart + 1;
|
|
13
|
+
const request = await api.prepareRenewalScheduleAttachmentV2({
|
|
14
|
+
prepared,
|
|
15
|
+
apiVersion: "2026-09-30.endive",
|
|
16
|
+
attachKey: "attach:owned-wire-test",
|
|
17
|
+
firstDispatchedAt,
|
|
18
|
+
});
|
|
19
|
+
const wallMs = firstDispatchedAt * 1000,
|
|
20
|
+
ns = BigInt(wallMs) * 1_000_000n;
|
|
21
|
+
const source = Object.freeze({
|
|
22
|
+
clock: Object.freeze({
|
|
23
|
+
basis: Object.freeze({
|
|
24
|
+
startWallMs: wallMs,
|
|
25
|
+
startNs: ns,
|
|
26
|
+
workEndWallMs: wallMs + 180000,
|
|
27
|
+
workEndNs: ns + 180000000000n,
|
|
28
|
+
endWallMs: wallMs + 210000,
|
|
29
|
+
endNs: ns + 210000000000n,
|
|
30
|
+
}),
|
|
31
|
+
sample: () => ({ wallMs, ns }),
|
|
32
|
+
subscribeRetirement: () => () => {},
|
|
33
|
+
}),
|
|
34
|
+
originalPolicy: Object.freeze({
|
|
35
|
+
firstDispatchedAt,
|
|
36
|
+
periodStart: prepared.expected.periodStart,
|
|
37
|
+
periodEnd: prepared.expected.periodEnd,
|
|
38
|
+
}),
|
|
39
|
+
originAssociation: Object.freeze({}),
|
|
40
|
+
});
|
|
41
|
+
const query = String(
|
|
42
|
+
new URLSearchParams(
|
|
43
|
+
["discounts", "items.data.discounts", "items.data.price"].map((v, i) => [
|
|
44
|
+
"expand[" + i + "]",
|
|
45
|
+
v,
|
|
46
|
+
]),
|
|
47
|
+
),
|
|
48
|
+
);
|
|
49
|
+
const path =
|
|
50
|
+
"/v1/subscriptions/" + prepared.expected.subscriptionId + "?" + query;
|
|
51
|
+
const http = installReadRejection("https://api.stripe.com" + path);
|
|
52
|
+
const { getStripeClient } = await import("../../../../helpers.js");
|
|
53
|
+
const client = getStripeClient("sk_test_owned_wire", "2026-09-30.endive", {
|
|
54
|
+
singleAttempt: true,
|
|
55
|
+
});
|
|
56
|
+
vi.doMock("../sourceBindings.js", () => ({
|
|
57
|
+
loadOwnedOriginalSource: () => source,
|
|
58
|
+
loadFixedStockClient: () => client,
|
|
59
|
+
}));
|
|
60
|
+
const { OWNER } = await import("../originalOwner.js");
|
|
61
|
+
const { createSourceStockRawDelegate } =
|
|
62
|
+
await import("../stockRawDelegate.js");
|
|
63
|
+
const delegate = createSourceStockRawDelegate();
|
|
64
|
+
const readPlan = [
|
|
65
|
+
{ resource: "subscription", path },
|
|
66
|
+
{
|
|
67
|
+
resource: "price",
|
|
68
|
+
path: "/v1/prices/" + prepared.expected.targetPriceId,
|
|
69
|
+
},
|
|
70
|
+
{
|
|
71
|
+
resource: "customer",
|
|
72
|
+
path: "/v1/customers/" + prepared.providerSnapshot.billingCustomer!.id,
|
|
73
|
+
},
|
|
74
|
+
].map((row, i) => ({
|
|
75
|
+
...row,
|
|
76
|
+
ordinal: i + 1,
|
|
77
|
+
method: "GET",
|
|
78
|
+
body: undefined,
|
|
79
|
+
options: { apiVersion: "2026-09-30.endive", maxNetworkRetries: 0 },
|
|
80
|
+
}));
|
|
81
|
+
const transportSource = Object.freeze({
|
|
82
|
+
owner: OWNER,
|
|
83
|
+
request,
|
|
84
|
+
readPlan,
|
|
85
|
+
delegate,
|
|
86
|
+
});
|
|
87
|
+
vi.doMock("../operations/sourceOperations.js", () => ({
|
|
88
|
+
loadOwnedTransportSource: () => transportSource,
|
|
89
|
+
}));
|
|
90
|
+
const { createOwnedTransportWithAttemptCapability } =
|
|
91
|
+
await import("../operations/fixedTransport.js");
|
|
92
|
+
const pair = createOwnedTransportWithAttemptCapability();
|
|
93
|
+
return { prepared, request, OWNER, pair, http, source };
|
|
94
|
+
}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { createSourceRawAcquisition } from "../acquisition/rawAcquisition.js";
|
|
2
|
+
import type { OWNER } from "../originalOwner.js";
|
|
3
|
+
import type { createOwnedTransportWithAttemptCapability } from "../operations/fixedTransport.js";
|
|
4
|
+
|
|
5
|
+
type Pair = ReturnType<typeof createOwnedTransportWithAttemptCapability>;
|
|
6
|
+
/**
|
|
7
|
+
* Missing-wiring baseline ONLY: the current isolated factory selects its own delegate.
|
|
8
|
+
* After a saved meaningful RED, retarget the test's import to the actual Source-bound
|
|
9
|
+
* production implementation with this signature. No assertion or fake token changes.
|
|
10
|
+
*/
|
|
11
|
+
export function bindRawAcquisitionFromSource(
|
|
12
|
+
_owner: typeof OWNER,
|
|
13
|
+
_transport: Pair["transport"]["readTransport"],
|
|
14
|
+
) {
|
|
15
|
+
return createSourceRawAcquisition();
|
|
16
|
+
}
|