@agent-teams/engineering-foundation 0.17.0 → 0.18.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/capabilities/contract-json-schema-releases/module.d.ts.map +1 -1
- package/dist/capabilities/contract-json-schema-releases/module.js +4 -17
- package/dist/capabilities/contract-json-schema-releases/module.js.map +1 -1
- package/dist/capabilities/contract-protobuf-evolution/module.d.ts.map +1 -1
- package/dist/capabilities/contract-protobuf-evolution/module.js +4 -17
- package/dist/capabilities/contract-protobuf-evolution/module.js.map +1 -1
- package/dist/capabilities/documentation-local-references/module.d.ts.map +1 -1
- package/dist/capabilities/documentation-local-references/module.js +4 -17
- package/dist/capabilities/documentation-local-references/module.js.map +1 -1
- package/dist/capabilities/executable-specifications/module.d.ts.map +1 -1
- package/dist/capabilities/executable-specifications/module.js +4 -17
- package/dist/capabilities/executable-specifications/module.js.map +1 -1
- package/dist/capabilities/governance-architecture-decisions/module.d.ts.map +1 -1
- package/dist/capabilities/governance-architecture-decisions/module.js +4 -17
- package/dist/capabilities/governance-architecture-decisions/module.js.map +1 -1
- package/dist/capabilities/public-api-compatibility/module.d.ts.map +1 -1
- package/dist/capabilities/public-api-compatibility/module.js +4 -19
- package/dist/capabilities/public-api-compatibility/module.js.map +1 -1
- package/dist/capabilities/quality-gate-runner/module.d.ts.map +1 -1
- package/dist/capabilities/quality-gate-runner/module.js +4 -17
- package/dist/capabilities/quality-gate-runner/module.js.map +1 -1
- package/dist/capabilities/repository-agent-workflow/module.d.ts.map +1 -1
- package/dist/capabilities/repository-agent-workflow/module.js +4 -17
- package/dist/capabilities/repository-agent-workflow/module.js.map +1 -1
- package/dist/capabilities/repository-security-baseline/adapters/outbound/filesystem/workflow-evidence-parser.d.ts.map +1 -1
- package/dist/capabilities/repository-security-baseline/adapters/outbound/filesystem/workflow-evidence-parser.js +33 -0
- package/dist/capabilities/repository-security-baseline/adapters/outbound/filesystem/workflow-evidence-parser.js.map +1 -1
- package/dist/capabilities/repository-security-baseline/application/model/repository-security.d.ts +1 -0
- package/dist/capabilities/repository-security-baseline/application/model/repository-security.d.ts.map +1 -1
- package/dist/capabilities/repository-security-baseline/application/model/repository-security.js.map +1 -1
- package/dist/capabilities/repository-security-baseline/application/policies/dependency-review-ordering.js +1 -1
- package/dist/capabilities/repository-security-baseline/application/policies/dependency-review-ordering.js.map +1 -1
- package/dist/capabilities/repository-security-baseline/application/policies/evaluate-repository-security-tools.js +1 -1
- package/dist/capabilities/repository-security-baseline/application/policies/evaluate-repository-security-tools.js.map +1 -1
- package/dist/capabilities/repository-security-baseline/application/policies/evaluate-repository-security.js +1 -1
- package/dist/capabilities/repository-security-baseline/application/policies/evaluate-repository-security.js.map +1 -1
- package/dist/capabilities/repository-security-baseline/module.d.ts.map +1 -1
- package/dist/capabilities/repository-security-baseline/module.js +4 -17
- package/dist/capabilities/repository-security-baseline/module.js.map +1 -1
- package/dist/capabilities/source-dependencies/module.d.ts.map +1 -1
- package/dist/capabilities/source-dependencies/module.js +4 -19
- package/dist/capabilities/source-dependencies/module.js.map +1 -1
- package/dist/capabilities/suppression-governance/module.d.ts.map +1 -1
- package/dist/capabilities/suppression-governance/module.js +4 -19
- package/dist/capabilities/suppression-governance/module.js.map +1 -1
- package/dist/capabilities/workspace-dependency-declarations/module.d.ts.map +1 -1
- package/dist/capabilities/workspace-dependency-declarations/module.js +4 -18
- package/dist/capabilities/workspace-dependency-declarations/module.js.map +1 -1
- package/dist/capability-runtime.d.ts +8 -0
- package/dist/capability-runtime.d.ts.map +1 -1
- package/dist/capability-runtime.js +66 -0
- package/dist/capability-runtime.js.map +1 -1
- package/dist/check-runner.d.ts.map +1 -1
- package/dist/check-runner.js +16 -10
- package/dist/check-runner.js.map +1 -1
- package/dist/document-authoring/index.d.ts +6 -1
- package/dist/document-authoring/index.d.ts.map +1 -1
- package/dist/document-authoring/index.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/local-mode/index.d.ts +5 -0
- package/dist/local-mode/index.d.ts.map +1 -1
- package/dist/local-mode/index.js +5 -0
- package/dist/local-mode/index.js.map +1 -1
- package/dist/mutation/index.d.ts +8 -0
- package/dist/mutation/index.d.ts.map +1 -1
- package/dist/mutation/index.js.map +1 -1
- package/dist/mutation/qualification/index.d.ts +10 -0
- package/dist/mutation/qualification/index.d.ts.map +1 -0
- package/dist/mutation/qualification/index.js +6 -0
- package/dist/mutation/qualification/index.js.map +1 -0
- package/dist/repository-mutation/adapters/node/node-known-file-apply-effects.d.ts +84 -0
- package/dist/repository-mutation/adapters/node/node-known-file-apply-effects.d.ts.map +1 -0
- package/dist/repository-mutation/adapters/node/node-known-file-apply-effects.js +232 -0
- package/dist/repository-mutation/adapters/node/node-known-file-apply-effects.js.map +1 -0
- package/dist/repository-mutation/adapters/node/node-known-file-apply-faults.d.ts +9 -0
- package/dist/repository-mutation/adapters/node/node-known-file-apply-faults.d.ts.map +1 -0
- package/dist/repository-mutation/adapters/node/node-known-file-apply-faults.js +2 -0
- package/dist/repository-mutation/adapters/node/node-known-file-apply-faults.js.map +1 -0
- package/dist/repository-mutation/adapters/node/node-known-file-apply-observation.d.ts +6 -0
- package/dist/repository-mutation/adapters/node/node-known-file-apply-observation.d.ts.map +1 -0
- package/dist/repository-mutation/adapters/node/node-known-file-apply-observation.js +30 -0
- package/dist/repository-mutation/adapters/node/node-known-file-apply-observation.js.map +1 -0
- package/dist/repository-mutation/adapters/node/node-known-file-apply-operation.d.ts +11 -0
- package/dist/repository-mutation/adapters/node/node-known-file-apply-operation.d.ts.map +1 -0
- package/dist/repository-mutation/adapters/node/node-known-file-apply-operation.js +159 -0
- package/dist/repository-mutation/adapters/node/node-known-file-apply-operation.js.map +1 -0
- package/dist/repository-mutation/adapters/node/node-known-file-apply-state.d.ts +9 -0
- package/dist/repository-mutation/adapters/node/node-known-file-apply-state.d.ts.map +1 -0
- package/dist/repository-mutation/adapters/node/node-known-file-apply-state.js +21 -0
- package/dist/repository-mutation/adapters/node/node-known-file-apply-state.js.map +1 -0
- package/dist/repository-mutation/adapters/node/node-known-file-recovery-cleanup.d.ts +9 -0
- package/dist/repository-mutation/adapters/node/node-known-file-recovery-cleanup.d.ts.map +1 -0
- package/dist/repository-mutation/adapters/node/node-known-file-recovery-cleanup.js +203 -0
- package/dist/repository-mutation/adapters/node/node-known-file-recovery-cleanup.js.map +1 -0
- package/dist/repository-mutation/adapters/node/node-known-file-recovery-executor.d.ts +17 -0
- package/dist/repository-mutation/adapters/node/node-known-file-recovery-executor.d.ts.map +1 -0
- package/dist/repository-mutation/adapters/node/node-known-file-recovery-executor.js +22 -0
- package/dist/repository-mutation/adapters/node/node-known-file-recovery-executor.js.map +1 -0
- package/dist/repository-mutation/adapters/node/node-known-file-recovery-observation.d.ts +15 -0
- package/dist/repository-mutation/adapters/node/node-known-file-recovery-observation.d.ts.map +1 -0
- package/dist/repository-mutation/adapters/node/node-known-file-recovery-observation.js +47 -0
- package/dist/repository-mutation/adapters/node/node-known-file-recovery-observation.js.map +1 -0
- package/dist/repository-mutation/adapters/node/node-known-file-recovery-preimage-captured-cleanup.d.ts +29 -0
- package/dist/repository-mutation/adapters/node/node-known-file-recovery-preimage-captured-cleanup.d.ts.map +1 -0
- package/dist/repository-mutation/adapters/node/node-known-file-recovery-preimage-captured-cleanup.js +72 -0
- package/dist/repository-mutation/adapters/node/node-known-file-recovery-preimage-captured-cleanup.js.map +1 -0
- package/dist/repository-mutation/adapters/node/node-known-file-recovery-preimage-captured.d.ts +31 -0
- package/dist/repository-mutation/adapters/node/node-known-file-recovery-preimage-captured.d.ts.map +1 -0
- package/dist/repository-mutation/adapters/node/node-known-file-recovery-preimage-captured.js +254 -0
- package/dist/repository-mutation/adapters/node/node-known-file-recovery-preimage-captured.js.map +1 -0
- package/dist/repository-mutation/adapters/node/node-known-file-recovery-preimage.d.ts +13 -0
- package/dist/repository-mutation/adapters/node/node-known-file-recovery-preimage.d.ts.map +1 -0
- package/dist/repository-mutation/adapters/node/node-known-file-recovery-preimage.js +210 -0
- package/dist/repository-mutation/adapters/node/node-known-file-recovery-preimage.js.map +1 -0
- package/dist/repository-mutation/adapters/node/node-known-file-recovery-retirement.d.ts +15 -0
- package/dist/repository-mutation/adapters/node/node-known-file-recovery-retirement.d.ts.map +1 -0
- package/dist/repository-mutation/adapters/node/node-known-file-recovery-retirement.js +172 -0
- package/dist/repository-mutation/adapters/node/node-known-file-recovery-retirement.js.map +1 -0
- package/dist/repository-mutation/adapters/node/node-known-file-recovery-state.d.ts +12 -0
- package/dist/repository-mutation/adapters/node/node-known-file-recovery-state.d.ts.map +1 -0
- package/dist/repository-mutation/adapters/node/node-known-file-recovery-state.js +17 -0
- package/dist/repository-mutation/adapters/node/node-known-file-recovery-state.js.map +1 -0
- package/dist/repository-mutation/adapters/node/node-known-file-transaction-recovery.d.ts +2 -5
- package/dist/repository-mutation/adapters/node/node-known-file-transaction-recovery.d.ts.map +1 -1
- package/dist/repository-mutation/adapters/node/node-known-file-transaction-recovery.js +18 -860
- package/dist/repository-mutation/adapters/node/node-known-file-transaction-recovery.js.map +1 -1
- package/dist/repository-mutation/adapters/node/node-known-file-transaction.d.ts +3 -9
- package/dist/repository-mutation/adapters/node/node-known-file-transaction.d.ts.map +1 -1
- package/dist/repository-mutation/adapters/node/node-known-file-transaction.js +35 -451
- package/dist/repository-mutation/adapters/node/node-known-file-transaction.js.map +1 -1
- package/dist/repository-mutation/application/policies/classify-known-file-recovery-transition.d.ts +25 -0
- package/dist/repository-mutation/application/policies/classify-known-file-recovery-transition.d.ts.map +1 -0
- package/dist/repository-mutation/application/policies/classify-known-file-recovery-transition.js +19 -0
- package/dist/repository-mutation/application/policies/classify-known-file-recovery-transition.js.map +1 -0
- package/dist/unexpected-failure.d.ts +9 -0
- package/dist/unexpected-failure.d.ts.map +1 -0
- package/dist/unexpected-failure.js +105 -0
- package/dist/unexpected-failure.js.map +1 -0
- package/package.json +5 -1
|
@@ -0,0 +1,159 @@
|
|
|
1
|
+
import { join } from "node:path";
|
|
2
|
+
import { serializeKnownFileIdentity } from "../../application/model/known-file-transaction-journal.js";
|
|
3
|
+
import { syncDirectoryStrictly } from "./node-directory-durability.js";
|
|
4
|
+
import { captureKnownFilePreimage, ensureKnownFileParentDirectories, prepareKnownFileCapture, prepareKnownFileRollback, prepareKnownFileTemporary, publishKnownFileLink, retireKnownFileDestination, unlinkKnownFileTemporary, verifyKnownFileTemporary } from "./node-known-file-apply-effects.js";
|
|
5
|
+
import { persistKnownFileApplyState, transitionKnownFileOperation } from "./node-known-file-apply-state.js";
|
|
6
|
+
import { KnownFileTransactionError, matchesKnownFileImage, observeKnownFile, sameKnownFileIdentity } from "./node-known-file-transaction-filesystem.js";
|
|
7
|
+
async function transitionAndCheckpoint(context, transition, phase) {
|
|
8
|
+
const operation = context.stored.envelope.journal.plan.operations[context.index];
|
|
9
|
+
const journal = transitionKnownFileOperation(context.stored.envelope.journal, context.index, transition);
|
|
10
|
+
await persistKnownFileApplyState(context.store, context.stored, journal);
|
|
11
|
+
await context.faultInjector?.({
|
|
12
|
+
phase,
|
|
13
|
+
operationIndex: context.index,
|
|
14
|
+
path: operation.path
|
|
15
|
+
});
|
|
16
|
+
}
|
|
17
|
+
async function publishPreparedLink(context, replacement) {
|
|
18
|
+
const operation = context.stored.envelope.journal.plan.operations[context.index];
|
|
19
|
+
await transitionAndCheckpoint(context, { state: "publishing" }, "after-operation-publishing");
|
|
20
|
+
await publishKnownFileLink({
|
|
21
|
+
destination: context.destination,
|
|
22
|
+
operationPath: operation.path,
|
|
23
|
+
temporaryPath: context.temporary.path,
|
|
24
|
+
replacement
|
|
25
|
+
});
|
|
26
|
+
await context.faultInjector?.({
|
|
27
|
+
phase: "after-postimage-linked",
|
|
28
|
+
operationIndex: context.index,
|
|
29
|
+
path: operation.path
|
|
30
|
+
});
|
|
31
|
+
await unlinkKnownFileTemporary(context.temporary.path);
|
|
32
|
+
}
|
|
33
|
+
async function prepareCapture(context) {
|
|
34
|
+
const operation = context.stored.envelope.journal.plan.operations[context.index];
|
|
35
|
+
await transitionAndCheckpoint(context, { state: "capture-authorized" }, "after-capture-authorized");
|
|
36
|
+
const capture = await prepareKnownFileCapture({
|
|
37
|
+
operation,
|
|
38
|
+
operationIndex: context.index,
|
|
39
|
+
parent: context.parent,
|
|
40
|
+
planDigest: context.stored.envelope.journal.plan.planDigest
|
|
41
|
+
});
|
|
42
|
+
await context.faultInjector?.({
|
|
43
|
+
phase: "after-capture-created-unbound",
|
|
44
|
+
operationIndex: context.index,
|
|
45
|
+
path: operation.path
|
|
46
|
+
});
|
|
47
|
+
await transitionAndCheckpoint(context, {
|
|
48
|
+
captureDirectoryIdentity: serializeKnownFileIdentity(capture.identity),
|
|
49
|
+
state: "capture-ready"
|
|
50
|
+
}, "after-capture-ready");
|
|
51
|
+
return capture;
|
|
52
|
+
}
|
|
53
|
+
async function executeKnownFileReplacement(context) {
|
|
54
|
+
const operation = context.stored.envelope.journal.plan.operations[context.index];
|
|
55
|
+
if (operation.precondition.state !== "known-file") {
|
|
56
|
+
throw new KnownFileTransactionError("KNOWN_FILE_JOURNAL_INVALID", `Replacement operation has no known preimage: ${operation.path}.`);
|
|
57
|
+
}
|
|
58
|
+
const capture = await prepareCapture(context);
|
|
59
|
+
const captured = await captureKnownFilePreimage({
|
|
60
|
+
capture,
|
|
61
|
+
operation: { ...operation, precondition: operation.precondition },
|
|
62
|
+
root: context.root
|
|
63
|
+
});
|
|
64
|
+
await context.faultInjector?.({
|
|
65
|
+
phase: "after-preimage-linked-unbound",
|
|
66
|
+
operationIndex: context.index,
|
|
67
|
+
path: operation.path
|
|
68
|
+
});
|
|
69
|
+
await transitionAndCheckpoint(context, {
|
|
70
|
+
capturedPreimageIdentity: serializeKnownFileIdentity(captured.identity),
|
|
71
|
+
matchedPreimage: captured.matchedPreimage,
|
|
72
|
+
state: "preimage-captured"
|
|
73
|
+
}, "after-preimage-captured");
|
|
74
|
+
await prepareKnownFileRollback({
|
|
75
|
+
...(context.faultInjector === undefined ? {} : { faultInjector: context.faultInjector }),
|
|
76
|
+
index: context.index,
|
|
77
|
+
operation: { ...operation, precondition: operation.precondition },
|
|
78
|
+
parent: context.parent,
|
|
79
|
+
preimageIndex: captured.matchedPreimage,
|
|
80
|
+
store: context.store,
|
|
81
|
+
stored: context.stored
|
|
82
|
+
});
|
|
83
|
+
await retireKnownFileDestination({
|
|
84
|
+
capture,
|
|
85
|
+
capturedIdentity: captured.identity,
|
|
86
|
+
destination: context.destination,
|
|
87
|
+
...(context.faultInjector === undefined ? {} : { faultInjector: context.faultInjector }),
|
|
88
|
+
index: context.index,
|
|
89
|
+
operationPath: operation.path,
|
|
90
|
+
parent: context.parent,
|
|
91
|
+
preimage: operation.precondition.acceptedPreimages[captured.matchedPreimage]
|
|
92
|
+
});
|
|
93
|
+
await transitionAndCheckpoint(context, { state: "destination-retired" }, "after-destination-retired");
|
|
94
|
+
await publishPreparedLink(context, true);
|
|
95
|
+
}
|
|
96
|
+
async function verifyPublishedPostimage(context) {
|
|
97
|
+
const operation = context.stored.envelope.journal.plan.operations[context.index];
|
|
98
|
+
await syncDirectoryStrictly(context.parent);
|
|
99
|
+
const published = await observeKnownFile(context.root, operation.path, operation.postimage.size);
|
|
100
|
+
if (!matchesKnownFileImage(published, operation.postimage) || published.identity === undefined ||
|
|
101
|
+
!sameKnownFileIdentity(published.identity, context.temporary.identity)) {
|
|
102
|
+
throw new KnownFileTransactionError("KNOWN_FILE_POSTIMAGE_INVALID", `Published postimage failed exact verification: ${operation.path}.`);
|
|
103
|
+
}
|
|
104
|
+
await transitionAndCheckpoint(context, { state: "published" }, "after-operation-published");
|
|
105
|
+
}
|
|
106
|
+
export async function executeKnownFileOperation(options) {
|
|
107
|
+
const operation = options.stored.envelope.journal.plan.operations[options.index];
|
|
108
|
+
const journalOperation = options.stored.envelope.journal.operations[options.index];
|
|
109
|
+
if (journalOperation.state === "already-satisfied" || journalOperation.state === "published") {
|
|
110
|
+
return;
|
|
111
|
+
}
|
|
112
|
+
if (journalOperation.state !== "pending") {
|
|
113
|
+
throw new KnownFileTransactionError("KNOWN_FILE_RECOVERY_REQUIRED", `Operation ${operation.path} is already in progress and requires recovery.`);
|
|
114
|
+
}
|
|
115
|
+
const parent = await ensureKnownFileParentDirectories({
|
|
116
|
+
...options,
|
|
117
|
+
operationPath: operation.path
|
|
118
|
+
});
|
|
119
|
+
const temporaryContext = {
|
|
120
|
+
destination: join(options.root, ...operation.path.split("/")),
|
|
121
|
+
...options,
|
|
122
|
+
parent
|
|
123
|
+
};
|
|
124
|
+
const authorized = transitionKnownFileOperation(options.stored.envelope.journal, options.index, { state: "temporary-authorized" });
|
|
125
|
+
await persistKnownFileApplyState(options.store, options.stored, authorized);
|
|
126
|
+
await options.faultInjector?.({
|
|
127
|
+
phase: "after-temporary-authorized",
|
|
128
|
+
operationIndex: options.index,
|
|
129
|
+
path: operation.path
|
|
130
|
+
});
|
|
131
|
+
const temporary = await prepareKnownFileTemporary({
|
|
132
|
+
operation,
|
|
133
|
+
operationIndex: options.index,
|
|
134
|
+
parent,
|
|
135
|
+
planDigest: options.stored.envelope.journal.plan.planDigest
|
|
136
|
+
});
|
|
137
|
+
await options.faultInjector?.({
|
|
138
|
+
phase: "after-temporary-created-unbound",
|
|
139
|
+
operationIndex: options.index,
|
|
140
|
+
path: operation.path
|
|
141
|
+
});
|
|
142
|
+
const ready = transitionKnownFileOperation(options.stored.envelope.journal, options.index, { state: "temporary-ready", temporaryIdentity: serializeKnownFileIdentity(temporary.identity) });
|
|
143
|
+
await persistKnownFileApplyState(options.store, options.stored, ready);
|
|
144
|
+
await options.faultInjector?.({
|
|
145
|
+
phase: "after-temporary-synced",
|
|
146
|
+
operationIndex: options.index,
|
|
147
|
+
path: operation.path
|
|
148
|
+
});
|
|
149
|
+
await verifyKnownFileTemporary(temporary, operation.postimage);
|
|
150
|
+
const context = { ...temporaryContext, temporary };
|
|
151
|
+
if (operation.precondition.state === "absent") {
|
|
152
|
+
await publishPreparedLink(context, false);
|
|
153
|
+
}
|
|
154
|
+
else {
|
|
155
|
+
await executeKnownFileReplacement(context);
|
|
156
|
+
}
|
|
157
|
+
await verifyPublishedPostimage(context);
|
|
158
|
+
}
|
|
159
|
+
//# sourceMappingURL=node-known-file-apply-operation.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"node-known-file-apply-operation.js","sourceRoot":"","sources":["../../../../src/repository-mutation/adapters/node/node-known-file-apply-operation.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AAEjC,OAAO,EAAE,0BAA0B,EAAE,MAAM,2DAA2D,CAAC;AACvG,OAAO,EAAE,qBAAqB,EAAE,MAAM,gCAAgC,CAAC;AACvE,OAAO,EACL,wBAAwB,EACxB,gCAAgC,EAChC,uBAAuB,EACvB,wBAAwB,EACxB,yBAAyB,EACzB,oBAAoB,EACpB,0BAA0B,EAC1B,wBAAwB,EACxB,wBAAwB,EAGzB,MAAM,oCAAoC,CAAC;AAE5C,OAAO,EACL,0BAA0B,EAC1B,4BAA4B,EAE7B,MAAM,kCAAkC,CAAC;AAC1C,OAAO,EACL,yBAAyB,EACzB,qBAAqB,EACrB,gBAAgB,EAChB,qBAAqB,EACtB,MAAM,6CAA6C,CAAC;AAcrD,KAAK,UAAU,uBAAuB,CACpC,OAAyB,EACzB,UAA8D,EAC9D,KAA6E;IAE7E,MAAM,SAAS,GAAG,OAAO,CAAC,MAAM,CAAC,QAAQ,CAAC,OAAO,CAAC,IAAI,CAAC,UAAU,CAAC,OAAO,CAAC,KAAK,CAAE,CAAC;IAClF,MAAM,OAAO,GAAG,4BAA4B,CAC1C,OAAO,CAAC,MAAM,CAAC,QAAQ,CAAC,OAAO,EAC/B,OAAO,CAAC,KAAK,EACb,UAAU,CACX,CAAC;IACF,MAAM,0BAA0B,CAAC,OAAO,CAAC,KAAK,EAAE,OAAO,CAAC,MAAM,EA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CAAC,CAAC;IACH,MAAM,KAAK,GAAG,4BAA4B,CACxC,OAAO,CAAC,MAAM,CAAC,QAAQ,CAAC,OAAO,EAC/B,OAAO,CAAC,KAAK,EACb,EAAE,KAAK,EAAE,iBAAiB,EAAE,iBAAiB,EAAE,0BAA0B,CAAC,SAAS,CAAC,QAAQ,CAAC,EAAE,CAChG,CAAC;IACF,MAAM,0BAA0B,CAAC,OAAO,CAAC,KAAK,EAAE,OAAO,CAAC,MAAM,EAAE,KAAK,CAAC,CAAC;IACvE,MAAM,OAAO,CAAC,aAAa,EAAE,CAAC;QAC5B,KAAK,EAAE,wBAAwB;QAC/B,cAAc,EAAE,OAAO,CAAC,KAAK;QAC7B,IAAI,EAAE,SAAS,CAAC,IAAI;KACrB,CAAC,CAAC;IACH,MAAM,wBAAwB,CAAC,SAAS,EAAE,SAAS,CAAC,SAAS,CAAC,CAAC;IAC/D,MAAM,OAAO,GAAqB,EAAE,GAAG,gBAAgB,EAAE,SAAS,EAAE,CAAC;IACrE,IAAI,SAAS,CAAC,YAAY,CAAC,KAAK,KAAK,QAAQ,EAAE,CAAC;QAC9C,MAAM,mBAAmB,CAAC,OAAO,EAAE,KAAK,CAAC,CAAC;IAC5C,CAAC;SAAM,CAAC;QACN,MAAM,2BAA2B,CAAC,OAAO,CAAC,CAAC;IAC7C,CAAC;IACD,MAAM,wBAAwB,CAAC,OAAO,CAAC,CAAC;AAC1C,CAAC"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import type { KnownFileTransactionEnvelopeV1, KnownFileTransactionJournalOperationV1, KnownFileTransactionJournalV1 } from "../../application/model/known-file-transaction-journal.js";
|
|
2
|
+
import type { KnownFileJournalAuthority, NodeKnownFileTransactionJournalStore } from "./node-known-file-transaction-journal-store.js";
|
|
3
|
+
export interface KnownFileApplyState {
|
|
4
|
+
authority: KnownFileJournalAuthority;
|
|
5
|
+
envelope: KnownFileTransactionEnvelopeV1;
|
|
6
|
+
}
|
|
7
|
+
export declare function transitionKnownFileOperation(journal: KnownFileTransactionJournalV1, index: number, transition: Partial<KnownFileTransactionJournalOperationV1>): KnownFileTransactionJournalV1;
|
|
8
|
+
export declare function persistKnownFileApplyState(store: NodeKnownFileTransactionJournalStore, stored: KnownFileApplyState, journal: KnownFileTransactionJournalV1, state?: KnownFileTransactionEnvelopeV1["state"]): Promise<void>;
|
|
9
|
+
//# sourceMappingURL=node-known-file-apply-state.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"node-known-file-apply-state.d.ts","sourceRoot":"","sources":["../../../../src/repository-mutation/adapters/node/node-known-file-apply-state.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,8BAA8B,EAC9B,sCAAsC,EACtC,6BAA6B,EAC9B,MAAM,2DAA2D,CAAC;AAEnE,OAAO,KAAK,EACV,yBAAyB,EACzB,oCAAoC,EACrC,MAAM,gDAAgD,CAAC;AAExD,MAAM,WAAW,mBAAmB;IAClC,SAAS,EAAE,yBAAyB,CAAC;IACrC,QAAQ,EAAE,8BAA8B,CAAC;CAC1C;AAaD,wBAAgB,4BAA4B,CAC1C,OAAO,EAAE,6BAA6B,EACtC,KAAK,EAAE,MAAM,EACb,UAAU,EAAE,OAAO,CAAC,sCAAsC,CAAC,GAC1D,6BAA6B,CAO/B;AAED,wBAAsB,0BAA0B,CAC9C,KAAK,EAAE,oCAAoC,EAC3C,MAAM,EAAE,mBAAmB,EAC3B,OAAO,EAAE,6BAA6B,EACtC,KAAK,GAAE,8BAA8B,CAAC,OAAO,CAAc,GAC1D,OAAO,CAAC,IAAI,CAAC,CAQf"}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { compileKnownFileTransactionEnvelope } from "../../application/policies/known-file-transaction-envelope.js";
|
|
2
|
+
function replaceKnownFileOperation(journal, index, replacement) {
|
|
3
|
+
return Object.freeze({
|
|
4
|
+
...journal,
|
|
5
|
+
operations: Object.freeze(journal.operations.with(index, replacement))
|
|
6
|
+
});
|
|
7
|
+
}
|
|
8
|
+
export function transitionKnownFileOperation(journal, index, transition) {
|
|
9
|
+
const current = journal.operations[index];
|
|
10
|
+
return replaceKnownFileOperation(journal, index, Object.freeze({ ...current, ...transition }));
|
|
11
|
+
}
|
|
12
|
+
export async function persistKnownFileApplyState(store, stored, journal, state = "APPLYING") {
|
|
13
|
+
const envelope = compileKnownFileTransactionEnvelope({
|
|
14
|
+
foundation: stored.envelope.foundation,
|
|
15
|
+
journal,
|
|
16
|
+
state
|
|
17
|
+
});
|
|
18
|
+
stored.authority = await store.replace(stored.authority, envelope);
|
|
19
|
+
stored.envelope = envelope;
|
|
20
|
+
}
|
|
21
|
+
//# sourceMappingURL=node-known-file-apply-state.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"node-known-file-apply-state.js","sourceRoot":"","sources":["../../../../src/repository-mutation/adapters/node/node-known-file-apply-state.ts"],"names":[],"mappings":"AAKA,OAAO,EAAE,mCAAmC,EAAE,MAAM,+DAA+D,CAAC;AAWpH,SAAS,yBAAyB,CAChC,OAAsC,EACtC,KAAa,EACb,WAAmD;IAEnD,OAAO,MAAM,CAAC,MAAM,CAAC;QACnB,GAAG,OAAO;QACV,UAAU,EAAE,MAAM,CAAC,MAAM,CAAC,OAAO,CAAC,UAAU,CAAC,IAAI,CAAC,KAAK,EAAE,WAAW,CAAC,CAAC;KACvE,CAAC,CAAC;AACL,CAAC;AAED,MAAM,UAAU,4BAA4B,CAC1C,OAAsC,EACtC,KAAa,EACb,UAA2D;IAE3D,MAAM,OAAO,GAAG,OAAO,CAAC,UAAU,CAAC,KAAK,CAAE,CAAC;IAC3C,OAAO,yBAAyB,CAC9B,OAAO,EACP,KAAK,EACL,MAAM,CAAC,MAAM,CAAC,EAAE,GAAG,OAAO,EAAE,GAAG,UAAU,EAAE,CAA2C,CACvF,CAAC;AACJ,CAAC;AAED,MAAM,CAAC,KAAK,UAAU,0BAA0B,CAC9C,KAA2C,EAC3C,MAA2B,EAC3B,OAAsC,EACtC,KAAK,GAA4C,UAAU;IAE3D,MAAM,QAAQ,GAAG,mCAAmC,CAAC;QACnD,UAAU,EAAE,MAAM,CAAC,QAAQ,CAAC,UAAU;QACtC,OAAO;QACP,KAAK;KACN,CAAC,CAAC;IACH,MAAM,CAAC,SAAS,GAAG,MAAM,KAAK,CAAC,OAAO,CAAC,MAAM,CAAC,SAAS,EAAE,QAAQ,CAAC,CAAC;IACnE,MAAM,CAAC,QAAQ,GAAG,QAAQ,CAAC;AAC7B,CAAC"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import type { KnownFileRecoveryFaultInjector, StoredRecoveryJournal } from "./node-known-file-recovery-state.js";
|
|
2
|
+
import type { NodeKnownFileTransactionJournalStore } from "./node-known-file-transaction-journal-store.js";
|
|
3
|
+
export declare function rollbackKnownFileRecovery(options: {
|
|
4
|
+
readonly faultInjector?: KnownFileRecoveryFaultInjector;
|
|
5
|
+
readonly root: string;
|
|
6
|
+
readonly store: NodeKnownFileTransactionJournalStore;
|
|
7
|
+
readonly stored: StoredRecoveryJournal;
|
|
8
|
+
}): Promise<void>;
|
|
9
|
+
//# sourceMappingURL=node-known-file-recovery-cleanup.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"node-known-file-recovery-cleanup.d.ts","sourceRoot":"","sources":["../../../../src/repository-mutation/adapters/node/node-known-file-recovery-cleanup.ts"],"names":[],"mappings":"AAkBA,OAAO,KAAK,EACV,8BAA8B,EAC9B,qBAAqB,EACtB,MAAM,qCAAqC,CAAC;AAC7C,OAAO,KAAK,EAAE,oCAAoC,EAAE,MAAM,gDAAgD,CAAC;AAyK3G,wBAAsB,yBAAyB,CAAC,OAAO,EAAE;IACvD,QAAQ,CAAC,aAAa,CAAC,EAAE,8BAA8B,CAAC;IACxD,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,KAAK,EAAE,oCAAoC,CAAC;IACrD,QAAQ,CAAC,MAAM,EAAE,qBAAqB,CAAC;CACxC,GAAG,OAAO,CAAC,IAAI,CAAC,CA2DhB"}
|
|
@@ -0,0 +1,203 @@
|
|
|
1
|
+
import { lstat, rmdir } from "node:fs/promises";
|
|
2
|
+
import { basename, dirname, join } from "node:path";
|
|
3
|
+
import { deserializeKnownFileIdentity } from "../../application/model/known-file-transaction-journal.js";
|
|
4
|
+
import { readBoundedRegularFile } from "./node-bounded-regular-file.js";
|
|
5
|
+
import { syncDirectoryStrictly } from "./node-directory-durability.js";
|
|
6
|
+
import { knownFileErrorCode, knownFileTemporaryName, KnownFileTransactionError, matchesKnownFileImage, sameKnownFileIdentity } from "./node-known-file-transaction-filesystem.js";
|
|
7
|
+
import { knownFileCapturePaths } from "./node-known-file-recovery-filesystem.js";
|
|
8
|
+
import { restorePreimage } from "./node-known-file-recovery-preimage.js";
|
|
9
|
+
import { retireJournalBoundPath } from "./node-known-file-recovery-retirement.js";
|
|
10
|
+
async function cleanupOperationTemporaries(options) {
|
|
11
|
+
const operation = options.stored.envelope.journal.plan.operations[options.operationIndex];
|
|
12
|
+
const journalOperation = options.stored.envelope.journal.operations[options.operationIndex];
|
|
13
|
+
const parent = dirname(join(options.root, ...operation.path.split("/")));
|
|
14
|
+
const candidates = [
|
|
15
|
+
{
|
|
16
|
+
identity: "temporaryIdentity" in journalOperation
|
|
17
|
+
? deserializeKnownFileIdentity(journalOperation.temporaryIdentity)
|
|
18
|
+
: undefined,
|
|
19
|
+
image: operation.postimage,
|
|
20
|
+
kind: "temporary",
|
|
21
|
+
authorizedWithoutIdentity: journalOperation.state === "temporary-authorized",
|
|
22
|
+
path: join(parent, knownFileTemporaryName(operation.path, options.stored.envelope.journal.plan.planDigest, options.operationIndex))
|
|
23
|
+
},
|
|
24
|
+
...(operation.precondition.state === "known-file" &&
|
|
25
|
+
journalOperation.matchedPreimage !== undefined
|
|
26
|
+
? [{
|
|
27
|
+
identity: journalOperation.rollbackTemporaryIdentity === undefined
|
|
28
|
+
? undefined
|
|
29
|
+
: deserializeKnownFileIdentity(journalOperation.rollbackTemporaryIdentity),
|
|
30
|
+
image: operation.precondition.acceptedPreimages[journalOperation.matchedPreimage],
|
|
31
|
+
kind: "rollback-temporary",
|
|
32
|
+
path: join(parent, `.${basename(operation.path)}.agent-teams.rollback.${options.operationIndex}.tmp`)
|
|
33
|
+
}]
|
|
34
|
+
: [])
|
|
35
|
+
];
|
|
36
|
+
for (const candidate of candidates) {
|
|
37
|
+
let observed;
|
|
38
|
+
try {
|
|
39
|
+
observed = await readBoundedRegularFile(candidate.path, candidate.image.size);
|
|
40
|
+
}
|
|
41
|
+
catch (error) {
|
|
42
|
+
if (knownFileErrorCode(error) === "ENOENT") {
|
|
43
|
+
continue;
|
|
44
|
+
}
|
|
45
|
+
throw error;
|
|
46
|
+
}
|
|
47
|
+
if (observed.outcome !== "read" || !matchesKnownFileImage({
|
|
48
|
+
state: "file", bytes: observed.bytes, identity: observed.identity,
|
|
49
|
+
mode: observed.mode & 0o777
|
|
50
|
+
}, candidate.image)) {
|
|
51
|
+
throw new KnownFileTransactionError("KNOWN_FILE_RECOVERY_CONFLICT", `Transaction temporary is foreign or modified: ${operation.path}.`);
|
|
52
|
+
}
|
|
53
|
+
if (candidate.identity === undefined && candidate.authorizedWithoutIdentity === true) {
|
|
54
|
+
throw new KnownFileTransactionError("KNOWN_FILE_RECOVERY_CONFLICT", `Authorized temporary exists without durable ownership identity: ${operation.path}.`);
|
|
55
|
+
}
|
|
56
|
+
if (candidate.identity === undefined ||
|
|
57
|
+
!sameKnownFileIdentity(observed.identity, candidate.identity)) {
|
|
58
|
+
throw new KnownFileTransactionError("KNOWN_FILE_RECOVERY_CONFLICT", `Transaction temporary identity is absent or changed: ${operation.path}.`);
|
|
59
|
+
}
|
|
60
|
+
await retireJournalBoundPath({
|
|
61
|
+
expectedIdentity: candidate.identity,
|
|
62
|
+
kind: candidate.kind,
|
|
63
|
+
operationIndex: options.operationIndex,
|
|
64
|
+
root: options.root,
|
|
65
|
+
store: options.store,
|
|
66
|
+
stored: options.stored
|
|
67
|
+
});
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
async function cleanupAuthorizedCapture(options) {
|
|
71
|
+
const operation = options.journal.plan.operations[options.operationIndex];
|
|
72
|
+
const parent = dirname(join(options.root, ...operation.path.split("/")));
|
|
73
|
+
const paths = knownFileCapturePaths({
|
|
74
|
+
operationIndex: options.operationIndex,
|
|
75
|
+
operationPath: operation.path,
|
|
76
|
+
parent,
|
|
77
|
+
planDigest: options.journal.plan.planDigest
|
|
78
|
+
});
|
|
79
|
+
const metadata = await lstat(paths.directory).catch((error) => {
|
|
80
|
+
if (knownFileErrorCode(error) === "ENOENT") {
|
|
81
|
+
return null;
|
|
82
|
+
}
|
|
83
|
+
throw error;
|
|
84
|
+
});
|
|
85
|
+
if (metadata === null) {
|
|
86
|
+
return;
|
|
87
|
+
}
|
|
88
|
+
if (!metadata.isDirectory() || metadata.isSymbolicLink()) {
|
|
89
|
+
throw new KnownFileTransactionError("KNOWN_FILE_RECOVERY_CONFLICT", `Authorized capture path is foreign: ${operation.path}.`);
|
|
90
|
+
}
|
|
91
|
+
throw new KnownFileTransactionError("KNOWN_FILE_RECOVERY_CONFLICT", `Authorized capture exists without durable ownership identity: ${operation.path}.`);
|
|
92
|
+
}
|
|
93
|
+
async function removeAuthorizedDirectories(root, directories) {
|
|
94
|
+
for (const repositoryPath of directories.toReversed()) {
|
|
95
|
+
const path = join(root, ...repositoryPath.split("/"));
|
|
96
|
+
const metadata = await lstat(path).catch((error) => {
|
|
97
|
+
if (knownFileErrorCode(error) === "ENOENT") {
|
|
98
|
+
return null;
|
|
99
|
+
}
|
|
100
|
+
throw error;
|
|
101
|
+
});
|
|
102
|
+
if (metadata === null) {
|
|
103
|
+
continue;
|
|
104
|
+
}
|
|
105
|
+
if (!metadata.isDirectory() || metadata.isSymbolicLink()) {
|
|
106
|
+
throw new KnownFileTransactionError("KNOWN_FILE_RECOVERY_CONFLICT", `Authorized directory path is foreign: ${repositoryPath}.`);
|
|
107
|
+
}
|
|
108
|
+
throw new KnownFileTransactionError("KNOWN_FILE_RECOVERY_CONFLICT", `Authorized directory exists without durable ownership identity: ${repositoryPath}.`);
|
|
109
|
+
}
|
|
110
|
+
}
|
|
111
|
+
async function removeCreatedDirectories(root, directories) {
|
|
112
|
+
for (const directory of directories.toReversed()) {
|
|
113
|
+
const path = join(root, ...directory.path.split("/"));
|
|
114
|
+
let metadata;
|
|
115
|
+
try {
|
|
116
|
+
metadata = await lstat(path, { bigint: true });
|
|
117
|
+
}
|
|
118
|
+
catch (error) {
|
|
119
|
+
if (knownFileErrorCode(error) === "ENOENT") {
|
|
120
|
+
continue;
|
|
121
|
+
}
|
|
122
|
+
throw error;
|
|
123
|
+
}
|
|
124
|
+
const expected = deserializeKnownFileIdentity(directory.identity);
|
|
125
|
+
if (!metadata.isDirectory() || metadata.isSymbolicLink() ||
|
|
126
|
+
metadata.dev !== expected.dev || metadata.ino !== expected.ino ||
|
|
127
|
+
metadata.birthtimeNs !== expected.birthtimeNs) {
|
|
128
|
+
throw new KnownFileTransactionError("KNOWN_FILE_RECOVERY_CONFLICT", `Transaction-created directory changed before cleanup: ${directory.path}.`);
|
|
129
|
+
}
|
|
130
|
+
try {
|
|
131
|
+
await rmdir(path);
|
|
132
|
+
await syncDirectoryStrictly(dirname(path));
|
|
133
|
+
}
|
|
134
|
+
catch (error) {
|
|
135
|
+
if (knownFileErrorCode(error) !== "ENOTEMPTY") {
|
|
136
|
+
throw error;
|
|
137
|
+
}
|
|
138
|
+
}
|
|
139
|
+
}
|
|
140
|
+
}
|
|
141
|
+
export async function rollbackKnownFileRecovery(options) {
|
|
142
|
+
for (let index = options.stored.envelope.journal.operations.length - 1; index >= 0; index -= 1) {
|
|
143
|
+
let journalOperation = options.stored.envelope.journal.operations[index];
|
|
144
|
+
if (journalOperation.retirement !== undefined) {
|
|
145
|
+
await retireJournalBoundPath({
|
|
146
|
+
expectedIdentity: deserializeKnownFileIdentity(journalOperation.retirement.pathIdentity),
|
|
147
|
+
...(options.faultInjector === undefined ? {} : { faultInjector: options.faultInjector }),
|
|
148
|
+
kind: journalOperation.retirement.kind,
|
|
149
|
+
operationIndex: index,
|
|
150
|
+
root: options.root,
|
|
151
|
+
store: options.store,
|
|
152
|
+
stored: options.stored
|
|
153
|
+
});
|
|
154
|
+
journalOperation = options.stored.envelope.journal.operations[index];
|
|
155
|
+
}
|
|
156
|
+
if (journalOperation.state === "capture-authorized") {
|
|
157
|
+
await cleanupAuthorizedCapture({
|
|
158
|
+
journal: options.stored.envelope.journal,
|
|
159
|
+
operationIndex: index,
|
|
160
|
+
root: options.root
|
|
161
|
+
});
|
|
162
|
+
continue;
|
|
163
|
+
}
|
|
164
|
+
if (![
|
|
165
|
+
"capture-ready", "preimage-captured", "destination-retired",
|
|
166
|
+
"publishing", "published", "rollback-restored"
|
|
167
|
+
].includes(journalOperation.state)) {
|
|
168
|
+
continue;
|
|
169
|
+
}
|
|
170
|
+
await restorePreimage({
|
|
171
|
+
...(options.faultInjector === undefined ? {} : { faultInjector: options.faultInjector }),
|
|
172
|
+
operation: options.stored.envelope.journal.plan.operations[index],
|
|
173
|
+
operationIndex: index,
|
|
174
|
+
root: options.root,
|
|
175
|
+
store: options.store,
|
|
176
|
+
stored: options.stored
|
|
177
|
+
});
|
|
178
|
+
await cleanupOperationTemporaries({
|
|
179
|
+
operationIndex: index,
|
|
180
|
+
root: options.root,
|
|
181
|
+
store: options.store,
|
|
182
|
+
stored: options.stored
|
|
183
|
+
});
|
|
184
|
+
}
|
|
185
|
+
for (let index = options.stored.envelope.journal.operations.length - 1; index >= 0; index -= 1) {
|
|
186
|
+
const journal = options.stored.envelope.journal;
|
|
187
|
+
if (![
|
|
188
|
+
"capture-ready", "preimage-captured", "destination-retired",
|
|
189
|
+
"publishing", "published", "rollback-restored"
|
|
190
|
+
].includes(journal.operations[index].state)) {
|
|
191
|
+
await cleanupOperationTemporaries({
|
|
192
|
+
operationIndex: index,
|
|
193
|
+
root: options.root,
|
|
194
|
+
store: options.store,
|
|
195
|
+
stored: options.stored
|
|
196
|
+
});
|
|
197
|
+
}
|
|
198
|
+
}
|
|
199
|
+
const journal = options.stored.envelope.journal;
|
|
200
|
+
await removeCreatedDirectories(options.root, journal.createdDirectories);
|
|
201
|
+
await removeAuthorizedDirectories(options.root, journal.authorizedDirectories);
|
|
202
|
+
}
|
|
203
|
+
//# sourceMappingURL=node-known-file-recovery-cleanup.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"node-known-file-recovery-cleanup.js","sourceRoot":"","sources":["../../../../src/repository-mutation/adapters/node/node-known-file-recovery-cleanup.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,KAAK,EAAE,MAAM,kBAAkB,CAAC;AAChD,OAAO,EAAE,QAAQ,EAAE,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AAIpD,OAAO,EAAE,4BAA4B,EAAE,MAAM,2DAA2D,CAAC;AACzG,OAAO,EAAE,sBAAsB,EAAE,MAAM,gCAAgC,CAAC;AACxE,OAAO,EAAE,qBAAqB,EAAE,MAAM,gCAAgC,CAAC;AACvE,OAAO,EACL,kBAAkB,EAClB,sBAAsB,EACtB,yBAAyB,EACzB,qBAAqB,EACrB,qBAAqB,EACtB,MAAM,6CAA6C,CAAC;AACrD,OAAO,EAAE,qBAAqB,EAAE,MAAM,0CAA0C,CAAC;AACjF,OAAO,EAAE,eAAe,EAAE,MAAM,wCAAwC,CAAC;AACzE,OAAO,EAAE,sBAAsB,EAAE,MAAM,0CAA0C,CAAC;AAOlF,KAAK,UAAU,2BAA2B,CAAC,OAK1C;IACC,MAAM,SAAS,GAAG,OAAO,CAAC,MAAM,CAAC,QAAQ,CAAC,OAAO,CAAC,IAAI,CAAC,UAAU,CAAC,OAAO,CAAC,cAAc,CAAE,CAAC;IAC3F,MAAM,gBAAgB,GAAG,OAAO,CAAC,MAAM,CAAC,QAAQ,CAAC,OAAO,CAA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B,CAAC,OAAO,CAAC,IAAI,EAAE,OAAO,CAAC,qBAAqB,CAAC,CAAC;AACjF,CAAC"}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import type { KnownFileTransactionReceiptV1 } from "../../application/model/known-file-transaction.js";
|
|
2
|
+
import { type KnownFileRecoveryFaultInjector, type StoredRecoveryJournal } from "./node-known-file-recovery-state.js";
|
|
3
|
+
import type { NodeKnownFileTransactionJournalStore } from "./node-known-file-transaction-journal-store.js";
|
|
4
|
+
export type { KnownFileRecoveryFaultInjector } from "./node-known-file-recovery-state.js";
|
|
5
|
+
export declare function executeCommittedKnownFileRecovery(options: {
|
|
6
|
+
readonly faultInjector?: KnownFileRecoveryFaultInjector;
|
|
7
|
+
readonly root: string;
|
|
8
|
+
readonly store: NodeKnownFileTransactionJournalStore;
|
|
9
|
+
readonly stored: StoredRecoveryJournal;
|
|
10
|
+
}): Promise<KnownFileTransactionReceiptV1>;
|
|
11
|
+
export declare function executeApplyingKnownFileRollback(options: {
|
|
12
|
+
readonly faultInjector?: KnownFileRecoveryFaultInjector;
|
|
13
|
+
readonly root: string;
|
|
14
|
+
readonly store: NodeKnownFileTransactionJournalStore;
|
|
15
|
+
readonly stored: StoredRecoveryJournal;
|
|
16
|
+
}): Promise<KnownFileTransactionReceiptV1>;
|
|
17
|
+
//# sourceMappingURL=node-known-file-recovery-executor.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"node-known-file-recovery-executor.d.ts","sourceRoot":"","sources":["../../../../src/repository-mutation/adapters/node/node-known-file-recovery-executor.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,6BAA6B,EAAE,MAAM,mDAAmD,CAAC;AAGvG,OAAO,EACL,KAAK,8BAA8B,EACnC,KAAK,qBAAqB,EAC3B,MAAM,qCAAqC,CAAC;AAC7C,OAAO,KAAK,EAAE,oCAAoC,EAAE,MAAM,gDAAgD,CAAC;AAQ3G,YAAY,EAAE,8BAA8B,EAAE,MAAM,qCAAqC,CAAC;AAE1F,wBAAsB,iCAAiC,CAAC,OAAO,EAAE;IAC/D,QAAQ,CAAC,aAAa,CAAC,EAAE,8BAA8B,CAAC;IACxD,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,KAAK,EAAE,oCAAoC,CAAC;IACrD,QAAQ,CAAC,MAAM,EAAE,qBAAqB,CAAC;CACxC,GAAG,OAAO,CAAC,6BAA6B,CAAC,CAczC;AAED,wBAAsB,gCAAgC,CAAC,OAAO,EAAE;IAC9D,QAAQ,CAAC,aAAa,CAAC,EAAE,8BAA8B,CAAC;IACxD,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,KAAK,EAAE,oCAAoC,CAAC;IACrD,QAAQ,CAAC,MAAM,EAAE,qBAAqB,CAAC;CACxC,GAAG,OAAO,CAAC,6BAA6B,CAAC,CAMzC"}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { cleanupCommittedKnownFileCaptures } from "./node-known-file-recovery-filesystem.js";
|
|
2
|
+
import { rollbackKnownFileRecovery } from "./node-known-file-recovery-cleanup.js";
|
|
3
|
+
import {} from "./node-known-file-recovery-state.js";
|
|
4
|
+
import { compileKnownFileTransactionReceipt, verifyCommittedKnownFilePostimages } from "./node-known-file-transaction.js";
|
|
5
|
+
import { compileRolledBackReceipt } from "./node-known-file-transaction-receipt.js";
|
|
6
|
+
import { verifyRolledBackKnownFileState } from "./node-known-file-recovery-observation.js";
|
|
7
|
+
export async function executeCommittedKnownFileRecovery(options) {
|
|
8
|
+
await verifyCommittedKnownFilePostimages(options.root, options.stored.envelope.journal);
|
|
9
|
+
await cleanupCommittedKnownFileCaptures(options.root, options.stored.envelope.journal, options.faultInjector);
|
|
10
|
+
await verifyCommittedKnownFilePostimages(options.root, options.stored.envelope.journal);
|
|
11
|
+
const result = compileKnownFileTransactionReceipt(options.stored.envelope.journal, "applied");
|
|
12
|
+
await options.store.remove(options.stored.authority);
|
|
13
|
+
return result;
|
|
14
|
+
}
|
|
15
|
+
export async function executeApplyingKnownFileRollback(options) {
|
|
16
|
+
await rollbackKnownFileRecovery(options);
|
|
17
|
+
await verifyRolledBackKnownFileState(options.root, options.stored.envelope.journal);
|
|
18
|
+
const result = compileRolledBackReceipt(options.stored.envelope.journal);
|
|
19
|
+
await options.store.remove(options.stored.authority);
|
|
20
|
+
return result;
|
|
21
|
+
}
|
|
22
|
+
//# sourceMappingURL=node-known-file-recovery-executor.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"node-known-file-recovery-executor.js","sourceRoot":"","sources":["../../../../src/repository-mutation/adapters/node/node-known-file-recovery-executor.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,iCAAiC,EAAE,MAAM,0CAA0C,CAAC;AAC7F,OAAO,EAAE,yBAAyB,EAAE,MAAM,uCAAuC,CAAC;AAClF,OAAO,EAGN,MAAM,qCAAqC,CAAC;AAE7C,OAAO,EACL,kCAAkC,EAClC,kCAAkC,EACnC,MAAM,kCAAkC,CAAC;AAC1C,OAAO,EAAE,wBAAwB,EAAE,MAAM,0CAA0C,CAAC;AACpF,OAAO,EAAE,8BAA8B,EAAE,MAAM,2CAA2C,CAAC;AAI3F,MAAM,CAAC,KAAK,UAAU,iCAAiC,CAAC,OAKvD;IACC,MAAM,kCAAkC,CAAC,OAAO,CAAC,IAAI,EAAE,OAAO,CAAC,MAAM,CAAC,QAAQ,CAAC,OAAO,CAAC,CAAC;IACxF,MAAM,iCAAiC,CACrC,OAAO,CAAC,IAAI,EACZ,OAAO,CAAC,MAAM,CAAC,QAAQ,CAAC,OAAO,EAC/B,OAAO,CAAC,aAAa,CACtB,CAAC;IACF,MAAM,kCAAkC,CAAC,OAAO,CAAC,IAAI,EAAE,OAAO,CAAC,MAAM,CAAC,QAAQ,CAAC,OAAO,CAAC,CAAC;IACxF,MAAM,MAAM,GAAG,kCAAkC,CAC/C,OAAO,CAAC,MAAM,CAAC,QAAQ,CAAC,OAAO,EAC/B,SAAS,CACV,CAAC;IACF,MAAM,OAAO,CAAC,KAAK,CAAC,MAAM,CAAC,OAAO,CAAC,MAAM,CAAC,SAAS,CAAC,CAAC;IACrD,OAAO,MAAM,CAAC;AAChB,CAAC;AAED,MAAM,CAAC,KAAK,UAAU,gCAAgC,CAAC,OAKtD;IACC,MAAM,yBAAyB,CAAC,OAAO,CAAC,CAAC;IACzC,MAAM,8BAA8B,CAAC,OAAO,CAAC,IAAI,EAAE,OAAO,CAAC,MAAM,CAAC,QAAQ,CAAC,OAAO,CAAC,CAAC;IACpF,MAAM,MAAM,GAAG,wBAAwB,CAAC,OAAO,CAAC,MAAM,CAAC,QAAQ,CAAC,OAAO,CAAC,CAAC;IACzE,MAAM,OAAO,CAAC,KAAK,CAAC,MAAM,CAAC,OAAO,CAAC,MAAM,CAAC,SAAS,CAAC,CAAC;IACrD,OAAO,MAAM,CAAC;AAChB,CAAC"}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import type { KnownFileTransactionEnvelopeV1, KnownFileTransactionJournalV1 } from "../../application/model/known-file-transaction-journal.js";
|
|
2
|
+
import type { InstalledKnownFileRecoveryBuild } from "../../application/policies/classify-known-file-recovery-transition.js";
|
|
3
|
+
import { NodeKnownFileTransactionJournalStore, type KnownFileJournalAuthority } from "./node-known-file-transaction-journal-store.js";
|
|
4
|
+
export interface StoredKnownFileRecoveryJournal {
|
|
5
|
+
authority: KnownFileJournalAuthority;
|
|
6
|
+
envelope: KnownFileTransactionEnvelopeV1;
|
|
7
|
+
}
|
|
8
|
+
export interface KnownFileRecoveryEvidence {
|
|
9
|
+
readonly installedBuild: InstalledKnownFileRecoveryBuild;
|
|
10
|
+
readonly store: NodeKnownFileTransactionJournalStore;
|
|
11
|
+
readonly stored: StoredKnownFileRecoveryJournal;
|
|
12
|
+
}
|
|
13
|
+
export declare function observeKnownFileRecoveryEvidence(root: string): Promise<KnownFileRecoveryEvidence>;
|
|
14
|
+
export declare function verifyRolledBackKnownFileState(root: string, journal: KnownFileTransactionJournalV1): Promise<void>;
|
|
15
|
+
//# sourceMappingURL=node-known-file-recovery-observation.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"node-known-file-recovery-observation.d.ts","sourceRoot":"","sources":["../../../../src/repository-mutation/adapters/node/node-known-file-recovery-observation.ts"],"names":[],"mappings":"AAKA,OAAO,KAAK,EACV,8BAA8B,EAC9B,6BAA6B,EAC9B,MAAM,2DAA2D,CAAC;AACnE,OAAO,KAAK,EAAE,+BAA+B,EAAE,MAAM,uEAAuE,CAAC;AAO7H,OAAO,EACL,oCAAoC,EACpC,KAAK,yBAAyB,EAC/B,MAAM,gDAAgD,CAAC;AAExD,MAAM,WAAW,8BAA8B;IAC7C,SAAS,EAAE,yBAAyB,CAAC;IACrC,QAAQ,EAAE,8BAA8B,CAAC;CAC1C;AAED,MAAM,WAAW,yBAAyB;IACxC,QAAQ,CAAC,cAAc,EAAE,+BAA+B,CAAC;IACzD,QAAQ,CAAC,KAAK,EAAE,oCAAoC,CAAC;IACrD,QAAQ,CAAC,MAAM,EAAE,8BAA8B,CAAC;CACjD;AAED,wBAAsB,gCAAgC,CACpD,IAAI,EAAE,MAAM,GACX,OAAO,CAAC,yBAAyB,CAAC,CAmBpC;AAED,wBAAsB,8BAA8B,CAClD,IAAI,EAAE,MAAM,EACZ,OAAO,EAAE,6BAA6B,GACrC,OAAO,CAAC,IAAI,CAAC,CAmCf"}
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
import { join } from "node:path";
|
|
2
|
+
import { LOCAL_STATE_DIRECTORY } from "../../../foundation-state-contract.js";
|
|
3
|
+
import { installedFoundationVersion } from "../../../package-version.js";
|
|
4
|
+
import { installedFoundationBuildIdentity } from "../../../transaction-coordination/adapters/node/installed-foundation-build-identity.js";
|
|
5
|
+
import { KnownFileTransactionError, matchesKnownFileImage, maximumKnownFileEvidenceBytes, observeKnownFile } from "./node-known-file-transaction-filesystem.js";
|
|
6
|
+
import { NodeKnownFileTransactionJournalStore } from "./node-known-file-transaction-journal-store.js";
|
|
7
|
+
export async function observeKnownFileRecoveryEvidence(root) {
|
|
8
|
+
const store = new NodeKnownFileTransactionJournalStore(join(root, LOCAL_STATE_DIRECTORY));
|
|
9
|
+
await store.canonicalizeTemporary();
|
|
10
|
+
const observed = await store.read();
|
|
11
|
+
if (observed === undefined) {
|
|
12
|
+
throw new KnownFileTransactionError("KNOWN_FILE_JOURNAL_MISSING", "Known-file recovery journal disappeared.");
|
|
13
|
+
}
|
|
14
|
+
const [version, buildIdentity] = await Promise.all([
|
|
15
|
+
installedFoundationVersion(),
|
|
16
|
+
installedFoundationBuildIdentity()
|
|
17
|
+
]);
|
|
18
|
+
return {
|
|
19
|
+
installedBuild: { buildIdentity, version },
|
|
20
|
+
store,
|
|
21
|
+
stored: observed
|
|
22
|
+
};
|
|
23
|
+
}
|
|
24
|
+
export async function verifyRolledBackKnownFileState(root, journal) {
|
|
25
|
+
for (const [index, operation] of journal.plan.operations.entries()) {
|
|
26
|
+
const journalOperation = journal.operations[index];
|
|
27
|
+
const observed = await observeKnownFile(root, operation.path, maximumKnownFileEvidenceBytes(operation));
|
|
28
|
+
if (journalOperation.state === "already-satisfied") {
|
|
29
|
+
if (!matchesKnownFileImage(observed, operation.postimage)) {
|
|
30
|
+
throw new KnownFileTransactionError("KNOWN_FILE_RECOVERY_CONFLICT", `Unchanged guard drifted during rollback: ${operation.path}.`);
|
|
31
|
+
}
|
|
32
|
+
continue;
|
|
33
|
+
}
|
|
34
|
+
if (operation.precondition.state === "absent") {
|
|
35
|
+
if (observed.state !== "absent") {
|
|
36
|
+
throw new KnownFileTransactionError("KNOWN_FILE_RECOVERY_CONFLICT", `Absent preimage was not restored: ${operation.path}.`);
|
|
37
|
+
}
|
|
38
|
+
continue;
|
|
39
|
+
}
|
|
40
|
+
const matched = journalOperation.matchedPreimage;
|
|
41
|
+
if (matched === undefined ||
|
|
42
|
+
!matchesKnownFileImage(observed, operation.precondition.acceptedPreimages[matched])) {
|
|
43
|
+
throw new KnownFileTransactionError("KNOWN_FILE_RECOVERY_CONFLICT", `Exact preimage was not restored: ${operation.path}.`);
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
//# sourceMappingURL=node-known-file-recovery-observation.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"node-known-file-recovery-observation.js","sourceRoot":"","sources":["../../../../src/repository-mutation/adapters/node/node-known-file-recovery-observation.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AAEjC,OAAO,EAAE,qBAAqB,EAAE,MAAM,uCAAuC,CAAC;AAC9E,OAAO,EAAE,0BAA0B,EAAE,MAAM,6BAA6B,CAAC;AACzE,OAAO,EAAE,gCAAgC,EAAE,MAAM,wFAAwF,CAAC;AAM1I,OAAO,EACL,yBAAyB,EACzB,qBAAqB,EACrB,6BAA6B,EAC7B,gBAAgB,EACjB,MAAM,6CAA6C,CAAC;AACrD,OAAO,EACL,oCAAoC,EAErC,MAAM,gDAAgD,CAAC;AAaxD,MAAM,CAAC,KAAK,UAAU,gCAAgC,CACpD,IAAY;IAEZ,MAAM,KAAK,GAAG,IAAI,oCAAoC,CAAC,IAAI,CAAC,IAAI,EAAE,qBAAqB,CAAC,CAAC,CAAC;IAC1F,MAAM,KAAK,CAAC,qBAAqB,EAAE,CAAC;IACpC,MAAM,QAAQ,GAAG,MAAM,KAAK,CAAC,IAAI,EAAE,CAAC;IACpC,IAAI,QAAQ,KAAK,SAAS,EAAE,CAAC;QAC3B,MAAM,IAAI,yBAAyB,CACjC,4BAA4B,EAC5B,0CAA0C,CAC3C,CAAC;IACJ,CAAC;IACD,MAAM,CAAC,OAAO,EAAE,aAAa,CAAC,GAAG,MAAM,OAAO,CAAC,GAAG,CAAC;QACjD,0BAA0B,EAAE;QAC5B,gCAAgC,EAAE;KACnC,CAAC,CAAC;IACH,OAAO;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CAAoC,SAAS,CAAC,IAAI,GAAG,CACtD,CAAC;QACJ,CAAC;IACH,CAAC;AACH,CAAC"}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import type { KnownFileTransactionPlanV1 } from "../../application/model/known-file-transaction.js";
|
|
2
|
+
import type { KnownFileTransactionJournalV1 } from "../../application/model/known-file-transaction-journal.js";
|
|
3
|
+
import type { KnownFileRecoveryFaultInjector } from "./node-known-file-recovery-state.js";
|
|
4
|
+
export declare function cleanupRestoredCapturedPreimage(options: {
|
|
5
|
+
readonly destination: string;
|
|
6
|
+
readonly faultInjector?: KnownFileRecoveryFaultInjector;
|
|
7
|
+
readonly journalOperation: KnownFileTransactionJournalV1["operations"][number] & {
|
|
8
|
+
readonly captureDirectoryIdentity: NonNullable<Extract<KnownFileTransactionJournalV1["operations"][number], {
|
|
9
|
+
readonly temporaryIdentity: unknown;
|
|
10
|
+
}>["captureDirectoryIdentity"]>;
|
|
11
|
+
readonly capturedPreimageIdentity?: NonNullable<Extract<KnownFileTransactionJournalV1["operations"][number], {
|
|
12
|
+
readonly temporaryIdentity: unknown;
|
|
13
|
+
}>["capturedPreimageIdentity"]>;
|
|
14
|
+
};
|
|
15
|
+
readonly operation: KnownFileTransactionPlanV1["operations"][number] & {
|
|
16
|
+
readonly precondition: Extract<KnownFileTransactionPlanV1["operations"][number]["precondition"], {
|
|
17
|
+
readonly state: "known-file";
|
|
18
|
+
}>;
|
|
19
|
+
};
|
|
20
|
+
readonly operationIndex: number;
|
|
21
|
+
readonly parent: string;
|
|
22
|
+
readonly paths: {
|
|
23
|
+
readonly captured: string;
|
|
24
|
+
readonly directory: string;
|
|
25
|
+
readonly retired: string;
|
|
26
|
+
};
|
|
27
|
+
readonly recoveryMaximumBytes: number;
|
|
28
|
+
}): Promise<void>;
|
|
29
|
+
//# sourceMappingURL=node-known-file-recovery-preimage-captured-cleanup.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"node-known-file-recovery-preimage-captured-cleanup.d.ts","sourceRoot":"","sources":["../../../../src/repository-mutation/adapters/node/node-known-file-recovery-preimage-captured-cleanup.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,0BAA0B,EAAE,MAAM,mDAAmD,CAAC;AACpG,OAAO,KAAK,EAAE,6BAA6B,EAAE,MAAM,2DAA2D,CAAC;AAU/G,OAAO,KAAK,EAAE,8BAA8B,EAAE,MAAM,qCAAqC,CAAC;AAY1F,wBAAsB,+BAA+B,CAAC,OAAO,EAAE;IAC7D,QAAQ,CAAC,WAAW,EAAE,MAAM,CAAC;IAC7B,QAAQ,CAAC,aAAa,CAAC,EAAE,8BAA8B,CAAC;IACxD,QAAQ,CAAC,gBAAgB,EAAE,6BAA6B,CAAC,YAAY,CAAC,CAAC,MAAM,CAAC,GAAG;QAC/E,QAAQ,CAAC,wBAAwB,EAAE,WAAW,CAAC,OAAO,CACpD,6BAA6B,CAAC,YAAY,CAAC,CAAC,MAAM,CAAC,EACnD;YAAE,QAAQ,CAAC,iBAAiB,EAAE,OAAO,CAAA;SAAE,CACxC,CAAC,0BAA0B,CAAC,CAAC,CAAC;QAC/B,QAAQ,CAAC,wBAAwB,CAAC,EAAE,WAAW,CAAC,OAAO,CACrD,6BAA6B,CAAC,YAAY,CAAC,CAAC,MAAM,CAAC,EACnD;YAAE,QAAQ,CAAC,iBAAiB,EAAE,OAAO,CAAA;SAAE,CACxC,CAAC,0BAA0B,CAAC,CAAC,CAAC;KAChC,CAAC;IACF,QAAQ,CAAC,SAAS,EAAE,0BAA0B,CAAC,YAAY,CAAC,CAAC,MAAM,CAAC,GAAG;QACrE,QAAQ,CAAC,YAAY,EAAE,OAAO,CAC5B,0BAA0B,CAAC,YAAY,CAAC,CAAC,MAAM,CAAC,CAAC,cAAc,CAAC,EAChE;YAAE,QAAQ,CAAC,KAAK,EAAE,YAAY,CAAA;SAAE,CACjC,CAAC;KACH,CAAC;IACF,QAAQ,CAAC,cAAc,EAAE,MAAM,CAAC;I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