footprintjs 9.45.0 → 9.46.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/CLAUDE.md +9 -9
- package/dist/esm/lib/memory/RecordFrame.d.ts +197 -0
- package/dist/esm/lib/memory/RecordFrame.js +265 -0
- package/dist/esm/lib/memory/SharedMemory.d.ts +1 -1
- package/dist/esm/lib/memory/SharedMemory.js +2 -2
- package/dist/esm/lib/memory/StageContext.d.ts +52 -143
- package/dist/esm/lib/memory/StageContext.js +106 -223
- package/dist/esm/lib/memory/TransactionBuffer.d.ts +2 -2
- package/dist/esm/lib/memory/TransactionBuffer.js +3 -3
- package/dist/esm/lib/memory/utils.d.ts +2 -2
- package/dist/esm/lib/memory/utils.js +3 -3
- package/dist/esm/lib/reactive/structuralWrite.d.ts +1 -1
- package/dist/esm/lib/reactive/structuralWrite.js +2 -2
- package/dist/lib/memory/RecordFrame.js +269 -0
- package/dist/lib/memory/SharedMemory.js +2 -2
- package/dist/lib/memory/StageContext.js +106 -223
- package/dist/lib/memory/TransactionBuffer.js +3 -3
- package/dist/lib/memory/utils.js +3 -3
- package/dist/lib/reactive/structuralWrite.js +2 -2
- package/dist/types/lib/memory/RecordFrame.d.ts +197 -0
- package/dist/types/lib/memory/SharedMemory.d.ts +1 -1
- package/dist/types/lib/memory/StageContext.d.ts +52 -143
- package/dist/types/lib/memory/TransactionBuffer.d.ts +2 -2
- package/dist/types/lib/memory/utils.d.ts +2 -2
- package/dist/types/lib/reactive/structuralWrite.d.ts +1 -1
- package/package.json +1 -1
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
*
|
|
4
4
|
* Like a runtime heap with namespace isolation:
|
|
5
5
|
* - A value is written at an ADDRESS — a path prefix the caller computed
|
|
6
|
-
* (C2: the engine's frame decides it, `StageContext ·
|
|
6
|
+
* (C2: the engine's frame decides it, `StageContext.ts · runAddress`) — and read
|
|
7
7
|
* there first, then at the root
|
|
8
8
|
* - Default values seed the root, and the container at an address when a
|
|
9
9
|
* write creates it
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
*
|
|
4
4
|
* Like a runtime heap with namespace isolation:
|
|
5
5
|
* - A value is written at an ADDRESS — a path prefix the caller computed
|
|
6
|
-
* (C2: the engine's frame decides it, `StageContext ·
|
|
6
|
+
* (C2: the engine's frame decides it, `StageContext.ts · runAddress`) — and read
|
|
7
7
|
* there first, then at the root
|
|
8
8
|
* - Default values seed the root, and the container at an address when a
|
|
9
9
|
* write creates it
|
|
@@ -79,4 +79,4 @@ export class SharedMemory {
|
|
|
79
79
|
this.context = nextGeneration(this.context, updates, overwrite, trace);
|
|
80
80
|
}
|
|
81
81
|
}
|
|
82
|
-
//# sourceMappingURL=data:application/json;base64,
|
|
82
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiU2hhcmVkTWVtb3J5LmpzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiLi4vLi4vLi4vLi4vc3JjL2xpYi9tZW1vcnkvU2hhcmVkTWVtb3J5LnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiJBQUFBOzs7Ozs7Ozs7Ozs7Ozs7Ozs7O0dBbUJHO0FBRUgsT0FBTyxFQUFFLGdCQUFnQixFQUFFLFdBQVcsRUFBRSxRQUFRLEVBQUUsTUFBTSxjQUFjLENBQUM7QUFFdkUsT0FBTyxFQUFFLGNBQWMsRUFBRSxvQkFBb0IsRUFBRSxjQUFjLEVBQUUsY0FBYyxFQUFFLGlCQUFpQixFQUFFLE1BQU0sWUFBWSxDQUFDO0FBRXJILE1BQU0sT0FBTyxZQUFZO0lBQ2YsT0FBTyxHQUEyQixFQUFFLENBQUM7SUFDckMsY0FBYyxDQUFXO0lBRWpDLFlBQVksYUFBdUIsRUFBRSxjQUF3QjtRQUMzRCxJQUFJLENBQUMsY0FBYyxHQUFHLGFBQWEsQ0FBQztRQUNwQyxNQUFNLElBQUksR0FBRyxnQ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W1vcnlQYXRjaCwgdHJhY2U6IFRyYWNlRW50cnlbXSk6IHZvaWQge1xuICAgIHRoaXMuY29udGV4dCA9IG5leHRHZW5lcmF0aW9uKHRoaXMuY29udGV4dCwgdXBkYXRlcywgb3ZlcndyaXRlLCB0cmFjZSk7XG4gIH1cbn1cbiJdfQ==
|
|
@@ -2,35 +2,33 @@
|
|
|
2
2
|
* StageContext — Execution context for a single stage in a flowchart run
|
|
3
3
|
*
|
|
4
4
|
* Like a stack frame in a compiler/runtime:
|
|
5
|
-
* -
|
|
6
|
-
*
|
|
5
|
+
* - A RecordFrame — the record half (C3): the heap, the address, the
|
|
6
|
+
* first-touch base, the lazy transaction buffer, the readKeys list
|
|
7
7
|
* - Links to parent/child/next contexts (call stack frames)
|
|
8
|
+
* - What belongs to a stage inside a run: retention of reads and writes, the
|
|
9
|
+
* redaction verdict per write, the dev-mode warnings, the commit observer
|
|
8
10
|
* - DiagnosticCollector for logs, errors, metrics
|
|
9
11
|
*/
|
|
10
12
|
import { type DiagnosticChannel, DiagnosticCollector } from './DiagnosticCollector.js';
|
|
11
|
-
import { EventLog } from './EventLog.js';
|
|
13
|
+
import type { EventLog } from './EventLog.js';
|
|
12
14
|
import type { EmitSourcePosition } from './eventPosition.js';
|
|
13
15
|
import type { RedactionVerdict } from './redaction.js';
|
|
14
16
|
import { RedactionRule } from './redaction.js';
|
|
15
17
|
import type { RunPolicy } from './runPolicy.js';
|
|
16
|
-
import { SharedMemory } from './SharedMemory.js';
|
|
17
|
-
import { TransactionBuffer } from './TransactionBuffer.js';
|
|
18
|
+
import type { SharedMemory } from './SharedMemory.js';
|
|
18
19
|
import type { CommitPhase, FlowControlType, StageSnapshot, UntrackedSource } from './types.js';
|
|
19
20
|
export declare class StageContext {
|
|
20
|
-
private sharedMemory;
|
|
21
21
|
/**
|
|
22
|
-
*
|
|
23
|
-
* the
|
|
24
|
-
*
|
|
25
|
-
*
|
|
26
|
-
*
|
|
27
|
-
*
|
|
28
|
-
*
|
|
29
|
-
*
|
|
30
|
-
* — consumers share the redacted view externally without leaking raw PII
|
|
31
|
-
* through `sharedState`.
|
|
22
|
+
* The record half of this frame (`RecordFrame.ts`, L3, C3): the heap and,
|
|
23
|
+
* when the run keeps them, the redacted mirror and the log; the address;
|
|
24
|
+
* the first-touch base; the lazy transaction buffer; the readKeys list.
|
|
25
|
+
* Every state read of this frame goes through it, and so does every
|
|
26
|
+
* commit. The mirror is present **only** when the run's policy keeps a
|
|
27
|
+
* redacted view (a `RedactionPolicy` is configured) — read via
|
|
28
|
+
* `FlowChartExecutor.getSnapshot({ redact: true })`, the foundation for
|
|
29
|
+
* sharing a trace without leaking raw PII through `sharedState`.
|
|
32
30
|
*/
|
|
33
|
-
private
|
|
31
|
+
private readonly record;
|
|
34
32
|
/**
|
|
35
33
|
* The run's policy — the four dials, the redaction rule, the mirror flag
|
|
36
34
|
* (`runPolicy.ts`, F5). Held BY REFERENCE: one frozen object per run (and
|
|
@@ -40,15 +38,6 @@ export declare class StageContext {
|
|
|
40
38
|
* ({@link usePolicy}). Never edited; a change is a new object.
|
|
41
39
|
*/
|
|
42
40
|
private policy;
|
|
43
|
-
private buffer?;
|
|
44
|
-
/**
|
|
45
|
-
* Committed-state view captured at this stage's FIRST touch (first read OR
|
|
46
|
-
* first write) — held by REFERENCE, never cloned. See
|
|
47
|
-
* {@link firstTouchState} for the algorithm and the immutability invariant
|
|
48
|
-
* that makes a bare reference safe.
|
|
49
|
-
*/
|
|
50
|
-
private stateView?;
|
|
51
|
-
private eventLog?;
|
|
52
41
|
/** The emitting frame's logical leg, never the mutable executor's current leg. */
|
|
53
42
|
private emitRunId?;
|
|
54
43
|
stageName: string;
|
|
@@ -65,7 +54,13 @@ export declare class StageContext {
|
|
|
65
54
|
* none — the same once-per-execution law `_untrackedSources` keeps.
|
|
66
55
|
*/
|
|
67
56
|
tags?: readonly string[];
|
|
68
|
-
|
|
57
|
+
/**
|
|
58
|
+
* The run this frame belongs to — its identity on every event, and the run
|
|
59
|
+
* namespace it reads and writes in ({@link runAddress}), read once, when the
|
|
60
|
+
* frame is built (C3). Only {@link useAddressOf} moves the address after
|
|
61
|
+
* that, and only before the first write.
|
|
62
|
+
*/
|
|
63
|
+
readonly runId: string;
|
|
69
64
|
/**
|
|
70
65
|
* The run namespace this frame writes and reads in when that is not its own
|
|
71
66
|
* `runId` — set once, before the frame's first write, by
|
|
@@ -128,11 +123,6 @@ export declare class StageContext {
|
|
|
128
123
|
* tier (`ScopeFacade`, one per stage execution), not here.
|
|
129
124
|
*/
|
|
130
125
|
private _committed;
|
|
131
|
-
/** Lazily-allocated ordered registry of keys tracked-read in THIS stage —
|
|
132
|
-
* the source of the per-write prefix. Only allocated under the
|
|
133
|
-
* `'reads-prefix'` dial; insertion-ordered (a Set) and monotonic, which
|
|
134
|
-
* is what makes "last write's prefix == union" hold in delta mode. */
|
|
135
|
-
private _provenanceReads?;
|
|
136
126
|
/** Tracked reads of a selected value ({@link selectedReads}). */
|
|
137
127
|
private _selectedReads;
|
|
138
128
|
/** Each object this frame read under a selected name → that read's verdict (`stageWrite` hands it on). */
|
|
@@ -159,7 +149,7 @@ export declare class StageContext {
|
|
|
159
149
|
/**
|
|
160
150
|
* Install a parallel redacted mirror. Subsequent `commit()` calls apply
|
|
161
151
|
* the already-computed redacted patches — the ones the log records — to
|
|
162
|
-
* this mirror, beside the raw patches on
|
|
152
|
+
* this mirror, beside the raw patches on the heap (`recordCommit`).
|
|
163
153
|
* Child / next contexts inherit the mirror via `createNext` / `createChild`.
|
|
164
154
|
*
|
|
165
155
|
* Called on a runtime's root frame by `ExecutionRuntime` when the run's policy keeps a mirror.
|
|
@@ -198,6 +188,12 @@ export declare class StageContext {
|
|
|
198
188
|
* {@link createChild} both call it, and it names no dial.
|
|
199
189
|
*/
|
|
200
190
|
private inheritRun;
|
|
191
|
+
/**
|
|
192
|
+
* The ONE place this frame's policy changes: the frame holds it, and its
|
|
193
|
+
* record frame encodes under the same reference (`commitValues`,
|
|
194
|
+
* `writeProvenance` — `RecordFrame · useEncoding`), so the two never differ.
|
|
195
|
+
*/
|
|
196
|
+
private adoptPolicy;
|
|
201
197
|
/**
|
|
202
198
|
* Record a tracked user-level write, policy-gated (#13c-A) — the single
|
|
203
199
|
* bookkeeping path for {@link setObject} and {@link updateObject}. Holds
|
|
@@ -257,70 +253,6 @@ export declare class StageContext {
|
|
|
257
253
|
* the verdict so the caller retains and reports under the same decision.
|
|
258
254
|
*/
|
|
259
255
|
private stageWrite;
|
|
260
|
-
/**
|
|
261
|
-
* ── The first-touch state view (#13) ────────────────────────────────────
|
|
262
|
-
*
|
|
263
|
-
* WHAT: returns the committed shared state as it was at this stage's FIRST
|
|
264
|
-
* touch (first read or first write), capturing the reference on first call.
|
|
265
|
-
* Serves two consumers: reads before the first write ({@link readState})
|
|
266
|
-
* and the transaction buffer's diff base ({@link getTransactionBuffer}).
|
|
267
|
-
*
|
|
268
|
-
* WHY A BARE REFERENCE IS SAFE — the invariant this rests on: committed
|
|
269
|
-
* state is immutable-after-swap. Every write to `SharedMemory` builds the
|
|
270
|
-
* NEXT generation and swaps it in (copy-on-write, 9.29.0: `applyPatch` via
|
|
271
|
-
* `nextGeneration`, and `setValue`/`updateValue` too) — it copies the root
|
|
272
|
-
* and the containers on each written path, shares the rest, and never
|
|
273
|
-
* edits a container of the generation a stage captured here. Holding the
|
|
274
|
-
* reference therefore gives this stage a stable snapshot at zero cost — no
|
|
275
|
-
* clone, which is the entire point of #13. The transaction buffer's
|
|
276
|
-
* net-change diff base rests on the same guarantee: it IS this view.
|
|
277
|
-
*
|
|
278
|
-
* WHY FIRST TOUCH, not first write: the pre-#13 eager engine cloned the
|
|
279
|
-
* state into the buffer at the stage's first ACCESS, anchoring both its
|
|
280
|
-
* snapshot reads and its commit baseline (the net-change diff base) there.
|
|
281
|
-
* #13's first cut anchored the lazy buffer at first WRITE — observably
|
|
282
|
-
* different when something else commits in the gap between this stage's
|
|
283
|
-
* first read and its first write. That gap is REACHABLE: fork siblings are
|
|
284
|
-
* namespace-isolated for run-scoped keys (each child writes under
|
|
285
|
-
* `runs/<childId>/`), but ROOT-level keys are shared — written via
|
|
286
|
-
* `setGlobal` from consumer scope code and, critically, by
|
|
287
|
-
* `SubflowInputMapper`'s output mapping (`parentContext.setGlobal`), which
|
|
288
|
-
* is exactly what runs when a subflow is a fork branch. A sibling's
|
|
289
|
-
* root-key commit landing in the gap would shift this stage's diff base,
|
|
290
|
-
* making its CommitBundle record a phantom change (or swallow a real one)
|
|
291
|
-
* relative to the eager engine. Anchoring the view at first touch restores
|
|
292
|
-
* the EXACT eager semantics — sequential AND parallel — at zero clone cost.
|
|
293
|
-
*
|
|
294
|
-
* Read visibility is two-tier, matching eager byte-for-byte: keys present
|
|
295
|
-
* in the view at first touch read repeatably from it; keys ABSENT from it
|
|
296
|
-
* fall back to LIVE state (the eager engine's exact fallback — a
|
|
297
|
-
* mid-flight sibling root-key write was always visible to reads, and
|
|
298
|
-
* stays visible; only the DIFF BASE is pinned).
|
|
299
|
-
*/
|
|
300
|
-
private firstTouchState;
|
|
301
|
-
/** Lazily creates the transaction buffer on the stage's FIRST WRITE (#13).
|
|
302
|
-
*
|
|
303
|
-
* Reads NEVER construct it: read-your-writes only matters once a staged
|
|
304
|
-
* write exists, so before that {@link getValue}/{@link getValueDirect}
|
|
305
|
-
* serve from the first-touch state view and {@link commit} records an
|
|
306
|
-
* empty bundle — all with ZERO `structuredClone`s of the shared state.
|
|
307
|
-
*
|
|
308
|
-
* The buffer's base is the FIRST-TOUCH view, NOT the live state at write
|
|
309
|
-
* time: under parallel forks a sibling may have committed between this
|
|
310
|
-
* stage's first read and this write, and the net-change diff base must
|
|
311
|
-
* stay anchored at first touch to match the eager engine — see
|
|
312
|
-
* {@link firstTouchState}. */
|
|
313
|
-
getTransactionBuffer(): TransactionBuffer;
|
|
314
|
-
/**
|
|
315
|
-
* Where this frame writes and reads: `['runs', <id>]`, or `[]` (the root) with
|
|
316
|
-
* no run id. Handed to the record layer as data (C2): the buffer's address,
|
|
317
|
-
* and where `SharedMemory · getValue` looks before the root.
|
|
318
|
-
*/
|
|
319
|
-
private get address();
|
|
320
|
-
/** Builds an absolute path inside the shared memory: this frame's {@link address}, then the path. */
|
|
321
|
-
private withNamespace;
|
|
322
|
-
/** The run namespace writes and reads go to: {@link addressRunId}, else `runId`. */
|
|
323
|
-
private get namespaceId();
|
|
324
256
|
/**
|
|
325
257
|
* Write and read at ANOTHER frame's address (its run namespace) while this
|
|
326
258
|
* frame keeps its own identity on the record — `stage`, `stageId`,
|
|
@@ -328,9 +260,13 @@ export declare class StageContext {
|
|
|
328
260
|
* (`SubflowExecutor · executeSubflow`, R13): the mount frame of a branch or
|
|
329
261
|
* fork child lands its values where its parent writes, as before, and its
|
|
330
262
|
* bundle now names the mount instead of the stage before it. Refused once
|
|
331
|
-
* the frame has staged anything — its buffer's address is fixed then.
|
|
263
|
+
* the frame has staged anything — its buffer's address is fixed then. The
|
|
264
|
+
* decision is the engine's (namespace ids, as since R13); the record frame
|
|
265
|
+
* takes the address it comes to (`RecordFrame · useAddress`).
|
|
332
266
|
*/
|
|
333
267
|
useAddressOf(frame: StageContext): void;
|
|
268
|
+
/** The run namespace writes and reads go to: {@link addressRunId}, else `runId`. */
|
|
269
|
+
private get namespaceId();
|
|
334
270
|
patch(path: string[], key: string, value: unknown, shouldRedact?: boolean): RedactionVerdict;
|
|
335
271
|
set(path: string[], key: string, value: unknown): void;
|
|
336
272
|
merge(path: string[], key: string, value: unknown, shouldRedact?: boolean): RedactionVerdict;
|
|
@@ -342,26 +278,6 @@ export declare class StageContext {
|
|
|
342
278
|
updateGlobalContext(key: string, value: unknown): void;
|
|
343
279
|
appendToArray(path: string[], key: string, items: unknown[], description?: string): void;
|
|
344
280
|
mergeObject(path: string[], key: string, obj: Record<string, unknown>, description?: string): void;
|
|
345
|
-
/** Buffer-aware read, mirroring the eager engine's read order byte-for-byte:
|
|
346
|
-
*
|
|
347
|
-
* 1. staged writes + first-touch snapshot — `buffer.get` over its
|
|
348
|
-
* workingCopy when the buffer exists, else `nativeGet` over the
|
|
349
|
-
* zero-clone state view (the buffer's base IS that view, so the two
|
|
350
|
-
* tiers agree on content);
|
|
351
|
-
* 2. LIVE state via `sharedMemory.getValue` for keys absent from the
|
|
352
|
-
* snapshot — including its run→global namespace fallback. The eager
|
|
353
|
-
* engine had this exact live fallback for snapshot-missing keys;
|
|
354
|
-
* byte-identity over purity. After the stage's first write such a
|
|
355
|
-
* value can be the very container the buffer's diff base holds at
|
|
356
|
-
* the path (the stage deleted or unset it, or replaced a container
|
|
357
|
-
* above it), so the base is detached there first
|
|
358
|
-
* (`TransactionBuffer · detachBase`): an in-place edit of the value
|
|
359
|
-
* (out of contract) written back is recorded, as on 9.28.0, whose
|
|
360
|
-
* base was a clone taken at the first write.
|
|
361
|
-
*
|
|
362
|
-
* Reads never construct the buffer (#13): a stage that never writes
|
|
363
|
-
* performs zero clones of the shared state. */
|
|
364
|
-
private readState;
|
|
365
281
|
/**
|
|
366
282
|
* Tracked read. The returned value is BORROWED — see the contract on
|
|
367
283
|
* `ScopeFacade.getValue`. Read-tracking cost is policy-gated (#14):
|
|
@@ -420,8 +336,8 @@ export declare class StageContext {
|
|
|
420
336
|
* those are engine reads (the subflow merge-back), not user reads.
|
|
421
337
|
*
|
|
422
338
|
* It also only looks at keys served from the PINNED source — the first-touch
|
|
423
|
-
* view or this stage's own buffer. A key absent from both was served by
|
|
424
|
-
*
|
|
339
|
+
* view or this stage's own buffer. A key absent from both was served by the
|
|
340
|
+
* read's live fallback (`RecordFrame · read`, tier 2), which a parallel sibling's root-key commit can
|
|
425
341
|
* legitimately move; accusing the stage there would be a false alarm. For
|
|
426
342
|
* the same reason it runs on the frame's FIRST commit only: the reads belong
|
|
427
343
|
* to that round, and by the engine's second round (a fork double-commit, a
|
|
@@ -453,21 +369,16 @@ export declare class StageContext {
|
|
|
453
369
|
* `outputMapper` (a lazy mount, every `parallelForEach` branch), whose exit
|
|
454
370
|
* is its only bundle, records that bundle as its own, tags and all.
|
|
455
371
|
*
|
|
456
|
-
* Commit is the stage's lifecycle end:
|
|
457
|
-
*
|
|
458
|
-
*
|
|
459
|
-
*
|
|
460
|
-
*
|
|
461
|
-
*
|
|
462
|
-
* O(N²) before copy-on-write (9.29.0), when each generation and each
|
|
463
|
-
* buffer was a whole-state clone: 563.8MB at N=200 on an agent-style
|
|
464
|
-
* chart; a 500-iteration agent OOMed a default Node heap (backlog #18).
|
|
465
|
-
* Generations now share every unchanged subtree, but a pinned one still
|
|
466
|
-
* keeps the containers later commits replaced alive.
|
|
372
|
+
* Commit is the stage's lifecycle end: the record frame's buffer and
|
|
373
|
+
* first-touch base are only needed DURING execution, as the read snapshot +
|
|
374
|
+
* net-change diff base, so the record frame releases them once the commit
|
|
375
|
+
* has landed and the observer has seen it (`RecordFrame · release` — why a
|
|
376
|
+
* frame that kept them would retain one state generation per executed
|
|
377
|
+
* stage, and why a re-used frame re-anchors on current state, is there).
|
|
467
378
|
*
|
|
468
|
-
* RE-USE AFTER COMMIT stays correct because both
|
|
469
|
-
* - a later READ re-anchors
|
|
470
|
-
*
|
|
379
|
+
* RE-USE AFTER COMMIT stays correct because both re-create lazily:
|
|
380
|
+
* - a later READ re-anchors on the CURRENT committed state (which includes
|
|
381
|
+
* this stage's own flushed writes);
|
|
471
382
|
* - a later WRITE constructs a fresh buffer on that re-anchored view, so a
|
|
472
383
|
* second commit diffs against post-first-commit state. The pre-release
|
|
473
384
|
* buffer behaved the same for VALUES (its `workingCopy` was reset on
|
|
@@ -498,20 +409,18 @@ export declare class StageContext {
|
|
|
498
409
|
* (M1: the transaction buffer holds writes until `commit()` flushes them).
|
|
499
410
|
*
|
|
500
411
|
* What is released, and why each one matters for the next attempt:
|
|
501
|
-
* -
|
|
502
|
-
* with nothing staged
|
|
503
|
-
*
|
|
504
|
-
*
|
|
505
|
-
*
|
|
412
|
+
* - the record frame's staged state (`RecordFrame · discard`) — the buffer
|
|
413
|
+
* (the next attempt starts with nothing staged), the
|
|
414
|
+
* first-touch base (it re-anchors on committed state as
|
|
415
|
+
* it stands NOW — a sibling fork branch may legitimately
|
|
416
|
+
* have committed in between) and the readKeys list (#P1:
|
|
417
|
+
* a discarded attempt's reads must never reach the next
|
|
418
|
+
* attempt's `TraceEntry.readKeys`);
|
|
506
419
|
* - `_stageWrites` / `_pendingWrites` / `_stageReads` — the snapshot
|
|
507
420
|
* payload; without the reset the execution tree would
|
|
508
421
|
* report writes that were discarded, which is the exact
|
|
509
422
|
* lie this feature exists to prevent (the pending map
|
|
510
423
|
* holds bare references — dropping it un-clones nothing);
|
|
511
|
-
* - `_provenanceReads` — the per-write read prefix (#P1); a discarded
|
|
512
|
-
* attempt's reads must never appear in the next attempt's
|
|
513
|
-
* `TraceEntry.readKeys`, or a backward slice would follow
|
|
514
|
-
* an edge that no committed write ever had;
|
|
515
424
|
* - `_untrackedSources` — the D2 honesty markers, released with the rest.
|
|
516
425
|
*
|
|
517
426
|
* What is deliberately KEPT: `debug` (logs, metrics, errors, flow messages).
|