@memberjunction/task-graph 6.2.1 → 6.3.0-edge.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/dist/TaskGraphDispatcher.d.ts +279 -2
- package/dist/TaskGraphDispatcher.d.ts.map +1 -1
- package/dist/TaskGraphDispatcher.js +1255 -330
- package/dist/TaskGraphDispatcher.js.map +1 -1
- package/dist/TaskGraphService.d.ts +57 -1
- package/dist/TaskGraphService.d.ts.map +1 -1
- package/dist/TaskGraphService.js +176 -24
- package/dist/TaskGraphService.js.map +1 -1
- package/dist/TaskGraphSubmitterImpl.d.ts +1 -0
- package/dist/TaskGraphSubmitterImpl.d.ts.map +1 -1
- package/dist/TaskGraphSubmitterImpl.js +5 -0
- package/dist/TaskGraphSubmitterImpl.js.map +1 -1
- package/dist/decision-node.d.ts +19 -0
- package/dist/decision-node.d.ts.map +1 -1
- package/dist/decision-node.js.map +1 -1
- package/dist/index.d.ts +2 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +2 -0
- package/dist/index.js.map +1 -1
- package/dist/operations/TaskGraphDebugOperations.d.ts +23 -0
- package/dist/operations/TaskGraphDebugOperations.d.ts.map +1 -1
- package/dist/operations/TaskGraphDebugOperations.js +13 -13
- package/dist/operations/TaskGraphDebugOperations.js.map +1 -1
- package/dist/operations/TaskGraphOperations.d.ts.map +1 -1
- package/dist/operations/TaskGraphOperations.js +12 -7
- package/dist/operations/TaskGraphOperations.js.map +1 -1
- package/dist/saga-compensation.d.ts +167 -0
- package/dist/saga-compensation.d.ts.map +1 -0
- package/dist/saga-compensation.js +392 -0
- package/dist/saga-compensation.js.map +1 -0
- package/dist/task-security.d.ts +96 -0
- package/dist/task-security.d.ts.map +1 -0
- package/dist/task-security.js +187 -0
- package/dist/task-security.js.map +1 -0
- package/dist/types.d.ts +57 -1
- package/dist/types.d.ts.map +1 -1
- package/dist/types.js +1 -0
- package/dist/types.js.map +1 -1
- package/package.json +12 -12
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { UserInfo } from '@memberjunction/core';
|
|
2
2
|
import { IShutdownable } from '@memberjunction/global';
|
|
3
3
|
import { MJTaskEntity } from '@memberjunction/core-entities';
|
|
4
|
+
import { type UpstreamTaintLookup } from './task-security.js';
|
|
4
5
|
/**
|
|
5
6
|
* Parses a task's stored `InputPayload`, telling an ABSENT input apart from an UNREADABLE one.
|
|
6
7
|
*
|
|
@@ -42,6 +43,17 @@ export type ClaimedTaskCandidate = {
|
|
|
42
43
|
* Accepts either a `Map` or a plain `Record` when supplied by callers/tests.
|
|
43
44
|
*/
|
|
44
45
|
dependencyOutputs?: Map<string, unknown> | Record<string, unknown>;
|
|
46
|
+
/**
|
|
47
|
+
* The task rows this task depends on, from the same graph load, so its input taint is computed
|
|
48
|
+
* without another query (see `ComputeNodeInputTaint`).
|
|
49
|
+
*/
|
|
50
|
+
upstreamTasks?: MJTaskEntity[];
|
|
51
|
+
/**
|
|
52
|
+
* Every task's prerequisites in the same graph load, so the taint check can look past a
|
|
53
|
+
* prerequisite that recorded no taint (see `UpstreamCarriesTaint`). Absent: such a prerequisite
|
|
54
|
+
* reads as tainted.
|
|
55
|
+
*/
|
|
56
|
+
upstreamOf?: UpstreamTaintLookup;
|
|
45
57
|
};
|
|
46
58
|
export declare class TaskGraphDispatcher implements IShutdownable {
|
|
47
59
|
private readonly providerFactory;
|
|
@@ -108,6 +120,19 @@ export declare class TaskGraphDispatcher implements IShutdownable {
|
|
|
108
120
|
* by the wide startup sweep, which is the durable backstop this leans on.
|
|
109
121
|
*/
|
|
110
122
|
private readonly retryingSettlement;
|
|
123
|
+
/**
|
|
124
|
+
* Graphs whose processing threw on this instance, and when it may try each again (S6). Reported
|
|
125
|
+
* once per failure streak, not once per poll; cleared the first time the graph processes cleanly,
|
|
126
|
+
* or once the graph is no longer active (settled elsewhere).
|
|
127
|
+
*/
|
|
128
|
+
private readonly failedGraphs;
|
|
129
|
+
/**
|
|
130
|
+
* Saga rows this instance failed to write on its last passes, by the task each would compensate
|
|
131
|
+
* (`CompensatesTaskID`), with the graph it belongs to and how many passes in a row failed
|
|
132
|
+
* ({@link SAGA_ROW_WRITE_ATTEMPTS}). Cleared when the row lands, when another dispatcher's row is
|
|
133
|
+
* found, or once the graph is no longer active.
|
|
134
|
+
*/
|
|
135
|
+
private readonly sagaRowWriteFailures;
|
|
111
136
|
/**
|
|
112
137
|
* Graphs whose settled-branch ANNOUNCEMENTS have already been made by this process.
|
|
113
138
|
*
|
|
@@ -339,8 +364,14 @@ export declare class TaskGraphDispatcher implements IShutdownable {
|
|
|
339
364
|
*
|
|
340
365
|
* Overlap-guarded — a pass that runs long simply skips the next tick rather than stacking, which
|
|
341
366
|
* would otherwise let a slow database multiply in-flight work past the cap.
|
|
367
|
+
*
|
|
368
|
+
* Always server work (`ServerOperationScopeManager.RunAsServerWork`). {@link Kick} runs a pass in its
|
|
369
|
+
* caller's async scope, and a caller inside a client's own CRUD request (a graph submitted from one)
|
|
370
|
+
* would otherwise hand that request's boundary to every node the pass runs, so a node's save of a
|
|
371
|
+
* Human step or an agent request would read as that person's own act.
|
|
342
372
|
*/
|
|
343
373
|
private pollOnce;
|
|
374
|
+
private runPass;
|
|
344
375
|
/**
|
|
345
376
|
* Executes one claimed task on its own provider, heartbeating until it settles.
|
|
346
377
|
*
|
|
@@ -360,6 +391,18 @@ export declare class TaskGraphDispatcher implements IShutdownable {
|
|
|
360
391
|
* graph is wedged — are delegated to the pure algorithms, unchanged from Phase 1.
|
|
361
392
|
*/
|
|
362
393
|
private propagateAndRollup;
|
|
394
|
+
/** Whether a graph that threw is still inside its back-off on this instance. */
|
|
395
|
+
private isBackingOffFailedGraph;
|
|
396
|
+
/**
|
|
397
|
+
* Sets a graph whose processing threw aside for {@link FAILED_GRAPH_BACKOFF_MS}, so the other graphs
|
|
398
|
+
* go on settling and claiming. Logged on the first failure of a streak only.
|
|
399
|
+
*/
|
|
400
|
+
private backOffFailedGraph;
|
|
401
|
+
/**
|
|
402
|
+
* {@link propagateAndRollup} for one graph: returns the graph when it is still live (so claiming can
|
|
403
|
+
* reuse it), or `undefined` when it settled, emptied or is waiting on a retry.
|
|
404
|
+
*/
|
|
405
|
+
private propagateAndRollupGraph;
|
|
363
406
|
/**
|
|
364
407
|
* Credits a finished graph's spending back to the agent run that submitted it.
|
|
365
408
|
*
|
|
@@ -481,6 +524,20 @@ export declare class TaskGraphDispatcher implements IShutdownable {
|
|
|
481
524
|
* so two instances reconciling the same completed graph produce one winner rather than two.
|
|
482
525
|
*/
|
|
483
526
|
private deliverContinuation;
|
|
527
|
+
/**
|
|
528
|
+
* What a `reinvoke` continuation turn runs under (B1): the graph's stored envelope, tainted when the
|
|
529
|
+
* submitting run was or when any step's output carries taint — the turn reads every step's outcome,
|
|
530
|
+
* so a completed Human step clears only what it reviewed. A stored envelope that cannot be read is a
|
|
531
|
+
* refusal: the turn is then not started at all.
|
|
532
|
+
*/
|
|
533
|
+
private continuationEnvelope;
|
|
534
|
+
/**
|
|
535
|
+
* Why a `reinvoke` turn must not start, or null. A fresh agent turn that ran without the graph's
|
|
536
|
+
* constraints would search without its tenant and readers and post into a shared conversation, so a
|
|
537
|
+
* graph whose envelope cannot be read, or that constrains anything on a host whose deliverer does not
|
|
538
|
+
* enforce envelopes, is delivered as a message instead.
|
|
539
|
+
*/
|
|
540
|
+
private reinvokeRefusal;
|
|
484
541
|
/** Reads the parent's durable continuation metadata through the shared parser. */
|
|
485
542
|
private readParentMetadata;
|
|
486
543
|
/**
|
|
@@ -670,6 +727,15 @@ export declare class TaskGraphDispatcher implements IShutdownable {
|
|
|
670
727
|
* human action: it takes another person cancelling again to come back here.
|
|
671
728
|
*/
|
|
672
729
|
private reconcileWaitingHumanTasks;
|
|
730
|
+
/** The step's Configuration with `runtime.completedByUserID` set to `userID` (removed when there is none). */
|
|
731
|
+
private configurationWithCompletedBy;
|
|
732
|
+
/**
|
|
733
|
+
* Saves a row inside {@link TASK_GRAPH_RUNTIME_SECURITY_OPERATION}, bound to this dispatcher's user and to
|
|
734
|
+
* the row's entity: the one scope in which `MJTaskEntityServer` accepts a write of a task's runtime
|
|
735
|
+
* security fields, and `MJAIAgentRequestEntityServer` accepts a new request for a workflow step. Only
|
|
736
|
+
* the save runs inside it.
|
|
737
|
+
*/
|
|
738
|
+
private saveWithRuntimeAuthority;
|
|
673
739
|
/** The answered (or expired) request for a task, if any. */
|
|
674
740
|
private answeredRequestFor;
|
|
675
741
|
/**
|
|
@@ -682,6 +748,8 @@ export declare class TaskGraphDispatcher implements IShutdownable {
|
|
|
682
748
|
/** The agent run that submitted this task's graph, for provenance on the request. */
|
|
683
749
|
private submittingRunOf;
|
|
684
750
|
/** Loads a graph's children and edges in the shapes both the algorithms and mutation need. */
|
|
751
|
+
/** A graph state with no steps: what a parent with no children, or one that is not a workflow, loads as. */
|
|
752
|
+
private emptyGraphState;
|
|
685
753
|
private loadGraphState;
|
|
686
754
|
/**
|
|
687
755
|
* Reports an unevaluable condition ONCE per edge, not once per poll.
|
|
@@ -716,14 +784,48 @@ export declare class TaskGraphDispatcher implements IShutdownable {
|
|
|
716
784
|
* loading wait on observability. Frames are commentary, never a step of the work.
|
|
717
785
|
*/
|
|
718
786
|
private emitGateDecisions;
|
|
787
|
+
/** The task rows `taskID` depends on, from the loaded graph (no query). */
|
|
788
|
+
private upstreamTasksInGraph;
|
|
789
|
+
/**
|
|
790
|
+
* Every task's prerequisites in the loaded graph, for the taint check to follow past a
|
|
791
|
+
* prerequisite that recorded no taint. A dependency whose row is not in the graph makes that
|
|
792
|
+
* task's prerequisites unknown, which the check reads as tainted.
|
|
793
|
+
*/
|
|
794
|
+
private upstreamLookupInGraph;
|
|
795
|
+
/**
|
|
796
|
+
* The graph's dependency rows of `taskID`. Indexed once per graph load: callers ask for every
|
|
797
|
+
* claimable task in turn, and scanning all edges per task made a pass O(tasks × edges).
|
|
798
|
+
*/
|
|
799
|
+
private dependencyRowsOf;
|
|
800
|
+
/**
|
|
801
|
+
* The envelope a node's runners receive: its stored constraints ({@link GraphContext.Security})
|
|
802
|
+
* with `IsRunTainted` set to the node's input taint (`ComputeNodeInputTaint`), or why the node
|
|
803
|
+
* must not run.
|
|
804
|
+
*/
|
|
805
|
+
private nodeEnvelope;
|
|
806
|
+
/** Whether a node's input is tainted; a node refused on security grounds counts as tainted. */
|
|
807
|
+
private inputTaintOf;
|
|
808
|
+
/**
|
|
809
|
+
* The failed outcome for a node refused on security grounds, or null when it may run. A node whose
|
|
810
|
+
* envelope constrains anything runs only on a runner that enforces envelopes: the dispatcher
|
|
811
|
+
* cannot apply a run scope, an audience or the taint gate itself, so a runner that does not
|
|
812
|
+
* declare it would run the node unconstrained.
|
|
813
|
+
*/
|
|
814
|
+
private securityRefusal;
|
|
815
|
+
/** A node refused on security grounds: failed, never run, and its output counted as tainted. */
|
|
816
|
+
private refusedNode;
|
|
719
817
|
/**
|
|
720
818
|
* Extracts parsed `OutputPayload` values for all dependencies of `taskID` directly from the
|
|
721
819
|
* already-loaded `GraphState`, avoiding any additional database round-trips when claiming and
|
|
722
820
|
* executing a task.
|
|
723
821
|
*/
|
|
724
822
|
private extractDependencyOutputsFromGraph;
|
|
725
|
-
/**
|
|
726
|
-
|
|
823
|
+
/**
|
|
824
|
+
* The task rows `taskID` depends on, and the parsed `OutputPayload` of each, keyed by that task's
|
|
825
|
+
* ID. The path for a task claimed without a graph load; `findClaimableTasks` reads both from the
|
|
826
|
+
* graph it already holds.
|
|
827
|
+
*/
|
|
828
|
+
private loadDependencies;
|
|
727
829
|
/**
|
|
728
830
|
* Runs one task's body, whatever kind of step it is.
|
|
729
831
|
*
|
|
@@ -734,8 +836,183 @@ export declare class TaskGraphDispatcher implements IShutdownable {
|
|
|
734
836
|
*
|
|
735
837
|
* Every branch is normalized to one shape so the recording path above stays single: an action has
|
|
736
838
|
* no agent run to point at, because its forensics live in `ActionExecutionLog` instead.
|
|
839
|
+
*
|
|
840
|
+
* **Every kind records its output taint here, as its input taint OR its own** (a Decision, a loop,
|
|
841
|
+
* a failure and a refusal included). A kind that returned none — a Decision did, before — let its
|
|
842
|
+
* output read as clean, so Fetch → Decision → Send Email ran the egress action ungated.
|
|
737
843
|
*/
|
|
738
844
|
private runTaskBody;
|
|
845
|
+
/** {@link runTaskBody} for one step kind, with the node's context and envelope already resolved. */
|
|
846
|
+
private runTaskBodyOfKind;
|
|
847
|
+
/**
|
|
848
|
+
* Runs an action task, retrying a failure up to the step's `retryCount` — but only when running the
|
|
849
|
+
* action again is safe: only when the action's `IsIdempotent` column says so. A forward step's node may
|
|
850
|
+
* turn that off (`compensation.isIdempotent: false`) but never on, because the node is written by a
|
|
851
|
+
* model and the column by whoever owns the action; a compensation task retries when its compensation
|
|
852
|
+
* action is idempotent. A non-idempotent action is never re-run: a payment that failed after charging
|
|
853
|
+
* must not charge again. Retries back off exponentially (`RetryBackoffBaseMs`, doubling, capped at 30×).
|
|
854
|
+
*/
|
|
855
|
+
private invokeActionWithRetry;
|
|
856
|
+
/**
|
|
857
|
+
* How many times a failed action step may be retried: its `retryCount`, or 0 when the action is not
|
|
858
|
+
* idempotent. Effective idempotency is `Action.IsIdempotent && node !== false`.
|
|
859
|
+
*/
|
|
860
|
+
private allowedRetries;
|
|
861
|
+
/**
|
|
862
|
+
* The saga columns of the given actions (`CompensationActionID`, `CompensationInputMapping`,
|
|
863
|
+
* `IsIdempotent`), read through their typed fields.
|
|
864
|
+
*/
|
|
865
|
+
private actionRows;
|
|
866
|
+
/**
|
|
867
|
+
* The parent rollup while a saga still has work (S7): every forward step can be terminal while a
|
|
868
|
+
* compensation is yet to be created or run, and settling then would mark the graph `Failed` (and
|
|
869
|
+
* announce it) with the rollback unfinished, or never started. Such a graph stays `In Progress`.
|
|
870
|
+
*/
|
|
871
|
+
private rollupWhileCompensating;
|
|
872
|
+
/**
|
|
873
|
+
* Drives a graph's saga one move per pass (WS-4.3), when its `failurePolicy` is
|
|
874
|
+
* `'CompensateCompleted'` and a forward step failed unhandled.
|
|
875
|
+
*
|
|
876
|
+
* Every decision is recomputed from durable rows ({@link NextSagaStep}), so any dispatcher picks up
|
|
877
|
+
* where another left off, and every write is one that cannot be raced into a wrong state: the
|
|
878
|
+
* remaining forward steps are skipped through the guarded `TrySkipPending` (and the claim filter
|
|
879
|
+
* already refuses them, see `sagaHoldsForwardWork`), and each compensation or escalation row is
|
|
880
|
+
* inserted with `CompensatesTaskID`, whose unique index lets exactly one dispatcher create it.
|
|
881
|
+
*
|
|
882
|
+
* @returns the graph (reloaded whenever this pass tried to insert a row, won or lost) and whether the
|
|
883
|
+
* saga still has work, so the caller does not settle the parent under it
|
|
884
|
+
*/
|
|
885
|
+
private coordinateSagaCompensation;
|
|
886
|
+
/**
|
|
887
|
+
* Whether a graph is rolling back, so its forward steps must not start: its policy is
|
|
888
|
+
* `'CompensateCompleted'` and a forward step failed with no drawn route out of the failure. Read from
|
|
889
|
+
* the rows, so every dispatcher's claim filter agrees.
|
|
890
|
+
*/
|
|
891
|
+
private sagaHoldsForwardWork;
|
|
892
|
+
/**
|
|
893
|
+
* Skips every forward step still `Pending` once the graph is rolling back — independent branches too,
|
|
894
|
+
* since running new work while undoing old work is what the policy exists to prevent. Guarded on
|
|
895
|
+
* `Pending` in the statement, so a step another dispatcher claimed meanwhile is left to finish (and
|
|
896
|
+
* is then compensated), never overwritten.
|
|
897
|
+
*
|
|
898
|
+
* @returns false when a skip did not land: that step was claimed elsewhere after this pass loaded
|
|
899
|
+
* the graph (or the write failed), so this snapshot no longer says what is running, and the
|
|
900
|
+
* saga must not plan from it — a step about to complete would be compensated out of reverse
|
|
901
|
+
* order, or after the saga reported itself finished
|
|
902
|
+
*/
|
|
903
|
+
private skipRemainingForwardTasks;
|
|
904
|
+
/**
|
|
905
|
+
* Creates the compensation task for one forward step, linked by `CompensatesTaskID`. Its unique index
|
|
906
|
+
* is the claim: when two dispatchers both get here, one insert succeeds and the other finds the
|
|
907
|
+
* winner's row and treats the step as already materialized. Nothing is written to the forward step.
|
|
908
|
+
*
|
|
909
|
+
* A compensation that can never be created (its action does not exist, or the step's envelope cannot
|
|
910
|
+
* be read) is recorded as a failed one at once ({@link recordUncreatableSagaRow}), so the saga
|
|
911
|
+
* escalates it rather than waiting. One that failed for a reason that may not repeat (the action
|
|
912
|
+
* lookup errored, or the insert failed with no other dispatcher's row behind it) is retried on later
|
|
913
|
+
* passes, and recorded as failed only after {@link SAGA_ROW_WRITE_ATTEMPTS} of them in a row
|
|
914
|
+
* ({@link retrySagaRowOrRecordFailed}).
|
|
915
|
+
*
|
|
916
|
+
* @returns true when this call wrote a row
|
|
917
|
+
*/
|
|
918
|
+
private materializeCompensation;
|
|
919
|
+
/**
|
|
920
|
+
* A saga row's write failed for a reason that may not repeat: a lookup that errored, or an insert
|
|
921
|
+
* that failed with no other dispatcher's row behind it (or with that check failing too). The next
|
|
922
|
+
* pass retries it; only after {@link SAGA_ROW_WRITE_ATTEMPTS} passes in a row have failed for the
|
|
923
|
+
* same row is it recorded as failed ({@link recordUncreatableSagaRow}).
|
|
924
|
+
*
|
|
925
|
+
* @returns true when this call wrote the failed row
|
|
926
|
+
*/
|
|
927
|
+
private retrySagaRowOrRecordFailed;
|
|
928
|
+
/**
|
|
929
|
+
* Records a saga row that cannot be created as intended — a compensation, or the Human step escalating
|
|
930
|
+
* a failed one — as a `Failed` row carrying the reason. The saga then moves on by its own rules
|
|
931
|
+
* ({@link NextSagaStep}): a failed compensation escalates to a person (or halts or continues, per its
|
|
932
|
+
* `onCompensationFailure`), and a failed escalation ends the rollback, so the graph settles. Leaving
|
|
933
|
+
* the row unwritten kept the graph `In Progress` and its submitting run `Paused` forever, retrying a
|
|
934
|
+
* write that could not succeed and logging it on every poll.
|
|
935
|
+
*
|
|
936
|
+
* The row carries only what the saga reads plus the reason, none of the columns that can make an
|
|
937
|
+
* insert fail (payload, assignee, action), so it lands where the full row did not. It is claimed by
|
|
938
|
+
* the same unique `CompensatesTaskID`. When even it cannot be written the database itself is failing,
|
|
939
|
+
* and the next pass tries again.
|
|
940
|
+
*
|
|
941
|
+
* @returns true when this call wrote the row
|
|
942
|
+
*/
|
|
943
|
+
private recordUncreatableSagaRow;
|
|
944
|
+
/**
|
|
945
|
+
* Asks a person to undo a step by hand after its compensation failed under
|
|
946
|
+
* `onCompensationFailure: 'EscalateToHumanTask'`: a `Human` step under the graph, assigned to the user
|
|
947
|
+
* who submitted it, linked to the failed compensation task by `CompensatesTaskID` (unique, so one
|
|
948
|
+
* escalation per failure however many dispatchers see it). The ordinary human-step machinery then
|
|
949
|
+
* notifies the person and raises an `MJ: AI Agent Requests` row on behalf of the graph's agent — or,
|
|
950
|
+
* for a graph with no agent, logs that once and leaves the step in the Tasks UI. Completing the step
|
|
951
|
+
* resumes the rollback; cancelling it (or letting it expire) stops it (see {@link NextSagaStep}). A step
|
|
952
|
+
* that cannot be created after {@link SAGA_ROW_WRITE_ATTEMPTS} passes in a row is recorded as a failed
|
|
953
|
+
* one ({@link retrySagaRowOrRecordFailed}), which stops it too.
|
|
954
|
+
*
|
|
955
|
+
* The step carries the forward step's record changes, read as the user the graph's work runs as with
|
|
956
|
+
* the caller's tenant from the envelope. An envelope that cannot be read carries no tenant
|
|
957
|
+
* ({@link graphContext}), so that read would run untenanted: the step then gets no record changes.
|
|
958
|
+
*
|
|
959
|
+
* @returns true when this call wrote a row
|
|
960
|
+
*/
|
|
961
|
+
private escalateCompensationFailure;
|
|
962
|
+
/** Whether some task already undoes `taskID` — the row the unique `CompensatesTaskID` index let another dispatcher insert. */
|
|
963
|
+
private rowCompensating;
|
|
964
|
+
/** The user the graph's work runs as (the submitter, stamped with the caller's tenant when the graph carries one). */
|
|
965
|
+
private sagaActingUser;
|
|
966
|
+
/** The `MJ: Action Execution Logs` row a completed action step recorded (`runtime.actionLogID`). */
|
|
967
|
+
private runtimeActionLogID;
|
|
968
|
+
/**
|
|
969
|
+
* The parameters a completed action step's action was given (`runtime.actionInput`), which the
|
|
970
|
+
* dispatcher records when the step runs. Not `InputPayload`: that is only the authored input, and
|
|
971
|
+
* the action's real parameters come from its input mapping over upstream outputs and the envelope.
|
|
972
|
+
*/
|
|
973
|
+
private runtimeActionInput;
|
|
974
|
+
/**
|
|
975
|
+
* The envelope a compensation task is written with: the forward task's constraints, tainted when
|
|
976
|
+
* the forward task's output carries taint ({@link UpstreamCarriesTaint}, so a forward task that
|
|
977
|
+
* recorded none is read as tainted when the graph or anything upstream of it could be). A
|
|
978
|
+
* compensation reads the forward run's input and output, so it runs under exactly what the forward
|
|
979
|
+
* task ran under, and never less tainted than what it reads.
|
|
980
|
+
*/
|
|
981
|
+
private compensationEnvelope;
|
|
982
|
+
/**
|
|
983
|
+
* Resolves a compensation action UUID from `compensationActionId` or `compensationActionName`.
|
|
984
|
+
* `ActionID` is null when neither names an action that exists. `LookupError` says the name lookup
|
|
985
|
+
* itself failed, so whether the action exists is unknown and a later pass may yet find it.
|
|
986
|
+
*/
|
|
987
|
+
private resolveCompensationActionID;
|
|
988
|
+
/**
|
|
989
|
+
* The `MJ: Record Changes` a forward action step made, for its compensation's input and a failed
|
|
990
|
+
* compensation's escalation. Read as the user the graph's work runs as — never the system user — so
|
|
991
|
+
* the user's own permissions bound what comes back.
|
|
992
|
+
*
|
|
993
|
+
* Bounded to the action's own execution window, `StartedAt`..`EndedAt` of the `MJ: Action Execution
|
|
994
|
+
* Logs` row the step recorded, and to the user that log ran as. That is the tightest correlation the
|
|
995
|
+
* data allows: a Record Change carries no action-log or task reference, only who changed what and
|
|
996
|
+
* when, so a window around the one execution — not the task's whole life, which spans its queueing
|
|
997
|
+
* and retries — is as close as it gets. Changes the same user made elsewhere inside that window can
|
|
998
|
+
* still appear; a step with no recorded log gets none.
|
|
999
|
+
*/
|
|
1000
|
+
private loadCorrelatedRecordChanges;
|
|
1001
|
+
/**
|
|
1002
|
+
* Builds the compensation input payload from a completed forward task's input (the parameters its
|
|
1003
|
+
* action was given, {@link runtimeActionInput}), output, runtime log ID, and correlated
|
|
1004
|
+
* `MJ: Record Changes` rows.
|
|
1005
|
+
*/
|
|
1006
|
+
private buildForwardTaskCompensationInput;
|
|
1007
|
+
/**
|
|
1008
|
+
* Records the saga's state on the parent (`InputPayload.sagaState`) for anyone reading the graph.
|
|
1009
|
+
*
|
|
1010
|
+
* Written through the guarded, type-scoped single-field write and nothing else: a full-row save of the
|
|
1011
|
+
* parent would carry this pass's snapshot of `InputPayload` and could erase a continuation marker or a
|
|
1012
|
+
* debug field another dispatcher wrote meanwhile (R2-14, R3-1). The state is informational — every saga
|
|
1013
|
+
* decision is recomputed from the rows — so a write that does not land is retried on the next pass.
|
|
1014
|
+
*/
|
|
1015
|
+
private updateParentSagaState;
|
|
739
1016
|
/**
|
|
740
1017
|
* Runs a loop step: its body once per iteration, with the item and index in scope.
|
|
741
1018
|
*
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"TaskGraphDispatcher.d.ts","sourceRoot":"","sources":["../src/TaskGraphDispatcher.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"TaskGraphDispatcher.d.ts","sourceRoot":"","sources":["../src/TaskGraphDispatcher.ts"],"names":[],"mappings":"AA8DA,OAAO,EAAyH,QAAQ,EAAE,MAAM,sBAAsB,CAAC;AACvK,OAAO,EAAgC,aAAa,EAA4E,MAAM,wBAAwB,CAAC;AAC/J,OAAO,EAAE,YAAY,EAA8F,MAAM,+BAA+B,CAAC;AA6DzJ,OAAO,EAQH,KAAK,mBAAmB,EAC3B,MAAM,iBAAiB,CAAC;AAqGzB;;;;;;;GAOG;AACH,wBAAgB,qBAAqB,CAAC,MAAM,EAAE,MAAM,EAAE,GAAG,EAAE,MAAM,GAAG,IAAI,GAAG,SAAS,GAAG;IAAE,OAAO,EAAE,OAAO,CAAA;CAAE,GAAG;IAAE,YAAY,EAAE,MAAM,CAAA;CAAE,CAarI;AACD,OAAO,EAA0F,KAAK,uBAAuB,EAAE,MAAM,oBAAoB,CAAC;AAC1J,OAAO,EAEH,eAAe,EAEf,gBAAgB,EAEhB,eAAe,EACf,gBAAgB,EAChB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