@adea-ai/app-framework 0.36.1 → 0.37.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/README.md +2 -0
- package/dist/appearance/appearance-host.js +2 -1
- package/dist/appearance/custom-theme-import.js +3 -1
- package/dist/appearance/custom-theme-library.d.ts +6 -185
- package/dist/appearance/custom-theme-library.js +3 -621
- package/dist/appearance/theme-library-mutation.d.ts +42 -0
- package/dist/appearance/theme-library-mutation.js +172 -0
- package/dist/appearance/theme-library-schema.d.ts +108 -0
- package/dist/appearance/theme-library-schema.js +189 -0
- package/dist/appearance/theme-library-store.d.ts +61 -0
- package/dist/appearance/theme-library-store.js +268 -0
- package/dist/appearance/theme-record-adapter.js +3 -1
- package/dist/appearance/theme-registry.js +2 -1
- package/dist/appearance/window-surface.d.ts +19 -0
- package/dist/appearance/window-surface.js +68 -1
- package/dist/cli/update-helper-cli.js +1 -1
- package/dist/cli/windows-installer-build-cli.d.ts +2 -0
- package/dist/cli/windows-installer-build-cli.js +14 -0
- package/dist/desktop/desktop-client.d.ts +1 -1
- package/dist/framework-source.json +1 -1
- package/dist/installer/installed-payload.js +2 -2
- package/dist/installer/{installer-archive.js → installer-archive-members.js} +2 -2
- package/dist/installer/installer-extraction.js +2 -2
- package/dist/installer/installer-fetch-guard.d.ts +1 -1
- package/dist/installer/installer-identity.js +2 -2
- package/dist/installer/installer-observation.d.ts +1 -1
- package/dist/installer/installer-observation.js +2 -2
- package/dist/installer/installer-upgrade-command.d.ts +2 -2
- package/dist/installer/installer-upgrade-command.js +5 -5
- package/dist/installer/linux-process-group.js +1 -1
- package/dist/installer/upgrade-asset-download.d.ts +1 -1
- package/dist/installer/upgrade-asset-download.js +2 -2
- package/dist/native/installer-archive.d.ts +42 -0
- package/dist/native/installer-archive.js +172 -0
- package/dist/native/posix-tree-removal.d.ts +1 -1
- package/dist/native/window-surface-store.d.ts +16 -0
- package/dist/native/window-surface-store.js +69 -0
- package/dist/native/windows-extractor-build.d.ts +95 -0
- package/dist/native/windows-extractor-build.js +326 -0
- package/dist/release/feed-release-cut.d.ts +1 -1
- package/dist/release/feed-state.d.ts +2 -2
- package/dist/release/feed-state.js +3 -3
- package/dist/release/github-release-cut.js +1 -1
- package/dist/release/github-release-promotion.js +1 -1
- package/dist/release/github-release-publisher.js +1 -1
- package/dist/release/github-release-qualification.js +1 -1
- package/dist/release/local-release.d.ts +2 -2
- package/dist/release/local-release.js +3 -3
- package/dist/release/release-artifact.d.ts +1 -1
- package/dist/release/release-artifact.js +2 -2
- package/dist/release/release-assets-plan.js +1 -1
- package/dist/release/release-config.d.ts +1 -1
- package/dist/release/release-config.js +1 -1
- package/dist/release/release-descriptor-staging.js +3 -3
- package/dist/release/release-finalize.js +1 -1
- package/dist/release/release-promotion.js +1 -1
- package/dist/release/release-publication.d.ts +1 -1
- package/dist/release/release-publication.js +2 -2
- package/dist/release/release-publish-command.js +2 -2
- package/dist/update-helper.bundle.js +18 -18
- package/dist/updates/channel-update-manager.d.ts +3 -3
- package/dist/updates/channel-update-manager.js +2 -2
- package/dist/updates/desktop-updater.d.ts +10 -83
- package/dist/updates/desktop-updater.js +14 -217
- package/dist/updates/{packaged-release-config.js → feed/packaged-release-config.js} +5 -5
- package/dist/updates/{release-feed.js → feed/release-feed.js} +2 -2
- package/dist/updates/{release-location.js → feed/release-location.js} +2 -2
- package/dist/updates/{release-version.js → feed/release-version.js} +1 -1
- package/dist/updates/{signed-release.js → feed/signed-release.js} +2 -2
- package/dist/updates/{update-discovery.js → feed/update-discovery.js} +1 -1
- package/dist/updates/helper/launch-gate-recovery.d.ts +8 -0
- package/dist/updates/{update-resume.js → helper/launch-gate-recovery.js} +13 -423
- package/dist/updates/helper/resume-staging.d.ts +22 -0
- package/dist/updates/helper/resume-staging.js +180 -0
- package/dist/updates/{update-helper.d.ts → helper/update-helper.d.ts} +1 -1
- package/dist/updates/{update-helper.js → helper/update-helper.js} +9 -9
- package/dist/updates/{update-resume.d.ts → helper/update-resume.d.ts} +4 -10
- package/dist/updates/helper/update-resume.js +252 -0
- package/dist/updates/{update-shutdown.js → helper/update-shutdown.js} +2 -2
- package/dist/updates/{update-arm.d.ts → install/update-arm.d.ts} +2 -2
- package/dist/updates/{update-arm.js → install/update-arm.js} +9 -9
- package/dist/updates/{update-download-cleanup.d.ts → install/update-download-cleanup.d.ts} +1 -1
- package/dist/updates/{update-download-cleanup.js → install/update-download-cleanup.js} +3 -3
- package/dist/updates/{update-download.d.ts → install/update-download.d.ts} +2 -2
- package/dist/updates/{update-download.js → install/update-download.js} +3 -3
- package/dist/updates/{update-extraction.d.ts → install/update-extraction.d.ts} +2 -2
- package/dist/updates/{update-extraction.js → install/update-extraction.js} +6 -6
- package/dist/updates/{update-handoff-plan.d.ts → install/update-handoff-plan.d.ts} +2 -2
- package/dist/updates/{update-handoff-plan.js → install/update-handoff-plan.js} +5 -5
- package/dist/updates/{update-marker.js → install/update-marker.js} +2 -2
- package/dist/updates/{update-swap-stage.d.ts → install/update-swap-stage.d.ts} +2 -2
- package/dist/updates/{update-swap-stage.js → install/update-swap-stage.js} +7 -6
- package/dist/updates/{update-swap.d.ts → install/update-swap.d.ts} +1 -1
- package/dist/updates/{update-swap.js → install/update-swap.js} +5 -5
- package/dist/updates/install-target.d.ts +8 -0
- package/dist/updates/install-target.js +27 -0
- package/dist/updates/{launch-environment.js → launch/launch-environment.js} +1 -1
- package/dist/updates/{packaged-launch-admission.js → launch/packaged-launch-admission.js} +4 -4
- package/dist/updates/{packaged-update-startup.d.ts → launch/packaged-update-startup.d.ts} +3 -3
- package/dist/updates/{packaged-update-startup.js → launch/packaged-update-startup.js} +10 -7
- package/dist/updates/{update-launch-gate.d.ts → launch/update-launch-gate.d.ts} +1 -1
- package/dist/updates/{update-launch-gate.js → launch/update-launch-gate.js} +9 -9
- package/dist/updates/{update-launch.d.ts → launch/update-launch.d.ts} +1 -1
- package/dist/updates/{update-launch.js → launch/update-launch.js} +2 -2
- package/dist/updates/{linux-process-state.js → locks/linux-process-state.js} +1 -1
- package/dist/updates/{native-file-lock.js → locks/native-file-lock.js} +1 -1
- package/dist/updates/{stable-file.js → locks/stable-file.js} +2 -2
- package/dist/updates/{update-download-lock.js → locks/update-download-lock.js} +1 -1
- package/dist/updates/{update-generation-lease.js → locks/update-generation-lease.js} +3 -3
- package/dist/updates/{update-inherited-launch-lease.d.ts → locks/update-inherited-launch-lease.d.ts} +1 -1
- package/dist/updates/{update-inherited-launch-lease.js → locks/update-inherited-launch-lease.js} +2 -2
- package/dist/updates/{update-instance-lease.js → locks/update-instance-lease.js} +2 -2
- package/dist/updates/{update-lock.js → locks/update-lock.js} +2 -2
- package/dist/updates/{update-process-fence.js → locks/update-process-fence.js} +3 -3
- package/dist/updates/{update-process-liveness.js → locks/update-process-liveness.js} +2 -2
- package/dist/updates/retained-client-assets.d.ts +60 -0
- package/dist/updates/retained-client-assets.js +116 -0
- package/dist/updates/retention/retention-cleanup.d.ts +103 -0
- package/dist/updates/retention/retention-cleanup.js +439 -0
- package/dist/updates/retention/retention-prune-progress.d.ts +27 -0
- package/dist/updates/retention/retention-prune-progress.js +203 -0
- package/dist/updates/retention/retirement-inventory.d.ts +93 -0
- package/dist/updates/retention/retirement-inventory.js +373 -0
- package/dist/updates/retention/retirement-records.d.ts +75 -0
- package/dist/updates/retention/retirement-records.js +309 -0
- package/dist/updates/{update-retention-marker.d.ts → retention/update-retention-marker.d.ts} +1 -1
- package/dist/updates/{update-retention-marker.js → retention/update-retention-marker.js} +3 -3
- package/dist/updates/{update-retention-plan.d.ts → retention/update-retention-plan.d.ts} +1 -1
- package/dist/updates/{update-retention-plan.js → retention/update-retention-plan.js} +2 -2
- package/dist/updates/{update-retention-sync.d.ts → retention/update-retention-sync.d.ts} +1 -1
- package/dist/updates/{update-retention-sync.js → retention/update-retention-sync.js} +2 -2
- package/dist/updates/retention/update-retirement.d.ts +26 -0
- package/dist/updates/retention/update-retirement.js +205 -0
- package/dist/updates/update-adapter.js +1 -1
- package/dist/updates/update-channel-store.d.ts +1 -1
- package/dist/updates/update-channel-store.js +2 -2
- package/dist/updates/update-manager.d.ts +4 -4
- package/dist/updates/update-manager.js +5 -5
- package/dist/updates/update-services.d.ts +15 -0
- package/dist/updates/update-services.js +77 -0
- package/dist/updates/update-state-store.d.ts +2 -2
- package/dist/updates/update-state-store.js +2 -2
- package/dist/views/appearance-surface.js +3 -1
- package/package.json +42 -29
- package/src/appearance/custom-theme-library.ts +42 -956
- package/src/appearance/theme-library-mutation.ts +288 -0
- package/src/appearance/theme-library-schema.ts +347 -0
- package/src/appearance/theme-library-store.ts +379 -0
- package/src/appearance/window-surface.ts +91 -5
- package/src/updates/update-adapter.ts +1 -1
- package/templates/application/src/bun/index.ts +15 -0
- package/templates/application/src/web/main.tsx +13 -1
- package/dist/updates/update-retirement.d.ts +0 -205
- package/dist/updates/update-retirement.js +0 -1485
- /package/dist/installer/{installer-archive.d.ts → installer-archive-members.d.ts} +0 -0
- /package/dist/updates/{packaged-release-config.d.ts → feed/packaged-release-config.d.ts} +0 -0
- /package/dist/updates/{release-feed.d.ts → feed/release-feed.d.ts} +0 -0
- /package/dist/updates/{release-location.d.ts → feed/release-location.d.ts} +0 -0
- /package/dist/updates/{release-version.d.ts → feed/release-version.d.ts} +0 -0
- /package/dist/updates/{signed-release.d.ts → feed/signed-release.d.ts} +0 -0
- /package/dist/updates/{update-discovery.d.ts → feed/update-discovery.d.ts} +0 -0
- /package/dist/updates/{update-shutdown.d.ts → helper/update-shutdown.d.ts} +0 -0
- /package/dist/updates/{update-marker.d.ts → install/update-marker.d.ts} +0 -0
- /package/dist/updates/{launch-environment.d.ts → launch/launch-environment.d.ts} +0 -0
- /package/dist/updates/{packaged-launch-admission.d.ts → launch/packaged-launch-admission.d.ts} +0 -0
- /package/dist/updates/{linux-process-state.d.ts → locks/linux-process-state.d.ts} +0 -0
- /package/dist/updates/{native-file-lock.d.ts → locks/native-file-lock.d.ts} +0 -0
- /package/dist/updates/{stable-file.d.ts → locks/stable-file.d.ts} +0 -0
- /package/dist/updates/{update-download-lock.d.ts → locks/update-download-lock.d.ts} +0 -0
- /package/dist/updates/{update-generation-lease.d.ts → locks/update-generation-lease.d.ts} +0 -0
- /package/dist/updates/{update-instance-lease.d.ts → locks/update-instance-lease.d.ts} +0 -0
- /package/dist/updates/{update-lock.d.ts → locks/update-lock.d.ts} +0 -0
- /package/dist/updates/{update-process-fence.d.ts → locks/update-process-fence.d.ts} +0 -0
- /package/dist/updates/{update-process-liveness.d.ts → locks/update-process-liveness.d.ts} +0 -0
- /package/src/updates/{release-version.ts → feed/release-version.ts} +0 -0
|
@@ -0,0 +1,439 @@
|
|
|
1
|
+
import { isCanonicalPath } from "../../native/canonical-path.js";
|
|
2
|
+
import { withUpdateLock } from "../update-state-store.js";
|
|
3
|
+
import { sameUpdateTreeIdentity } from "../install/update-swap.js";
|
|
4
|
+
import { tryAcquireUpdateGenerationLease } from "../locks/update-generation-lease.js";
|
|
5
|
+
import { publishUpdateRetentionIntent, readUpdateRetentionIntent, readUpdateRetentionIntentFile, sameRetentionIntent, updateRetentionIntentPath } from "./update-retention-marker.js";
|
|
6
|
+
import { PUBLISHER_TEMP_UUID, VERSION, healthReceiptFor, healthReceiptMatches, matchesInstalledTree, ownerMatches, pathInfo, readHealthReceipt, readOwner, samePathTreeIdentity, updateRetirementPaths } from "./retirement-records.js";
|
|
7
|
+
import { findPruneProgressTemporaryName, publishPruneProgress, readPruneProgress, readPruneProgressFile, retentionPruneProgressPath, syncPruneDirectory, syncPruneFile, syncPruneProgress, syncPruneRecoveryEvidence } from "./retention-prune-progress.js";
|
|
8
|
+
import { planRetentionWhileLocked } from "./retirement-inventory.js";
|
|
9
|
+
import { removeDirectoryContentsChunk } from "../../native/posix-tree-removal.js";
|
|
10
|
+
import { syncUpdateRetentionIntent } from "./update-retention-sync.js";
|
|
11
|
+
import { link, readdir, rmdir, unlink } from "node:fs/promises";
|
|
12
|
+
import { basename, dirname, join } from "node:path";
|
|
13
|
+
// src/updates/retention/retention-cleanup.ts
|
|
14
|
+
/** A failed promotion may have left the final marker in place; inspect before retrying. */
|
|
15
|
+
var UpdateRetentionOrphanPromotionError = class extends Error {
|
|
16
|
+
temporaryPath;
|
|
17
|
+
finalPath;
|
|
18
|
+
publicationState;
|
|
19
|
+
constructor(temporaryPath, finalPath, publicationState, cause) {
|
|
20
|
+
super("Update retention orphan promotion requires inspection", { cause });
|
|
21
|
+
this.temporaryPath = temporaryPath;
|
|
22
|
+
this.finalPath = finalPath;
|
|
23
|
+
this.publicationState = publicationState;
|
|
24
|
+
this.name = "UpdateRetentionOrphanPromotionError";
|
|
25
|
+
}
|
|
26
|
+
};
|
|
27
|
+
function isRetentionArtifactName(name, target) {
|
|
28
|
+
const foldedName = name.toLowerCase();
|
|
29
|
+
const baseName = basename(target).toLowerCase();
|
|
30
|
+
return foldedName.startsWith(`.${baseName}.framework-prune-`) || foldedName.startsWith(`..${baseName}.framework-prune-`);
|
|
31
|
+
}
|
|
32
|
+
/** Accept only one UUID-named publisher temporary for this exact marker. */
|
|
33
|
+
function retentionTemporaryName(names, target, generation) {
|
|
34
|
+
const markerName = basename(updateRetentionIntentPath(target, generation));
|
|
35
|
+
const temporaryPrefix = `.${markerName}.`;
|
|
36
|
+
const artifacts = names.filter((name) => isRetentionArtifactName(name, target));
|
|
37
|
+
const temporaryPrefixForTarget = `..${basename(target)}.framework-prune-`.toLowerCase();
|
|
38
|
+
const temporaryNames = artifacts.filter((name) => name.toLowerCase().startsWith(temporaryPrefixForTarget));
|
|
39
|
+
if (temporaryNames.length > 1) throw new Error("Multiple update retention temporaries require recovery");
|
|
40
|
+
let selected;
|
|
41
|
+
if (temporaryNames.length === 1) {
|
|
42
|
+
const name = temporaryNames[0];
|
|
43
|
+
const id = name.startsWith(temporaryPrefix) && name.endsWith(".tmp") ? name.slice(temporaryPrefix.length, -4) : "";
|
|
44
|
+
if (!PUBLISHER_TEMP_UUID.test(id)) throw new Error("Malformed update retention temporary requires recovery");
|
|
45
|
+
selected = name;
|
|
46
|
+
}
|
|
47
|
+
for (const name of artifacts) {
|
|
48
|
+
if (name === markerName || name === selected) continue;
|
|
49
|
+
throw new Error("An unrelated update retention artifact requires recovery");
|
|
50
|
+
}
|
|
51
|
+
return selected;
|
|
52
|
+
}
|
|
53
|
+
async function assertIntentMatchesRetentionPlan(target, inventory, plan, intent) {
|
|
54
|
+
if (plan.status !== "ready") throw new Error("Update retention intent requires recovery");
|
|
55
|
+
const selected = inventory.records.find(({ owner }) => owner.generation.toLowerCase() === intent.generation);
|
|
56
|
+
const installed = inventory.records.find(({ owner }) => owner.generation.toLowerCase() === plan.keep?.toLowerCase());
|
|
57
|
+
if (!selected || !installed || plan.prune[0]?.toLowerCase() !== intent.generation || !sameUpdateTreeIdentity(intent.previousTreeIdentity, selected.owner.previousTreeIdentity) || intent.installedGeneration !== installed.owner.generation.toLowerCase() || !sameUpdateTreeIdentity(intent.installedTreeIdentity, inventory.actualIdentity) || !sameUpdateTreeIdentity(intent.installedTreeIdentity, installed.owner.newTreeIdentity) || !await matchesInstalledTree(target, installed.owner)) throw new Error("Update retention intent is stale");
|
|
58
|
+
}
|
|
59
|
+
/**
|
|
60
|
+
* Inspect one published retention intent against the current install while
|
|
61
|
+
* holding the update lock. This validates recovery data only; it never changes
|
|
62
|
+
* the filesystem or grants deletion authority.
|
|
63
|
+
*/
|
|
64
|
+
async function inspectUpdateRetentionCleanup(options) {
|
|
65
|
+
const { target, currentVersion, generation } = options;
|
|
66
|
+
if (typeof currentVersion !== "string" || !VERSION.test(currentVersion) || !isCanonicalPath(target)) throw new Error("Invalid update retention lookup");
|
|
67
|
+
updateRetentionIntentPath(target, generation);
|
|
68
|
+
return withUpdateLock(target, () => inspectRetentionWhileLocked(target, currentVersion, generation));
|
|
69
|
+
}
|
|
70
|
+
async function inspectRetentionWhileLocked(target, currentVersion, generation) {
|
|
71
|
+
const { inventory, plan } = await planRetentionWhileLocked(target, currentVersion, { allowedRetentionIntentGeneration: generation });
|
|
72
|
+
const intent = await readUpdateRetentionIntent(target, generation);
|
|
73
|
+
if (!intent) {
|
|
74
|
+
if (inventory.allowedIntentObserved) throw new Error("Update retention intent disappeared during inspection");
|
|
75
|
+
return null;
|
|
76
|
+
}
|
|
77
|
+
await assertIntentMatchesRetentionPlan(target, inventory, plan, intent);
|
|
78
|
+
return intent;
|
|
79
|
+
}
|
|
80
|
+
/**
|
|
81
|
+
* Request synchronization of a freshly validated marker under the update lock.
|
|
82
|
+
* This does not establish hardware-level durability or authorize deletion.
|
|
83
|
+
*/
|
|
84
|
+
async function syncValidatedUpdateRetentionCleanup(options) {
|
|
85
|
+
const { target, currentVersion, generation } = options;
|
|
86
|
+
if (typeof currentVersion !== "string" || !VERSION.test(currentVersion) || !isCanonicalPath(target)) throw new Error("Invalid update retention lookup");
|
|
87
|
+
updateRetentionIntentPath(target, generation);
|
|
88
|
+
return withUpdateLock(target, async () => {
|
|
89
|
+
const intent = await inspectRetentionWhileLocked(target, currentVersion, generation);
|
|
90
|
+
if (!intent) throw new Error("Update retention intent is missing");
|
|
91
|
+
const identity = await syncUpdateRetentionIntent(intent);
|
|
92
|
+
const verified = await inspectRetentionWhileLocked(target, currentVersion, generation);
|
|
93
|
+
const finalMarker = await readUpdateRetentionIntentFile(updateRetentionIntentPath(target, generation), target, generation);
|
|
94
|
+
if (!verified || !sameRetentionIntent(intent, verified) || !finalMarker || !sameRetentionIntent(intent, finalMarker.intent) || !sameUpdateTreeIdentity(identity, finalMarker.identity)) throw new Error("Update retention intent changed during synchronization");
|
|
95
|
+
return identity;
|
|
96
|
+
});
|
|
97
|
+
}
|
|
98
|
+
/**
|
|
99
|
+
* Promote one publisher temporary left by an interrupted intent publication.
|
|
100
|
+
* Under the update lock this requires exactly one canonical temporary, no
|
|
101
|
+
* final marker, and no other retention artifacts, then validates the bounded
|
|
102
|
+
* file and oldest eligible cleanup plan twice before a no-replace hard link.
|
|
103
|
+
* It leaves both names in place for reconcileUpdateRetentionCleanup. If the
|
|
104
|
+
* link call fails, whether a final name was created is treated as unknown; if
|
|
105
|
+
* post-link validation fails, the link is known to exist. Both failures
|
|
106
|
+
* preserve every path for inspection. This operation makes no power-loss
|
|
107
|
+
* durability claim and never removes a retirement tree or marker.
|
|
108
|
+
*/
|
|
109
|
+
async function promoteOrphanUpdateRetentionCleanup(options) {
|
|
110
|
+
const { target, currentVersion, generation } = options;
|
|
111
|
+
if (typeof currentVersion !== "string" || !VERSION.test(currentVersion) || !isCanonicalPath(target)) throw new Error("Invalid update retention lookup");
|
|
112
|
+
const finalPath = updateRetentionIntentPath(target, generation);
|
|
113
|
+
const readOrphan = async (expectedTemporaryName) => {
|
|
114
|
+
const names = await readdir(dirname(target));
|
|
115
|
+
const temporaryName = retentionTemporaryName(names, target, generation);
|
|
116
|
+
if (!temporaryName) throw new Error("Update retention orphan temporary is missing");
|
|
117
|
+
if (expectedTemporaryName !== void 0 && temporaryName !== expectedTemporaryName) throw new Error("Update retention orphan temporary changed");
|
|
118
|
+
if (names.includes(basename(finalPath))) throw new Error("Update retention final intent already exists");
|
|
119
|
+
const temporaryPath = join(dirname(finalPath), temporaryName);
|
|
120
|
+
const { inventory, plan } = await planRetentionWhileLocked(target, currentVersion, {
|
|
121
|
+
allowedRetentionIntentGeneration: generation,
|
|
122
|
+
allowedRetentionTemporaryName: temporaryName
|
|
123
|
+
});
|
|
124
|
+
if (inventory.allowedIntentObserved) throw new Error("Update retention final intent appeared during promotion");
|
|
125
|
+
const temporaryFile = await readUpdateRetentionIntentFile(temporaryPath, target, generation);
|
|
126
|
+
if (!temporaryFile) throw new Error("Update retention orphan temporary disappeared during promotion");
|
|
127
|
+
await assertIntentMatchesRetentionPlan(target, inventory, plan, temporaryFile.intent);
|
|
128
|
+
return {
|
|
129
|
+
temporaryName,
|
|
130
|
+
temporaryPath,
|
|
131
|
+
temporaryFile
|
|
132
|
+
};
|
|
133
|
+
};
|
|
134
|
+
return withUpdateLock(target, async () => {
|
|
135
|
+
const initial = await readOrphan();
|
|
136
|
+
const beforeLink = await readOrphan(initial.temporaryName);
|
|
137
|
+
if (!sameRetentionIntent(beforeLink.temporaryFile.intent, initial.temporaryFile.intent) || !sameUpdateTreeIdentity(beforeLink.temporaryFile.identity, initial.temporaryFile.identity)) throw new Error("Update retention orphan changed before promotion");
|
|
138
|
+
try {
|
|
139
|
+
await link(beforeLink.temporaryPath, finalPath);
|
|
140
|
+
} catch (cause) {
|
|
141
|
+
throw new UpdateRetentionOrphanPromotionError(beforeLink.temporaryPath, finalPath, "unknown", cause);
|
|
142
|
+
}
|
|
143
|
+
try {
|
|
144
|
+
const temporaryName = retentionTemporaryName(await readdir(dirname(target)), target, generation);
|
|
145
|
+
if (temporaryName !== beforeLink.temporaryName) throw new Error("Update retention orphan temporary changed after promotion");
|
|
146
|
+
const { inventory, plan } = await planRetentionWhileLocked(target, currentVersion, {
|
|
147
|
+
allowedRetentionIntentGeneration: generation,
|
|
148
|
+
allowedRetentionTemporaryName: temporaryName
|
|
149
|
+
});
|
|
150
|
+
if (!inventory.allowedIntentObserved) throw new Error("Update retention final intent is missing after promotion");
|
|
151
|
+
const finalFile = await readUpdateRetentionIntentFile(finalPath, target, generation);
|
|
152
|
+
const temporaryFile = await readUpdateRetentionIntentFile(beforeLink.temporaryPath, target, generation);
|
|
153
|
+
if (!finalFile || !temporaryFile) throw new Error("Update retention file disappeared after promotion");
|
|
154
|
+
await assertIntentMatchesRetentionPlan(target, inventory, plan, finalFile.intent);
|
|
155
|
+
if (!sameRetentionIntent(finalFile.intent, beforeLink.temporaryFile.intent) || !sameRetentionIntent(temporaryFile.intent, beforeLink.temporaryFile.intent) || !sameUpdateTreeIdentity(finalFile.identity, beforeLink.temporaryFile.identity) || !sameUpdateTreeIdentity(temporaryFile.identity, beforeLink.temporaryFile.identity)) throw new Error("Update retention files changed after promotion");
|
|
156
|
+
return {
|
|
157
|
+
status: "promoted",
|
|
158
|
+
intent: finalFile.intent,
|
|
159
|
+
temporaryPath: beforeLink.temporaryPath,
|
|
160
|
+
finalPath
|
|
161
|
+
};
|
|
162
|
+
} catch (cause) {
|
|
163
|
+
throw new UpdateRetentionOrphanPromotionError(beforeLink.temporaryPath, finalPath, "linked", cause);
|
|
164
|
+
}
|
|
165
|
+
});
|
|
166
|
+
}
|
|
167
|
+
/**
|
|
168
|
+
* Reconcile only the publisher's extra hard link after validating the final
|
|
169
|
+
* intent against a fresh retention plan under the update lock. This never
|
|
170
|
+
* deletes a final marker, retirement tree, claim, or receipt, and makes no
|
|
171
|
+
* power-loss durability claim.
|
|
172
|
+
*/
|
|
173
|
+
async function reconcileUpdateRetentionCleanup(options) {
|
|
174
|
+
const { target, currentVersion, generation } = options;
|
|
175
|
+
if (typeof currentVersion !== "string" || !VERSION.test(currentVersion) || !isCanonicalPath(target)) throw new Error("Invalid update retention lookup");
|
|
176
|
+
const markerPath = updateRetentionIntentPath(target, generation);
|
|
177
|
+
return withUpdateLock(target, async () => {
|
|
178
|
+
const temporaryName = retentionTemporaryName(await readdir(dirname(target)), target, generation);
|
|
179
|
+
const { inventory, plan } = await planRetentionWhileLocked(target, currentVersion, {
|
|
180
|
+
allowedRetentionIntentGeneration: generation,
|
|
181
|
+
...temporaryName ? { allowedRetentionTemporaryName: temporaryName } : {}
|
|
182
|
+
});
|
|
183
|
+
if (!inventory.allowedIntentObserved) throw new Error("Update retention intent is missing or changed during reconciliation");
|
|
184
|
+
const markerFile = await readUpdateRetentionIntentFile(markerPath, target, generation);
|
|
185
|
+
if (!markerFile) throw new Error("Update retention intent is missing");
|
|
186
|
+
await assertIntentMatchesRetentionPlan(target, inventory, plan, markerFile.intent);
|
|
187
|
+
if (!temporaryName) return {
|
|
188
|
+
status: "already-clean",
|
|
189
|
+
intent: markerFile.intent
|
|
190
|
+
};
|
|
191
|
+
const temporaryPath = join(dirname(markerPath), temporaryName);
|
|
192
|
+
const temporaryFile = await readUpdateRetentionIntentFile(temporaryPath, target, generation);
|
|
193
|
+
if (!temporaryFile) throw new Error("Update retention temporary disappeared during reconciliation");
|
|
194
|
+
if (!sameRetentionIntent(temporaryFile.intent, markerFile.intent) || !sameUpdateTreeIdentity(temporaryFile.identity, markerFile.identity)) throw new Error("Update retention temporary does not match the final intent");
|
|
195
|
+
const before = await planRetentionWhileLocked(target, currentVersion, {
|
|
196
|
+
allowedRetentionIntentGeneration: generation,
|
|
197
|
+
allowedRetentionTemporaryName: temporaryName
|
|
198
|
+
});
|
|
199
|
+
if (!before.inventory.allowedIntentObserved) throw new Error("Update retention intent disappeared before reconciliation");
|
|
200
|
+
const markerBefore = await readUpdateRetentionIntentFile(markerPath, target, generation);
|
|
201
|
+
const temporaryBefore = await readUpdateRetentionIntentFile(temporaryPath, target, generation);
|
|
202
|
+
if (!markerBefore || !temporaryBefore) throw new Error("Update retention file disappeared before reconciliation");
|
|
203
|
+
await assertIntentMatchesRetentionPlan(target, before.inventory, before.plan, markerBefore.intent);
|
|
204
|
+
if (!sameRetentionIntent(markerBefore.intent, markerFile.intent) || !sameRetentionIntent(temporaryBefore.intent, markerFile.intent) || !sameUpdateTreeIdentity(markerBefore.identity, markerFile.identity) || !sameUpdateTreeIdentity(temporaryBefore.identity, markerFile.identity)) throw new Error("Update retention files changed before reconciliation");
|
|
205
|
+
await unlink(temporaryPath);
|
|
206
|
+
const after = await planRetentionWhileLocked(target, currentVersion, { allowedRetentionIntentGeneration: generation });
|
|
207
|
+
if (!after.inventory.allowedIntentObserved) throw new Error("Update retention intent disappeared after reconciliation");
|
|
208
|
+
const markerAfter = await readUpdateRetentionIntentFile(markerPath, target, generation);
|
|
209
|
+
if (!markerAfter) throw new Error("Update retention intent disappeared after reconciliation");
|
|
210
|
+
await assertIntentMatchesRetentionPlan(target, after.inventory, after.plan, markerAfter.intent);
|
|
211
|
+
if (!sameRetentionIntent(markerAfter.intent, markerFile.intent) || !sameUpdateTreeIdentity(markerAfter.identity, markerFile.identity)) throw new Error("Update retention intent changed after reconciliation");
|
|
212
|
+
if (await pathInfo(temporaryPath)) throw new Error("Update retention temporary remains after reconciliation");
|
|
213
|
+
return {
|
|
214
|
+
status: "temporary-removed",
|
|
215
|
+
intent: markerAfter.intent,
|
|
216
|
+
temporaryPath
|
|
217
|
+
};
|
|
218
|
+
});
|
|
219
|
+
}
|
|
220
|
+
/**
|
|
221
|
+
* Record the oldest eligible cleanup candidate while holding the update lock.
|
|
222
|
+
* This WIP operation does not delete data or grant authority to a later caller.
|
|
223
|
+
* Intent publication is not yet power-loss durable.
|
|
224
|
+
*/
|
|
225
|
+
async function beginUpdateRetentionCleanup(options) {
|
|
226
|
+
const { target, currentVersion } = options;
|
|
227
|
+
if (typeof currentVersion !== "string" || !VERSION.test(currentVersion) || !isCanonicalPath(target)) throw new Error("Invalid update retention lookup");
|
|
228
|
+
return withUpdateLock(target, async () => {
|
|
229
|
+
const { inventory, plan } = await planRetentionWhileLocked(target, currentVersion);
|
|
230
|
+
if (plan.status !== "ready") throw new Error("Update retention lineage requires recovery");
|
|
231
|
+
const candidate = plan.prune[0];
|
|
232
|
+
if (!candidate) return null;
|
|
233
|
+
const selected = inventory.records.find(({ owner }) => owner.generation === candidate);
|
|
234
|
+
const installed = inventory.records.find(({ owner }) => owner.generation === plan.keep);
|
|
235
|
+
if (!selected || !installed) throw new Error("Update retention lineage changed");
|
|
236
|
+
const intent = {
|
|
237
|
+
schema: 1,
|
|
238
|
+
phase: "prune-previous-tree",
|
|
239
|
+
target,
|
|
240
|
+
generation: selected.owner.generation.toLowerCase(),
|
|
241
|
+
previousTreeIdentity: selected.owner.previousTreeIdentity,
|
|
242
|
+
installedGeneration: installed.owner.generation.toLowerCase(),
|
|
243
|
+
installedTreeIdentity: inventory.actualIdentity
|
|
244
|
+
};
|
|
245
|
+
return {
|
|
246
|
+
intent,
|
|
247
|
+
publication: await publishUpdateRetentionIntent(intent)
|
|
248
|
+
};
|
|
249
|
+
});
|
|
250
|
+
}
|
|
251
|
+
/**
|
|
252
|
+
* Make one explicit, bounded prune step for an already-published retention
|
|
253
|
+
* intent. Ordinary inventory readers fail closed while this progress record
|
|
254
|
+
* exists. Calls serialize under the install lock, then take the generation's
|
|
255
|
+
* exclusive lease before inspecting or changing its retired tree.
|
|
256
|
+
*
|
|
257
|
+
* This currently supports only the tested macOS ARM64 directory-relative
|
|
258
|
+
* remover. It requests file and directory synchronization before destructive
|
|
259
|
+
* transitions, but those calls do not prove hardware persistence or recovery
|
|
260
|
+
* after power loss. Callers must invoke this explicitly; startup and updater
|
|
261
|
+
* flows do not prune automatically.
|
|
262
|
+
*/
|
|
263
|
+
async function pruneUpdateRetentionStep(options) {
|
|
264
|
+
const { target, currentVersion, generation } = options;
|
|
265
|
+
const maxOperations = options.maxOperations ?? 64;
|
|
266
|
+
if (typeof currentVersion !== "string" || !VERSION.test(currentVersion) || !isCanonicalPath(target) || !Number.isSafeInteger(maxOperations) || maxOperations < 1 || maxOperations > 4096) throw new Error("Invalid update retention prune request");
|
|
267
|
+
updateRetirementPaths(target, generation);
|
|
268
|
+
if (process.platform !== "darwin" || process.arch !== "arm64") return { status: "recovery-required" };
|
|
269
|
+
return withUpdateLock(target, async () => {
|
|
270
|
+
const diskIntent = await readUpdateRetentionIntent(target, generation);
|
|
271
|
+
const progress = await readPruneProgress(target, generation, diskIntent);
|
|
272
|
+
const progressTemporaryName = await findPruneProgressTemporaryName(target, generation);
|
|
273
|
+
const intent = diskIntent ?? progress?.intent;
|
|
274
|
+
if (!intent && !progress && !progressTemporaryName) {
|
|
275
|
+
if ((await planRetentionWhileLocked(target, currentVersion)).plan.status === "ready") return { status: "none" };
|
|
276
|
+
return { status: "recovery-required" };
|
|
277
|
+
}
|
|
278
|
+
if (!intent || intent.generation !== generation.toLowerCase()) return { status: "recovery-required" };
|
|
279
|
+
let context = await planRetentionWhileLocked(target, currentVersion, {
|
|
280
|
+
allowedRetentionIntentGeneration: generation,
|
|
281
|
+
...progress || progressTemporaryName ? { allowedPruneProgressGeneration: generation } : {},
|
|
282
|
+
...progressTemporaryName ? { allowedPruneProgressTemporaryName: progressTemporaryName } : {}
|
|
283
|
+
});
|
|
284
|
+
if (context.plan.status !== "ready") return { status: "recovery-required" };
|
|
285
|
+
await assertIntentMatchesRetentionPlan(target, context.inventory, context.plan, intent);
|
|
286
|
+
if (context.plan.prune[0]?.toLowerCase() !== generation.toLowerCase()) return { status: "recovery-required" };
|
|
287
|
+
let selected = context.inventory.records.find(({ owner }) => owner.generation.toLowerCase() === generation.toLowerCase());
|
|
288
|
+
if (!selected) return { status: "recovery-required" };
|
|
289
|
+
const lease = await tryAcquireUpdateGenerationLease(target, generation, "exclusive");
|
|
290
|
+
if (!lease) return { status: "busy" };
|
|
291
|
+
try {
|
|
292
|
+
const currentIntent = await readUpdateRetentionIntent(target, generation);
|
|
293
|
+
let currentProgress = await readPruneProgress(target, generation, currentIntent);
|
|
294
|
+
let currentProgressTemporaryName = await findPruneProgressTemporaryName(target, generation);
|
|
295
|
+
if (currentIntent && !sameRetentionIntent(currentIntent, intent) || currentProgress && (!sameRetentionIntent(currentProgress.intent, intent) || !ownerMatches(currentProgress.owner, selected.owner)) || progress && !currentProgress || !progress && currentProgress || currentProgressTemporaryName !== progressTemporaryName) return { status: "recovery-required" };
|
|
296
|
+
context = await planRetentionWhileLocked(target, currentVersion, {
|
|
297
|
+
allowedRetentionIntentGeneration: generation,
|
|
298
|
+
...currentProgress || currentProgressTemporaryName ? { allowedPruneProgressGeneration: generation } : {},
|
|
299
|
+
...currentProgressTemporaryName ? { allowedPruneProgressTemporaryName: currentProgressTemporaryName } : {}
|
|
300
|
+
});
|
|
301
|
+
if (context.plan.status !== "ready") return { status: "recovery-required" };
|
|
302
|
+
await assertIntentMatchesRetentionPlan(target, context.inventory, context.plan, intent);
|
|
303
|
+
if (context.plan.prune[0]?.toLowerCase() !== generation.toLowerCase()) return { status: "recovery-required" };
|
|
304
|
+
selected = context.inventory.records.find(({ owner }) => owner.generation.toLowerCase() === generation.toLowerCase());
|
|
305
|
+
if (!selected) return { status: "recovery-required" };
|
|
306
|
+
if (currentIntent) await syncUpdateRetentionIntent(currentIntent);
|
|
307
|
+
if (currentProgressTemporaryName) {
|
|
308
|
+
const temporaryPath = join(dirname(target), currentProgressTemporaryName);
|
|
309
|
+
const temporary = await readPruneProgressFile(temporaryPath, target, generation, currentIntent, selected.owner);
|
|
310
|
+
if (!temporary) return { status: "recovery-required" };
|
|
311
|
+
if (currentProgress) {
|
|
312
|
+
if (!healthReceiptMatches(temporary.healthReceipt, currentProgress.healthReceipt)) return { status: "recovery-required" };
|
|
313
|
+
await unlink(temporaryPath);
|
|
314
|
+
if (await pathInfo(temporaryPath)) return { status: "recovery-required" };
|
|
315
|
+
await syncPruneDirectory(dirname(temporaryPath), intent.previousTreeIdentity.device);
|
|
316
|
+
} else {
|
|
317
|
+
if (temporary.phase !== "deleting" || !currentIntent) return { status: "recovery-required" };
|
|
318
|
+
const finalPath = retentionPruneProgressPath(target, generation);
|
|
319
|
+
if (await pathInfo(finalPath)) return { status: "recovery-required" };
|
|
320
|
+
await syncPruneFile(temporaryPath, intent.previousTreeIdentity.device);
|
|
321
|
+
await link(temporaryPath, finalPath);
|
|
322
|
+
await syncPruneDirectory(dirname(finalPath), intent.previousTreeIdentity.device);
|
|
323
|
+
currentProgress = await readPruneProgress(target, generation, currentIntent);
|
|
324
|
+
if (!currentProgress || !ownerMatches(currentProgress.owner, temporary.owner) || !healthReceiptMatches(currentProgress.healthReceipt, temporary.healthReceipt)) return { status: "recovery-required" };
|
|
325
|
+
await unlink(temporaryPath);
|
|
326
|
+
if (await pathInfo(temporaryPath)) return { status: "recovery-required" };
|
|
327
|
+
await syncPruneDirectory(dirname(temporaryPath), intent.previousTreeIdentity.device);
|
|
328
|
+
}
|
|
329
|
+
context = await planRetentionWhileLocked(target, currentVersion, {
|
|
330
|
+
allowedRetentionIntentGeneration: generation,
|
|
331
|
+
allowedPruneProgressGeneration: generation
|
|
332
|
+
});
|
|
333
|
+
if (context.plan.status !== "ready") return { status: "recovery-required" };
|
|
334
|
+
await assertIntentMatchesRetentionPlan(target, context.inventory, context.plan, intent);
|
|
335
|
+
if (context.plan.prune[0]?.toLowerCase() !== generation.toLowerCase()) return { status: "recovery-required" };
|
|
336
|
+
selected = context.inventory.records.find(({ owner }) => owner.generation.toLowerCase() === generation.toLowerCase());
|
|
337
|
+
if (!selected) return { status: "recovery-required" };
|
|
338
|
+
}
|
|
339
|
+
if (!currentProgress || currentProgress.phase === "deleting") await syncPruneRecoveryEvidence(target, intent, context.inventory);
|
|
340
|
+
if (currentProgress) await syncPruneProgress(target, generation, currentProgress);
|
|
341
|
+
const progressHealthReceipt = currentProgress?.healthReceipt ?? await readHealthReceipt(selected.paths.healthReceipt);
|
|
342
|
+
if (!healthReceiptMatches(progressHealthReceipt, healthReceiptFor(selected.owner))) return { status: "recovery-required" };
|
|
343
|
+
let prioritizeVersionMarker;
|
|
344
|
+
if (!currentProgress || currentProgress.phase === "deleting") {
|
|
345
|
+
const versionPath = join(selected.paths.tree, "Contents", "Resources", "version.json");
|
|
346
|
+
const versionInfo = await pathInfo(versionPath);
|
|
347
|
+
if (!currentProgress && (!versionInfo?.isFile() || versionInfo.isSymbolicLink())) return { status: "recovery-required" };
|
|
348
|
+
if (versionInfo) {
|
|
349
|
+
if (!versionInfo.isFile() || versionInfo.isSymbolicLink()) return { status: "recovery-required" };
|
|
350
|
+
prioritizeVersionMarker = {
|
|
351
|
+
path: [
|
|
352
|
+
"Contents",
|
|
353
|
+
"Resources",
|
|
354
|
+
"version.json"
|
|
355
|
+
],
|
|
356
|
+
version: selected.owner.previousVersion
|
|
357
|
+
};
|
|
358
|
+
}
|
|
359
|
+
}
|
|
360
|
+
if (!currentProgress) {
|
|
361
|
+
if (!await publishPruneProgress(intent, selected.owner, progressHealthReceipt, "deleting")) return { status: "recovery-required" };
|
|
362
|
+
const removed = await removeDirectoryContentsChunk({
|
|
363
|
+
root: selected.paths.tree,
|
|
364
|
+
expectedRootIdentity: intent.previousTreeIdentity,
|
|
365
|
+
maxOperations,
|
|
366
|
+
prioritizeVersionMarker
|
|
367
|
+
});
|
|
368
|
+
if (removed.status === "empty") {
|
|
369
|
+
if (!await publishPruneProgress(intent, selected.owner, progressHealthReceipt, "empty")) return { status: "recovery-required" };
|
|
370
|
+
}
|
|
371
|
+
return {
|
|
372
|
+
status: "more",
|
|
373
|
+
removed: removed.removed
|
|
374
|
+
};
|
|
375
|
+
}
|
|
376
|
+
if (currentProgress.phase === "deleting") {
|
|
377
|
+
const removed = await removeDirectoryContentsChunk({
|
|
378
|
+
root: selected.paths.tree,
|
|
379
|
+
expectedRootIdentity: intent.previousTreeIdentity,
|
|
380
|
+
maxOperations,
|
|
381
|
+
prioritizeVersionMarker
|
|
382
|
+
});
|
|
383
|
+
if (removed.status === "empty") {
|
|
384
|
+
if (!await publishPruneProgress(intent, selected.owner, progressHealthReceipt, "empty")) return { status: "recovery-required" };
|
|
385
|
+
}
|
|
386
|
+
return {
|
|
387
|
+
status: "more",
|
|
388
|
+
removed: removed.removed
|
|
389
|
+
};
|
|
390
|
+
}
|
|
391
|
+
const treeInfo = await pathInfo(selected.paths.tree);
|
|
392
|
+
if (treeInfo) {
|
|
393
|
+
if (!treeInfo.isDirectory() || treeInfo.isSymbolicLink() || !await samePathTreeIdentity(selected.paths.tree, intent.previousTreeIdentity) || (await readdir(selected.paths.tree)).length !== 0) return { status: "recovery-required" };
|
|
394
|
+
await rmdir(selected.paths.tree);
|
|
395
|
+
}
|
|
396
|
+
if (await pathInfo(selected.paths.container)) {
|
|
397
|
+
if (await pathInfo(selected.paths.healthReceipt)) {
|
|
398
|
+
const receipt = await readHealthReceipt(selected.paths.healthReceipt);
|
|
399
|
+
if (!receipt || !healthReceiptMatches(receipt, healthReceiptFor(selected.owner))) return { status: "recovery-required" };
|
|
400
|
+
await unlink(selected.paths.healthReceipt);
|
|
401
|
+
}
|
|
402
|
+
if (await pathInfo(selected.paths.claim)) {
|
|
403
|
+
const currentOwner = await readOwner(selected.paths.claim);
|
|
404
|
+
if (!currentOwner || !ownerMatches(currentOwner, selected.owner)) return { status: "recovery-required" };
|
|
405
|
+
await unlink(selected.paths.claim);
|
|
406
|
+
}
|
|
407
|
+
const currentDiskIntent = await readUpdateRetentionIntent(target, generation);
|
|
408
|
+
if (currentDiskIntent) {
|
|
409
|
+
if (!sameRetentionIntent(currentDiskIntent, intent)) return { status: "recovery-required" };
|
|
410
|
+
await unlink(updateRetentionIntentPath(target, generation));
|
|
411
|
+
}
|
|
412
|
+
if ((await readdir(selected.paths.container)).length !== 0) return { status: "recovery-required" };
|
|
413
|
+
await syncPruneDirectory(selected.paths.container, intent.previousTreeIdentity.device);
|
|
414
|
+
await rmdir(selected.paths.container);
|
|
415
|
+
} else {
|
|
416
|
+
if (await pathInfo(selected.paths.claim)) {
|
|
417
|
+
const currentOwner = await readOwner(selected.paths.claim);
|
|
418
|
+
if (!currentOwner || !ownerMatches(currentOwner, selected.owner)) return { status: "recovery-required" };
|
|
419
|
+
await unlink(selected.paths.claim);
|
|
420
|
+
}
|
|
421
|
+
const currentDiskIntent = await readUpdateRetentionIntent(target, generation);
|
|
422
|
+
if (currentDiskIntent) {
|
|
423
|
+
if (!sameRetentionIntent(currentDiskIntent, intent)) return { status: "recovery-required" };
|
|
424
|
+
await unlink(updateRetentionIntentPath(target, generation));
|
|
425
|
+
}
|
|
426
|
+
}
|
|
427
|
+
await syncPruneDirectory(dirname(target), intent.previousTreeIdentity.device);
|
|
428
|
+
const progressPath = retentionPruneProgressPath(target, generation);
|
|
429
|
+
const finalProgress = await readPruneProgressFile(progressPath, target, generation, intent, selected.owner);
|
|
430
|
+
if (!finalProgress || finalProgress.phase !== "empty") return { status: "recovery-required" };
|
|
431
|
+
await unlink(progressPath);
|
|
432
|
+
await syncPruneDirectory(dirname(target), intent.previousTreeIdentity.device);
|
|
433
|
+
return { status: "pruned" };
|
|
434
|
+
} finally {
|
|
435
|
+
await lease.release();
|
|
436
|
+
}
|
|
437
|
+
});
|
|
438
|
+
}
|
|
439
|
+
export { UpdateRetentionOrphanPromotionError, beginUpdateRetentionCleanup, inspectUpdateRetentionCleanup, promoteOrphanUpdateRetentionCleanup, pruneUpdateRetentionStep, reconcileUpdateRetentionCleanup, syncValidatedUpdateRetentionCleanup };
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { type UpdateRetentionIntent } from './update-retention-marker';
|
|
2
|
+
import type { ValidatedRetirementInventory } from './retirement-inventory';
|
|
3
|
+
import { type HealthReceipt, type RetirementOwner } from './retirement-records';
|
|
4
|
+
export type RetentionPruneProgress = Readonly<{
|
|
5
|
+
schema: 1;
|
|
6
|
+
phase: 'deleting' | 'empty';
|
|
7
|
+
intent: UpdateRetentionIntent;
|
|
8
|
+
owner: RetirementOwner;
|
|
9
|
+
healthReceipt: HealthReceipt;
|
|
10
|
+
}>;
|
|
11
|
+
export declare function retentionPruneProgressPath(target: string, generation: string): string;
|
|
12
|
+
export declare function isPruneProgressName(name: string, target: string): boolean;
|
|
13
|
+
export declare function pruneProgressNames(target: string, generation: string): readonly string[];
|
|
14
|
+
export declare function assertNoUnresolvedRetentionPruneArtifacts(target: string, names: readonly string[], allowances?: Readonly<{
|
|
15
|
+
allowedRetentionIntentGeneration?: string;
|
|
16
|
+
allowedRetentionTemporaryName?: string;
|
|
17
|
+
allowedPruneProgressGeneration?: string;
|
|
18
|
+
allowedPruneProgressTemporaryName?: string;
|
|
19
|
+
}>, message?: string): void;
|
|
20
|
+
export declare function findPruneProgressTemporaryName(target: string, generation: string): Promise<string | undefined>;
|
|
21
|
+
export declare function readPruneProgressFile(path: string, target: string, generation: string, expectedIntent?: UpdateRetentionIntent, expectedOwner?: RetirementOwner): Promise<RetentionPruneProgress | undefined>;
|
|
22
|
+
export declare function publishPruneProgress(intent: UpdateRetentionIntent, owner: RetirementOwner, healthReceipt: HealthReceipt, phase: 'deleting' | 'empty'): Promise<boolean>;
|
|
23
|
+
export declare function readPruneProgress(target: string, generation: string, expectedIntent?: UpdateRetentionIntent): Promise<RetentionPruneProgress | undefined>;
|
|
24
|
+
export declare function syncPruneFile(path: string, expectedDevice?: string): Promise<void>;
|
|
25
|
+
export declare function syncPruneDirectory(path: string, expectedDevice?: string): Promise<void>;
|
|
26
|
+
export declare function syncPruneRecoveryEvidence(target: string, intent: UpdateRetentionIntent, inventory: ValidatedRetirementInventory): Promise<void>;
|
|
27
|
+
export declare function syncPruneProgress(target: string, generation: string, expected: RetentionPruneProgress): Promise<void>;
|