@sekiban/dcb-runtime 0.2.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/LICENSE +86 -0
- package/README.md +13 -0
- package/dist/allocator/AllocatorDurableObject.d.ts +36 -0
- package/dist/allocator/AllocatorDurableObject.js +658 -0
- package/dist/allocator/IssuanceLedger.d.ts +188 -0
- package/dist/allocator/IssuanceLedger.js +608 -0
- package/dist/allocator/IssuanceReconciler.d.ts +41 -0
- package/dist/allocator/IssuanceReconciler.js +191 -0
- package/dist/allocator/OrderClock.d.ts +41 -0
- package/dist/allocator/OrderClock.js +92 -0
- package/dist/allocator/SortableUniqueId.d.ts +46 -0
- package/dist/allocator/SortableUniqueId.js +156 -0
- package/dist/allocator/types.d.ts +52 -0
- package/dist/allocator/types.js +1 -0
- package/dist/bootstrap/BootstrapCoordinatorDurableObject.d.ts +28 -0
- package/dist/bootstrap/BootstrapCoordinatorDurableObject.js +357 -0
- package/dist/bootstrap/BootstrapStoreAdapter.d.ts +51 -0
- package/dist/bootstrap/BootstrapStoreAdapter.js +162 -0
- package/dist/bootstrap/OperatorBootstrap.d.ts +20 -0
- package/dist/bootstrap/OperatorBootstrap.js +104 -0
- package/dist/bootstrap/manifest.d.ts +9 -0
- package/dist/bootstrap/manifest.js +115 -0
- package/dist/bootstrap/types.d.ts +75 -0
- package/dist/bootstrap/types.js +1 -0
- package/dist/cli/OperatorRepairCli.d.ts +11 -0
- package/dist/cli/OperatorRepairCli.js +108 -0
- package/dist/cloudflare.d.ts +164 -0
- package/dist/cloudflare.js +19487 -0
- package/dist/commit/CommitWorker.d.ts +101 -0
- package/dist/commit/CommitWorker.js +921 -0
- package/dist/commit/types.d.ts +25 -0
- package/dist/commit/types.js +13 -0
- package/dist/completeness/GlobalCompletenessReconciler.d.ts +77 -0
- package/dist/completeness/GlobalCompletenessReconciler.js +572 -0
- package/dist/completeness/types.d.ts +85 -0
- package/dist/completeness/types.js +6 -0
- package/dist/composition.d.ts +123 -0
- package/dist/composition.js +237 -0
- package/dist/cosmos.d.ts +11 -0
- package/dist/cosmos.js +1411 -0
- package/dist/d1-mv.d.ts +8 -0
- package/dist/d1-mv.js +2001 -0
- package/dist/d1.d.ts +16 -0
- package/dist/d1.js +3418 -0
- package/dist/diagnostics/G60DurableHop.d.ts +99 -0
- package/dist/diagnostics/G60DurableHop.js +248 -0
- package/dist/diagnostics/G65Admission.d.ts +23 -0
- package/dist/diagnostics/G65Admission.js +43 -0
- package/dist/diagnostics/G65DirectRing.d.ts +33 -0
- package/dist/diagnostics/G65DirectRing.js +85 -0
- package/dist/diagnostics/G69AdmissionAttempt.d.ts +43 -0
- package/dist/diagnostics/G69AdmissionAttempt.js +22 -0
- package/dist/downstream/DeliveryCore.d.ts +127 -0
- package/dist/downstream/DeliveryCore.js +304 -0
- package/dist/downstream/Doorbell.d.ts +43 -0
- package/dist/downstream/Doorbell.js +137 -0
- package/dist/downstream/DownstreamAdapter.d.ts +52 -0
- package/dist/downstream/DownstreamAdapter.js +299 -0
- package/dist/downstream/ExclusionLookup.d.ts +36 -0
- package/dist/downstream/ExclusionLookup.js +50 -0
- package/dist/downstream/InconsistencyDetector.d.ts +27 -0
- package/dist/downstream/InconsistencyDetector.js +82 -0
- package/dist/downstream/OutboxDrain.d.ts +35 -0
- package/dist/downstream/OutboxDrain.js +126 -0
- package/dist/downstream/types.d.ts +77 -0
- package/dist/downstream/types.js +64 -0
- package/dist/eventIdentity.d.ts +30 -0
- package/dist/eventIdentity.js +49 -0
- package/dist/eventRecord.d.ts +26 -0
- package/dist/eventRecord.js +53 -0
- package/dist/g42-probe.d.ts +9 -0
- package/dist/g42-probe.js +9 -0
- package/dist/http/SerializedQueryWorker.d.ts +58 -0
- package/dist/http/SerializedQueryWorker.js +497 -0
- package/dist/http/commitResponse.d.ts +46 -0
- package/dist/http/commitResponse.js +80 -0
- package/dist/http/testServiceId.d.ts +17 -0
- package/dist/http/testServiceId.js +14 -0
- package/dist/index.d.ts +112 -0
- package/dist/index.js +19926 -0
- package/dist/journal/JournalDurableObject.d.ts +30 -0
- package/dist/journal/JournalDurableObject.js +481 -0
- package/dist/journal/JournalFirstTouchProbe.d.ts +190 -0
- package/dist/journal/JournalFirstTouchProbe.js +375 -0
- package/dist/journal/types.d.ts +116 -0
- package/dist/journal/types.js +52 -0
- package/dist/mv/MaterializedViewCatchUp.d.ts +60 -0
- package/dist/mv/MaterializedViewCatchUp.js +353 -0
- package/dist/mv/MaterializedViewRuntime.d.ts +80 -0
- package/dist/mv/MaterializedViewRuntime.js +328 -0
- package/dist/mv/MaterializedViewStore.d.ts +257 -0
- package/dist/mv/MaterializedViewStore.js +875 -0
- package/dist/mv/UnsafeWindowMaterializedView.d.ts +112 -0
- package/dist/mv/UnsafeWindowMaterializedView.js +495 -0
- package/dist/mv/index.d.ts +8 -0
- package/dist/mv/index.js +2357 -0
- package/dist/projection/LiveProjectionWorker.d.ts +86 -0
- package/dist/projection/LiveProjectionWorker.js +240 -0
- package/dist/projection/ProjectionRuntime.d.ts +113 -0
- package/dist/projection/ProjectionRuntime.js +346 -0
- package/dist/projection/ProjectorRegistry.d.ts +51 -0
- package/dist/projection/ProjectorRegistry.js +116 -0
- package/dist/query/ProjectionQueryStore.d.ts +102 -0
- package/dist/query/ProjectionQueryStore.js +185 -0
- package/dist/query/QueryRegistry.d.ts +22 -0
- package/dist/query/QueryRegistry.js +36 -0
- package/dist/read/SerializedReadWorker.d.ts +36 -0
- package/dist/read/SerializedReadWorker.js +225 -0
- package/dist/repair/RepairWorker.d.ts +72 -0
- package/dist/repair/RepairWorker.js +461 -0
- package/dist/safeWindow.d.ts +20 -0
- package/dist/safeWindow.js +36 -0
- package/dist/scope/ControlRouteScope.d.ts +22 -0
- package/dist/scope/ControlRouteScope.js +36 -0
- package/dist/scope/ScopeName.d.ts +34 -0
- package/dist/scope/ScopeName.js +67 -0
- package/dist/service/ServiceIdentityProvider.d.ts +35 -0
- package/dist/service/ServiceIdentityProvider.js +56 -0
- package/dist/store/CosmosEventStore.d.ts +126 -0
- package/dist/store/CosmosEventStore.js +950 -0
- package/dist/store/D1EventStore.d.ts +111 -0
- package/dist/store/D1EventStore.js +1111 -0
- package/dist/store/PostgresEventStore.d.ts +35 -0
- package/dist/store/PostgresEventStore.js +811 -0
- package/dist/store/provider.d.ts +25 -0
- package/dist/store/provider.js +32 -0
- package/dist/store/types.d.ts +205 -0
- package/dist/store/types.js +18 -0
- package/dist/tag/EventDigest.d.ts +40 -0
- package/dist/tag/EventDigest.js +158 -0
- package/dist/tag/TagDurableObject.d.ts +286 -0
- package/dist/tag/TagDurableObject.js +4071 -0
- package/dist/tag/TagSqlMeasurement.d.ts +26 -0
- package/dist/tag/TagSqlMeasurement.js +44 -0
- package/dist/tag/TagSqlSchema.d.ts +29 -0
- package/dist/tag/TagSqlSchema.js +211 -0
- package/dist/tag/types.d.ts +173 -0
- package/dist/tag/types.js +3 -0
- package/dist/tagstate/TagStateDurableObject.d.ts +57 -0
- package/dist/tagstate/TagStateDurableObject.js +499 -0
- package/dist/trace/AttributionRatio.d.ts +12 -0
- package/dist/trace/AttributionRatio.js +68 -0
- package/dist/trace/CloudflareTracing.d.ts +7 -0
- package/dist/trace/CloudflareTracing.js +9 -0
- package/dist/trace/CommitTrace.d.ts +405 -0
- package/dist/trace/CommitTrace.js +1008 -0
- package/dist/trace/CommitTraceConsoleSink.d.ts +68 -0
- package/dist/trace/CommitTraceConsoleSink.js +114 -0
- package/dist/trace/CommitTraceVerifier.d.ts +22 -0
- package/dist/trace/CommitTraceVerifier.js +295 -0
- package/dist/trace/ObservationStream.d.ts +118 -0
- package/dist/trace/ObservationStream.js +148 -0
- package/package.json +71 -0
|
@@ -0,0 +1,405 @@
|
|
|
1
|
+
import { type UnattributedRatio } from "./AttributionRatio";
|
|
2
|
+
import type { DurableObjectHandlerObservation } from "./ObservationStream";
|
|
3
|
+
/**
|
|
4
|
+
* Trace-only commit attribution support.
|
|
5
|
+
*
|
|
6
|
+
* This module deliberately has no dependency on the commit protocol or on
|
|
7
|
+
* Durable Object storage. It turns the host-owned manifest into the runtime
|
|
8
|
+
* vocabulary and delegates real parentage to Cloudflare's active async
|
|
9
|
+
* tracing context. The in-memory records are an observation adapter used by
|
|
10
|
+
* unit tests and the B0 evidence tooling; they never cross a public wire.
|
|
11
|
+
*/
|
|
12
|
+
export type CommitTraceSchema = "sdt.commit/v1" | "sdt.commit/v2" | "sdt.commit.reconcile/v1" | "sdt.commit.repair/v1";
|
|
13
|
+
export type CommitTraceFace = "pre-admission" | "accepted" | "reconcile-root" | "repair-root";
|
|
14
|
+
export type CommitTraceActorClass = "ROOT" | "BOOTSTRAP" | "JOURNAL" | "ALLOCATOR" | "TAG" | "REPAIR";
|
|
15
|
+
export type TraceAttributeValue = string | number | boolean;
|
|
16
|
+
export interface CommitTraceProviderAdapter {
|
|
17
|
+
readonly scriptVersion?: string;
|
|
18
|
+
readonly colo?: string;
|
|
19
|
+
/** Observed only. G30 must never use this in a control branch. */
|
|
20
|
+
readonly placement?: string;
|
|
21
|
+
readonly cpuTimeMs?: number;
|
|
22
|
+
readonly wallTimeMs?: number;
|
|
23
|
+
}
|
|
24
|
+
export interface NativeTraceSpan {
|
|
25
|
+
readonly isTraced?: boolean;
|
|
26
|
+
setAttribute(key: string, value: TraceAttributeValue | undefined): unknown;
|
|
27
|
+
}
|
|
28
|
+
export interface NativeTracing {
|
|
29
|
+
enterSpan<T, A extends unknown[]>(name: string, callback: (span: NativeTraceSpan, ...args: A) => T, ...args: A): T;
|
|
30
|
+
}
|
|
31
|
+
/**
|
|
32
|
+
* The portable runtime must remain importable from Node-side provider and
|
|
33
|
+
* contract tooling. Cloudflare-only entrypoints inject the real tracer;
|
|
34
|
+
* this adapter preserves the trace-only, fail-open contract everywhere else.
|
|
35
|
+
*/
|
|
36
|
+
export declare const noOpNativeTracing: NativeTracing;
|
|
37
|
+
/**
|
|
38
|
+
* A request handler can use the platform context without importing the
|
|
39
|
+
* Cloudflare-only module into the portable Node/provider graph.
|
|
40
|
+
*/
|
|
41
|
+
export declare function nativeTracingFromContext(context?: Pick<ExecutionContext, "tracing">): NativeTracing;
|
|
42
|
+
export interface CommitTraceClock {
|
|
43
|
+
now(): number;
|
|
44
|
+
}
|
|
45
|
+
export interface CommitTraceSpan {
|
|
46
|
+
readonly rowId: string;
|
|
47
|
+
readonly schema: CommitTraceSchema;
|
|
48
|
+
readonly face: CommitTraceFace;
|
|
49
|
+
readonly span: string;
|
|
50
|
+
readonly emitter: string;
|
|
51
|
+
readonly logicalParent: string | null;
|
|
52
|
+
readonly rootId: string;
|
|
53
|
+
readonly clockDomain: "caller" | "callee";
|
|
54
|
+
readonly startMs: number;
|
|
55
|
+
readonly endMs: number;
|
|
56
|
+
readonly present: true;
|
|
57
|
+
readonly attributes: Readonly<Record<string, TraceAttributeValue>>;
|
|
58
|
+
readonly zeroDurationPlatformLimited: boolean;
|
|
59
|
+
}
|
|
60
|
+
export interface CommitTraceSnapshot {
|
|
61
|
+
readonly schema: CommitTraceSchema;
|
|
62
|
+
readonly rootId: string;
|
|
63
|
+
readonly correlationId: string;
|
|
64
|
+
readonly serviceId: string;
|
|
65
|
+
readonly spans: readonly CommitTraceSpan[];
|
|
66
|
+
readonly provider: CommitTraceProviderAdapter;
|
|
67
|
+
readonly diagnostics: Readonly<Record<string, TraceAttributeValue>>;
|
|
68
|
+
/** Private evidence/export field; never a public V1 response member. */
|
|
69
|
+
readonly unattributed?: UnattributedRatio;
|
|
70
|
+
readonly attributionGatePassed?: boolean;
|
|
71
|
+
/**
|
|
72
|
+
* In-process verifier result. This is an observation adapter for a trace
|
|
73
|
+
* sink/exporter only; it is never copied onto a Response or a native span.
|
|
74
|
+
* A verifier finding is deliberately fail-open so measurement cannot alter
|
|
75
|
+
* the commit protocol it observes.
|
|
76
|
+
*/
|
|
77
|
+
readonly runtimeVerification?: Readonly<{
|
|
78
|
+
readonly passed: boolean;
|
|
79
|
+
readonly code?: string;
|
|
80
|
+
}>;
|
|
81
|
+
}
|
|
82
|
+
export interface CommitTraceSink {
|
|
83
|
+
record(snapshot: CommitTraceSnapshot): void;
|
|
84
|
+
}
|
|
85
|
+
/** Structural verifier hook supplied by the owning runtime module. */
|
|
86
|
+
export interface CommitTraceRuntimeVerifier {
|
|
87
|
+
verify(snapshot: CommitTraceSnapshot): void;
|
|
88
|
+
}
|
|
89
|
+
export interface CommitTraceOptions {
|
|
90
|
+
readonly schema: CommitTraceSchema;
|
|
91
|
+
readonly correlationId: string;
|
|
92
|
+
readonly serviceId: string;
|
|
93
|
+
readonly provider?: CommitTraceProviderAdapter;
|
|
94
|
+
readonly nativeTracing?: NativeTracing;
|
|
95
|
+
readonly sink?: CommitTraceSink;
|
|
96
|
+
readonly clock?: CommitTraceClock;
|
|
97
|
+
readonly diagnostics?: Readonly<Record<string, TraceAttributeValue>>;
|
|
98
|
+
readonly runtimeVerifier?: CommitTraceRuntimeVerifier;
|
|
99
|
+
/**
|
|
100
|
+
* Optional observation-only work scheduled after the response object has
|
|
101
|
+
* been assembled but before the root callback unwinds. Production's
|
|
102
|
+
* `waitUntil` integration is deliberately outside this trace model: the
|
|
103
|
+
* returned promise is detached, so it can neither extend S00 nor alter the
|
|
104
|
+
* commit result. The seam lets the runtime oracle prove that boundary
|
|
105
|
+
* without adding an ExecutionContext or a V1 wire field to CommitWorker.
|
|
106
|
+
*/
|
|
107
|
+
readonly scheduleDetachedObservation?: () => Promise<void> | void;
|
|
108
|
+
/**
|
|
109
|
+
* Attribution observes an existing protocol. Production callers keep this
|
|
110
|
+
* enabled so a tracing/exporter defect can never reject, retry, or replay a
|
|
111
|
+
* commit. Focused unit or mutation tests may opt into strict behavior to
|
|
112
|
+
* assert a local schema guard directly.
|
|
113
|
+
*/
|
|
114
|
+
readonly failOpen?: boolean;
|
|
115
|
+
}
|
|
116
|
+
interface ManifestRow {
|
|
117
|
+
readonly rowId: string;
|
|
118
|
+
readonly span: string;
|
|
119
|
+
readonly emitter: string;
|
|
120
|
+
readonly logicalParent: string | null;
|
|
121
|
+
readonly coverage: boolean;
|
|
122
|
+
readonly kind: string;
|
|
123
|
+
}
|
|
124
|
+
interface ManifestAttribute {
|
|
125
|
+
readonly type: string;
|
|
126
|
+
readonly values?: readonly string[];
|
|
127
|
+
readonly faces: Readonly<Record<CommitTraceFace, "required" | "optional" | "forbidden">>;
|
|
128
|
+
/** Optional row-level scope layered on top of the schema face. */
|
|
129
|
+
readonly rowScope?: readonly string[];
|
|
130
|
+
/** A fact that is only available while its still-open root is active. */
|
|
131
|
+
readonly factDerived?: boolean;
|
|
132
|
+
}
|
|
133
|
+
interface ManifestBoundary {
|
|
134
|
+
readonly name: string;
|
|
135
|
+
readonly requiredRows: readonly string[];
|
|
136
|
+
readonly conditionalRows: readonly unknown[];
|
|
137
|
+
readonly forbiddenRows: readonly string[];
|
|
138
|
+
}
|
|
139
|
+
interface TraceManifest {
|
|
140
|
+
readonly schemas: Readonly<Record<CommitTraceSchema, {
|
|
141
|
+
readonly rows: readonly ManifestRow[];
|
|
142
|
+
readonly boundaries?: readonly ManifestBoundary[];
|
|
143
|
+
readonly recoveryDag?: Readonly<Record<string, unknown>>;
|
|
144
|
+
readonly terminalAtEntryBoundary?: Readonly<{
|
|
145
|
+
name?: string;
|
|
146
|
+
}>;
|
|
147
|
+
}>>;
|
|
148
|
+
readonly attributeMatrix: {
|
|
149
|
+
readonly faces: readonly CommitTraceFace[];
|
|
150
|
+
readonly states: readonly string[];
|
|
151
|
+
readonly attributes: Readonly<Record<string, ManifestAttribute>>;
|
|
152
|
+
};
|
|
153
|
+
}
|
|
154
|
+
/**
|
|
155
|
+
* Stable, non-authoritative, non-cryptographic observation key. Four
|
|
156
|
+
* independent FNV-1a lanes yield the lower-case 64-hex spelling mandated by
|
|
157
|
+
* the trace schema without making the key a protocol or storage authority.
|
|
158
|
+
*/
|
|
159
|
+
export declare function stableTraceHash(value: string): string;
|
|
160
|
+
/**
|
|
161
|
+
* The DO request bodies already carry attemptId, while G30 cannot add a
|
|
162
|
+
* correlation wire field. This deterministic, distinct observation key lets
|
|
163
|
+
* independently exported caller/callee spans be joined without treating
|
|
164
|
+
* attempt.id and correlation.id as the same attribute.
|
|
165
|
+
*/
|
|
166
|
+
export declare function correlationIdForAttempt(attemptId: string): string;
|
|
167
|
+
export declare function createTraceCorrelationId(): string;
|
|
168
|
+
export declare function traceManifest(): TraceManifest;
|
|
169
|
+
export interface CommitTraceSpanOptions {
|
|
170
|
+
readonly face: CommitTraceFace;
|
|
171
|
+
readonly actorClass: CommitTraceActorClass;
|
|
172
|
+
readonly actorKey?: string;
|
|
173
|
+
readonly attemptId?: string;
|
|
174
|
+
readonly outcome?: string;
|
|
175
|
+
readonly httpStatus?: number;
|
|
176
|
+
readonly phaseOrdinal?: number;
|
|
177
|
+
readonly retryIndex?: number;
|
|
178
|
+
readonly memberIndex?: number;
|
|
179
|
+
readonly tag?: string;
|
|
180
|
+
readonly attributes?: Readonly<Record<string, TraceAttributeValue>>;
|
|
181
|
+
readonly zeroDurationPlatformLimited?: boolean;
|
|
182
|
+
readonly clockDomain?: "caller" | "callee";
|
|
183
|
+
}
|
|
184
|
+
interface ScopeState {
|
|
185
|
+
readonly rootId: string;
|
|
186
|
+
readonly currentRowId: string | null;
|
|
187
|
+
readonly face: CommitTraceFace;
|
|
188
|
+
readonly actorClass: CommitTraceActorClass;
|
|
189
|
+
readonly actorKey?: string;
|
|
190
|
+
readonly attemptId?: string;
|
|
191
|
+
readonly clockDomain: "caller" | "callee";
|
|
192
|
+
/** A failed observation subtree invokes application work without tracing. */
|
|
193
|
+
readonly observationDisabled?: boolean;
|
|
194
|
+
}
|
|
195
|
+
/**
|
|
196
|
+
* A scope is the test/evidence adapter's reflection of callback nesting. It
|
|
197
|
+
* does not accept a native span context or a parent span ID; Cloudflare owns
|
|
198
|
+
* real parentage through enterSpan's active async context.
|
|
199
|
+
*/
|
|
200
|
+
export declare class CommitTraceScope {
|
|
201
|
+
private readonly trace;
|
|
202
|
+
private readonly state;
|
|
203
|
+
constructor(trace: CommitTrace, state: ScopeState);
|
|
204
|
+
accepted(attemptId: string): CommitTraceScope;
|
|
205
|
+
withActor(actorClass: CommitTraceActorClass, actorKey: string, clockDomain?: "caller" | "callee"): CommitTraceScope;
|
|
206
|
+
fork(): CommitTraceScope;
|
|
207
|
+
span<T>(rowId: string, options: Omit<CommitTraceSpanOptions, "face" | "actorClass" | "actorKey" | "attemptId" | "clockDomain"> & {
|
|
208
|
+
readonly face?: CommitTraceFace;
|
|
209
|
+
readonly actorClass?: CommitTraceActorClass;
|
|
210
|
+
readonly actorKey?: string;
|
|
211
|
+
readonly attemptId?: string;
|
|
212
|
+
readonly clockDomain?: "caller" | "callee";
|
|
213
|
+
}, callback: (scope: CommitTraceScope) => T | Promise<T>): Promise<T>;
|
|
214
|
+
}
|
|
215
|
+
export declare class CommitTrace {
|
|
216
|
+
private readonly options;
|
|
217
|
+
private readonly spans;
|
|
218
|
+
private readonly emittedWorkerRows;
|
|
219
|
+
private readonly provider;
|
|
220
|
+
private readonly diagnostics;
|
|
221
|
+
private correlationId;
|
|
222
|
+
private activeRootId;
|
|
223
|
+
private activeRootRecord;
|
|
224
|
+
private activeRootNative;
|
|
225
|
+
private nextRootIndex;
|
|
226
|
+
private runtimeVerification;
|
|
227
|
+
private observationFailureCode;
|
|
228
|
+
constructor(options: CommitTraceOptions);
|
|
229
|
+
root<T>(rowId: string, options: Omit<CommitTraceSpanOptions, "face" | "actorClass"> & {
|
|
230
|
+
readonly face?: CommitTraceFace;
|
|
231
|
+
readonly actorClass?: CommitTraceActorClass;
|
|
232
|
+
}, callback: (scope: CommitTraceScope) => T | Promise<T>): Promise<T>;
|
|
233
|
+
/**
|
|
234
|
+
* Returns the Worker-local rows for which a native tracing callback was
|
|
235
|
+
* actually entered on this request. This private-in-effect observation is
|
|
236
|
+
* copied only into sdt.observe/v1 by CommitWorker; it never changes the
|
|
237
|
+
* sealed trace schema, verifier, public response, or a control branch.
|
|
238
|
+
*/
|
|
239
|
+
emittedWorkerRowIds(): readonly string[];
|
|
240
|
+
snapshot(): CommitTraceSnapshot;
|
|
241
|
+
/**
|
|
242
|
+
* A request becomes accepted after admission. Updating the still-active root
|
|
243
|
+
* preserves the single root correlation while S01 remains an honest
|
|
244
|
+
* pre-admission record with no attempt.id.
|
|
245
|
+
*/
|
|
246
|
+
markAccepted(attemptId: string): void;
|
|
247
|
+
/**
|
|
248
|
+
* Observation-only consumers can read the post-admission correlation after
|
|
249
|
+
* it has been written to S00. This exposes no wire field and never controls
|
|
250
|
+
* a commit decision or native-parent relationship.
|
|
251
|
+
*/
|
|
252
|
+
observationCorrelationId(): string;
|
|
253
|
+
span<T>(state: ScopeState, rowId: string, options: CommitTraceSpanOptions, callback: (scope: CommitTraceScope) => T | Promise<T>): Promise<T>;
|
|
254
|
+
private finish;
|
|
255
|
+
private recordEmittedWorkerRow;
|
|
256
|
+
private attributesFor;
|
|
257
|
+
private setNativeAttributes;
|
|
258
|
+
private outcomeFromResult;
|
|
259
|
+
private clock;
|
|
260
|
+
private now;
|
|
261
|
+
private publishSnapshot;
|
|
262
|
+
/**
|
|
263
|
+
* A telemetry/export failure is retained as an observation failure, but a
|
|
264
|
+
* detached task is never allowed to hold the root open or replace the
|
|
265
|
+
* application's Response. Keeping this as a method makes the exact
|
|
266
|
+
* `void` call at root finalization mutation-testable.
|
|
267
|
+
*/
|
|
268
|
+
private scheduleDetachedObservation;
|
|
269
|
+
private isFailOpen;
|
|
270
|
+
private observationVerification;
|
|
271
|
+
private noteObservationFailure;
|
|
272
|
+
/**
|
|
273
|
+
* If a platform tracer declines a span before invoking its callback, run
|
|
274
|
+
* the application callback once without a span. Once the callback has
|
|
275
|
+
* started, its own error remains authoritative and is never replayed.
|
|
276
|
+
*/
|
|
277
|
+
private enterNativeSpan;
|
|
278
|
+
}
|
|
279
|
+
export interface DurableObjectActivationObservation {
|
|
280
|
+
readonly activationId: string;
|
|
281
|
+
readonly first: boolean;
|
|
282
|
+
/** Monotonic-in-practice wall-clock observation; never persisted. */
|
|
283
|
+
readonly handlerStartedAtMs: number;
|
|
284
|
+
readonly constructorToHandlerMs: number;
|
|
285
|
+
}
|
|
286
|
+
/**
|
|
287
|
+
* Constructor-only activation observation. It never touches Durable Object
|
|
288
|
+
* storage and callers must invoke beginHandler synchronously before awaiting.
|
|
289
|
+
*/
|
|
290
|
+
export declare class DurableObjectActivation {
|
|
291
|
+
readonly activationId: `${string}-${string}-${string}-${string}-${string}`;
|
|
292
|
+
private readonly constructedAtMs;
|
|
293
|
+
private first;
|
|
294
|
+
beginHandler(): DurableObjectActivationObservation;
|
|
295
|
+
}
|
|
296
|
+
export declare function beginWorkerInvocationObservation(): Readonly<{
|
|
297
|
+
isolateInstanceId: string;
|
|
298
|
+
firstInvocation: boolean;
|
|
299
|
+
}>;
|
|
300
|
+
export interface IdleLedgerEntry {
|
|
301
|
+
readonly actorKeyHash: string;
|
|
302
|
+
readonly endMs: number;
|
|
303
|
+
readonly complete: boolean;
|
|
304
|
+
}
|
|
305
|
+
/**
|
|
306
|
+
* This deliberately accepts only an externally collected complete ledger.
|
|
307
|
+
* The DO runtime never records timestamps or idle observations in storage.
|
|
308
|
+
*/
|
|
309
|
+
export declare function observedIdleGapLowerBoundMs(previous: IdleLedgerEntry | undefined, currentStartMs: number): number | null;
|
|
310
|
+
export declare const IDLE_EXPERIMENT_SCHEDULE_MS: readonly [2000, 15000, 180000];
|
|
311
|
+
/**
|
|
312
|
+
* G30 intentionally does not infer a Durable Object reactivation cause from
|
|
313
|
+
* elapsed time. Idle eviction timings are only loose platform behaviour and
|
|
314
|
+
* are not a durable fact. The evidence runner may classify a constructor
|
|
315
|
+
* observation only from a deployed-version change or explicit platform
|
|
316
|
+
* evidence; otherwise it remains honestly unknown.
|
|
317
|
+
*/
|
|
318
|
+
export type ReactivationCause = "deployment-correlated" | "platform-evidenced" | "unknown";
|
|
319
|
+
export interface ReactivationEvidence {
|
|
320
|
+
readonly deployedVersionChanged: boolean;
|
|
321
|
+
readonly platformEvidence?: string;
|
|
322
|
+
/**
|
|
323
|
+
* Retained as a measured axis only. It must never decide a reactivation
|
|
324
|
+
* cause: Cloudflare may hibernate/evict at variable times.
|
|
325
|
+
*/
|
|
326
|
+
readonly elapsedMs?: number;
|
|
327
|
+
}
|
|
328
|
+
export declare function classifyReactivationCause(evidence: ReactivationEvidence): ReactivationCause;
|
|
329
|
+
export interface NativeCommitSpanInput {
|
|
330
|
+
readonly schema: CommitTraceSchema;
|
|
331
|
+
/** The manifest face governs the complete emitted attribute set. */
|
|
332
|
+
readonly face: CommitTraceFace;
|
|
333
|
+
/** Exact host-manifest row emitted by this callback boundary. */
|
|
334
|
+
readonly rowId: string;
|
|
335
|
+
readonly correlationId: string;
|
|
336
|
+
/** Repair roots may cover more than one attempt. */
|
|
337
|
+
readonly attemptId?: string;
|
|
338
|
+
readonly serviceId: string;
|
|
339
|
+
readonly actorClass: CommitTraceActorClass;
|
|
340
|
+
readonly actorKey: string;
|
|
341
|
+
readonly activation: DurableObjectActivationObservation;
|
|
342
|
+
readonly operation: string;
|
|
343
|
+
readonly kind: "root" | "nested" | "callee" | "direct" | "fanout-stage" | "fanout-member" | "sequential-stage" | "sequential-member";
|
|
344
|
+
readonly attributes?: Readonly<Record<string, TraceAttributeValue>>;
|
|
345
|
+
}
|
|
346
|
+
export interface NativeActorHandleIdentity {
|
|
347
|
+
readonly attemptId: string;
|
|
348
|
+
readonly serviceId: string;
|
|
349
|
+
/** Optional durable actor identity resolved with the attempt context. */
|
|
350
|
+
readonly actorKey?: string;
|
|
351
|
+
}
|
|
352
|
+
export interface NativeActorHandleInput {
|
|
353
|
+
readonly actorClass: CommitTraceActorClass;
|
|
354
|
+
readonly actorKey: string;
|
|
355
|
+
readonly activation: DurableObjectActivationObservation;
|
|
356
|
+
/** Separate sdt.observe/v1 log stream; never a commit-span attribute. */
|
|
357
|
+
readonly observation?: DurableObjectHandlerObservation;
|
|
358
|
+
}
|
|
359
|
+
/**
|
|
360
|
+
* Alarm identity is intentionally supplied by the Journal's durable facts,
|
|
361
|
+
* never guessed from a timestamp or a platform automatic attribute. The
|
|
362
|
+
* helper starts the custom span before those facts are read, then annotates
|
|
363
|
+
* that already-active callback context once the Journal has decoded them.
|
|
364
|
+
*/
|
|
365
|
+
export interface NativeReconcileRootIdentity {
|
|
366
|
+
readonly attemptId: string;
|
|
367
|
+
readonly serviceId: string;
|
|
368
|
+
readonly actorKey: string;
|
|
369
|
+
readonly activation: DurableObjectActivationObservation;
|
|
370
|
+
readonly alarmEventId: string;
|
|
371
|
+
readonly invocationId: string;
|
|
372
|
+
readonly retryCount: number;
|
|
373
|
+
readonly isRetry: boolean;
|
|
374
|
+
readonly prefixAtEntry: string;
|
|
375
|
+
}
|
|
376
|
+
/**
|
|
377
|
+
* A reconciliation fact becomes available only after durable recovery reads.
|
|
378
|
+
* R00 remains open for the handler's whole callback, so it is the sole span
|
|
379
|
+
* to which the host contract permits this late attribute.
|
|
380
|
+
*/
|
|
381
|
+
export interface NativeReconcileRootFacts {
|
|
382
|
+
setRecoveryKind(kind: string): void;
|
|
383
|
+
}
|
|
384
|
+
/**
|
|
385
|
+
* Emit a real Cloudflare custom span in the currently active async context.
|
|
386
|
+
* There is intentionally no parent argument: Worker/DO parentage is the
|
|
387
|
+
* platform's concern, and this function only supplies manifest attributes.
|
|
388
|
+
*/
|
|
389
|
+
export declare function enterNativeCommitSpan<T>(nativeTracing: NativeTracing, name: string, input: NativeCommitSpanInput, callback: () => T | Promise<T>): Promise<T>;
|
|
390
|
+
/**
|
|
391
|
+
* Emits S16 at the Durable Object handler boundary. Identity may only become
|
|
392
|
+
* available after a clone of the internal request body is decoded, but the
|
|
393
|
+
* custom span itself begins synchronously at handler entry. Failure to derive
|
|
394
|
+
* an internal identity merely leaves that non-commit actor invocation outside
|
|
395
|
+
* the sdt.commit universe; it never changes the request's control path.
|
|
396
|
+
*/
|
|
397
|
+
export declare function enterNativeActorHandleSpan<T>(nativeTracing: NativeTracing, input: NativeActorHandleInput, resolveIdentity: () => Promise<NativeActorHandleIdentity | undefined>, callback: () => T | Promise<T>): Promise<T>;
|
|
398
|
+
/**
|
|
399
|
+
* Emit R00 at actual alarm-handler entry. The Journal must read the durable
|
|
400
|
+
* record to discover the generation/attempt identity, so resolving it inside
|
|
401
|
+
* the active callback is the only way to keep both the entry boundary and
|
|
402
|
+
* Cloudflare-owned parentage without synthetic parent IDs.
|
|
403
|
+
*/
|
|
404
|
+
export declare function enterNativeReconcileRootSpan<T>(nativeTracing: NativeTracing, resolveIdentity: () => Promise<NativeReconcileRootIdentity | undefined>, callback: (identity: NativeReconcileRootIdentity | undefined, facts: NativeReconcileRootFacts) => T | Promise<T>): Promise<T>;
|
|
405
|
+
export {};
|