@fantastic.dev/better-stripe 0.91.0 → 0.93.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/configure/actor.d.ts +6 -0
- package/dist/client/billing/renewalAttach/internal/configure/actor.d.ts.map +1 -1
- package/dist/client/billing/renewalAttach/internal/configure/actor.js +46 -56
- package/dist/client/billing/renewalAttach/internal/configure/actor.js.map +1 -1
- 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/observation/actor.d.ts.map +1 -1
- package/dist/client/billing/renewalAttach/internal/observation/actor.js +25 -4
- package/dist/client/billing/renewalAttach/internal/observation/actor.js.map +1 -1
- package/dist/client/billing/renewalAttach/internal/observation/capture.d.ts.map +1 -1
- package/dist/client/billing/renewalAttach/internal/observation/capture.js +3 -2
- package/dist/client/billing/renewalAttach/internal/observation/capture.js.map +1 -1
- 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/types.d.ts +5 -0
- package/dist/client/billing/renewalAttach/internal/observation/types.d.ts.map +1 -1
- package/dist/client/billing/renewalAttach/internal/observation/types.js.map +1 -1
- package/dist/client/billing/renewalAttach/internal/producer/classOwnedActionRoot.d.ts +30 -0
- package/dist/client/billing/renewalAttach/internal/producer/classOwnedActionRoot.d.ts.map +1 -0
- package/dist/client/billing/renewalAttach/internal/producer/classOwnedActionRoot.js +113 -0
- package/dist/client/billing/renewalAttach/internal/producer/classOwnedActionRoot.js.map +1 -0
- package/dist/client/connect/payoutAdoptionTestHelpers.d.ts +562 -0
- package/dist/client/connect/payoutAdoptionTestHelpers.d.ts.map +1 -1
- package/dist/client/connect/payoutExecutionTestHelpers.d.ts +281 -0
- package/dist/client/connect/payoutExecutionTestHelpers.d.ts.map +1 -1
- package/dist/client/connect/payoutLargeAdoptionTestHelpers.d.ts +562 -0
- package/dist/client/connect/payoutLargeAdoptionTestHelpers.d.ts.map +1 -1
- package/dist/client/connect/payoutSyncTestHelpers.d.ts +281 -0
- package/dist/client/connect/payoutSyncTestHelpers.d.ts.map +1 -1
- package/dist/client/index.d.ts +3 -2
- package/dist/client/index.d.ts.map +1 -1
- package/dist/client/index.js +16 -3
- package/dist/client/index.js.map +1 -1
- package/dist/component/_generated/api.d.ts +6 -0
- package/dist/component/_generated/api.d.ts.map +1 -1
- package/dist/component/_generated/api.js.map +1 -1
- package/dist/component/_generated/component.d.ts +406 -0
- package/dist/component/_generated/component.d.ts.map +1 -1
- package/dist/component/balanceFunding/workflowValidators.d.ts +16 -16
- package/dist/component/earnings/triggers.d.ts +294 -0
- package/dist/component/earnings/triggers.d.ts.map +1 -1
- package/dist/component/payoutRelease/queries.d.ts +2 -2
- package/dist/component/payoutRelease/queries.d.ts.map +1 -1
- package/dist/component/processingCostReconciliation/rollback.d.ts +1 -1
- package/dist/component/renewalOperations/helpers.d.ts +236 -0
- package/dist/component/renewalOperations/helpers.d.ts.map +1 -0
- package/dist/component/renewalOperations/helpers.js +457 -0
- package/dist/component/renewalOperations/helpers.js.map +1 -0
- package/dist/component/renewalOperations/mutations.d.ts +252 -0
- package/dist/component/renewalOperations/mutations.d.ts.map +1 -0
- package/dist/component/renewalOperations/mutations.js +340 -0
- package/dist/component/renewalOperations/mutations.js.map +1 -0
- package/dist/component/renewalOperations/queries.d.ts +163 -0
- package/dist/component/renewalOperations/queries.d.ts.map +1 -0
- package/dist/component/renewalOperations/queries.js +167 -0
- package/dist/component/renewalOperations/queries.js.map +1 -0
- package/dist/component/renewalOperations/schema.d.ts +1988 -0
- package/dist/component/renewalOperations/schema.d.ts.map +1 -0
- package/dist/component/renewalOperations/schema.js +227 -0
- package/dist/component/renewalOperations/schema.js.map +1 -0
- package/dist/component/schema.d.ts +281 -0
- package/dist/component/schema.js +5 -0
- package/dist/component/schema.js.map +1 -1
- package/dist/component/usage/allowance.fixtures.d.ts +281 -0
- package/dist/component/usage/allowance.fixtures.d.ts.map +1 -1
- package/dist/component/usageCredits/accounting.fixtures.d.ts +281 -0
- package/dist/component/usageCredits/accounting.fixtures.d.ts.map +1 -1
- package/dist/shared/renewalOperationJournal.d.ts +43 -0
- package/dist/shared/renewalOperationJournal.d.ts.map +1 -0
- package/dist/shared/renewalOperationJournal.js +294 -0
- package/dist/shared/renewalOperationJournal.js.map +1 -0
- package/docs/renewal-context-reads.md +152 -0
- package/docs/renewal-material-observation.md +32 -11
- package/package.json +1 -1
- package/src/client/billing/renewalAttach/internal/configure/actor.ts +63 -52
- package/src/client/billing/renewalAttach/internal/configure/ownedContinuation.ts +56 -0
- package/src/client/billing/renewalAttach/internal/observation/actor.ts +46 -3
- package/src/client/billing/renewalAttach/internal/observation/capture.ts +3 -2
- package/src/client/billing/renewalAttach/internal/observation/configureAcknowledgement.ts +20 -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/types.ts +5 -0
- package/src/client/billing/renewalAttach/internal/operationJournal.integration.test.ts +380 -0
- package/src/client/billing/renewalAttach/internal/producer/classOwnedActionRoot.ts +155 -0
- package/src/client/billing/renewalAttach/internal/test-fixtures/configureWriteAssertions.ts +5 -1
- package/src/client/billing/renewalAttach/internal/test-fixtures/configureWriteDeclarations.ts +12 -1
- package/src/client/billing/renewalAttach/internal/test-fixtures/configureWriteDelegate.ts +38 -0
- package/src/client/billing/renewalAttach/internal/test-fixtures/configureWriteHistory.ts +8 -0
- package/src/client/billing/renewalAttach/internal/test-fixtures/configureWriteOperation.ts +10 -23
- 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/index.ts +24 -3
- package/src/component/_generated/api.ts +6 -0
- package/src/component/_generated/component.ts +450 -0
- package/src/component/renewalOperations/acknowledgement.fixtures.ts +552 -0
- package/src/component/renewalOperations/acknowledgement.test.ts +573 -0
- package/src/component/renewalOperations/acknowledgementReads.test.ts +442 -0
- package/src/component/renewalOperations/acknowledgementV2.test.ts +493 -0
- package/src/component/renewalOperations/acknowledgementV2Publication.test.ts +373 -0
- package/src/component/renewalOperations/basisBinding.test.ts +567 -0
- package/src/component/renewalOperations/basisLifecycle.test.ts +569 -0
- package/src/component/renewalOperations/boundHistory.test.ts +474 -0
- package/src/component/renewalOperations/helpers.ts +592 -0
- package/src/component/renewalOperations/historyReads.test.ts +595 -0
- package/src/component/renewalOperations/initialBasis.test.ts +578 -0
- package/src/component/renewalOperations/journal.test.ts +567 -0
- package/src/component/renewalOperations/mutations.ts +456 -0
- package/src/component/renewalOperations/payload.test.ts +589 -0
- package/src/component/renewalOperations/payloadEncoding.test.ts +592 -0
- package/src/component/renewalOperations/queries.ts +204 -0
- package/src/component/renewalOperations/schema.ts +268 -0
- package/src/component/renewalOperations/timingPolicy.fixtures.ts +193 -0
- package/src/component/renewalOperations/timingPolicy.test.ts +523 -0
- package/src/component/schema.ts +11 -0
- package/src/shared/renewalOperationJournal.ts +333 -0
|
@@ -1,4 +1,7 @@
|
|
|
1
1
|
import { types } from "node:util";
|
|
2
|
+
import { owned } from "./ownedContinuation.js";
|
|
3
|
+
import { renewalSnapshot } from "../../../renewalReplacementSnapshot.js";
|
|
4
|
+
import { freeze } from "../material/nodeKernel.js";
|
|
2
5
|
import { OWNER } from "../originalOwner.js";
|
|
3
6
|
import {
|
|
4
7
|
COMPILED_CONFIGURE_WRITE_ENTRIES as ENTRIES,
|
|
@@ -59,7 +62,9 @@ type History = {
|
|
|
59
62
|
| "receipt_prepared"
|
|
60
63
|
| "receipt_recorded";
|
|
61
64
|
pair: Pair | null;
|
|
62
|
-
receipt?:
|
|
65
|
+
receipt?: Parameters<typeof admitConfigureACK>[2];
|
|
66
|
+
rawReceipt?: Parameters<typeof admitConfigureACK>[1];
|
|
67
|
+
returned: boolean;
|
|
63
68
|
output?: unknown;
|
|
64
69
|
};
|
|
65
70
|
// Local actual Source identities only. JSON and public preflight output never enter this map.
|
|
@@ -79,59 +84,62 @@ function isCurrentBundle(
|
|
|
79
84
|
wireSubscription: record.configuration.freshSubscription,
|
|
80
85
|
});
|
|
81
86
|
}
|
|
82
|
-
/**
|
|
83
|
-
function
|
|
87
|
+
/** Checked process-local custody only; neither a caller context nor write authority. */
|
|
88
|
+
export function readOwnedConfigureAcknowledgement(
|
|
89
|
+
operation: unknown,
|
|
90
|
+
acknowledgement: unknown,
|
|
91
|
+
record: PreflightRecord,
|
|
92
|
+
actualAttachAcknowledgement: unknown,
|
|
93
|
+
origin: unknown,
|
|
94
|
+
originalEntry: unknown,
|
|
95
|
+
) {
|
|
84
96
|
OWNER.check();
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
finish(false, error);
|
|
129
|
-
} catch {
|
|
130
|
-
retire();
|
|
131
|
-
}
|
|
132
|
-
},
|
|
133
|
-
);
|
|
97
|
+
need(arguments.length === 6);
|
|
98
|
+
const row = historyFor(operation);
|
|
99
|
+
need(row && row.owner === OWNER && row.basis === OWNER.basis);
|
|
100
|
+
need(
|
|
101
|
+
row.origin === ORIGINAL_ORIGIN_ASSOCIATION &&
|
|
102
|
+
row.origin === origin &&
|
|
103
|
+
row.entry === originalEntry &&
|
|
104
|
+
!types.isProxy(COMPILED_INITIAL_ENTRIES) &&
|
|
105
|
+
Array.isArray(COMPILED_INITIAL_ENTRIES) &&
|
|
106
|
+
COMPILED_INITIAL_ENTRIES.includes(row.entry) &&
|
|
107
|
+
!types.isProxy(ENTRIES) &&
|
|
108
|
+
Array.isArray(ENTRIES) &&
|
|
109
|
+
ENTRIES.includes(row.configureEntry),
|
|
110
|
+
);
|
|
111
|
+
const entry = closed(row.configureEntry, [
|
|
112
|
+
"originalEntry",
|
|
113
|
+
"coversConfigure",
|
|
114
|
+
]);
|
|
115
|
+
need(entry.originalEntry === row.entry);
|
|
116
|
+
need(
|
|
117
|
+
row.actualAttachAcknowledgement === actualAttachAcknowledgement &&
|
|
118
|
+
equal(row.record, record) &&
|
|
119
|
+
row.lineage.receiptKnown &&
|
|
120
|
+
row.state === "receipt_recorded" &&
|
|
121
|
+
row.returned === true &&
|
|
122
|
+
row.output === acknowledgement &&
|
|
123
|
+
row.rawReceipt &&
|
|
124
|
+
row.receipt,
|
|
125
|
+
);
|
|
126
|
+
// Re-admit the whole18/19 wrapper, then return detached immutable DATA only.
|
|
127
|
+
const admitted = closed(
|
|
128
|
+
admitConfigureACK(row.record, row.rawReceipt, row.receipt),
|
|
129
|
+
[
|
|
130
|
+
"status",
|
|
131
|
+
"originalRecord",
|
|
132
|
+
"rawReceipt",
|
|
133
|
+
"receipt",
|
|
134
|
+
"operationalAuthority",
|
|
135
|
+
],
|
|
136
|
+
);
|
|
137
|
+
const result = Object.freeze({
|
|
138
|
+
rawReceipt: freeze(renewalSnapshot(row.rawReceipt)),
|
|
139
|
+
receipt: admitted.receipt,
|
|
134
140
|
});
|
|
141
|
+
OWNER.check();
|
|
142
|
+
return result;
|
|
135
143
|
}
|
|
136
144
|
function capture(replay: boolean) {
|
|
137
145
|
let consumed = false;
|
|
@@ -327,6 +335,7 @@ function capture(replay: boolean) {
|
|
|
327
335
|
actualAttachAcknowledgement,
|
|
328
336
|
lineage,
|
|
329
337
|
state: "not_started",
|
|
338
|
+
returned: false,
|
|
330
339
|
pair,
|
|
331
340
|
};
|
|
332
341
|
attempts.set(live, row);
|
|
@@ -504,6 +513,7 @@ function capture(replay: boolean) {
|
|
|
504
513
|
OWNER.check();
|
|
505
514
|
// Actual C9 success is retained before output admission or receipt-event publication.
|
|
506
515
|
// This closes the whole lineage even if either later admission/publication fails.
|
|
516
|
+
row.rawReceipt = rawReceipt;
|
|
507
517
|
row.receipt = receipt;
|
|
508
518
|
row.state = "receipt_prepared";
|
|
509
519
|
lineage.receiptKnown = true;
|
|
@@ -523,6 +533,7 @@ function capture(replay: boolean) {
|
|
|
523
533
|
lineage.busy = false;
|
|
524
534
|
OWNER.check();
|
|
525
535
|
activePair.capability.discardFulfilledQuarantine();
|
|
536
|
+
row.returned = true;
|
|
526
537
|
return output;
|
|
527
538
|
} catch (error) {
|
|
528
539
|
let live = false;
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
import { OWNER } from "../originalOwner.js";
|
|
2
|
+
|
|
3
|
+
/** Same original Owner subscription, with FIRST continuation guards on both outcomes. */
|
|
4
|
+
export function owned<T>(work: () => T | PromiseLike<T>): Promise<T> {
|
|
5
|
+
OWNER.check();
|
|
6
|
+
return new Promise((resolve, reject) => {
|
|
7
|
+
let done = false,
|
|
8
|
+
remove: (() => void) | null = null;
|
|
9
|
+
const finish = (ok: boolean, value: unknown) => {
|
|
10
|
+
if (done) return;
|
|
11
|
+
done = true;
|
|
12
|
+
remove?.();
|
|
13
|
+
if (ok) resolve(value as T);
|
|
14
|
+
else reject(value);
|
|
15
|
+
};
|
|
16
|
+
const retire = () => finish(false, Error("CONFIGURE_WRITE_STOP"));
|
|
17
|
+
remove = OWNER.subscribe(retire);
|
|
18
|
+
if (done) {
|
|
19
|
+
remove();
|
|
20
|
+
return;
|
|
21
|
+
}
|
|
22
|
+
let pending: T | PromiseLike<T>;
|
|
23
|
+
try {
|
|
24
|
+
OWNER.check();
|
|
25
|
+
pending = work();
|
|
26
|
+
} catch (error) {
|
|
27
|
+
try {
|
|
28
|
+
OWNER.check();
|
|
29
|
+
finish(false, error);
|
|
30
|
+
} catch {
|
|
31
|
+
retire();
|
|
32
|
+
}
|
|
33
|
+
return;
|
|
34
|
+
}
|
|
35
|
+
void Promise.resolve(pending).then(
|
|
36
|
+
(value) => {
|
|
37
|
+
if (done) return;
|
|
38
|
+
try {
|
|
39
|
+
OWNER.check();
|
|
40
|
+
finish(true, value);
|
|
41
|
+
} catch {
|
|
42
|
+
retire();
|
|
43
|
+
}
|
|
44
|
+
},
|
|
45
|
+
(error) => {
|
|
46
|
+
if (done) return;
|
|
47
|
+
try {
|
|
48
|
+
OWNER.check();
|
|
49
|
+
finish(false, error);
|
|
50
|
+
} catch {
|
|
51
|
+
retire();
|
|
52
|
+
}
|
|
53
|
+
},
|
|
54
|
+
);
|
|
55
|
+
});
|
|
56
|
+
}
|
|
@@ -9,6 +9,7 @@ import {
|
|
|
9
9
|
import {
|
|
10
10
|
projectRenewalConfigurationV2,
|
|
11
11
|
constructRenewalScheduleAttachmentReceiptV2,
|
|
12
|
+
constructRenewalConfigurationReceiptV2,
|
|
12
13
|
} from "../../../renewalV2/index.js";
|
|
13
14
|
import { inspectRenewalScheduleMaterialV2 } from "../../../renewalV2/observation.js";
|
|
14
15
|
import { captureObservationRecord, verifyObservationRecord } from "./record.js";
|
|
@@ -26,6 +27,7 @@ import {
|
|
|
26
27
|
validateCoupon,
|
|
27
28
|
} from "./profile.js";
|
|
28
29
|
import { checkOwnerResult } from "./types.js";
|
|
30
|
+
import { admitRetainedConfigureAcknowledgement } from "./configureAcknowledgement.js";
|
|
29
31
|
import type {
|
|
30
32
|
Data,
|
|
31
33
|
SourceMethod,
|
|
@@ -148,7 +150,7 @@ export function captureOwnedRenewalObservationV2() {
|
|
|
148
150
|
"actualAttachAcknowledgement",
|
|
149
151
|
"readTransport",
|
|
150
152
|
],
|
|
151
|
-
["configureAcknowledgement"],
|
|
153
|
+
["configureAcknowledgement", "configureOperation"],
|
|
152
154
|
);
|
|
153
155
|
need(op.owner === OWNER && OWNER === ORIGINAL_OWNER);
|
|
154
156
|
need(op.originAssociation === ORIGINAL_ORIGIN_ASSOCIATION);
|
|
@@ -158,8 +160,13 @@ export function captureOwnedRenewalObservationV2() {
|
|
|
158
160
|
COMPILED_OBSERVATION_ENTRIES.includes(op.observationEntry),
|
|
159
161
|
);
|
|
160
162
|
need(field(op.observationEntry, "originalEntry") === op.originalEntry);
|
|
163
|
+
const hasConfigureAcknowledgement = Object.prototype.hasOwnProperty.call(
|
|
164
|
+
op,
|
|
165
|
+
"configureAcknowledgement",
|
|
166
|
+
);
|
|
161
167
|
need(
|
|
162
|
-
|
|
168
|
+
hasConfigureAcknowledgement ===
|
|
169
|
+
Object.prototype.hasOwnProperty.call(op, "configureOperation"),
|
|
163
170
|
);
|
|
164
171
|
const coversRetained = method(op.originalEntry, "coversRetained");
|
|
165
172
|
const coversObservation = method(
|
|
@@ -365,6 +372,39 @@ export function captureOwnedRenewalObservationV2() {
|
|
|
365
372
|
]);
|
|
366
373
|
ownerCheck();
|
|
367
374
|
need(covered === true);
|
|
375
|
+
let configureReceipt:
|
|
376
|
+
| import("../../../renewalV2/index.js").ConstructRenewalConfigurationReceiptV2Options
|
|
377
|
+
| undefined;
|
|
378
|
+
if (hasConfigureAcknowledgement) {
|
|
379
|
+
const writer = await owned(() => import("../configure/actor.js"));
|
|
380
|
+
ownerCheck();
|
|
381
|
+
const readOwnedConfigureAcknowledgement =
|
|
382
|
+
writer.readOwnedConfigureAcknowledgement;
|
|
383
|
+
ownerCheck();
|
|
384
|
+
need(
|
|
385
|
+
typeof readOwnedConfigureAcknowledgement === "function" &&
|
|
386
|
+
!types.isProxy(readOwnedConfigureAcknowledgement),
|
|
387
|
+
);
|
|
388
|
+
const retainedACK = readOwnedConfigureAcknowledgement(
|
|
389
|
+
op.configureOperation,
|
|
390
|
+
op.configureAcknowledgement,
|
|
391
|
+
record,
|
|
392
|
+
op.actualAttachAcknowledgement,
|
|
393
|
+
op.originAssociation,
|
|
394
|
+
op.originalEntry,
|
|
395
|
+
);
|
|
396
|
+
ownerCheck();
|
|
397
|
+
const configured = await owned(() =>
|
|
398
|
+
constructRenewalConfigurationReceiptV2(retainedACK.rawReceipt),
|
|
399
|
+
);
|
|
400
|
+
ownerCheck();
|
|
401
|
+
configureReceipt = admitRetainedConfigureAcknowledgement(
|
|
402
|
+
record,
|
|
403
|
+
retainedACK,
|
|
404
|
+
configured,
|
|
405
|
+
);
|
|
406
|
+
ownerCheck();
|
|
407
|
+
}
|
|
368
408
|
// New child/channel identity is allocated only after all original proof work.
|
|
369
409
|
invocation = Object.freeze({});
|
|
370
410
|
generation = Object.freeze({});
|
|
@@ -405,6 +445,7 @@ export function captureOwnedRenewalObservationV2() {
|
|
|
405
445
|
const input = captureObservationInput({
|
|
406
446
|
configuration: record.configuration,
|
|
407
447
|
reads,
|
|
448
|
+
...(configureReceipt === undefined ? {} : { configureReceipt }),
|
|
408
449
|
});
|
|
409
450
|
phase = "observer";
|
|
410
451
|
const observation = await owned(() =>
|
|
@@ -423,7 +464,9 @@ export function captureOwnedRenewalObservationV2() {
|
|
|
423
464
|
observation,
|
|
424
465
|
reads: input.reads,
|
|
425
466
|
observedAt,
|
|
426
|
-
retainedConfigureAcknowledgement:
|
|
467
|
+
retainedConfigureAcknowledgement: hasConfigureAcknowledgement
|
|
468
|
+
? "present"
|
|
469
|
+
: "absent",
|
|
427
470
|
operationalAuthority: false,
|
|
428
471
|
});
|
|
429
472
|
ownerCheck();
|
|
@@ -126,7 +126,7 @@ export function captureObservationReply(reply: unknown) {
|
|
|
126
126
|
return ordinary(Object.fromEntries(entries));
|
|
127
127
|
}
|
|
128
128
|
export function captureObservationInput<T>(value: T): T {
|
|
129
|
-
const root = closed(value, ["configuration", "reads"]);
|
|
129
|
+
const root = closed(value, ["configuration", "reads"], ["configureReceipt"]);
|
|
130
130
|
const reads = closed(root.reads, [
|
|
131
131
|
"schedule",
|
|
132
132
|
"subscription",
|
|
@@ -149,7 +149,8 @@ export function admitObservationOutput<T>(value: T): T {
|
|
|
149
149
|
need(
|
|
150
150
|
root.status === "owned_observation_data" &&
|
|
151
151
|
root.operationalAuthority === false &&
|
|
152
|
-
root.retainedConfigureAcknowledgement === "absent"
|
|
152
|
+
(root.retainedConfigureAcknowledgement === "absent" ||
|
|
153
|
+
root.retainedConfigureAcknowledgement === "present"),
|
|
153
154
|
);
|
|
154
155
|
need(
|
|
155
156
|
typeof root.observedAt === "number" &&
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { admitConfigureACK } from "../configure/output.js";
|
|
2
|
+
import { equal } from "../../../renewalAggregate/shared.js";
|
|
3
|
+
import type { RenewalConfigurationReceiptV2 } from "../../../renewalV2/index.js";
|
|
4
|
+
import type {
|
|
5
|
+
ObservationRecord,
|
|
6
|
+
RetainedConfigureAcknowledgement,
|
|
7
|
+
} from "./types.js";
|
|
8
|
+
|
|
9
|
+
/** Stateless whole relation only; the actor must establish actual returned-ACK custody first. */
|
|
10
|
+
export function admitRetainedConfigureAcknowledgement(
|
|
11
|
+
record: ObservationRecord,
|
|
12
|
+
retained: RetainedConfigureAcknowledgement,
|
|
13
|
+
actualReceipt: RenewalConfigurationReceiptV2,
|
|
14
|
+
) {
|
|
15
|
+
// Existing exact18/19 slot ledger binds the complete request/raw response/default presence.
|
|
16
|
+
admitConfigureACK(record, retained.rawReceipt, actualReceipt);
|
|
17
|
+
if (!equal(actualReceipt, retained.receipt))
|
|
18
|
+
throw Error("OWNED_OBSERVATION_STOP");
|
|
19
|
+
return retained.rawReceipt;
|
|
20
|
+
}
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import { it } from "vitest";
|
|
2
|
+
import { optionalConfigureACK18Fixture } from "../test-fixtures/observationConfigureACKOperation.js";
|
|
3
|
+
import { assertOptionalConfigureACK18 } from "../test-fixtures/observationConfigureACKAssertions.js";
|
|
4
|
+
|
|
5
|
+
it("owned observation retains actual published configure ACK18 with historical unknown", async () => {
|
|
6
|
+
const h = await optionalConfigureACK18Fixture();
|
|
7
|
+
try {
|
|
8
|
+
const output = await h.capture().invoke();
|
|
9
|
+
assertOptionalConfigureACK18(h, output);
|
|
10
|
+
} catch (originalError) {
|
|
11
|
+
try {
|
|
12
|
+
console.log(
|
|
13
|
+
JSON.stringify({
|
|
14
|
+
kind: "OPTIONAL_ACK18_TARGET_FAILURE_FRONTIER",
|
|
15
|
+
counters: { ...h.counters },
|
|
16
|
+
observationHTTP: h.calls.length,
|
|
17
|
+
originalReadPromises: h.promises.length,
|
|
18
|
+
writerRecords: h.writer.writeState.records.length,
|
|
19
|
+
writerPOSTs: h.writer.writeState.calls.filter(
|
|
20
|
+
(row) => row.method === "POST",
|
|
21
|
+
).length,
|
|
22
|
+
writerExplicitC9: h.writer.writeState.explicitC9,
|
|
23
|
+
setupRecords: h.writer.state.records.length,
|
|
24
|
+
setupPOSTs: h.writer.state.calls.filter(
|
|
25
|
+
(row) => row.method === "POST",
|
|
26
|
+
).length,
|
|
27
|
+
operationalAuthority: false,
|
|
28
|
+
}),
|
|
29
|
+
);
|
|
30
|
+
} finally {
|
|
31
|
+
throw originalError;
|
|
32
|
+
}
|
|
33
|
+
} finally {
|
|
34
|
+
await h.cleanup();
|
|
35
|
+
}
|
|
36
|
+
});
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
import assert from "node:assert/strict";
|
|
2
|
+
import { it } from "vitest";
|
|
3
|
+
import { optionalConfigureACKControlCases } from "../test-fixtures/observationConfigureACKDeclarations.js";
|
|
4
|
+
import { optionalConfigureACKControlFixture } from "../test-fixtures/observationConfigureACKOperation.js";
|
|
5
|
+
import {
|
|
6
|
+
assertOptionalConfigureACK18,
|
|
7
|
+
assertOptionalConfigureACKRefusal,
|
|
8
|
+
} from "../test-fixtures/observationConfigureACKAssertions.js";
|
|
9
|
+
|
|
10
|
+
for (const controlCase of optionalConfigureACKControlCases)
|
|
11
|
+
it("owned observation configure ACK control: " + controlCase, async () => {
|
|
12
|
+
const h = await optionalConfigureACKControlFixture(controlCase);
|
|
13
|
+
try {
|
|
14
|
+
const original = h.capture().invoke();
|
|
15
|
+
if (h.selected.stage === "positive")
|
|
16
|
+
assertOptionalConfigureACK18(h, await original);
|
|
17
|
+
else {
|
|
18
|
+
const error = await original.then(
|
|
19
|
+
() => assert.fail("EXPECTED_OPTIONAL_CONFIGURE_ACK_REFUSAL"),
|
|
20
|
+
(error: unknown) => error,
|
|
21
|
+
);
|
|
22
|
+
assertOptionalConfigureACKRefusal(h, error);
|
|
23
|
+
}
|
|
24
|
+
} catch (originalError) {
|
|
25
|
+
try {
|
|
26
|
+
console.log(
|
|
27
|
+
JSON.stringify({
|
|
28
|
+
kind: "OPTIONAL_CONFIGURE_ACK_CONTROL_FAILURE_FRONTIER",
|
|
29
|
+
controlCase,
|
|
30
|
+
declaredStage: h.selected.stage,
|
|
31
|
+
counters: { ...h.counters },
|
|
32
|
+
observationHTTP: h.calls.length,
|
|
33
|
+
originalReadPromises: h.promises.length,
|
|
34
|
+
writerRecords: h.writer.writeState.records.length,
|
|
35
|
+
writerPOSTs: h.writer.writeState.calls.filter(
|
|
36
|
+
(row) => row.method === "POST",
|
|
37
|
+
).length,
|
|
38
|
+
writerExplicitC9: h.writer.writeState.explicitC9,
|
|
39
|
+
operationalAuthority: false,
|
|
40
|
+
}),
|
|
41
|
+
);
|
|
42
|
+
} finally {
|
|
43
|
+
throw originalError;
|
|
44
|
+
}
|
|
45
|
+
} finally {
|
|
46
|
+
await h.cleanup();
|
|
47
|
+
}
|
|
48
|
+
});
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import assert from "node:assert/strict";
|
|
2
|
+
import { it } from "vitest";
|
|
3
|
+
import { configureACKLifecycleCases } from "../test-fixtures/observationConfigureACKLifecycleDeclarations.js";
|
|
4
|
+
import { configureACKLifecycleFixture } from "../test-fixtures/observationConfigureACKLifecycleOperation.js";
|
|
5
|
+
import { assertConfigureACKLifecycleResult } from "../test-fixtures/observationConfigureACKLifecycleAssertions.js";
|
|
6
|
+
|
|
7
|
+
for (const controlCase of configureACKLifecycleCases)
|
|
8
|
+
it("owned observation configure ACK lifecycle: " + controlCase, async () => {
|
|
9
|
+
const h = await configureACKLifecycleFixture(controlCase);
|
|
10
|
+
try {
|
|
11
|
+
const original = h.capture().invoke();
|
|
12
|
+
const expectedFailure = controlCase === "L07-C6Failure-priority";
|
|
13
|
+
const value = expectedFailure
|
|
14
|
+
? await original
|
|
15
|
+
: await original.then(
|
|
16
|
+
() => assert.fail("EXPECTED_LIFECYCLE_REFUSAL"),
|
|
17
|
+
(error: unknown) => error,
|
|
18
|
+
);
|
|
19
|
+
assertConfigureACKLifecycleResult(h, value);
|
|
20
|
+
if (controlCase === "L04-POST-pending") await h.finishPendingWriter();
|
|
21
|
+
} catch (originalError) {
|
|
22
|
+
try {
|
|
23
|
+
console.log(
|
|
24
|
+
JSON.stringify({
|
|
25
|
+
kind: "OPTIONAL_ACK_LIFECYCLE_FAILURE_FRONTIER",
|
|
26
|
+
controlCase,
|
|
27
|
+
counters: { ...h.counters },
|
|
28
|
+
observationHTTP: h.calls.length,
|
|
29
|
+
writerRecords: h.writer.writeState.records.length,
|
|
30
|
+
writerPOSTs: h.writer.writeState.calls.filter(
|
|
31
|
+
(row) => row.method === "POST",
|
|
32
|
+
).length,
|
|
33
|
+
writerC9: h.writer.writeState.explicitC9,
|
|
34
|
+
candidateKind: h.declaration.candidateKind,
|
|
35
|
+
operationalAuthority: false,
|
|
36
|
+
}),
|
|
37
|
+
);
|
|
38
|
+
} finally {
|
|
39
|
+
throw originalError;
|
|
40
|
+
}
|
|
41
|
+
} finally {
|
|
42
|
+
await h.cleanup();
|
|
43
|
+
}
|
|
44
|
+
});
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import { it } from "vitest";
|
|
2
|
+
import { configuredHistoryCases } from "../test-fixtures/observationConfiguredHistoryDeclarations.js";
|
|
3
|
+
import { configuredHistoryFixture } from "../test-fixtures/observationConfiguredHistoryOperation.js";
|
|
4
|
+
import { assertConfiguredHistoryResult } from "../test-fixtures/observationConfiguredHistoryAssertions.js";
|
|
5
|
+
|
|
6
|
+
for (const controlCase of configuredHistoryCases)
|
|
7
|
+
it("configured history owned observation: " + controlCase, async () => {
|
|
8
|
+
const h = await configuredHistoryFixture(controlCase);
|
|
9
|
+
try {
|
|
10
|
+
assertConfiguredHistoryResult(h, await h.capture().invoke());
|
|
11
|
+
} catch (originalError) {
|
|
12
|
+
try {
|
|
13
|
+
console.log(
|
|
14
|
+
JSON.stringify({
|
|
15
|
+
kind: "CONFIGURED_HISTORY_FAILURE_FRONTIER",
|
|
16
|
+
controlCase,
|
|
17
|
+
counters: { ...h.counters },
|
|
18
|
+
observationHTTP: h.calls.length,
|
|
19
|
+
originalReadPromises: h.promises.length,
|
|
20
|
+
writerRecords: h.writer.writeState.records.length,
|
|
21
|
+
writerPOSTs: h.writer.writeState.calls.filter(
|
|
22
|
+
(row) => row.method === "POST",
|
|
23
|
+
).length,
|
|
24
|
+
writerC9: h.writer.writeState.explicitC9,
|
|
25
|
+
operationalAuthority: false,
|
|
26
|
+
}),
|
|
27
|
+
);
|
|
28
|
+
} finally {
|
|
29
|
+
throw originalError;
|
|
30
|
+
}
|
|
31
|
+
} finally {
|
|
32
|
+
await h.cleanup();
|
|
33
|
+
}
|
|
34
|
+
});
|
|
@@ -5,6 +5,11 @@ import type { Node } from "../material/nodeKernel.js";
|
|
|
5
5
|
import type { inspectRenewalScheduleMaterialV2 } from "../../../renewalV2/observation.js";
|
|
6
6
|
|
|
7
7
|
export type Data = Record<string, unknown>;
|
|
8
|
+
/** Detached immutable DATA after checked actor-local writer custody; never a capability. */
|
|
9
|
+
export interface RetainedConfigureAcknowledgement {
|
|
10
|
+
readonly rawReceipt: import("../../../renewalV2/index.js").ConstructRenewalConfigurationReceiptV2Options;
|
|
11
|
+
readonly receipt: unknown;
|
|
12
|
+
}
|
|
8
13
|
/** Captured DATA shape only; actual C6/C3/raw proof and Source pointers remain mandatory. */
|
|
9
14
|
export type ObservationRecord = PreflightRecord;
|
|
10
15
|
export interface CapturedObservationRecord {
|