@akagilnc/pi-workflow-roles 0.1.4759 → 0.1.4772
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/acp-host/production-host.js +227 -428
- package/dist/headless-host/production-host.js +233 -434
- package/dist/migrate-book-topology.js +1255 -1087
- package/dist/notary-source-run.js +12 -2
- package/dist/public-cli/invocation.js +11 -8
- package/dist/public-cli/main.js +198 -399
- package/dist/public-cli/post-admission.js +27 -1
- package/dist/public-cli/run-lifecycle.js +25 -4
- package/dist/role-run-relocation.js +19 -18
- package/package.json +1 -1
- package/src/book-topology-migration-placement.ts +9 -1
- package/src/book-topology-runs-migrator.ts +156 -4
- package/src/notary-source-run.ts +18 -2
- package/src/public-cli/invocation.ts +13 -9
- package/src/public-cli/post-admission.ts +36 -0
- package/src/public-cli/run-lifecycle.ts +42 -4
- package/src/role-run-relocation.ts +27 -30
|
@@ -63,7 +63,8 @@ export async function resolveNotarySourceRunLocator(options) {
|
|
|
63
63
|
}
|
|
64
64
|
const ledgerHome = resolveActivationLedgerHome(options.home);
|
|
65
65
|
const bookKey = resolveBookKeyFromGit(options.projectRoot);
|
|
66
|
-
const
|
|
66
|
+
const bookDirectory = activationBookDirectory(ledgerHome, bookKey);
|
|
67
|
+
const bookRunsRoot = join(bookDirectory, "runs");
|
|
67
68
|
let candidate;
|
|
68
69
|
const bare = parseRunDirectoryName(raw);
|
|
69
70
|
if (bare !== undefined && !raw.includes("/") && !raw.includes("\\")) {
|
|
@@ -72,10 +73,19 @@ export async function resolveNotarySourceRunLocator(options) {
|
|
|
72
73
|
}
|
|
73
74
|
else {
|
|
74
75
|
candidate = isAbsolute(raw) ? raw : resolve(options.projectRoot, raw);
|
|
76
|
+
const identity = parseRunDirectoryName(basename(candidate));
|
|
77
|
+
const subjectDirectory = dirname(dirname(candidate));
|
|
78
|
+
const isLegacyUnboundLocator = identity !== undefined &&
|
|
79
|
+
basename(dirname(candidate)) === "runs" &&
|
|
80
|
+
basename(subjectDirectory) === "unbound" &&
|
|
81
|
+
resolve(dirname(subjectDirectory)) === resolve(bookDirectory);
|
|
82
|
+
if (isLegacyUnboundLocator) {
|
|
83
|
+
candidate = (await findRunDirectoryById(options.home, identity.runId, bookKey, identity.role)) ?? candidate;
|
|
84
|
+
}
|
|
75
85
|
}
|
|
76
86
|
const real = await requireRunDirectory(candidate, raw);
|
|
77
87
|
const identity = parseRunDirectoryName(basename(real));
|
|
78
|
-
const bookIdentity = physicalPathIdentity(
|
|
88
|
+
const bookIdentity = physicalPathIdentity(bookDirectory);
|
|
79
89
|
const parentIdentity = physicalPathIdentity(dirname(real));
|
|
80
90
|
const subjectBookIdentity = physicalPathIdentity(dirname(dirname(dirname(real))));
|
|
81
91
|
if (parentIdentity !== physicalPathIdentity(bookRunsRoot) &&
|
|
@@ -11,7 +11,7 @@ import { activationBookDirectory, ensureRealDirectoryTree, homeFromRunDirectory,
|
|
|
11
11
|
import { resolveBookKeyFromGit } from "../activation-ledger-git.js";
|
|
12
12
|
import { ensureRoleRunDirectory, ensureRoleRunPlacement, roleRunArtifactsDirectory, roleRunPlacement, } from "../role-run-placement.js";
|
|
13
13
|
import { isSafePositiveTicketNumber, readBoardTicketNumber, requireSafePositiveTicketNumber, } from "../run-ticket-number.js";
|
|
14
|
-
import {
|
|
14
|
+
import { rewriteRunDirectoryPathFields, rewriteRunDirectoryPathValue, } from "../role-run-relocation.js";
|
|
15
15
|
import { loadDoctorCase, } from "../doctor-evidence.js";
|
|
16
16
|
import { projectCourtTicketNumbers } from "../diarist-contracts.js";
|
|
17
17
|
import { emptyCollectorManifest, loadCollectorManifest, parseCollectorPrNumber, parseCollectorRepository, } from "../collector-config.js";
|
|
@@ -230,7 +230,7 @@ export async function bindCourtTicketNumbersOnAdmitted(admitted, courtTicketNumb
|
|
|
230
230
|
/** Move a settled first-entry run from unbound to its asserted ticket directory. */
|
|
231
231
|
export async function relocateAdmittedRunToTicket(admitted, authority, heldLease) {
|
|
232
232
|
if (admitted.ticketNumber === undefined || !admitted.runDirectory.includes(`${sep}unbound${sep}runs${sep}`))
|
|
233
|
-
return;
|
|
233
|
+
return undefined;
|
|
234
234
|
const oldRunDirectory = admitted.runDirectory;
|
|
235
235
|
const ledgerHome = resolveActivationLedgerHome(homeFromRunDirectory(oldRunDirectory));
|
|
236
236
|
const target = roleRunPlacement(ledgerHome, {
|
|
@@ -240,7 +240,15 @@ export async function relocateAdmittedRunToTicket(admitted, authority, heldLease
|
|
|
240
240
|
role: admitted.role,
|
|
241
241
|
});
|
|
242
242
|
ensureRoleRunDirectory(ledgerHome, dirname(target.runDirectory));
|
|
243
|
+
// Host sealing is pure identity projection, but may reject the coordinates.
|
|
244
|
+
// Keep that failure before the filesystem commit point.
|
|
245
|
+
const principal = authority.seal(target);
|
|
246
|
+
// Rename is the only durable commit. Persisted paths are resolved from typed
|
|
247
|
+
// run identity on read, so online relocation never writes unleased peers or
|
|
248
|
+
// pretends a directory rename plus page rewrites form one transaction.
|
|
243
249
|
await rename(oldRunDirectory, target.runDirectory);
|
|
250
|
+
// rename moved the open lock inode with the directory. Transfer cleanup
|
|
251
|
+
// ownership immediately after the commit.
|
|
244
252
|
heldLease?.relocate(target.runDirectory);
|
|
245
253
|
const admittedRecord = admitted;
|
|
246
254
|
rewriteRunDirectoryPathFields(admittedRecord, [
|
|
@@ -255,13 +263,8 @@ export async function relocateAdmittedRunToTicket(admitted, authority, heldLease
|
|
|
255
263
|
for (const attachment of admitted.attachments) {
|
|
256
264
|
attachment.frozenPath = rewriteRunDirectoryPathValue(attachment.frozenPath, oldRunDirectory, target.runDirectory);
|
|
257
265
|
}
|
|
258
|
-
const principal = authority.seal(target);
|
|
259
266
|
admitted.principal = principal;
|
|
260
|
-
|
|
261
|
-
pagesDirectory: target.runDirectory,
|
|
262
|
-
oldRunDirectory,
|
|
263
|
-
newRunDirectory: target.runDirectory,
|
|
264
|
-
});
|
|
267
|
+
return { oldRunDirectory, newRunDirectory: target.runDirectory };
|
|
265
268
|
}
|
|
266
269
|
/**
|
|
267
270
|
* Bind ticket identity onto a run directory's durable pages when the admitted
|