agentic-workflow-manager 9.7.1 → 9.8.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/README.md +5 -1
- package/dist/src/commands/job/exec-wrapper.js +53 -3
- package/dist/src/commands/plan/index.js +124 -6
- package/dist/src/commands/sensors/bootstrap.js +36 -5
- package/dist/src/commands/sensors/compatibility/contract.js +19 -4
- package/dist/src/commands/sensors/compatibility/discovery.js +23 -3
- package/dist/src/commands/sensors/compatibility/live.js +18 -1
- package/dist/src/commands/sensors/compatibility/probe.js +8 -2
- package/dist/src/commands/sensors/compatibility/resolve.js +5 -2
- package/dist/src/commands/sensors/coverage/evidence.js +19 -10
- package/dist/src/commands/sensors/coverage/index.js +11 -2
- package/dist/src/commands/sensors/coverage/resolve.js +10 -0
- package/dist/src/commands/sensors/exec.js +16 -1
- package/dist/src/commands/sensors/migrate.js +62 -2
- package/dist/src/commands/sensors/prepare.js +2 -0
- package/dist/src/commands/sensors/result.js +2 -0
- package/dist/src/commands/sensors/run.js +64 -1
- package/dist/src/commands/sensors/status.js +6 -4
- package/dist/src/commands/watch/archive-unused.js +138 -0
- package/dist/src/commands/watch/generations.js +32 -9
- package/dist/src/commands/watch/index.js +108 -2
- package/dist/src/commands/watch/init.js +149 -18
- package/dist/src/commands/watch/supervisor.js +167 -13
- package/dist/src/commands/watch/teardown-driver.js +13 -13
- package/dist/src/commands/watch/track-state.js +59 -0
- package/dist/src/commands/watch/tracks.js +38 -102
- package/dist/src/core/admission/index.js +181 -0
- package/dist/src/core/admission/registry-contracts.js +290 -0
- package/dist/src/core/journal/fingerprint.js +35 -1
- package/dist/src/core/journal/paths.js +11 -0
- package/dist/src/core/journal/store.js +146 -4
- package/dist/src/core/journal/types.js +35 -1
- package/dist/src/core/migration/historical-provenance.js +18 -0
- package/dist/src/core/migration/index.js +322 -0
- package/dist/src/core/plan/identity.js +75 -0
- package/dist/src/core/plan/validate.js +178 -64
- package/dist/tests/commands/job/exec-wrapper.test.js +16 -0
- package/dist/tests/commands/job/gate-reconcile.test.js +24 -10
- package/dist/tests/commands/pin.test.js +23 -23
- package/dist/tests/commands/plan/index.test.js +630 -14
- package/dist/tests/commands/sensors/bootstrap.test.js +57 -4
- package/dist/tests/commands/sensors/compatibility/contract.test.js +21 -0
- package/dist/tests/commands/sensors/compatibility/discovery.test.js +19 -0
- package/dist/tests/commands/sensors/compatibility/probe.test.js +14 -1
- package/dist/tests/commands/sensors/compatibility/resolve.test.js +17 -0
- package/dist/tests/commands/sensors/coverage/evidence.test.js +51 -27
- package/dist/tests/commands/sensors/coverage/resolve.test.js +51 -0
- package/dist/tests/commands/sensors/exec.test.js +112 -0
- package/dist/tests/commands/sensors/run-changed.test.js +11 -0
- package/dist/tests/commands/sensors/run.test.js +15 -2
- package/dist/tests/commands/sensors/status.test.js +3 -3
- package/dist/tests/commands/watch/e2e-crash.test.js +126 -11
- package/dist/tests/commands/watch/generations.test.js +113 -4
- package/dist/tests/commands/watch/plan-lifecycle.test.js +263 -0
- package/dist/tests/commands/watch/supervisor-loop.test.js +247 -49
- package/dist/tests/commands/watch/track-finalize.test.js +20 -3
- package/dist/tests/commands/watch/track-freeze.test.js +43 -30
- package/dist/tests/commands/watch/track-state-dependency.test.js +15 -0
- package/dist/tests/commands/watch/watch-init.test.js +244 -0
- package/dist/tests/core/admission/index.test.js +87 -0
- package/dist/tests/core/journal/fingerprint.test.js +22 -0
- package/dist/tests/core/journal/store.test.js +53 -0
- package/dist/tests/core/journal/types.test.js +7 -0
- package/dist/tests/core/migration/facts.test.js +289 -0
- package/dist/tests/core/migration/historical-provenance.test.js +25 -0
- package/dist/tests/core/plan/validate.test.js +320 -6
- package/dist/tests/integration/pack-e2e.test.js +4 -1
- package/dist/tests/integration/preflight-json-pipe.e2e.test.js +7 -3
- package/dist/tests/integration/sensor-bootstrap.e2e.test.js +37 -0
- package/dist/tests/integration/sensor-structured-run.e2e.test.js +12 -10
- package/dist/tests/providers/injection-config.test.js +14 -6
- package/dist/tests/structural/jest-environment-is-isolated.test.js +29 -24
- package/dist/tests/structural/native-release-artifacts.test.js +16 -0
- package/package.json +2 -2
- package/prebuilds/darwin-arm64/secure_fs.node +0 -0
- package/prebuilds/darwin-x64/secure_fs.node +0 -0
- package/prebuilds/win32-arm64/secure_fs.node +0 -0
- package/prebuilds/win32-x64/secure_fs.node +0 -0
|
@@ -21,7 +21,7 @@ const protocol_1 = require("../../core/tracks/protocol");
|
|
|
21
21
|
const git_1 = require("../../core/tracks/git");
|
|
22
22
|
const teardown_1 = require("../../core/tracks/teardown");
|
|
23
23
|
const store_1 = require("../../core/journal/store");
|
|
24
|
-
const
|
|
24
|
+
const track_state_1 = require("./track-state");
|
|
25
25
|
/** Task 13 (R4.2/R4.3/R4.6/R4.10/C2/C9): gathering READ-ONLY del estado real
|
|
26
26
|
* de UN track en teardown — jamás cuenta como el side effect del tick
|
|
27
27
|
* (mismo criterio que `ownedWorktreeExists`/`foreignPathExists` en
|
|
@@ -94,7 +94,7 @@ function gatherTeardownObservation(planRoot, s, ref) {
|
|
|
94
94
|
* haya funcionado, la relectura es la única fuente de verdad). */
|
|
95
95
|
async function runBeginTeardown(planRoot, branch, s, protocol, effect, runtime) {
|
|
96
96
|
const trackId = effect.trackId;
|
|
97
|
-
const ref = (0,
|
|
97
|
+
const ref = (0, track_state_1.refOf)(s, trackId);
|
|
98
98
|
const observed = gatherTeardownObservation(planRoot, s, ref);
|
|
99
99
|
const decision = (0, protocol_1.decideTeardown)(protocol.tracks[trackId], observed);
|
|
100
100
|
if (decision === 'persist-intent') {
|
|
@@ -104,16 +104,16 @@ async function runBeginTeardown(planRoot, branch, s, protocol, effect, runtime)
|
|
|
104
104
|
// dato del journal, no del protocolo puro, así que se aplica con
|
|
105
105
|
// `withRef` en la MISMA persistencia (una sola frontera, no dos).
|
|
106
106
|
const applied = (0, protocol_1.observeProtocolEffect)(protocol, effect, { kind: 'effect-applied', effect });
|
|
107
|
-
const withIntent = (0,
|
|
107
|
+
const withIntent = (0, track_state_1.withRef)((0, track_state_1.applyProtocolToState)(s, applied), trackId, {
|
|
108
108
|
teardownIntent: { worktreePath: ref.worktreePath, branch: ref.branch, supervisorNonce: ref.supervisorProcessRef?.spawnNonce },
|
|
109
109
|
});
|
|
110
|
-
const next = (0,
|
|
110
|
+
const next = (0, track_state_1.persist)(planRoot, branch, withIntent);
|
|
111
111
|
(0, store_1.appendEvent)(planRoot, branch, { kind: 'track-teardown-step', trackId, step: 'TEARDOWN_INTENT' });
|
|
112
112
|
return { state: next, stop: true, executed: effect.kind };
|
|
113
113
|
}
|
|
114
114
|
if (decision === 'block-foreign') {
|
|
115
115
|
const blocked = (0, protocol_1.observeProtocolEffect)(protocol, effect, { kind: 'teardown-observation', trackId, ...observed });
|
|
116
|
-
const next = (0,
|
|
116
|
+
const next = (0, track_state_1.persist)(planRoot, branch, (0, track_state_1.applyProtocolToState)(s, blocked));
|
|
117
117
|
(0, store_1.appendEvent)(planRoot, branch, {
|
|
118
118
|
kind: 'track-blocked', trackId,
|
|
119
119
|
reason: observed.foreignSupervisor ? 'identidad de supervisor ajena' : 'worktree preexistente ajeno',
|
|
@@ -125,8 +125,8 @@ async function runBeginTeardown(planRoot, branch, s, protocol, effect, runtime)
|
|
|
125
125
|
// `runtime` este tick (mismo criterio que 'accept-worktree' en
|
|
126
126
|
// `runCreateWorktree`).
|
|
127
127
|
const applied = (0, protocol_1.observeProtocolEffect)(protocol, effect, { kind: 'teardown-observation', trackId, ...observed });
|
|
128
|
-
const next = (0,
|
|
129
|
-
(0, store_1.appendEvent)(planRoot, branch, { kind: 'track-teardown-step', trackId, step: (0,
|
|
128
|
+
const next = (0, track_state_1.persist)(planRoot, branch, (0, track_state_1.applyProtocolToState)(s, applied));
|
|
129
|
+
(0, store_1.appendEvent)(planRoot, branch, { kind: 'track-teardown-step', trackId, step: (0, track_state_1.refOf)(next, trackId).phase });
|
|
130
130
|
return { state: next, stop: true, executed: effect.kind };
|
|
131
131
|
}
|
|
132
132
|
if (decision === 'stop-own-supervisor') {
|
|
@@ -135,7 +135,7 @@ async function runBeginTeardown(planRoot, branch, s, protocol, effect, runtime)
|
|
|
135
135
|
const confirmed = await runtime.stopOwnSupervisor(ref);
|
|
136
136
|
const after = { ownSupervisorAlive: !confirmed };
|
|
137
137
|
const applied = (0, protocol_1.observeProtocolEffect)(protocol, effect, { kind: 'teardown-observation', trackId, ...after });
|
|
138
|
-
const next = (0,
|
|
138
|
+
const next = (0, track_state_1.persist)(planRoot, branch, (0, track_state_1.applyProtocolToState)(s, applied));
|
|
139
139
|
(0, store_1.appendEvent)(planRoot, branch, { kind: 'track-teardown-step', trackId, step: confirmed ? 'SUPERVISOR_STOPPED' : 'TEARDOWN_INTENT' });
|
|
140
140
|
return { state: next, stop: true, executed: effect.kind };
|
|
141
141
|
}
|
|
@@ -149,12 +149,12 @@ async function runBeginTeardown(planRoot, branch, s, protocol, effect, runtime)
|
|
|
149
149
|
}
|
|
150
150
|
catch (error) {
|
|
151
151
|
const failed = (0, protocol_1.observeProtocolEffect)(protocol, effect, { kind: 'effect-failed', trackId, effect: effect.kind, detail: error.message });
|
|
152
|
-
const next = (0,
|
|
152
|
+
const next = (0, track_state_1.persist)(planRoot, branch, (0, track_state_1.applyProtocolToState)(s, failed));
|
|
153
153
|
(0, store_1.appendEvent)(planRoot, branch, { kind: 'track-effect-failed', trackId, effect: effect.kind, detail: error.message });
|
|
154
154
|
return { state: next, stop: true, executed: effect.kind };
|
|
155
155
|
}
|
|
156
156
|
const applied = (0, protocol_1.observeProtocolEffect)(protocol, effect, { kind: 'teardown-observation', trackId, ownedWorktreeExists: false });
|
|
157
|
-
const next = (0,
|
|
157
|
+
const next = (0, track_state_1.persist)(planRoot, branch, (0, track_state_1.applyProtocolToState)(s, applied));
|
|
158
158
|
(0, store_1.appendEvent)(planRoot, branch, { kind: 'track-teardown-step', trackId, step: 'WORKTREE_REMOVED' });
|
|
159
159
|
return { state: next, stop: true, executed: effect.kind };
|
|
160
160
|
}
|
|
@@ -168,7 +168,7 @@ async function runBeginTeardown(planRoot, branch, s, protocol, effect, runtime)
|
|
|
168
168
|
// próximo tick, ya en esa fase, decide la branch de nuevo con una
|
|
169
169
|
// observación fresca.
|
|
170
170
|
const applied = (0, protocol_1.observeProtocolEffect)(protocol, effect, { kind: 'teardown-observation', trackId, ownedWorktreeExists: false });
|
|
171
|
-
const next = (0,
|
|
171
|
+
const next = (0, track_state_1.persist)(planRoot, branch, (0, track_state_1.applyProtocolToState)(s, applied));
|
|
172
172
|
(0, store_1.appendEvent)(planRoot, branch, { kind: 'track-teardown-step', trackId, step: 'WORKTREE_REMOVED' });
|
|
173
173
|
return { state: next, stop: true, executed: effect.kind };
|
|
174
174
|
}
|
|
@@ -178,12 +178,12 @@ async function runBeginTeardown(planRoot, branch, s, protocol, effect, runtime)
|
|
|
178
178
|
}
|
|
179
179
|
catch (error) {
|
|
180
180
|
const failed = (0, protocol_1.observeProtocolEffect)(protocol, effect, { kind: 'effect-failed', trackId, effect: effect.kind, detail: error.message });
|
|
181
|
-
const next = (0,
|
|
181
|
+
const next = (0, track_state_1.persist)(planRoot, branch, (0, track_state_1.applyProtocolToState)(s, failed));
|
|
182
182
|
(0, store_1.appendEvent)(planRoot, branch, { kind: 'track-effect-failed', trackId, effect: effect.kind, detail: error.message });
|
|
183
183
|
return { state: next, stop: true, executed: effect.kind };
|
|
184
184
|
}
|
|
185
185
|
const applied = (0, protocol_1.observeProtocolEffect)(protocol, effect, { kind: 'teardown-observation', trackId, ownedBranchExists: false });
|
|
186
|
-
const next = (0,
|
|
186
|
+
const next = (0, track_state_1.persist)(planRoot, branch, (0, track_state_1.applyProtocolToState)(s, applied));
|
|
187
187
|
(0, store_1.appendEvent)(planRoot, branch, { kind: 'track-teardown-step', trackId, step: 'BRANCH_REMOVED' });
|
|
188
188
|
return { state: next, stop: true, executed: effect.kind };
|
|
189
189
|
}
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.applyProtocolToState = applyProtocolToState;
|
|
4
|
+
exports.persist = persist;
|
|
5
|
+
exports.refOf = refOf;
|
|
6
|
+
exports.withRef = withRef;
|
|
7
|
+
const store_1 = require("../../core/journal/store");
|
|
8
|
+
const types_1 = require("../../core/tracks/types");
|
|
9
|
+
function applyProtocolToState(state, protocol) {
|
|
10
|
+
const next = structuredClone(state);
|
|
11
|
+
next.cohortPhase = protocol.cohortPhase;
|
|
12
|
+
if (protocol.planHeadSha !== undefined)
|
|
13
|
+
next.cohortPlanHeadSha = protocol.planHeadSha;
|
|
14
|
+
if (protocol.cohortPhase === 'FALLBACK_PENDING') {
|
|
15
|
+
next.globalQaHeadSha = undefined;
|
|
16
|
+
next.finalIntegrationJobId = undefined;
|
|
17
|
+
next.qaFinalizeRequested = undefined;
|
|
18
|
+
}
|
|
19
|
+
else {
|
|
20
|
+
if (protocol.globalQaHeadSha !== undefined)
|
|
21
|
+
next.globalQaHeadSha = protocol.globalQaHeadSha;
|
|
22
|
+
if (protocol.finalIntegrationJobId !== undefined)
|
|
23
|
+
next.finalIntegrationJobId = protocol.finalIntegrationJobId;
|
|
24
|
+
}
|
|
25
|
+
if (protocol.fallbackReason !== undefined)
|
|
26
|
+
next.cohortFallbackReason = protocol.fallbackReason;
|
|
27
|
+
next.tracks = (next.tracks ?? []).map((ref) => {
|
|
28
|
+
const track = protocol.tracks[ref.trackId];
|
|
29
|
+
if (track === undefined)
|
|
30
|
+
return ref;
|
|
31
|
+
return {
|
|
32
|
+
...ref,
|
|
33
|
+
phase: track.phase,
|
|
34
|
+
frozenHeadSha: track.frozenHeadSha,
|
|
35
|
+
blockedReason: track.blockedReason,
|
|
36
|
+
joinedCommitSha: track.joinedCommitSha,
|
|
37
|
+
joinIntent: track.expectedPlanHeadSha !== undefined && track.expectedTrackHeadSha !== undefined
|
|
38
|
+
? { expectedPlanHeadSha: track.expectedPlanHeadSha, expectedTrackHeadSha: track.expectedTrackHeadSha, strategy: types_1.JOIN_STRATEGY_NO_FF }
|
|
39
|
+
: ref.joinIntent,
|
|
40
|
+
};
|
|
41
|
+
});
|
|
42
|
+
return next;
|
|
43
|
+
}
|
|
44
|
+
function persist(planRoot, branch, state) {
|
|
45
|
+
(0, store_1.writeJournal)(planRoot, branch, state);
|
|
46
|
+
const result = (0, store_1.readJournal)(planRoot, branch);
|
|
47
|
+
if (result.corrupt || result.state === null)
|
|
48
|
+
throw new Error('journal corrupto tras persistir tracks (R1.6)');
|
|
49
|
+
return result.state;
|
|
50
|
+
}
|
|
51
|
+
function refOf(state, trackId) {
|
|
52
|
+
const ref = state.tracks?.find((track) => track.trackId === trackId);
|
|
53
|
+
if (ref === undefined)
|
|
54
|
+
throw new Error(`invariante rota: TrackRef ausente para ${trackId}`);
|
|
55
|
+
return ref;
|
|
56
|
+
}
|
|
57
|
+
function withRef(state, trackId, patch) {
|
|
58
|
+
return { ...state, tracks: (state.tracks ?? []).map((track) => (track.trackId === trackId ? { ...track, ...patch } : track)) };
|
|
59
|
+
}
|
|
@@ -3,11 +3,8 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
3
3
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
4
|
};
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.withRef = exports.refOf = exports.persist = exports.applyProtocolToState = void 0;
|
|
6
7
|
exports.canCompleteCohort = canCompleteCohort;
|
|
7
|
-
exports.applyProtocolToState = applyProtocolToState;
|
|
8
|
-
exports.persist = persist;
|
|
9
|
-
exports.refOf = refOf;
|
|
10
|
-
exports.withRef = withRef;
|
|
11
8
|
exports.reconcileTracks = reconcileTracks;
|
|
12
9
|
exports.reconcileOpenJoin = reconcileOpenJoin;
|
|
13
10
|
exports.observeSupervisorFromDisk = observeSupervisorFromDisk;
|
|
@@ -34,6 +31,12 @@ const ownership_1 = require("../../core/tracks/ownership");
|
|
|
34
31
|
const descriptor_1 = require("../../core/tracks/descriptor");
|
|
35
32
|
const join_1 = require("../../core/tracks/join");
|
|
36
33
|
const teardown_driver_1 = require("./teardown-driver");
|
|
34
|
+
const track_state_1 = require("./track-state");
|
|
35
|
+
var track_state_2 = require("./track-state");
|
|
36
|
+
Object.defineProperty(exports, "applyProtocolToState", { enumerable: true, get: function () { return track_state_2.applyProtocolToState; } });
|
|
37
|
+
Object.defineProperty(exports, "persist", { enumerable: true, get: function () { return track_state_2.persist; } });
|
|
38
|
+
Object.defineProperty(exports, "refOf", { enumerable: true, get: function () { return track_state_2.refOf; } });
|
|
39
|
+
Object.defineProperty(exports, "withRef", { enumerable: true, get: function () { return track_state_2.withRef; } });
|
|
37
40
|
const request_1 = require("../job/request");
|
|
38
41
|
const gate_1 = require("../job/gate");
|
|
39
42
|
const process_2 = require("../../core/journal/process");
|
|
@@ -119,73 +122,6 @@ function toProtocol(state, maxParallel) {
|
|
|
119
122
|
fallbackReason: state.cohortFallbackReason,
|
|
120
123
|
};
|
|
121
124
|
}
|
|
122
|
-
/** Vuelca las decisiones de `protocol.ts` de regreso al `TrackRef[]` real —
|
|
123
|
-
* nunca al revés: esta función jamás decide, solo transcribe. Exportada
|
|
124
|
-
* (junto con `persist`/`refOf`/`withRef`/`EffectRunResult` más abajo) para
|
|
125
|
-
* que `./teardown-driver` — que ejecuta el mismo patrón "gather -> decide ->
|
|
126
|
-
* tocar el mundo real como mucho una vez -> persistir -> stop" que todo
|
|
127
|
-
* `run*` de este archivo — reutilice estos helpers sin duplicarlos. */
|
|
128
|
-
function applyProtocolToState(state, protocol) {
|
|
129
|
-
const next = structuredClone(state);
|
|
130
|
-
next.cohortPhase = protocol.cohortPhase;
|
|
131
|
-
// R6.2/R6.3/C7 (Task 11): persistir el HEAD del plan avanzado por
|
|
132
|
-
// `reconcileProtocol`'s `accept-merge` (`out.planHeadSha = decision.
|
|
133
|
-
// joinedCommitSha`) — sin esto, el siguiente `toProtocol` volvería a leer
|
|
134
|
-
// `cohortBaseSha` (stale) y el segundo join de la cohorte usaría un
|
|
135
|
-
// `expectedPlanHeadSha` incorrecto.
|
|
136
|
-
if (protocol.planHeadSha !== undefined)
|
|
137
|
-
next.cohortPlanHeadSha = protocol.planHeadSha;
|
|
138
|
-
// R7/C3 (Task 12): los valores finales normalmente solo avanzan, salvo
|
|
139
|
-
// que fallback abandone explícitamente esa ruta. En ese caso el reducer
|
|
140
|
-
// ya invalidó su evidencia y el mirror durable DEBE borrarla también;
|
|
141
|
-
// conservarla permitiría que un restart reconstruyera un protocolo que
|
|
142
|
-
// contradice los tracks en teardown.
|
|
143
|
-
if (protocol.cohortPhase === 'FALLBACK_PENDING') {
|
|
144
|
-
next.globalQaHeadSha = undefined;
|
|
145
|
-
next.finalIntegrationJobId = undefined;
|
|
146
|
-
next.qaFinalizeRequested = undefined;
|
|
147
|
-
}
|
|
148
|
-
else {
|
|
149
|
-
if (protocol.globalQaHeadSha !== undefined)
|
|
150
|
-
next.globalQaHeadSha = protocol.globalQaHeadSha;
|
|
151
|
-
if (protocol.finalIntegrationJobId !== undefined)
|
|
152
|
-
next.finalIntegrationJobId = protocol.finalIntegrationJobId;
|
|
153
|
-
}
|
|
154
|
-
if (protocol.fallbackReason !== undefined)
|
|
155
|
-
next.cohortFallbackReason = protocol.fallbackReason;
|
|
156
|
-
next.tracks = (next.tracks ?? []).map((ref) => {
|
|
157
|
-
const t = protocol.tracks[ref.trackId];
|
|
158
|
-
if (t === undefined)
|
|
159
|
-
return ref;
|
|
160
|
-
return {
|
|
161
|
-
...ref,
|
|
162
|
-
phase: t.phase,
|
|
163
|
-
frozenHeadSha: t.frozenHeadSha,
|
|
164
|
-
blockedReason: t.blockedReason,
|
|
165
|
-
joinedCommitSha: t.joinedCommitSha,
|
|
166
|
-
joinIntent: t.expectedPlanHeadSha !== undefined && t.expectedTrackHeadSha !== undefined
|
|
167
|
-
? { expectedPlanHeadSha: t.expectedPlanHeadSha, expectedTrackHeadSha: t.expectedTrackHeadSha, strategy: types_1.JOIN_STRATEGY_NO_FF }
|
|
168
|
-
: ref.joinIntent,
|
|
169
|
-
};
|
|
170
|
-
});
|
|
171
|
-
return next;
|
|
172
|
-
}
|
|
173
|
-
function persist(planRoot, branch, s) {
|
|
174
|
-
(0, store_1.writeJournal)(planRoot, branch, s);
|
|
175
|
-
const r = (0, store_1.readJournal)(planRoot, branch);
|
|
176
|
-
if (r.corrupt || r.state === null)
|
|
177
|
-
throw new Error('journal corrupto tras persistir tracks (R1.6)');
|
|
178
|
-
return r.state;
|
|
179
|
-
}
|
|
180
|
-
function refOf(s, trackId) {
|
|
181
|
-
const ref = s.tracks?.find((t) => t.trackId === trackId);
|
|
182
|
-
if (ref === undefined)
|
|
183
|
-
throw new Error(`invariante rota: TrackRef ausente para ${trackId}`);
|
|
184
|
-
return ref;
|
|
185
|
-
}
|
|
186
|
-
function withRef(s, trackId, patch) {
|
|
187
|
-
return { ...s, tracks: (s.tracks ?? []).map((t) => (t.trackId === trackId ? { ...t, ...patch } : t)) };
|
|
188
|
-
}
|
|
189
125
|
function mustBaseSha(s) {
|
|
190
126
|
if (s.cohortBaseSha === undefined)
|
|
191
127
|
throw new Error('invariante rota: cohortBaseSha ausente para una cohorte en PREPARING/ACTIVE');
|
|
@@ -193,7 +129,7 @@ function mustBaseSha(s) {
|
|
|
193
129
|
}
|
|
194
130
|
function runCreateWorktree(planRoot, branch, s, protocol, effect, runtime) {
|
|
195
131
|
const trackId = effect.trackId;
|
|
196
|
-
const ref = refOf(s, trackId);
|
|
132
|
+
const ref = (0, track_state_1.refOf)(s, trackId);
|
|
197
133
|
// Task 9 (R4.2/R4.6/C11): observaciones read-only del mundo real ANTES de
|
|
198
134
|
// tocar `runtime` — ninguna de las dos cuenta como el side effect del
|
|
199
135
|
// tick, igual que documentaba la versión anterior de este comentario.
|
|
@@ -209,13 +145,13 @@ function runCreateWorktree(planRoot, branch, s, protocol, effect, runtime) {
|
|
|
209
145
|
const decision = (0, protocol_1.decidePrepare)(protocol.tracks[trackId], observed);
|
|
210
146
|
if (decision === 'accept-worktree') {
|
|
211
147
|
const applied = (0, protocol_1.observeProtocolEffect)(protocol, effect, { kind: 'worktree-observed', trackId, owned: true });
|
|
212
|
-
const next = persist(planRoot, branch, applyProtocolToState(s, applied));
|
|
148
|
+
const next = (0, track_state_1.persist)(planRoot, branch, (0, track_state_1.applyProtocolToState)(s, applied));
|
|
213
149
|
(0, store_1.appendEvent)(planRoot, branch, { kind: 'track-effect', trackId, effect: effect.kind });
|
|
214
150
|
return { state: next, stop: true, executed: effect.kind };
|
|
215
151
|
}
|
|
216
152
|
if (decision === 'block-foreign') {
|
|
217
153
|
const blocked = (0, protocol_1.observeProtocolEffect)(protocol, effect, { kind: 'worktree-observed', trackId, owned: false });
|
|
218
|
-
const next = persist(planRoot, branch, applyProtocolToState(s, blocked));
|
|
154
|
+
const next = (0, track_state_1.persist)(planRoot, branch, (0, track_state_1.applyProtocolToState)(s, blocked));
|
|
219
155
|
(0, store_1.appendEvent)(planRoot, branch, { kind: 'track-blocked', trackId, reason: 'worktree preexistente ajeno' });
|
|
220
156
|
// Post-review fix (Task 8): bloquear un track es en sí mismo UNA
|
|
221
157
|
// frontera — dejar `stop:false` acá permitía que el MISMO call
|
|
@@ -232,18 +168,18 @@ function runCreateWorktree(planRoot, branch, s, protocol, effect, runtime) {
|
|
|
232
168
|
}
|
|
233
169
|
catch (error) {
|
|
234
170
|
const failed = (0, protocol_1.observeProtocolEffect)(protocol, effect, { kind: 'effect-failed', trackId, effect: effect.kind, detail: error.message });
|
|
235
|
-
const next = persist(planRoot, branch, applyProtocolToState(s, failed));
|
|
171
|
+
const next = (0, track_state_1.persist)(planRoot, branch, (0, track_state_1.applyProtocolToState)(s, failed));
|
|
236
172
|
(0, store_1.appendEvent)(planRoot, branch, { kind: 'track-effect-failed', trackId, effect: effect.kind, detail: error.message });
|
|
237
173
|
return { state: next, stop: true, executed: effect.kind };
|
|
238
174
|
}
|
|
239
175
|
const applied = (0, protocol_1.observeProtocolEffect)(protocol, effect, { kind: 'worktree-observed', trackId, owned: true });
|
|
240
|
-
const next = persist(planRoot, branch, applyProtocolToState(s, applied));
|
|
176
|
+
const next = (0, track_state_1.persist)(planRoot, branch, (0, track_state_1.applyProtocolToState)(s, applied));
|
|
241
177
|
(0, store_1.appendEvent)(planRoot, branch, { kind: 'track-effect', trackId, effect: effect.kind });
|
|
242
178
|
return { state: next, stop: true, executed: effect.kind };
|
|
243
179
|
}
|
|
244
180
|
function runCreateTrackJournal(planRoot, branch, s, protocol, effect, runtime) {
|
|
245
181
|
const trackId = effect.trackId;
|
|
246
|
-
const ref = refOf(s, trackId);
|
|
182
|
+
const ref = (0, track_state_1.refOf)(s, trackId);
|
|
247
183
|
// GAP CONOCIDO Y DELIBERADAMENTE DIFERIDO (ver el comentario largo en
|
|
248
184
|
// `apply.ts` junto a `track-prepare-request`): `taskIds`/`planDigest`
|
|
249
185
|
// deberían nacer del plan .md parseado, pero NINGÚN task (1-8) provee un
|
|
@@ -270,12 +206,12 @@ function runCreateTrackJournal(planRoot, branch, s, protocol, effect, runtime) {
|
|
|
270
206
|
}
|
|
271
207
|
catch (error) {
|
|
272
208
|
const failed = (0, protocol_1.observeProtocolEffect)(protocol, effect, { kind: 'effect-failed', trackId, effect: effect.kind, detail: error.message });
|
|
273
|
-
const next = persist(planRoot, branch, applyProtocolToState(s, failed));
|
|
209
|
+
const next = (0, track_state_1.persist)(planRoot, branch, (0, track_state_1.applyProtocolToState)(s, failed));
|
|
274
210
|
(0, store_1.appendEvent)(planRoot, branch, { kind: 'track-effect-failed', trackId, effect: effect.kind, detail: error.message });
|
|
275
211
|
return { state: next, stop: true, executed: effect.kind };
|
|
276
212
|
}
|
|
277
213
|
const applied = (0, protocol_1.observeProtocolEffect)(protocol, effect, { kind: 'effect-applied', effect });
|
|
278
|
-
const next = persist(planRoot, branch, applyProtocolToState(s, applied));
|
|
214
|
+
const next = (0, track_state_1.persist)(planRoot, branch, (0, track_state_1.applyProtocolToState)(s, applied));
|
|
279
215
|
(0, store_1.appendEvent)(planRoot, branch, { kind: 'track-effect', trackId, effect: effect.kind });
|
|
280
216
|
return { state: next, stop: true, executed: effect.kind };
|
|
281
217
|
}
|
|
@@ -300,7 +236,7 @@ function runCreateTrackJournal(planRoot, branch, s, protocol, effect, runtime) {
|
|
|
300
236
|
* `Supervisor.tick()` del track, en su journal, en su propio proceso). */
|
|
301
237
|
function runFreezeTrack(planRoot, branch, s, protocol, effect, runtime) {
|
|
302
238
|
const trackId = effect.trackId;
|
|
303
|
-
const ref = refOf(s, trackId);
|
|
239
|
+
const ref = (0, track_state_1.refOf)(s, trackId);
|
|
304
240
|
const r = (0, store_1.readJournal)(ref.worktreePath, ref.branch);
|
|
305
241
|
if (r.corrupt || r.state === null) {
|
|
306
242
|
// Journal del track todavía no legible (crash entre `create-track-
|
|
@@ -331,7 +267,7 @@ function runFreezeTrack(planRoot, branch, s, protocol, effect, runtime) {
|
|
|
331
267
|
const observed = (0, protocol_1.observeProtocolEffect)(protocol, effect, {
|
|
332
268
|
kind: 'freeze-observation', trackId, frozenHeadSha: trackState.frozen.headSha,
|
|
333
269
|
});
|
|
334
|
-
let next = applyProtocolToState(s, observed);
|
|
270
|
+
let next = (0, track_state_1.applyProtocolToState)(s, observed);
|
|
335
271
|
// R5.7/R5.8/R5.9/C5 (Step 6): ownership REAL post-hoc, desde commits
|
|
336
272
|
// YA congelados — nunca `git status` para esto (esa es la
|
|
337
273
|
// herramienta de limpieza, no de ownership). `ref.ownership` es el
|
|
@@ -361,7 +297,7 @@ function runFreezeTrack(planRoot, branch, s, protocol, effect, runtime) {
|
|
|
361
297
|
cohortParallelInvalidatedBy: [...new Set([...(next.cohortParallelInvalidatedBy ?? []), ...marks])],
|
|
362
298
|
};
|
|
363
299
|
}
|
|
364
|
-
const persisted = persist(planRoot, branch, next);
|
|
300
|
+
const persisted = (0, track_state_1.persist)(planRoot, branch, next);
|
|
365
301
|
(0, store_1.appendEvent)(planRoot, branch, { kind: 'track-frozen-observed', trackId, frozenHeadSha: trackState.frozen.headSha });
|
|
366
302
|
if (actual.outsideOwnership.length > 0) {
|
|
367
303
|
(0, store_1.appendEvent)(planRoot, branch, { kind: 'track-ownership-violation', trackId, paths: actual.outsideOwnership });
|
|
@@ -490,7 +426,7 @@ async function runMergeTrack(planRoot, branch, s, protocol, effect, runtime) {
|
|
|
490
426
|
}
|
|
491
427
|
const after = gatherJoinObservation(planRoot, intent.expectedTrackHeadSha);
|
|
492
428
|
const observed = (0, protocol_1.observeProtocolEffect)(protocol, effect, { kind: 'join-observation', trackId, ...after });
|
|
493
|
-
const next = persist(planRoot, branch, applyProtocolToState(s, observed));
|
|
429
|
+
const next = (0, track_state_1.persist)(planRoot, branch, (0, track_state_1.applyProtocolToState)(s, observed));
|
|
494
430
|
(0, store_1.appendEvent)(planRoot, branch, { kind: 'track-merge-attempted', trackId, detail });
|
|
495
431
|
return { state: next, stop: true, executed: effect.kind };
|
|
496
432
|
}
|
|
@@ -508,7 +444,7 @@ async function runMergeTrack(planRoot, branch, s, protocol, effect, runtime) {
|
|
|
508
444
|
}
|
|
509
445
|
const after = gatherJoinObservation(planRoot, intent.expectedTrackHeadSha);
|
|
510
446
|
const observed = (0, protocol_1.observeProtocolEffect)(protocol, effect, { kind: 'join-observation', trackId, ...after });
|
|
511
|
-
const next = persist(planRoot, branch, applyProtocolToState(s, observed));
|
|
447
|
+
const next = (0, track_state_1.persist)(planRoot, branch, (0, track_state_1.applyProtocolToState)(s, observed));
|
|
512
448
|
(0, store_1.appendEvent)(planRoot, branch, { kind: 'track-merge-aborted', trackId, detail });
|
|
513
449
|
return { state: next, stop: true, executed: effect.kind };
|
|
514
450
|
}
|
|
@@ -516,7 +452,7 @@ async function runMergeTrack(planRoot, branch, s, protocol, effect, runtime) {
|
|
|
516
452
|
// ningún efecto git nuevo que ejecutar este tick (mismo criterio que
|
|
517
453
|
// `runCreateWorktree`'s ramas 'accept-worktree'/'block-foreign').
|
|
518
454
|
const observed = (0, protocol_1.observeProtocolEffect)(protocol, effect, { kind: 'join-observation', trackId, ...before });
|
|
519
|
-
const next = persist(planRoot, branch, applyProtocolToState(s, observed));
|
|
455
|
+
const next = (0, track_state_1.persist)(planRoot, branch, (0, track_state_1.applyProtocolToState)(s, observed));
|
|
520
456
|
(0, store_1.appendEvent)(planRoot, branch, {
|
|
521
457
|
kind: decision.action === 'accept-merge' ? 'track-merged' : 'track-blocked',
|
|
522
458
|
trackId, ...(decision.action === 'block' ? { reason: decision.reason } : {}),
|
|
@@ -555,7 +491,7 @@ function runRequestGlobalQa(planRoot, branch, s, protocol, effect) {
|
|
|
555
491
|
}
|
|
556
492
|
if (actualHead === reported.headSha && clean) {
|
|
557
493
|
const observed = (0, protocol_1.observeProtocolEffect)(protocol, effect, { kind: 'global-qa-pass', headSha: actualHead, clean: true });
|
|
558
|
-
const next = persist(planRoot, branch, applyProtocolToState(s, observed));
|
|
494
|
+
const next = (0, track_state_1.persist)(planRoot, branch, (0, track_state_1.applyProtocolToState)(s, observed));
|
|
559
495
|
(0, store_1.appendEvent)(planRoot, branch, { kind: 'global-qa-passed', headSha: actualHead });
|
|
560
496
|
return { state: next, stop: true, executed: effect.kind };
|
|
561
497
|
}
|
|
@@ -573,7 +509,7 @@ function runRequestGlobalQa(planRoot, branch, s, protocol, effect) {
|
|
|
573
509
|
nextAction: { actionId: 'finalize-global-qa', type: 'run-global-qa', target: 'cycle', preconditions: [], attempt: 0, state: 'pending' },
|
|
574
510
|
},
|
|
575
511
|
};
|
|
576
|
-
const persisted = persist(planRoot, branch, next);
|
|
512
|
+
const persisted = (0, track_state_1.persist)(planRoot, branch, next);
|
|
577
513
|
(0, store_1.appendEvent)(planRoot, branch, { kind: 'global-qa-requested' });
|
|
578
514
|
return { state: persisted, stop: true, executed: effect.kind };
|
|
579
515
|
}
|
|
@@ -601,7 +537,7 @@ async function runRequestFinalIntegration(planRoot, branch, s, protocol, effect,
|
|
|
601
537
|
return { state: s, stop: true, executed: null };
|
|
602
538
|
}
|
|
603
539
|
const observed = (0, protocol_1.observeProtocolEffect)(protocol, effect, { kind: 'integration-pass', jobId: existing.id, headSha: headNow });
|
|
604
|
-
const next = persist(planRoot, branch, applyProtocolToState(s, observed));
|
|
540
|
+
const next = (0, track_state_1.persist)(planRoot, branch, (0, track_state_1.applyProtocolToState)(s, observed));
|
|
605
541
|
(0, store_1.appendEvent)(planRoot, branch, { kind: 'track-integration-passed', jobId: existing.id });
|
|
606
542
|
return { state: next, stop: true, executed: effect.kind };
|
|
607
543
|
}
|
|
@@ -659,7 +595,7 @@ function runRunFinalInterlock(planRoot, branch, s, protocol, effect, runtime) {
|
|
|
659
595
|
if (protocol.globalQaHeadSha === undefined)
|
|
660
596
|
throw new Error('invariante rota: globalQaHeadSha ausente en FINAL_INTERLOCK');
|
|
661
597
|
const observed = (0, protocol_1.observeProtocolEffect)(protocol, effect, { kind: 'interlock-pass', headSha: protocol.globalQaHeadSha });
|
|
662
|
-
const next = persist(planRoot, branch, applyProtocolToState(s, observed));
|
|
598
|
+
const next = (0, track_state_1.persist)(planRoot, branch, (0, track_state_1.applyProtocolToState)(s, observed));
|
|
663
599
|
runtime.releaseIntegrationLockIfHeld();
|
|
664
600
|
(0, store_1.appendEvent)(planRoot, branch, { kind: 'cohort-complete' });
|
|
665
601
|
return { state: next, stop: true, executed: effect.kind };
|
|
@@ -671,7 +607,7 @@ function defaultCliEntry() {
|
|
|
671
607
|
}
|
|
672
608
|
function runSpawnTrackSupervisor(planRoot, branch, s, protocol, effect, runtime) {
|
|
673
609
|
const trackId = effect.trackId;
|
|
674
|
-
const ref = refOf(s, trackId);
|
|
610
|
+
const ref = (0, track_state_1.refOf)(s, trackId);
|
|
675
611
|
if (ref.supervisorIntent === undefined) {
|
|
676
612
|
// R1.8/C11: el intent (nonce + argv + claimPath) se persiste ANTES de
|
|
677
613
|
// spawnear nada — si el supervisor del plan muere justo acá, el
|
|
@@ -688,7 +624,7 @@ function runSpawnTrackSupervisor(planRoot, branch, s, protocol, effect, runtime)
|
|
|
688
624
|
claimPath: path_1.default.join(ref.worktreePath, '.awm', 'supervisor.claim'),
|
|
689
625
|
};
|
|
690
626
|
const applied = (0, protocol_1.observeProtocolEffect)(protocol, effect, { kind: 'effect-applied', effect });
|
|
691
|
-
const next = persist(planRoot, branch, withRef(applyProtocolToState(s, applied), trackId, { supervisorIntent: intent }));
|
|
627
|
+
const next = (0, track_state_1.persist)(planRoot, branch, (0, track_state_1.withRef)((0, track_state_1.applyProtocolToState)(s, applied), trackId, { supervisorIntent: intent }));
|
|
692
628
|
(0, store_1.appendEvent)(planRoot, branch, { kind: 'track-supervisor-intent', trackId });
|
|
693
629
|
// Post-review fix: persistir el supervisorIntent es en sí mismo UNA
|
|
694
630
|
// frontera durable (R1.8/C11) — con `stop:false` el MISMO call podía
|
|
@@ -721,7 +657,7 @@ function runSpawnTrackSupervisor(planRoot, branch, s, protocol, effect, runtime)
|
|
|
721
657
|
const decision = (0, protocol_1.decidePrepare)(protocol.tracks[trackId], { supervisorArtifact: observation.kind });
|
|
722
658
|
if (decision === 'block-foreign') {
|
|
723
659
|
const blocked = (0, protocol_1.observeProtocolEffect)(protocol, effect, { kind: 'supervisor-observed', trackId, identity: 'other' });
|
|
724
|
-
const next = persist(planRoot, branch, applyProtocolToState(s, blocked));
|
|
660
|
+
const next = (0, track_state_1.persist)(planRoot, branch, (0, track_state_1.applyProtocolToState)(s, blocked));
|
|
725
661
|
(0, store_1.appendEvent)(planRoot, branch, { kind: 'track-blocked', trackId, reason: 'identidad de supervisor ajena' });
|
|
726
662
|
return { state: next, stop: true, executed: null };
|
|
727
663
|
}
|
|
@@ -733,7 +669,7 @@ function runSpawnTrackSupervisor(planRoot, branch, s, protocol, effect, runtime)
|
|
|
733
669
|
// mutante por invocación — igual patrón que
|
|
734
670
|
// `foreignPathExists` -> `addWorktree` en `runCreateWorktree`.
|
|
735
671
|
const pr = runtime.spawnSupervisor(ref);
|
|
736
|
-
const next = pr !== undefined ? persist(planRoot, branch, withRef(s, trackId, { supervisorProcessRef: pr })) : s;
|
|
672
|
+
const next = pr !== undefined ? (0, track_state_1.persist)(planRoot, branch, (0, track_state_1.withRef)(s, trackId, { supervisorProcessRef: pr })) : s;
|
|
737
673
|
(0, store_1.appendEvent)(planRoot, branch, { kind: 'track-effect', trackId, effect: effect.kind });
|
|
738
674
|
return { state: next, stop: true, executed: effect.kind };
|
|
739
675
|
}
|
|
@@ -755,7 +691,7 @@ function runSpawnTrackSupervisor(planRoot, branch, s, protocol, effect, runtime)
|
|
|
755
691
|
const observed = (0, protocol_1.observeProtocolEffect)(protocol, effect, {
|
|
756
692
|
kind: 'supervisor-observed', trackId, identity: 'expected', readinessNonce: observation.readinessNonce,
|
|
757
693
|
});
|
|
758
|
-
const next = persist(planRoot, branch, applyProtocolToState(s, observed));
|
|
694
|
+
const next = (0, track_state_1.persist)(planRoot, branch, (0, track_state_1.applyProtocolToState)(s, observed));
|
|
759
695
|
(0, store_1.appendEvent)(planRoot, branch, { kind: 'track-armed-or-blocked', trackId });
|
|
760
696
|
return { state: next, stop: true, executed: null };
|
|
761
697
|
}
|
|
@@ -839,7 +775,7 @@ async function reconcileTracks(planRoot, branch, state, runtime, maxParallel) {
|
|
|
839
775
|
for (const track of next.tracks ?? [])
|
|
840
776
|
if (track.trackId === pendingTeardown.trackId)
|
|
841
777
|
track.teardownRequested = undefined;
|
|
842
|
-
s = persist(planRoot, branch, next);
|
|
778
|
+
s = (0, track_state_1.persist)(planRoot, branch, next);
|
|
843
779
|
(0, store_1.appendEvent)(planRoot, branch, {
|
|
844
780
|
kind: 'track-teardown-moot', trackId: pendingTeardown.trackId, phase: s.cohortPhase,
|
|
845
781
|
});
|
|
@@ -847,11 +783,11 @@ async function reconcileTracks(planRoot, branch, state, runtime, maxParallel) {
|
|
|
847
783
|
}
|
|
848
784
|
const protocolBefore = toProtocol(s, maxParallel);
|
|
849
785
|
const observed = (0, protocol_1.reconcileProtocol)(protocolBefore, { kind: 'teardown-requested', trackId: pendingTeardown.trackId });
|
|
850
|
-
const next = applyProtocolToState(s, observed);
|
|
786
|
+
const next = (0, track_state_1.applyProtocolToState)(s, observed);
|
|
851
787
|
for (const track of next.tracks ?? [])
|
|
852
788
|
if (track.trackId === pendingTeardown.trackId)
|
|
853
789
|
track.teardownRequested = undefined;
|
|
854
|
-
s = persist(planRoot, branch, next);
|
|
790
|
+
s = (0, track_state_1.persist)(planRoot, branch, next);
|
|
855
791
|
// El lock pertenece al proceso vivo que alcanzó la integración.
|
|
856
792
|
// Al abandonar FINAL_INTERLOCK debe soltarse en este mismo proceso;
|
|
857
793
|
// tras un crash el lease muerto se reclama por identidad al iniciar.
|
|
@@ -886,11 +822,11 @@ async function reconcileTracks(planRoot, branch, state, runtime, maxParallel) {
|
|
|
886
822
|
if (pendingJoin !== undefined) {
|
|
887
823
|
const protocolBefore = toProtocol(s, maxParallel);
|
|
888
824
|
const observed = (0, protocol_1.reconcileProtocol)(protocolBefore, { kind: 'join-requested', trackId: pendingJoin.trackId });
|
|
889
|
-
const next = applyProtocolToState(s, observed);
|
|
825
|
+
const next = (0, track_state_1.applyProtocolToState)(s, observed);
|
|
890
826
|
for (const t of next.tracks ?? [])
|
|
891
827
|
if (t.trackId === pendingJoin.trackId)
|
|
892
828
|
t.joinRequested = undefined;
|
|
893
|
-
s = persist(planRoot, branch, next);
|
|
829
|
+
s = (0, track_state_1.persist)(planRoot, branch, next);
|
|
894
830
|
(0, store_1.appendEvent)(planRoot, branch, {
|
|
895
831
|
kind: 'track-join-observed', trackId: pendingJoin.trackId,
|
|
896
832
|
phase: s.tracks?.find((t) => t.trackId === pendingJoin.trackId)?.phase,
|
|
@@ -908,7 +844,7 @@ async function reconcileTracks(planRoot, branch, state, runtime, maxParallel) {
|
|
|
908
844
|
for (const t of next.tracks ?? [])
|
|
909
845
|
if (t.trackId === mootJoin.trackId)
|
|
910
846
|
t.joinRequested = undefined;
|
|
911
|
-
s = persist(planRoot, branch, next);
|
|
847
|
+
s = (0, track_state_1.persist)(planRoot, branch, next);
|
|
912
848
|
(0, store_1.appendEvent)(planRoot, branch, { kind: 'track-join-moot', trackId: mootJoin.trackId, phase: mootJoin.phase });
|
|
913
849
|
continue;
|
|
914
850
|
}
|
|
@@ -918,7 +854,7 @@ async function reconcileTracks(planRoot, branch, state, runtime, maxParallel) {
|
|
|
918
854
|
return { state: s, effectExecuted: null };
|
|
919
855
|
if (!RUNTIME_EFFECTS.has(effect.kind)) {
|
|
920
856
|
const applied = (0, protocol_1.observeProtocolEffect)(protocol, effect, { kind: 'effect-applied', effect });
|
|
921
|
-
const candidate = applyProtocolToState(s, applied);
|
|
857
|
+
const candidate = (0, track_state_1.applyProtocolToState)(s, applied);
|
|
922
858
|
// Defensivo: un ProtocolEffect sin fase mapeada en `EFFECT_APPLIED_PHASE`
|
|
923
859
|
// (ej. `merge-track`/`request-global-qa`, todavía sin driver propio en
|
|
924
860
|
// esta task — llegan en Tasks 11/12) no debe hacer que este loop gire
|
|
@@ -926,7 +862,7 @@ async function reconcileTracks(planRoot, branch, state, runtime, maxParallel) {
|
|
|
926
862
|
if (candidate.cohortPhase === s.cohortPhase && JSON.stringify(candidate.tracks) === JSON.stringify(s.tracks)) {
|
|
927
863
|
return { state: s, effectExecuted: null };
|
|
928
864
|
}
|
|
929
|
-
s = persist(planRoot, branch, candidate);
|
|
865
|
+
s = (0, track_state_1.persist)(planRoot, branch, candidate);
|
|
930
866
|
const trackId = 'trackId' in effect ? effect.trackId : undefined;
|
|
931
867
|
const label = trackId !== undefined ? (s.tracks?.find((t) => t.trackId === trackId)?.phase ?? effect.kind) : s.cohortPhase;
|
|
932
868
|
// `enter-serial` es el ÚNICO efecto de este branch que lleva una causa: la
|