@cotal-ai/cli 0.154.0 → 0.155.1
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/commands/agents.js +3 -3
- package/dist/commands/agents.js.map +1 -1
- package/dist/commands/space-registration.d.ts.map +1 -1
- package/dist/commands/space-registration.js +17 -6
- package/dist/commands/space-registration.js.map +1 -1
- package/dist/commands/space.d.ts +2 -0
- package/dist/commands/space.d.ts.map +1 -1
- package/dist/commands/space.js +5 -1
- package/dist/commands/space.js.map +1 -1
- package/dist/commands/spawn-preview.d.ts.map +1 -1
- package/dist/commands/spawn-preview.js +4 -8
- package/dist/commands/spawn-preview.js.map +1 -1
- package/dist/commands/stack-down.d.ts.map +1 -1
- package/dist/commands/stack-down.js +13 -8
- package/dist/commands/stack-down.js.map +1 -1
- package/dist/commands/stack-lost-records.d.ts +7 -0
- package/dist/commands/stack-lost-records.d.ts.map +1 -0
- package/dist/commands/stack-lost-records.js +143 -0
- package/dist/commands/stack-lost-records.js.map +1 -0
- package/dist/commands/stack-up.d.ts +3 -3
- package/dist/commands/stack-up.d.ts.map +1 -1
- package/dist/commands/stack-up.js +20 -12
- package/dist/commands/stack-up.js.map +1 -1
- package/dist/commands/status.d.ts +4 -0
- package/dist/commands/status.d.ts.map +1 -1
- package/dist/commands/status.js +89 -37
- package/dist/commands/status.js.map +1 -1
- package/dist/commands/sync.d.ts.map +1 -1
- package/dist/commands/sync.js +8 -6
- package/dist/commands/sync.js.map +1 -1
- package/dist/commands/team-boot-controller.d.ts.map +1 -1
- package/dist/commands/team-boot-controller.js +3 -1
- package/dist/commands/team-boot-controller.js.map +1 -1
- package/dist/commands/team-channel-remove.d.ts +2 -2
- package/dist/commands/team.d.ts.map +1 -1
- package/dist/commands/team.js +6 -2
- package/dist/commands/team.js.map +1 -1
- package/dist/commands/whoami.d.ts.map +1 -1
- package/dist/commands/whoami.js +7 -11
- package/dist/commands/whoami.js.map +1 -1
- package/dist/help.d.ts.map +1 -1
- package/dist/help.js +11 -2
- package/dist/help.js.map +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1 -1
- package/dist/index.js.map +1 -1
- package/dist/lib/controller-resume.d.ts.map +1 -1
- package/dist/lib/controller-resume.js +2 -1
- package/dist/lib/controller-resume.js.map +1 -1
- package/dist/lib/persona-files.d.ts.map +1 -1
- package/dist/lib/persona-files.js +26 -11
- package/dist/lib/persona-files.js.map +1 -1
- package/dist/lib/restore.d.ts.map +1 -1
- package/dist/lib/restore.js +3 -1
- package/dist/lib/restore.js.map +1 -1
- package/dist/lib/self-exec.d.ts +2 -2
- package/dist/lib/self-exec.d.ts.map +1 -1
- package/dist/lib/self-exec.js +6 -3
- package/dist/lib/self-exec.js.map +1 -1
- package/dist/lib/service-presets.d.ts.map +1 -1
- package/dist/lib/service-presets.js +7 -1
- package/dist/lib/service-presets.js.map +1 -1
- package/dist/lib/service-systemd-files.d.ts +3 -0
- package/dist/lib/service-systemd-files.d.ts.map +1 -1
- package/dist/lib/service-systemd-files.js +23 -0
- package/dist/lib/service-systemd-files.js.map +1 -1
- package/dist/lib/stack-journal.d.ts +16 -0
- package/dist/lib/stack-journal.d.ts.map +1 -1
- package/dist/lib/stack-journal.js +39 -8
- package/dist/lib/stack-journal.js.map +1 -1
- package/dist/lib/store-identity.d.ts +15 -0
- package/dist/lib/store-identity.d.ts.map +1 -0
- package/dist/lib/store-identity.js +30 -0
- package/dist/lib/store-identity.js.map +1 -0
- package/package.json +4 -4
|
@@ -0,0 +1,143 @@
|
|
|
1
|
+
/** Explicit signal stop when a stack's launching home has lost all exact instance records.
|
|
2
|
+
* The root journal must retain its launch-time home, host and member creation pins. */
|
|
3
|
+
import { resolve } from "node:path";
|
|
4
|
+
import { CommandFailure, ConfirmationRequired, assertRecordIdentity, homeCotalDir, loadMeshes, presentationOf, probeLiveness, recordOperationSpace, releaseMaintenanceLock, stackHomeRemedy, writeResult } from "@cotal-ai/workspace";
|
|
5
|
+
import { serviceInstances, serviceInstanceStore } from "../lib/service-instances.js";
|
|
6
|
+
import { assertNoServiceUnitAttempts } from "../lib/service-process.js";
|
|
7
|
+
import { acquireStackOperationLock, newStackOperation, readStackJournal, recordedProcessesUnder, stackMaintenanceFence, stackOperationUnsettled, stackRecoveryHost, writeStackJournal } from "../lib/stack-journal.js";
|
|
8
|
+
const ORDER = ["manager", "delivery", "auth", "broker"];
|
|
9
|
+
const delay = (ms) => new Promise((done) => setTimeout(done, ms));
|
|
10
|
+
function unconfirmedLaunches(snapshot) {
|
|
11
|
+
const journal = snapshot.journal;
|
|
12
|
+
if (journal.operation.kind !== "up" || !stackOperationUnsettled(journal))
|
|
13
|
+
return [];
|
|
14
|
+
return journal.members.filter((row) => row.instanceId === null && (row.state === "planned" || row.state === "unknown"));
|
|
15
|
+
}
|
|
16
|
+
/** Missing launch evidence also includes a child whose instance ID never reached the root journal. */
|
|
17
|
+
export function stackRecordsLost(snapshot) {
|
|
18
|
+
const space = snapshot.journal.space, store = serviceInstanceStore(space);
|
|
19
|
+
return snapshot.journal.members.some((row) => row.instanceId !== null && store.read(row.instanceId) === undefined)
|
|
20
|
+
|| (unconfirmedLaunches(snapshot).length > 0 && snapshot.journal.members.every((row) => serviceInstances(space, row.definition).length === 0));
|
|
21
|
+
}
|
|
22
|
+
function members(snapshot) {
|
|
23
|
+
const journal = snapshot.journal, target = { root: journal.root, space: journal.space };
|
|
24
|
+
const refuse = (message) => { throw new CommandFailure("refused", "TARGET_UNAVAILABLE", message, { target, remedy: stackHomeRemedy() }); };
|
|
25
|
+
if (process.platform !== "linux")
|
|
26
|
+
refuse("recovery from missing stack instance records requires Linux; no member was stopped");
|
|
27
|
+
if (!journal.recovery || journal.recovery.home !== resolve(homeCotalDir()) || journal.recovery.host !== stackRecoveryHost())
|
|
28
|
+
refuse("the stack's member records are missing here, and its journal does not pin this launching home, machine, boot and account; no member was stopped");
|
|
29
|
+
if (stackMaintenanceFence(journal.root, journal).fenced || !["up", "down"].includes(journal.operation.kind))
|
|
30
|
+
refuse("the stack retains a maintenance operation; missing-record recovery cannot decide it and no member was stopped");
|
|
31
|
+
if (journal.members.some((row) => row.replacement !== undefined))
|
|
32
|
+
refuse("the stack retains an unresolved replacement launch; no member was stopped");
|
|
33
|
+
if (unconfirmedLaunches(snapshot).length)
|
|
34
|
+
refuse("the stack retains an unconfirmed launch without an instance identity; restore the original instance records before stopping, and no member was stopped");
|
|
35
|
+
const rows = journal.members.filter((row) => row.instanceId !== null);
|
|
36
|
+
const store = serviceInstanceStore(journal.space);
|
|
37
|
+
if (rows.some((row) => store.read(row.instanceId) !== undefined))
|
|
38
|
+
refuse("only some stack instance records are missing; restore the complete records before stopping, and no member was stopped");
|
|
39
|
+
if (serviceInstances(journal.space).length)
|
|
40
|
+
refuse("other service instance records remain in this space; restore the complete records before stopping, and no member was stopped");
|
|
41
|
+
for (const row of rows)
|
|
42
|
+
assertNoServiceUnitAttempts(journal.space, row.definition);
|
|
43
|
+
if (rows.some((row) => row.process === undefined))
|
|
44
|
+
refuse("the stack journal lacks a complete set of member creation pins; no member was stopped");
|
|
45
|
+
if (loadMeshes().some((row) => row.space !== journal.space && row.server === journal.server))
|
|
46
|
+
refuse("another registered space uses this broker address; missing-record recovery stopped nothing");
|
|
47
|
+
const pids = new Set(rows.map((row) => row.process.pid));
|
|
48
|
+
if (recordedProcessesUnder(journal.root, [journal.space]).some((row) => row.pid === undefined || !pids.has(row.pid)))
|
|
49
|
+
refuse("another or unreadable process record remains under this root; missing-record recovery stopped nothing");
|
|
50
|
+
for (const row of rows) {
|
|
51
|
+
const verdict = assertRecordIdentity(row.process);
|
|
52
|
+
if (!["match", "gone", "mismatch"].includes(verdict.kind))
|
|
53
|
+
refuse(`the ${row.role} creation identity cannot be checked; no member was stopped`);
|
|
54
|
+
}
|
|
55
|
+
return rows.sort((a, b) => ORDER.indexOf(a.role) - ORDER.indexOf(b.role));
|
|
56
|
+
}
|
|
57
|
+
/** Recovery never recreates service authority or runs a native adapter with inferred records. */
|
|
58
|
+
export async function lostRecordsStackDown(root, values) {
|
|
59
|
+
if (["with-agents", "abandon-stop", "abandon-launch", "preserve-state"].some((flag) => values[flag] !== undefined))
|
|
60
|
+
throw new CommandFailure("refused", "USAGE_INVALID", "missing-record recovery takes only --space, --yes, --dry-run and presentation flags; no member was stopped");
|
|
61
|
+
const presentation = presentationOf(values);
|
|
62
|
+
const inspect = () => {
|
|
63
|
+
const snapshot = readStackJournal(root);
|
|
64
|
+
if (!snapshot)
|
|
65
|
+
throw new CommandFailure("refused", "CONFLICT", "the stack journal disappeared before recovery; nothing was inferred");
|
|
66
|
+
if (values.space !== undefined && values.space !== snapshot.journal.space)
|
|
67
|
+
throw new CommandFailure("refused", "CONFLICT", "--space is not this folder's stack; no member was stopped");
|
|
68
|
+
if (!stackRecordsLost(snapshot))
|
|
69
|
+
throw new CommandFailure("refused", "CONFLICT", "the stack instance records changed before recovery; run down again");
|
|
70
|
+
return { snapshot, rows: members(snapshot) };
|
|
71
|
+
};
|
|
72
|
+
const initial = inspect();
|
|
73
|
+
recordOperationSpace(initial.snapshot.journal.space);
|
|
74
|
+
const target = { root, space: initial.snapshot.journal.space };
|
|
75
|
+
const preview = initial.rows.map((row) => ({ role: row.role, instanceId: row.instanceId, pid: row.process.pid, process: assertRecordIdentity(row.process).kind === "match" ? "running" : "gone" }));
|
|
76
|
+
if (values["dry-run"] === true) {
|
|
77
|
+
writeResult(presentation, { command: "down", target, result: { kind: "missing-records-stack-stop-preview", members: preview, dryRun: true, signalled: false }, noOp: true }, () => ({ sections: [{ title: "Stack member records are missing", blocks: [
|
|
78
|
+
{ kind: "table", columns: [{ key: "role", label: "Member" }, { key: "instanceId", label: "Full instance" }, { key: "pid", label: "Pid" }, { key: "process", label: "Process" }], rows: preview.map((row) => ({ ...row, instanceId: row.instanceId, pid: String(row.pid) })) },
|
|
79
|
+
{ kind: "lines", lines: ["Nothing was stopped or written. down --yes sends SIGTERM to the journal's creation-pinned members, manager first and broker last. It does not restore the missing service records."] },
|
|
80
|
+
] }] }));
|
|
81
|
+
return;
|
|
82
|
+
}
|
|
83
|
+
const journal = initial.snapshot.journal;
|
|
84
|
+
if (journal.operation.kind === "down" && journal.operation.phase === "completed" && initial.rows.every((row) => (row.state === "stopped" || row.state === "already-stopped") && ["gone", "mismatch"].includes(assertRecordIdentity(row.process).kind))) {
|
|
85
|
+
writeResult(presentation, { command: "down", target, result: { kind: "missing-records-stack-stop", members: journal.members, recordsRestored: false }, noOp: true }, () => ({ sections: [{ title: "Stack is already stopped", blocks: [{ kind: "lines", lines: ["Every creation-pinned member is gone. No signal was sent or record changed."] }] }] }));
|
|
86
|
+
return;
|
|
87
|
+
}
|
|
88
|
+
if (values.yes !== true)
|
|
89
|
+
throw new ConfirmationRequired("stopping a stack whose instance records are missing requires --yes", { target, remedy: "run `cotal down --dry-run` to inspect its pinned members, then `cotal down --yes`" });
|
|
90
|
+
const lock = acquireStackOperationLock(root, "down");
|
|
91
|
+
try {
|
|
92
|
+
let { snapshot, rows } = inspect();
|
|
93
|
+
const operation = newStackOperation("down");
|
|
94
|
+
const save = (phase, member) => {
|
|
95
|
+
snapshot = writeStackJournal(root, snapshot, { ...snapshot.journal, members: snapshot.journal.members.map((row) => row.role === member?.role ? member : row), operation: { ...operation, phase }, updatedAt: new Date().toISOString() });
|
|
96
|
+
};
|
|
97
|
+
save("applying");
|
|
98
|
+
for (const row of rows) {
|
|
99
|
+
// Never continue under records or broker-sharing scope that reappeared during an earlier stop.
|
|
100
|
+
const current = readStackJournal(root);
|
|
101
|
+
if (!current || current.sha256 !== snapshot.sha256)
|
|
102
|
+
throw new CommandFailure("unknown", "OPERATION_UNKNOWN", "the stack journal changed during recovery; later members were not stopped", { target });
|
|
103
|
+
try {
|
|
104
|
+
members(current);
|
|
105
|
+
}
|
|
106
|
+
catch {
|
|
107
|
+
save("unknown");
|
|
108
|
+
throw new CommandFailure("unknown", "OPERATION_UNKNOWN", "the recovery scope changed after the stop began; recorded member outcomes were kept and later members were not stopped", { target, remedy: "restore the missing records or inspect the stack journal before running down again" });
|
|
109
|
+
}
|
|
110
|
+
const pin = row.process, verdict = assertRecordIdentity(pin);
|
|
111
|
+
if (verdict.kind === "match") {
|
|
112
|
+
try {
|
|
113
|
+
process.kill(pin.pid, "SIGTERM");
|
|
114
|
+
}
|
|
115
|
+
catch (error) {
|
|
116
|
+
if (error.code !== "ESRCH") {
|
|
117
|
+
save("unknown");
|
|
118
|
+
throw new CommandFailure("unknown", "OPERATION_UNKNOWN", `the ${row.role} signal was not confirmed; later members were not stopped`, { target });
|
|
119
|
+
}
|
|
120
|
+
}
|
|
121
|
+
const deadline = Date.now() + (row.role === "manager" ? 90_000 : 30_000);
|
|
122
|
+
while (assertRecordIdentity(pin).kind === "match" && probeLiveness(pin.pid) !== "dead" && Date.now() < deadline)
|
|
123
|
+
await delay(100);
|
|
124
|
+
const after = assertRecordIdentity(pin);
|
|
125
|
+
if (after.kind !== "gone" && after.kind !== "mismatch") {
|
|
126
|
+
save("unknown");
|
|
127
|
+
throw new CommandFailure("unknown", "OPERATION_UNKNOWN", `the ${row.role} exit was not confirmed; later members were not stopped`, { target, remedy: "run `cotal down --yes` again once that member exits" });
|
|
128
|
+
}
|
|
129
|
+
}
|
|
130
|
+
else if (verdict.kind !== "gone" && verdict.kind !== "mismatch") {
|
|
131
|
+
save("unknown");
|
|
132
|
+
throw new CommandFailure("unknown", "OPERATION_UNKNOWN", `the ${row.role} identity could not be verified; it and later members were not stopped`, { target });
|
|
133
|
+
}
|
|
134
|
+
save("applying", { ...row, state: verdict.kind === "match" ? "stopped" : "already-stopped" });
|
|
135
|
+
}
|
|
136
|
+
save("completed");
|
|
137
|
+
writeResult(presentation, { command: "down", target, result: { kind: "missing-records-stack-stop", members: snapshot.journal.members, recordsRestored: false } }, () => ({ sections: [{ title: "Stack stopped from its journal pins", blocks: [{ kind: "lines", lines: ["Every recorded member exited. Missing home records were not recreated. Prepare this space again with space create before starting it."] }] }, { title: "Next", blocks: [{ kind: "commands", items: [{ command: `cotal space create ${target.space}`, description: "Prepare the space again here, then run cotal up" }] }] }] }));
|
|
138
|
+
}
|
|
139
|
+
finally {
|
|
140
|
+
releaseMaintenanceLock(lock);
|
|
141
|
+
}
|
|
142
|
+
}
|
|
143
|
+
//# sourceMappingURL=stack-lost-records.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"stack-lost-records.js","sourceRoot":"","sources":["../../src/commands/stack-lost-records.ts"],"names":[],"mappings":"AAAA;uFACuF;AACvF,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAEpC,OAAO,EAAE,cAAc,EAAE,oBAAoB,EAAE,oBAAoB,EAAE,YAAY,EAAE,UAAU,EAAE,cAAc,EAAE,aAAa,EAAE,oBAAoB,EAAE,sBAAsB,EAAE,eAAe,EAAE,WAAW,EAAe,MAAM,qBAAqB,CAAC;AACnP,OAAO,EAAE,gBAAgB,EAAE,oBAAoB,EAAE,MAAM,6BAA6B,CAAC;AACrF,OAAO,EAAE,2BAA2B,EAAE,MAAM,2BAA2B,CAAC;AACxE,OAAO,EAAE,yBAAyB,EAAE,iBAAiB,EAAE,gBAAgB,EAAE,sBAAsB,EAAE,qBAAqB,EAAE,uBAAuB,EAAE,iBAAiB,EAAE,iBAAiB,EAA+C,MAAM,yBAAyB,CAAC;AAEpQ,MAAM,KAAK,GAAG,CAAC,SAAS,EAAE,UAAU,EAAE,MAAM,EAAE,QAAQ,CAAC,CAAC;AACxD,MAAM,KAAK,GAAG,CAAC,EAAU,EAAE,EAAE,CAAC,IAAI,OAAO,CAAO,CAAC,IAAI,EAAE,EAAE,CAAC,UAAU,CAAC,IAAI,EAAE,EAAE,CAAC,CAAC,CAAC;AAEhF,SAAS,mBAAmB,CAAC,QAA8B;IACzD,MAAM,OAAO,GAAG,QAAQ,CAAC,OAAO,CAAC;IACjC,IAAI,OAAO,CAAC,SAAS,CAAC,IAAI,KAAK,IAAI,IAAI,CAAC,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AC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC,CAAC;IAC5kB,CAAC;YAAS,CAAC;QAAC,sBAAsB,CAAC,IAAI,CAAC,CAAC;IAAC,CAAC;AAC7C,CAAC"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { type BrokerTransport, type ParsedArgs } from "@cotal-ai/core";
|
|
2
|
-
import { CommandFailure, presentationOf, type MaintenanceLock, type Report, type UserAuthInfo } from "@cotal-ai/workspace";
|
|
2
|
+
import { CommandFailure, presentationOf, type MaintenanceLock, type OutputWarning, type Report, type UserAuthInfo } from "@cotal-ai/workspace";
|
|
3
3
|
import { type StackJournal, type StackMode, type StackSettlement } from "../lib/stack-journal.js";
|
|
4
4
|
import { type NatsServer } from "../lib/nats-bin.js";
|
|
5
5
|
import { type StoreTenant } from "../lib/store-dir.js";
|
|
@@ -192,8 +192,8 @@ export interface StackUpResult {
|
|
|
192
192
|
path: string;
|
|
193
193
|
tenants: StoreTenant[];
|
|
194
194
|
};
|
|
195
|
-
/**
|
|
196
|
-
|
|
195
|
+
/** Store loss observed before this call reused or started the broker. */
|
|
196
|
+
storeWarnings?: OutputWarning[];
|
|
197
197
|
}
|
|
198
198
|
/** A `--server` broker URL as `up` records and compares it: the scheme in lower case, with no bare
|
|
199
199
|
* trailing `/`. Any other value comes back as given, for the address checks to refuse. */
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"stack-up.d.ts","sourceRoot":"","sources":["../../src/commands/stack-up.ts"],"names":[],"mappings":"AAeA,OAAO,EAAsM,KAAK,eAAe,EAAE,KAAK,UAAU,EAAE,MAAM,gBAAgB,CAAC;AAC3Q,OAAO,EACL,cAAc,EAgBd,cAAc,EAad,KAAK,eAAe,
|
|
1
|
+
{"version":3,"file":"stack-up.d.ts","sourceRoot":"","sources":["../../src/commands/stack-up.ts"],"names":[],"mappings":"AAeA,OAAO,EAAsM,KAAK,eAAe,EAAE,KAAK,UAAU,EAAE,MAAM,gBAAgB,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AY,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,CAElD;AAED,iEAAiE;AACjE,wBAAgB,QAAQ,CAAC,KAAK,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,GAAG,MAAM,CAE5D;AAED;;6FAE6F;AAC7F,wBAAsB,OAAO,CAAC,OAAO,EAAE,cAAc,EAAE,MAAM,EAAE,aAAa,GAAG,OAAO,CAAC,IAAI,CAAC,CAkE3F;AAuDD;;kCAEkC;AAClC,wBAAgB,kBAAkB,CAAC,IAAI,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,EAAE,SAAS,UAAQ,GAAG,cAAc,CAiBjG;AAED;8DAC8D;AAC9D,wBAAgB,WAAW,CAAC,IAAI,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,GAAG,OAAO,CAOjE;AAED,yFAAyF;AACzF,wBAAsB,oBAAoB,CAAC,OAAO,EAAE,cAAc,EAAE,MAAM,EAAE,aAAa,GAAG,OAAO,CAAC,aAAa,CAAC,CAqejH;AAgCD,6EAA6E;AAC7E,wBAAgB,gBAAgB,CAAC,OAAO,EAAE,YAAY,EAAE,KAAK,EAAE,MAAM,GAAG,MAAM,CAE7E;AAED;2GAC2G;AAC3G,wBAAgB,uBAAuB,CAAC,YAAY,EAAE,UAAU,CAAC,OAAO,cAAc,CAAC,EAAE,KAAK,EAAE,MAAM,EAAE,QAAQ,UAAQ,GAAG,IAAI,CAM9H"}
|
|
@@ -28,9 +28,10 @@ import { prepareKernelServiceStop, prepareProcessService, readServiceLog, remove
|
|
|
28
28
|
import { listLedgerFiles } from "../lib/manifest/ledger.js";
|
|
29
29
|
import { listAdditiveTeamAttempts, retainedAdditiveTeamAttempts } from "../lib/team-additive-attempt.js";
|
|
30
30
|
import { freshTeamAttemptSettled, listFreshTeamAttempts, listFreshTeamSummaries } from "../lib/team-fresh.js";
|
|
31
|
-
import { foreignLocalProcesses, newStackOperation, readStackJournal, runningStackRoles, serviceHeldRecords, settleRetainedStackStops, settleStackOperation, STACK_ADAPTER, STACK_DEFINITION, STACK_ROLES, stackDefinitionsAt, stackMaintenanceFence, stackNeverStarted, stackOperationUnsettled, stackRoleApplies, stackSettlementNotice, withSettledMembers, writeStackJournal } from "../lib/stack-journal.js";
|
|
31
|
+
import { foreignLocalProcesses, newStackOperation, readStackJournal, runningStackRoles, serviceHeldRecords, settleRetainedStackStops, settleStackOperation, STACK_ADAPTER, STACK_DEFINITION, STACK_ROLES, stackDefinitionsAt, stackMaintenanceFence, stackNeverStarted, stackRecoveryHost, stackOperationUnsettled, stackRoleApplies, stackSettlementNotice, withSettledMembers, writeStackJournal } from "../lib/stack-journal.js";
|
|
32
32
|
import { natsServerLabel } from "../lib/nats-bin.js";
|
|
33
|
-
import {
|
|
33
|
+
import { sharedStoreAtStart, sharedStoreWarning } from "../lib/store-dir.js";
|
|
34
|
+
import { readStoreIdentity, stackStoreWarnings } from "../lib/store-identity.js";
|
|
34
35
|
import { assertManagerLogin, assertUserStackTransport, confirmUserAuthEndpoints, preflightUserStack, provisionalUserAuth, userRegistrationIncomplete } from "./stack-user-auth.js";
|
|
35
36
|
/** Pin a named store that must already exist as a real directory, refusing a missing path, a
|
|
36
37
|
* non-directory and a symlink. The pin and its rechecks narrow the window in which another local
|
|
@@ -191,7 +192,7 @@ export function controllerStackApplies(root, space, values) {
|
|
|
191
192
|
function stackPreflight(root, space, recorded, ownAttempt) {
|
|
192
193
|
// Its members' own pidfiles would read as legacy processes under a Cotal home with no record of them.
|
|
193
194
|
if (recorded && stackRunsUnderOtherHome(root, recorded))
|
|
194
|
-
throw new CommandFailure("refused", "TARGET_UNAVAILABLE", "this root's controller stack
|
|
195
|
+
throw new CommandFailure("refused", "TARGET_UNAVAILABLE", "this root's controller stack has missing member records in this Cotal home; nothing was started, adopted or replaced", { target: { root, space, cotalHome: homeCotalDir() }, remedy: stackHomeRemedy() });
|
|
195
196
|
const maintenance = recorded ? stackMaintenanceFence(root, recorded) : { fenced: readMaintenanceJournal(root) !== undefined };
|
|
196
197
|
if (maintenance.fenced)
|
|
197
198
|
throw new CommandFailure("refused", "LIFECYCLE_BLOCKED", "this root retains a maintenance or recovery attempt; the controller stack did not substitute an ordinary startup", { target: { root, space } });
|
|
@@ -334,7 +335,7 @@ export function keptOnUp(space, kept) {
|
|
|
334
335
|
* persona that cannot be written, or saved services that cannot be listed, is a warning. */
|
|
335
336
|
export async function stackUp(request, native) {
|
|
336
337
|
const before = usableSelection();
|
|
337
|
-
const { journal, changed, allReused, admittedRestore, settled, brokerExecutable, streamsRecreated, rotation, storeShared,
|
|
338
|
+
const { journal, changed, allReused, admittedRestore, settled, brokerExecutable, streamsRecreated, rotation, storeShared, storeWarnings } = await startControllerStack(request, native);
|
|
338
339
|
const { root, space, server, mode } = journal;
|
|
339
340
|
const managed = journal.members.some((row) => row.role === "manager" && (row.state === "started" || row.state === "reused"));
|
|
340
341
|
// The receipt says when the start selected its space, and when another space stays selected.
|
|
@@ -343,8 +344,7 @@ export async function stackUp(request, native) {
|
|
|
343
344
|
const selected = current === space && before !== space;
|
|
344
345
|
const written = [];
|
|
345
346
|
const warnings = settled ? [{ code: "OPERATION_SETTLED", target: { root, space, operation: settled.operation.id }, message: stackSettlementNotice(settled) }] : [];
|
|
346
|
-
|
|
347
|
-
warnings.push({ code: "STORE_MISSING", target: { root, space, storeDir: storeMissing }, message: missingStoreWarning(storeMissing) });
|
|
347
|
+
warnings.push(...storeWarnings ?? []);
|
|
348
348
|
if (storeShared)
|
|
349
349
|
warnings.push({ code: "STORE_SHARED", target: { root, space, storeDir: storeShared.path, otherSpaces: storeShared.tenants }, message: sharedStoreWarning(storeShared.path, storeShared.tenants) });
|
|
350
350
|
// Damage the broker found while it restored its stored files is logged by now.
|
|
@@ -639,7 +639,7 @@ export async function startControllerStack(request, native) {
|
|
|
639
639
|
// another space uses it; the recorded or default store starts, and the receipt warns.
|
|
640
640
|
const storePath = brokerStore !== undefined ? resolve(brokerStore) : join(root, ".cotal", "nats");
|
|
641
641
|
const storeTenants = sharedStoreAtStart(storePath, space, recordedBroker !== undefined || legacyStopped || request.storeDir === undefined);
|
|
642
|
-
const
|
|
642
|
+
const storeWarnings = previous ? stackStoreWarnings(previous.journal, !brokerIsRunning()) : [];
|
|
643
643
|
// An up stopped after its broker served and before it registered the space leaves a broker whose
|
|
644
644
|
// stream setup and registration only that up's own preparation could finish, and trust is never
|
|
645
645
|
// prepared again under a running broker. This start refuses before any write and names the stop.
|
|
@@ -693,8 +693,11 @@ export async function startControllerStack(request, native) {
|
|
|
693
693
|
const roles = STACK_ROLES.filter((role) => stackRoleApplies(mode, role) && !(role === "manager" && request.noManager));
|
|
694
694
|
// A replacement an earlier `up` journaled is resolved from its own record before it is carried over.
|
|
695
695
|
const recordedMembers = current ? withSettledMembers(current.journal, undefined).members : [];
|
|
696
|
-
const members = STACK_ROLES.map((role) =>
|
|
697
|
-
|
|
696
|
+
const members = STACK_ROLES.map((role) => {
|
|
697
|
+
const recorded = recordedMembers.find((row) => row.role === role);
|
|
698
|
+
return { role, definition: STACK_DEFINITION[role], instanceId: recorded?.instanceId ?? null, process: roles.includes(role) ? undefined : recorded?.process, state: roles.includes(role) ? "planned" : "not-attempted" };
|
|
699
|
+
});
|
|
700
|
+
let journal = { schemaVersion: 1, kind: "cotal-stack-controller", root, space, server, mode, recovery: { home: resolve(homeCotalDir()), host: stackRecoveryHost() }, ...(recordedBroker ? { broker: recordedBroker } : {}), members, operation: newStackOperation("up"), updatedAt: new Date().toISOString() };
|
|
698
701
|
// The whole scoped plan is durable before the first effect. A crash after this reads as unsettled
|
|
699
702
|
// until the next whole-stack operation settles it from its members' evidence.
|
|
700
703
|
let snapshot = writeStackJournal(root, current ?? recorded, journal);
|
|
@@ -726,7 +729,7 @@ export async function startControllerStack(request, native) {
|
|
|
726
729
|
process.stderr.write(`Starting ${definition.name}; waiting up to ${Math.round(definition.record.value.readiness.timeoutMs / 1000)}s for its readiness check\n`);
|
|
727
730
|
// A redefined member starts its replacement under the IDs the journal already names.
|
|
728
731
|
const started = await startProcessService(definition, replacement ? { replacement: { instanceId: replacement.instanceId, launchRequestId: replacement.launchRequestId } } : current[0] ? { instance: current[0].name } : {});
|
|
729
|
-
mark(role, { instanceId: started.instance.name, state: started.noOp ? "reused" : "started", replacement: undefined });
|
|
732
|
+
mark(role, { instanceId: started.instance.name, state: started.noOp ? "reused" : "started", replacement: undefined, process: started.instance.record.value.process });
|
|
730
733
|
if (!started.noOp)
|
|
731
734
|
changed.push(instanceProjection(started.instance));
|
|
732
735
|
return started.instance;
|
|
@@ -802,7 +805,7 @@ export async function startControllerStack(request, native) {
|
|
|
802
805
|
// The validated transport decision is recorded before the broker child starts, so its
|
|
803
806
|
// listener-report check compares against the transport this configuration actually serves.
|
|
804
807
|
native.commitTransport(root, prepared.transport, { authTimeout: prepared.authTimeout, maxPayload: prepared.maxPayload });
|
|
805
|
-
journal = { ...journal, broker: { storeDir: resolve(prepared.storeDir), ...(brokerCap !== undefined ? { maxFileStore: brokerCap } : {}), ...(brokerHost ? { host: brokerHost } : {}), ...(brokerLogFile !== undefined ? { logFile: resolve(brokerLogFile) } : {}), ...(brokerLogfileSizeLimit !== undefined ? { logfileSizeLimit: brokerLogfileSizeLimit } : {}), ...(brokerLogfileMaxNum !== undefined ? { logfileMaxNum: brokerLogfileMaxNum } : {}) }, updatedAt: new Date().toISOString() };
|
|
808
|
+
journal = { ...journal, broker: { storeDir: resolve(prepared.storeDir), ...(recordedBroker?.storeIdentity ? { storeIdentity: recordedBroker.storeIdentity } : {}), ...(brokerCap !== undefined ? { maxFileStore: brokerCap } : {}), ...(brokerHost ? { host: brokerHost } : {}), ...(brokerLogFile !== undefined ? { logFile: resolve(brokerLogFile) } : {}), ...(brokerLogfileSizeLimit !== undefined ? { logfileSizeLimit: brokerLogfileSizeLimit } : {}), ...(brokerLogfileMaxNum !== undefined ? { logfileMaxNum: brokerLogfileMaxNum } : {}) }, updatedAt: new Date().toISOString() };
|
|
806
809
|
snapshot = writeStackJournal(root, snapshot, journal);
|
|
807
810
|
}
|
|
808
811
|
// A running stack broker keeps its saved definition; a fresh one is defined from this preparation.
|
|
@@ -816,7 +819,12 @@ export async function startControllerStack(request, native) {
|
|
|
816
819
|
const broker = ensureDefinition(space, "broker", adapterDefinition(space, STACK_ADAPTER.broker, brokerOptions, 30000), root, replace("broker"));
|
|
817
820
|
if (storePin)
|
|
818
821
|
recheckExistingStore(storePin, { root, space });
|
|
822
|
+
const storeIdentity = prepared ? readStoreIdentity(prepared.storeDir) : undefined;
|
|
819
823
|
const brokerInstance = await start("broker", broker);
|
|
824
|
+
if (storeIdentity && journal.broker) {
|
|
825
|
+
journal = { ...journal, broker: { ...journal.broker, storeIdentity }, updatedAt: new Date().toISOString() };
|
|
826
|
+
snapshot = writeStackJournal(root, snapshot, journal);
|
|
827
|
+
}
|
|
820
828
|
if (brokerLogFile !== undefined) {
|
|
821
829
|
let fd;
|
|
822
830
|
try {
|
|
@@ -1023,7 +1031,7 @@ export async function startControllerStack(request, native) {
|
|
|
1023
1031
|
: "the user stack's other members were already running and were reused; the manager was not attempted because no signed-in, granted login exists. This is not whole-stack readiness", { target: detail, changed, native: { code: "AUTH_REQUIRED", outcome: "refused", detail: loginBlock.message }, ...(loginBlock.remedy ? { remedy: loginBlock.remedy } : {}) });
|
|
1024
1032
|
}
|
|
1025
1033
|
const allReused = journal.members.every((row) => row.state === "reused" || row.state === "not-attempted");
|
|
1026
|
-
return { journal, changed, allReused, ...(storeTenants.length ? { storeShared: { path: storePath, tenants: storeTenants } } : {}), ...(
|
|
1034
|
+
return { journal, changed, allReused, ...(storeTenants.length ? { storeShared: { path: storePath, tenants: storeTenants } } : {}), ...(storeWarnings.length ? { storeWarnings } : {}), ...(launch ? { launch } : {}), ...(admittedRestore ? { admittedRestore } : {}), ...(settled ? { settled } : {}), ...(brokerExecutable ? { brokerExecutable } : {}), ...(streamsRecreated ? { streamsRecreated: true } : {}), ...(rotation ? { rotation } : {}) };
|
|
1027
1035
|
}
|
|
1028
1036
|
/** Stop a broker this call started, through its exact kernel stop, and read whether its log says it
|
|
1029
1037
|
* ran out of open files. A stop that does not confirm returns nothing, so the caller reports the
|