@adea-ai/app-framework-release-tools 0.1.0 → 0.3.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/cli.js +1714 -306
- package/dist/index.js +672 -251
- package/dist/release-tools-source.json +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -17,12 +17,15 @@ var __export = (target, all) => {
|
|
|
17
17
|
// src/index.ts
|
|
18
18
|
var exports_src = {};
|
|
19
19
|
__export(exports_src, {
|
|
20
|
+
createDailyNativeReceipt: () => createDailyNativeReceipt,
|
|
20
21
|
createGitHubPromotionProvider: () => createGitHubPromotionProvider,
|
|
21
22
|
createGitHubReleasePublisher: () => createGitHubReleasePublisher,
|
|
22
23
|
createMacosDmg: () => createMacosDmg,
|
|
24
|
+
desktopDailyProfile: () => desktopDailyProfile,
|
|
23
25
|
fileIdentity: () => fileIdentity2,
|
|
24
26
|
finalizeReleasePleaseDraft: () => finalizeReleasePleaseDraft,
|
|
25
27
|
inspectStagedStep: () => inspectStagedStep,
|
|
28
|
+
planDailyReleaseMatrix: () => planDailyReleaseMatrix,
|
|
26
29
|
planQualificationRun: () => planQualificationRun2,
|
|
27
30
|
planReleaseAssets: () => planReleaseAssets2,
|
|
28
31
|
publishFrameworkPackage: () => publishFrameworkPackage,
|
|
@@ -39,6 +42,7 @@ __export(exports_src, {
|
|
|
39
42
|
stageBuildStep: () => stageBuildStep,
|
|
40
43
|
stagePlatformArtifacts: () => stagePlatformArtifacts,
|
|
41
44
|
stageReleaseDescriptors: () => stageReleaseDescriptors,
|
|
45
|
+
verifyDailyReleaseMatrix: () => verifyDailyReleaseMatrix,
|
|
42
46
|
verifyImage: () => verifyImage,
|
|
43
47
|
writeDescriptors: () => writeDescriptors
|
|
44
48
|
});
|
|
@@ -97,6 +101,149 @@ function sidecarBundlePath(name, platform) {
|
|
|
97
101
|
return `Resources/app/${SIDECAR_DIRECTORY}/${sidecarFileName(name, platform)}`;
|
|
98
102
|
}
|
|
99
103
|
|
|
104
|
+
// ../../src/updates/feed/arch-package-policy.ts
|
|
105
|
+
var packageName = /^[a-z0-9][a-z0-9@+._-]{0,63}$/;
|
|
106
|
+
var executableName = /^[a-z][a-z0-9-]{0,63}$/;
|
|
107
|
+
var licenseToken = /^[A-Za-z0-9][A-Za-z0-9.+:-]{0,63}$/;
|
|
108
|
+
var category = /^[A-Za-z][A-Za-z0-9-]{0,31}$/;
|
|
109
|
+
var relative = /^[A-Za-z0-9._-]+(?:\/[A-Za-z0-9._-]+)*$/;
|
|
110
|
+
var optdependsEntry = /^[a-z0-9][a-z0-9@+._-]{0,63}(?:: [^<>\r\n]{1,128})?$/;
|
|
111
|
+
function assert(condition, message) {
|
|
112
|
+
if (!condition)
|
|
113
|
+
throw new Error(message);
|
|
114
|
+
}
|
|
115
|
+
function text(value, maximum) {
|
|
116
|
+
return typeof value === "string" && value.length > 0 && value.length <= maximum && !containsAsciiControl(value) && value.trim() === value;
|
|
117
|
+
}
|
|
118
|
+
function httpsUrl(value) {
|
|
119
|
+
if (typeof value !== "string" || value.length > 300)
|
|
120
|
+
return false;
|
|
121
|
+
let url;
|
|
122
|
+
try {
|
|
123
|
+
url = new URL(value);
|
|
124
|
+
} catch {
|
|
125
|
+
return false;
|
|
126
|
+
}
|
|
127
|
+
return url.protocol === "https:" && (url.href === value || url.pathname === "/" && url.href === `${value}/`) && !url.username && !url.password && !url.port && !url.search && !url.hash;
|
|
128
|
+
}
|
|
129
|
+
function sourceTemplate(value) {
|
|
130
|
+
if (typeof value !== "string" || !value.includes("{tag}"))
|
|
131
|
+
return false;
|
|
132
|
+
const rest = value.replaceAll("{tag}", "");
|
|
133
|
+
return !rest.includes("{") && !rest.includes("}") && httpsUrl(value.replaceAll("{tag}", "v1.0.0"));
|
|
134
|
+
}
|
|
135
|
+
function tokenList(value, options) {
|
|
136
|
+
assert(Array.isArray(value) && value.length >= options.minimum && value.length <= options.maximum && value.every((item) => typeof item === "string" && item.length <= 200 && options.pattern.test(item) && !containsAsciiControl(item)) && new Set(value).size === value.length, options.message);
|
|
137
|
+
return [...value];
|
|
138
|
+
}
|
|
139
|
+
function bundlePath(value, suffix) {
|
|
140
|
+
return typeof value === "string" && value.length <= 200 && relative.test(value) && !value.split("/").some((part) => part === "." || part === "..") && (suffix === undefined || value.endsWith(suffix));
|
|
141
|
+
}
|
|
142
|
+
var policyKeys = new Set([
|
|
143
|
+
"pkgname",
|
|
144
|
+
"pkgdesc",
|
|
145
|
+
"maintainer",
|
|
146
|
+
"url",
|
|
147
|
+
"license",
|
|
148
|
+
"depends",
|
|
149
|
+
"optdepends",
|
|
150
|
+
"provides",
|
|
151
|
+
"conflicts",
|
|
152
|
+
"executable",
|
|
153
|
+
"setuid",
|
|
154
|
+
"desktop",
|
|
155
|
+
"icon",
|
|
156
|
+
"licenseSource",
|
|
157
|
+
"links",
|
|
158
|
+
"channel",
|
|
159
|
+
"repository"
|
|
160
|
+
]);
|
|
161
|
+
function parseArchPackage(value) {
|
|
162
|
+
assert(isRecord(value) && Object.keys(value).every((key) => policyKeys.has(key)), "Invalid Arch package configuration");
|
|
163
|
+
const policy = value;
|
|
164
|
+
const desktop = policy.desktop;
|
|
165
|
+
const links = policy.links ?? [];
|
|
166
|
+
assert(typeof policy.pkgname === "string" && packageName.test(policy.pkgname) && policy.pkgname.endsWith("-bin"), "Arch package name must be a lowercase pkgname ending in -bin");
|
|
167
|
+
assert(text(policy.pkgdesc, 256), "Invalid Arch package description");
|
|
168
|
+
assert(text(policy.maintainer, 128) && /^[^<>\r\n]{1,64} <[^<>\r\n]{3,64}>$/.test(policy.maintainer), "Invalid Arch package maintainer");
|
|
169
|
+
assert(httpsUrl(policy.url), "Invalid Arch package URL");
|
|
170
|
+
assert(text(policy.executable, 64) && executableName.test(policy.executable), "Invalid Arch executable");
|
|
171
|
+
assert(policy.icon === undefined || bundlePath(policy.icon, ".svg"), "Invalid Arch package icon");
|
|
172
|
+
assert(policy.licenseSource === undefined || sourceTemplate(policy.licenseSource), "Invalid Arch license source");
|
|
173
|
+
assert(isRecord(desktop) && Object.keys(desktop).every((key) => ["name", "comment", "categories"].includes(key)) && text(desktop.name, 64) && (desktop.comment === undefined || text(desktop.comment, 128)) && "categories" in desktop, "Invalid Arch desktop entry");
|
|
174
|
+
assert(Array.isArray(links) && links.length <= 8 && links.every((link, index) => isRecord(link) && Object.keys(link).length === 2 && text(link.name, 64) && executableName.test(link.name) && link.name !== policy.executable && links.findIndex((item) => isRecord(item) && item.name === link.name) === index && bundlePath(link.target)), "Invalid Arch package links");
|
|
175
|
+
assert(policy.channel === undefined || policy.channel === "stable" || policy.channel === "daily", "Invalid Arch package channel");
|
|
176
|
+
const repository = policy.repository;
|
|
177
|
+
assert(repository === undefined || isRecord(repository) && Object.keys(repository).length === 3 && typeof repository.name === "string" && /^[a-z][a-z0-9-]{0,31}$/.test(repository.name) && httpsUrl(repository.base) && repository.base.endsWith("/") && httpsUrl(repository.publicKey), "Invalid Arch package repository");
|
|
178
|
+
return {
|
|
179
|
+
pkgname: policy.pkgname,
|
|
180
|
+
pkgdesc: policy.pkgdesc,
|
|
181
|
+
maintainer: policy.maintainer,
|
|
182
|
+
url: policy.url,
|
|
183
|
+
license: tokenList(policy.license, {
|
|
184
|
+
maximum: 8,
|
|
185
|
+
minimum: 1,
|
|
186
|
+
pattern: licenseToken,
|
|
187
|
+
message: "Invalid Arch package license"
|
|
188
|
+
}),
|
|
189
|
+
depends: tokenList(policy.depends, {
|
|
190
|
+
maximum: 64,
|
|
191
|
+
minimum: 1,
|
|
192
|
+
pattern: packageName,
|
|
193
|
+
message: "Invalid Arch package dependencies"
|
|
194
|
+
}),
|
|
195
|
+
optdepends: tokenList(policy.optdepends ?? [], {
|
|
196
|
+
maximum: 32,
|
|
197
|
+
minimum: 0,
|
|
198
|
+
pattern: optdependsEntry,
|
|
199
|
+
message: "Invalid Arch optional dependencies"
|
|
200
|
+
}),
|
|
201
|
+
provides: tokenList(policy.provides ?? [], {
|
|
202
|
+
maximum: 16,
|
|
203
|
+
minimum: 0,
|
|
204
|
+
pattern: packageName,
|
|
205
|
+
message: "Invalid Arch package provides"
|
|
206
|
+
}),
|
|
207
|
+
conflicts: tokenList(policy.conflicts ?? [], {
|
|
208
|
+
maximum: 16,
|
|
209
|
+
minimum: 0,
|
|
210
|
+
pattern: packageName,
|
|
211
|
+
message: "Invalid Arch package conflicts"
|
|
212
|
+
}),
|
|
213
|
+
executable: policy.executable,
|
|
214
|
+
setuid: tokenList(policy.setuid ?? [], {
|
|
215
|
+
maximum: 8,
|
|
216
|
+
minimum: 0,
|
|
217
|
+
pattern: /^[A-Za-z0-9._-]+(?:\/[A-Za-z0-9._-]+)+$/,
|
|
218
|
+
message: "Invalid Arch setuid executables"
|
|
219
|
+
}),
|
|
220
|
+
desktop: {
|
|
221
|
+
name: desktop.name,
|
|
222
|
+
...desktop.comment === undefined ? {} : { comment: desktop.comment },
|
|
223
|
+
categories: tokenList(desktop.categories, {
|
|
224
|
+
maximum: 8,
|
|
225
|
+
minimum: 1,
|
|
226
|
+
pattern: category,
|
|
227
|
+
message: "Invalid Arch desktop categories"
|
|
228
|
+
})
|
|
229
|
+
},
|
|
230
|
+
...policy.icon === undefined ? {} : { icon: policy.icon },
|
|
231
|
+
...policy.licenseSource === undefined ? {} : { licenseSource: policy.licenseSource },
|
|
232
|
+
links: links.map((link) => ({
|
|
233
|
+
name: link.name,
|
|
234
|
+
target: link.target
|
|
235
|
+
})),
|
|
236
|
+
channel: policy.channel ?? "stable",
|
|
237
|
+
...repository === undefined ? {} : {
|
|
238
|
+
repository: {
|
|
239
|
+
name: repository.name,
|
|
240
|
+
base: repository.base,
|
|
241
|
+
publicKey: repository.publicKey
|
|
242
|
+
}
|
|
243
|
+
}
|
|
244
|
+
};
|
|
245
|
+
}
|
|
246
|
+
|
|
100
247
|
// ../../src/updates/feed/release-feed.ts
|
|
101
248
|
var MAX_LEDGER_RELEASES = 500;
|
|
102
249
|
var MAX_RELEASE_ASSETS = 256;
|
|
@@ -182,19 +329,19 @@ function parseReleaseLedger(value, app) {
|
|
|
182
329
|
}
|
|
183
330
|
|
|
184
331
|
// ../../src/updates/feed/release-config-contract.ts
|
|
185
|
-
function
|
|
332
|
+
function assert2(condition, message) {
|
|
186
333
|
if (!condition)
|
|
187
334
|
throw new Error(message);
|
|
188
335
|
}
|
|
189
336
|
function parseOfflinePolicy(value) {
|
|
190
|
-
|
|
337
|
+
assert2(typeof value === "object" && value !== null && !Array.isArray(value), "Invalid offline policy");
|
|
191
338
|
const policy = value;
|
|
192
|
-
|
|
339
|
+
assert2(typeof policy.marker === "string" && policy.marker.trim().length > 0 && policy.marker.length <= 256 && !containsAsciiControl(policy.marker), "Invalid offline marker");
|
|
193
340
|
if (policy.kind === "standalone") {
|
|
194
|
-
|
|
341
|
+
assert2(Object.keys(policy).length === 2, "Invalid standalone offline policy");
|
|
195
342
|
return { kind: "standalone", marker: policy.marker };
|
|
196
343
|
}
|
|
197
|
-
|
|
344
|
+
assert2(policy.kind === "local-bootstrap" && Object.keys(policy).length === 3 && typeof policy.path === "string" && policy.path.length <= 256 && /^\/(?:[A-Za-z0-9_~-]+\/)*[A-Za-z0-9_~-]+$/.test(policy.path) && !policy.path.startsWith("/__framework/"), "Invalid bootstrap offline policy");
|
|
198
345
|
return { kind: "local-bootstrap", marker: policy.marker, path: policy.path };
|
|
199
346
|
}
|
|
200
347
|
var strings = (value) => Array.isArray(value) && value.length > 0 && value.every((item) => typeof item === "string" && item.length <= 200 && /^[A-Za-z0-9][A-Za-z0-9._{}-]*$/.test(item) && !item.replaceAll("{tag}", "").includes("{") && !item.replaceAll("{tag}", "").includes("}")) && new Set(value).size === value.length;
|
|
@@ -289,6 +436,7 @@ function parseReleaseConfig(config) {
|
|
|
289
436
|
if (!/^[a-z0-9-]+$/.test(platform) || !strings(assets))
|
|
290
437
|
throw new Error("Invalid release platform configuration");
|
|
291
438
|
const platformSnapshot = Object.fromEntries(Object.entries(platforms).map(([platform, assets]) => [platform, [...assets]]));
|
|
439
|
+
const archPackage = config.archPackage === undefined ? undefined : parseArchPackage(config.archPackage);
|
|
292
440
|
const commandArtifacts = parseCommandArtifacts(config.commandArtifacts, Object.keys(platforms));
|
|
293
441
|
const appIds = [config.appId, ...commandArtifacts.map((artifact) => artifact.appId)];
|
|
294
442
|
if (new Set(appIds).size !== appIds.length)
|
|
@@ -333,6 +481,7 @@ function parseReleaseConfig(config) {
|
|
|
333
481
|
sidecars,
|
|
334
482
|
releaseWorkflows,
|
|
335
483
|
feed,
|
|
484
|
+
archPackage,
|
|
336
485
|
commandArtifacts,
|
|
337
486
|
requirements
|
|
338
487
|
};
|
|
@@ -853,7 +1002,7 @@ function normalizePromotionRelease(value) {
|
|
|
853
1002
|
}
|
|
854
1003
|
|
|
855
1004
|
// ../../src/release/release-qualification.ts
|
|
856
|
-
function
|
|
1005
|
+
function assert3(condition, message) {
|
|
857
1006
|
if (!condition)
|
|
858
1007
|
throw new Error(message);
|
|
859
1008
|
}
|
|
@@ -861,19 +1010,19 @@ function expectedAssets(requirements) {
|
|
|
861
1010
|
if (Object.hasOwn(requirements, "offlinePolicy"))
|
|
862
1011
|
parseOfflinePolicy(requirements.offlinePolicy);
|
|
863
1012
|
const platforms = Object.entries(requirements.platforms);
|
|
864
|
-
|
|
1013
|
+
assert3(platforms.length > 0, "Missing platforms");
|
|
865
1014
|
const names = [
|
|
866
1015
|
...platforms.flatMap(([platform, artifacts]) => {
|
|
867
|
-
|
|
1016
|
+
assert3(/^[a-z0-9-]+$/.test(platform) && artifacts.length > 0, "Invalid platform requirements");
|
|
868
1017
|
return artifacts;
|
|
869
1018
|
}),
|
|
870
1019
|
...Object.entries(requirements.commandArtifacts ?? {}).flatMap(([kind, byPlatform]) => {
|
|
871
|
-
|
|
1020
|
+
assert3(/^[a-z][a-z0-9-]{0,31}$/.test(kind) && Object.keys(byPlatform).length === platforms.length && platforms.every(([platform]) => typeof byPlatform[platform] === "string"), "Invalid command artifact requirements");
|
|
872
1021
|
return Object.values(byPlatform);
|
|
873
1022
|
}),
|
|
874
1023
|
...requirements.releaseAssets
|
|
875
1024
|
];
|
|
876
|
-
|
|
1025
|
+
assert3(names.length > 0 && names.every((name) => /^[A-Za-z0-9][A-Za-z0-9._-]*$/.test(name)) && new Set(names).size === names.length, "Invalid or duplicate asset requirements");
|
|
877
1026
|
return names;
|
|
878
1027
|
}
|
|
879
1028
|
function matches(saved, uploaded) {
|
|
@@ -881,74 +1030,74 @@ function matches(saved, uploaded) {
|
|
|
881
1030
|
}
|
|
882
1031
|
function uniqueAsset(assets, name) {
|
|
883
1032
|
const found = assets.filter((asset) => asset.name === name);
|
|
884
|
-
|
|
1033
|
+
assert3(found.length === 1, `Missing or duplicate asset: ${name}`);
|
|
885
1034
|
return found[0];
|
|
886
1035
|
}
|
|
887
1036
|
function checkRenderer(value, offlinePolicy) {
|
|
888
1037
|
const port = Number(value?.origin?.split(":").at(-1));
|
|
889
1038
|
const common = value && port >= 1024 && port <= 65535 && /^http:\/\/127\.0\.0\.1:[1-9]\d{3,4}$/.test(value.origin) && value.samples === 2 && value.guardInstalled === true && value.offlineObserved === true && value.unexpectedActivity === false && Number.isFinite(value.elapsedMs) && value.elapsedMs >= 3000 && value.visible === true && ["interactive", "complete"].includes(value.readyState) && Number.isFinite(value.width) && value.width >= 100 && Number.isFinite(value.height) && value.height >= 100 && Number.isSafeInteger(value.interactiveElements) && value.interactiveElements >= 1 && Number.isSafeInteger(value.textLength) && value.textLength >= 1;
|
|
890
1039
|
if (!offlinePolicy) {
|
|
891
|
-
|
|
1040
|
+
assert3(common && value.method === "native-dom-raf-v1" && value.bootstrapDenied === true, "Incomplete native renderer evidence");
|
|
892
1041
|
return;
|
|
893
1042
|
}
|
|
894
|
-
|
|
1043
|
+
assert3(value && value.offlinePolicy, "Incomplete native renderer evidence");
|
|
895
1044
|
const policy = parseOfflinePolicy(offlinePolicy), observed = parseOfflinePolicy(value.offlinePolicy);
|
|
896
|
-
|
|
1045
|
+
assert3(common && value.method === "native-dom-raf-v2" && value.markerObserved === true && value.browserNetworkRestricted === true && observed.kind === policy.kind && observed.marker === policy.marker && (policy.kind === "standalone" ? value.bootstrapDenied === false : observed.kind === "local-bootstrap" && observed.path === policy.path && value.bootstrapDenied === true), "Incomplete native renderer evidence");
|
|
897
1046
|
}
|
|
898
1047
|
function validateInstallerReceipt(identity, entry, platform, names, assets, offlinePolicy) {
|
|
899
1048
|
assertIdentity(identity, platform);
|
|
900
|
-
|
|
901
|
-
|
|
1049
|
+
assert3(Array.isArray(names) && new Set(names).size === names.length, "Invalid installer receipt context");
|
|
1050
|
+
assert3(entry && entry.platform === platform && entry.schema === 2 && entry.installed === true && entry.launched === true && entry.rendererReady === true && ["tag", "sourceSha", "workflowSha", "runId", "runAttempt"].every((key) => entry[key] === identity[key]), "Installer identity mismatch");
|
|
902
1051
|
checkRenderer(entry.rendererEvidence, offlinePolicy);
|
|
903
|
-
|
|
1052
|
+
assert3(Array.isArray(entry.assets) && names.length > 0 && entry.assets.length === names.length, "Incorrect installer asset count");
|
|
904
1053
|
for (const name of names)
|
|
905
|
-
|
|
1054
|
+
assert3(matches(uniqueAsset(entry.assets, name), uniqueAsset(assets, name)), `Installer asset mismatch: ${name}`);
|
|
906
1055
|
return true;
|
|
907
1056
|
}
|
|
908
1057
|
function assertIdentity(identity, platform) {
|
|
909
|
-
|
|
1058
|
+
assert3(/^v\d+\.\d+\.\d+$/.test(identity.tag) && isGitSha(identity.sourceSha) && isGitSha(identity.workflowSha) && /^[1-9]\d{0,19}$/.test(identity.runId) && Number.isSafeInteger(identity.runAttempt) && identity.runAttempt > 0 && /^[a-z0-9-]+$/.test(platform), "Invalid receipt context");
|
|
910
1059
|
}
|
|
911
1060
|
function validateCommandReceipt(identity, entry, kind, platform, name, assets) {
|
|
912
1061
|
assertIdentity(identity, platform);
|
|
913
|
-
|
|
914
|
-
|
|
1062
|
+
assert3(entry && entry.schema === 1 && entry.kind === kind && entry.platform === platform && entry.installed === true && entry.versionMatched === true && entry.probesPassed === true && entry.serviceStarted === true && entry.serviceStopped === (platform === "windows-x64" ? "process-tree" : "sigterm") && Object.keys(entry).length === 14 && ["tag", "sourceSha", "workflowSha", "runId", "runAttempt"].every((key) => entry[key] === identity[key]), "Command artifact receipt mismatch");
|
|
1063
|
+
assert3(matches(entry.asset, uniqueAsset(assets, name)), `Command artifact asset mismatch: ${name}`);
|
|
915
1064
|
return true;
|
|
916
1065
|
}
|
|
917
1066
|
function validateCommandReceipts(identity, receipts, requirements, assets) {
|
|
918
1067
|
const required = Object.entries(requirements.commandArtifacts ?? {}).flatMap(([kind, byPlatform]) => Object.entries(byPlatform).map(([platform, name]) => ({ kind, platform, name })));
|
|
919
1068
|
if (!required.length) {
|
|
920
|
-
|
|
1069
|
+
assert3(receipts === undefined, "Unexpected command artifact receipts");
|
|
921
1070
|
return;
|
|
922
1071
|
}
|
|
923
|
-
|
|
1072
|
+
assert3(Array.isArray(receipts) && receipts.length === required.length, "Missing or duplicate command artifact receipts");
|
|
924
1073
|
for (const { kind, platform, name } of required) {
|
|
925
1074
|
const entries = receipts.filter((entry) => entry?.kind === kind && entry.platform === platform);
|
|
926
|
-
|
|
1075
|
+
assert3(entries.length === 1, `Missing or duplicate command artifact receipt: ${kind}`);
|
|
927
1076
|
validateCommandReceipt(identity, entries[0], kind, platform, name, assets);
|
|
928
1077
|
}
|
|
929
1078
|
}
|
|
930
1079
|
function validateReleaseQualification(release, receipt, sourceSha, requirements) {
|
|
931
1080
|
const required = expectedAssets(requirements);
|
|
932
1081
|
const platforms = Object.keys(requirements.platforms);
|
|
933
|
-
|
|
934
|
-
|
|
1082
|
+
assert3(release.draft === false && receipt.schema === 2 && receipt.tag === release.tag_name && receipt.sourceSha === sourceSha && isGitSha(sourceSha) && isGitSha(receipt.workflowSha) && /^[1-9]\d*$/.test(receipt.runId) && Number.isSafeInteger(receipt.runAttempt) && receipt.runAttempt > 0, "Qualification identity mismatch");
|
|
1083
|
+
assert3(receipt.platforms.length === platforms.length && receipt.installerTests.length === platforms.length && receipt.installerReceipts.length === platforms.length && platforms.every((platform) => receipt.platforms.filter((x) => x === platform).length === 1 && receipt.installerTests.filter((x) => x === platform).length === 1), "Missing or duplicate platform tests");
|
|
935
1084
|
for (const platform of platforms) {
|
|
936
1085
|
const entries = receipt.installerReceipts.filter((entry) => entry.platform === platform);
|
|
937
|
-
|
|
1086
|
+
assert3(entries.length === 1, `Missing or duplicate installer receipt: ${platform}`);
|
|
938
1087
|
validateInstallerReceipt(receipt, entries[0], platform, requirements.platforms[platform], release.assets, requirements.offlinePolicy);
|
|
939
1088
|
}
|
|
940
1089
|
validateCommandReceipts(receipt, receipt.commandReceipts, requirements, release.assets);
|
|
941
|
-
|
|
1090
|
+
assert3(receipt.assets.length === required.length, "Incorrect qualification asset count");
|
|
942
1091
|
for (const name of required)
|
|
943
|
-
|
|
1092
|
+
assert3(matches(uniqueAsset(receipt.assets, name), uniqueAsset(release.assets, name)), `Qualification asset mismatch: ${name}`);
|
|
944
1093
|
return true;
|
|
945
1094
|
}
|
|
946
1095
|
function validateQualificationRun(run, jobs, receipt, repository, requirements, assetsWorkflow) {
|
|
947
1096
|
expectedAssets(requirements);
|
|
948
|
-
|
|
1097
|
+
assert3(String(run.id) === receipt.runId && run.run_attempt === receipt.runAttempt && run.conclusion === "success" && run.path === assetsWorkflow && run.repository.full_name === repository && run.head_sha === receipt.workflowSha && ["release", "workflow_dispatch"].includes(run.event), "Qualification run identity mismatch");
|
|
949
1098
|
for (const platform of Object.keys(requirements.platforms)) {
|
|
950
1099
|
const platformJobs = jobs.filter((job) => new RegExp(`^(?:[A-Za-z0-9_-]+ / )?Installer / ${platform}$`).test(job.name));
|
|
951
|
-
|
|
1100
|
+
assert3(platformJobs.length === 1 && platformJobs[0].conclusion === "success", `Missing successful installer job: ${platform}`);
|
|
952
1101
|
}
|
|
953
1102
|
return true;
|
|
954
1103
|
}
|
|
@@ -1490,6 +1639,9 @@ var RELEASE_VERSION = /^\d+\.\d+\.\d+(?:-dev\.\d+)?$/;
|
|
|
1490
1639
|
function isReleaseVersion(value) {
|
|
1491
1640
|
return typeof value === "string" && value.length <= MAX_RELEASE_VERSION_LENGTH && RELEASE_VERSION.test(value);
|
|
1492
1641
|
}
|
|
1642
|
+
function isReleaseTag(value) {
|
|
1643
|
+
return typeof value === "string" && value.startsWith("v") && isReleaseVersion(value.slice(1));
|
|
1644
|
+
}
|
|
1493
1645
|
|
|
1494
1646
|
// ../../src/release/release-promotion.ts
|
|
1495
1647
|
function order(a, b) {
|
|
@@ -1736,7 +1888,7 @@ function assertBuildMetadata(value, renderer) {
|
|
|
1736
1888
|
// ../../src/installer/command-artifact.ts
|
|
1737
1889
|
import { lstat as lstat2, mkdir as mkdir2, mkdtemp as mkdtemp2, readFile as readFile3, readdir as readdir3, rm as rm2 } from "fs/promises";
|
|
1738
1890
|
import { tmpdir } from "os";
|
|
1739
|
-
import { basename, join, relative, sep } from "path";
|
|
1891
|
+
import { basename, join, relative as relative2, sep } from "path";
|
|
1740
1892
|
import { c as create, t as list, x as extract } from "tar";
|
|
1741
1893
|
|
|
1742
1894
|
// ../../src/installer/archive-entry.ts
|
|
@@ -1851,7 +2003,7 @@ async function collect(root, directory, entries) {
|
|
|
1851
2003
|
for (const child of children) {
|
|
1852
2004
|
const path = join(directory, child.name);
|
|
1853
2005
|
const info = await lstat2(path);
|
|
1854
|
-
const name =
|
|
2006
|
+
const name = relative2(root, path).split(sep).join("/");
|
|
1855
2007
|
if (info.isDirectory()) {
|
|
1856
2008
|
entries.push(name);
|
|
1857
2009
|
await collect(root, path, entries);
|
|
@@ -2636,7 +2788,7 @@ function readPackageFile(bytes, path) {
|
|
|
2636
2788
|
}
|
|
2637
2789
|
|
|
2638
2790
|
// src/framework-package-publish.ts
|
|
2639
|
-
var
|
|
2791
|
+
var packageName2 = "@adea-ai/app-framework";
|
|
2640
2792
|
var registryUrl = "https://registry.npmjs.org/";
|
|
2641
2793
|
var VISIBILITY_SLEEPS = 32;
|
|
2642
2794
|
var FIRST_VISIBILITY_DELAY_MS = 5000;
|
|
@@ -2706,12 +2858,12 @@ function publishProgram(options) {
|
|
|
2706
2858
|
const manifest = yield* step(async () => JSON.parse(await fs.readFile("package.json", "utf8")));
|
|
2707
2859
|
const version = provenance.releasedVersion;
|
|
2708
2860
|
const archive = resolve4(options.archive);
|
|
2709
|
-
if (provenance.repository !== "adea-ai/app-framework" || manifest.name !==
|
|
2861
|
+
if (provenance.repository !== "adea-ai/app-framework" || manifest.name !== packageName2 || manifest.version !== version || basename2(archive) !== `adea-ai-app-framework-${version}.tgz`)
|
|
2710
2862
|
return yield* refused("source-mismatch");
|
|
2711
2863
|
const { bytes, integrity } = yield* archiveIntegrity(fs, archive);
|
|
2712
2864
|
const packed = yield* step(async () => readPackageFile(bytes, "package/package.json"));
|
|
2713
2865
|
const source = yield* step(async () => readPackageFile(bytes, "package/dist/framework-source.json"));
|
|
2714
|
-
if (packed.name !==
|
|
2866
|
+
if (packed.name !== packageName2 || packed.version !== version || source.version !== version || source.commit !== sha)
|
|
2715
2867
|
return yield* refused("not-from-checkout");
|
|
2716
2868
|
const existing = yield* step(() => registry(version));
|
|
2717
2869
|
if (existing !== null) {
|
|
@@ -2991,6 +3143,264 @@ var stageReleaseDescriptorsEffect = (options) => Effect15.gen(function* () {
|
|
|
2991
3143
|
});
|
|
2992
3144
|
var writeDescriptors = (directory, signed) => runReleaseLibrary(provideLibraryPorts()(writeDescriptorsEffect(directory, signed)));
|
|
2993
3145
|
var stageReleaseDescriptors = (options) => runReleaseLibrary(provideLibraryPorts({ run: planGitHubRun(options.env, options.run) })(stageReleaseDescriptorsEffect(options)));
|
|
3146
|
+
// src/library/daily-matrix.ts
|
|
3147
|
+
import { join as join7 } from "path";
|
|
3148
|
+
import { Effect as Effect16 } from "effect";
|
|
3149
|
+
|
|
3150
|
+
// src/library/daily-native-evidence.ts
|
|
3151
|
+
var digest = (value) => typeof value === "string" && /^sha256:[a-f0-9]{64}$/.test(value);
|
|
3152
|
+
var record = (value, keys) => isRecord(value) && hasExactOwnKeys(value, keys);
|
|
3153
|
+
function assertDailyIdentity(identity) {
|
|
3154
|
+
if (!isReleaseTag(identity.tag) || !isGitSha(identity.sourceSha) || identity.workflowSha !== identity.sourceSha || typeof identity.runId !== "string" || !/^[1-9]\d{0,19}$/.test(identity.runId) || !Number.isSafeInteger(identity.runAttempt) || identity.runAttempt <= 0)
|
|
3155
|
+
throw new Error("Invalid exact Daily identity");
|
|
3156
|
+
}
|
|
3157
|
+
function validArtifact(value) {
|
|
3158
|
+
return record(value, ["name", "size", "digest"]) && typeof value.name === "string" && typeof value.size === "number" && Number.isSafeInteger(value.size) && value.size > 0 && digest(value.digest);
|
|
3159
|
+
}
|
|
3160
|
+
function originMatches(value, payloadName) {
|
|
3161
|
+
if (record(value, ["kind", "sourceSha"]))
|
|
3162
|
+
return value.kind === "published-installer" && isGitSha(value.sourceSha);
|
|
3163
|
+
return record(value, ["kind", "sourceSha", "payload"]) && value.kind === "private-from-verified-payload" && isGitSha(value.sourceSha) && validArtifact(value.payload) && value.payload.name === payloadName;
|
|
3164
|
+
}
|
|
3165
|
+
function observationsMatch(value, { identity, check, baselineNames }) {
|
|
3166
|
+
const version = identity.tag.slice(1);
|
|
3167
|
+
if (!record(value, check.format === "command" ? ["install", "command"] : ["install", "launch", "upgrade"]) || !record(value.install, ["version"]) || value.install.version !== version)
|
|
3168
|
+
return false;
|
|
3169
|
+
if (check.format === "command") {
|
|
3170
|
+
const cmd = value.command;
|
|
3171
|
+
return record(cmd, ["version", "probesPassed", "serviceStarted", "serviceStopped"]) && cmd.version === version && cmd.probesPassed === true && cmd.serviceStarted === true && cmd.serviceStopped === (check.platform === "windows-x64" ? "process-tree" : "sigterm");
|
|
3172
|
+
}
|
|
3173
|
+
const { launch, upgrade } = value;
|
|
3174
|
+
return record(launch, ["version", "ready"]) && launch.version === version && launch.ready === true && record(upgrade, [
|
|
3175
|
+
"baselineTag",
|
|
3176
|
+
"baselineAsset",
|
|
3177
|
+
"baselineOrigin",
|
|
3178
|
+
"baselineVersion",
|
|
3179
|
+
"upgradedVersion",
|
|
3180
|
+
"ready",
|
|
3181
|
+
"fixtureBefore",
|
|
3182
|
+
"fixtureAfter"
|
|
3183
|
+
]) && isReleaseTag(upgrade.baselineTag) && versionLessThan(upgrade.baselineTag, identity.tag) && validArtifact(upgrade.baselineAsset) && upgrade.baselineAsset.name === baselineNames(upgrade.baselineTag).installer && originMatches(upgrade.baselineOrigin, baselineNames(upgrade.baselineTag).payload) && upgrade.baselineVersion === upgrade.baselineTag.slice(1) && upgrade.upgradedVersion === version && upgrade.ready === true && digest(upgrade.fixtureBefore) && upgrade.fixtureAfter === upgrade.fixtureBefore;
|
|
3184
|
+
}
|
|
3185
|
+
function validateDailyNativeEvidence(input, schema, context) {
|
|
3186
|
+
const { appId, identity, check, assets } = context;
|
|
3187
|
+
const [os, arch] = platformTargets[check.platform];
|
|
3188
|
+
if (!record(input, [
|
|
3189
|
+
"schema",
|
|
3190
|
+
"appId",
|
|
3191
|
+
"profile",
|
|
3192
|
+
"tag",
|
|
3193
|
+
"sourceSha",
|
|
3194
|
+
"workflowSha",
|
|
3195
|
+
"runId",
|
|
3196
|
+
"runAttempt",
|
|
3197
|
+
"check",
|
|
3198
|
+
"platform",
|
|
3199
|
+
"format",
|
|
3200
|
+
"host",
|
|
3201
|
+
"assets",
|
|
3202
|
+
"observations"
|
|
3203
|
+
]) || input.schema !== schema || input.appId !== appId || input.profile !== "desktop-v1" || input.tag !== identity.tag || input.sourceSha !== identity.sourceSha || input.workflowSha !== identity.workflowSha || input.runId !== identity.runId || input.runAttempt !== identity.runAttempt || input.check !== check.name || input.platform !== check.platform || input.format !== check.format || !record(input.host, ["os", "arch"]) || input.host.os !== os || input.host.arch !== arch || !Array.isArray(input.assets) || input.assets.length !== assets.length)
|
|
3204
|
+
throw new Error(`Native receipt identity or result mismatch: ${check.name}`);
|
|
3205
|
+
for (const expected of assets) {
|
|
3206
|
+
const matches = input.assets.filter((item) => validArtifact(item) && item.name === expected.name);
|
|
3207
|
+
if (matches.length !== 1 || matches[0].size !== expected.size || matches[0].digest !== expected.digest)
|
|
3208
|
+
throw new Error(`Native receipt does not qualify staged bytes: ${check.name} / ${expected.name}`);
|
|
3209
|
+
}
|
|
3210
|
+
if (!observationsMatch(input.observations, context))
|
|
3211
|
+
throw new Error(`Missing or invalid native observations: ${check.name}`);
|
|
3212
|
+
return { host: { os, arch }, observations: input.observations };
|
|
3213
|
+
}
|
|
3214
|
+
|
|
3215
|
+
// src/library/daily-matrix.ts
|
|
3216
|
+
var desktopDailyProfile = "desktop-v1";
|
|
3217
|
+
var platforms = [
|
|
3218
|
+
"macos-arm64",
|
|
3219
|
+
"windows-x64",
|
|
3220
|
+
"linux-x64"
|
|
3221
|
+
];
|
|
3222
|
+
var receiptLimit = 64 * 1024;
|
|
3223
|
+
function requireThat(ok, message) {
|
|
3224
|
+
if (!ok)
|
|
3225
|
+
throw new Error(message);
|
|
3226
|
+
}
|
|
3227
|
+
function planDailyReleaseMatrix(config, tag) {
|
|
3228
|
+
requireThat(isRecord(config) && config.dailyReleaseProfile === desktopDailyProfile && typeof config.appId === "string", "Missing supported Daily release profile");
|
|
3229
|
+
const parsed = parseReleaseConfig(config);
|
|
3230
|
+
const requirements = parsed.requirements(tag);
|
|
3231
|
+
const checks = [];
|
|
3232
|
+
for (const platform of platforms) {
|
|
3233
|
+
const pair = requirements.platforms[platform];
|
|
3234
|
+
requireThat(pair?.length === 2, `Expected installer and updater archive for ${platform}`);
|
|
3235
|
+
const [installer, archive] = pair;
|
|
3236
|
+
const suffix = platform === "macos-arm64" ? ".dmg" : platform === "windows-x64" ? "-Setup.zip" : "-Setup.tar.gz";
|
|
3237
|
+
requireThat(installer.endsWith(suffix) && archive.endsWith(".tar.zst"), `Unexpected desktop installer or updater format for ${platform}`);
|
|
3238
|
+
const format = platform === "macos-arm64" ? "dmg" : platform === "windows-x64" ? "windows-setup" : "portable-linux";
|
|
3239
|
+
checks.push({ name: `installer-${platform}`, platform, format, assets: pair });
|
|
3240
|
+
for (const command of parsed.commandArtifacts) {
|
|
3241
|
+
const name = requirements.commandArtifacts?.[command.kind]?.[platform];
|
|
3242
|
+
requireThat(name, `Missing command archive for ${platform}`);
|
|
3243
|
+
checks.push({
|
|
3244
|
+
name: `command-${command.kind}-${platform}`,
|
|
3245
|
+
platform,
|
|
3246
|
+
format: "command",
|
|
3247
|
+
assets: [name]
|
|
3248
|
+
});
|
|
3249
|
+
}
|
|
3250
|
+
}
|
|
3251
|
+
const linux = "linux-x64";
|
|
3252
|
+
const base = requirements.platforms[linux][1].slice(0, -".tar.zst".length);
|
|
3253
|
+
checks.push({ name: "deb-linux-x64", platform: linux, format: "deb", assets: [base + ".deb"] }, {
|
|
3254
|
+
name: "appimage-linux-x64",
|
|
3255
|
+
platform: linux,
|
|
3256
|
+
format: "appimage",
|
|
3257
|
+
assets: [base + ".AppImage"]
|
|
3258
|
+
});
|
|
3259
|
+
const names = checks.flatMap((check) => check.assets);
|
|
3260
|
+
discoveryPolicies(config, tag);
|
|
3261
|
+
const all = [...names, ...requirements.releaseAssets];
|
|
3262
|
+
requireThat(new Set(all).size === all.length, "Daily release assets are not unique");
|
|
3263
|
+
return { appId: config.appId, profile: desktopDailyProfile, assets: all, checks };
|
|
3264
|
+
}
|
|
3265
|
+
function priorDailyInstallerNames(config, tag, check) {
|
|
3266
|
+
const plan = planDailyReleaseMatrix(config, tag);
|
|
3267
|
+
return {
|
|
3268
|
+
installer: plan.checks.find((entry) => entry.name === check.name)?.assets[0],
|
|
3269
|
+
payload: plan.checks.find((entry) => entry.name === `installer-${check.platform}`)?.assets[1]
|
|
3270
|
+
};
|
|
3271
|
+
}
|
|
3272
|
+
function exactDirectory(root, names) {
|
|
3273
|
+
return Effect16.gen(function* () {
|
|
3274
|
+
const fs = yield* ReleaseFs;
|
|
3275
|
+
const stat = yield* step(() => fs.lstat(root));
|
|
3276
|
+
if (!stat.isDirectory() || stat.isSymbolicLink())
|
|
3277
|
+
return yield* fail("Expected real matrix input directory");
|
|
3278
|
+
const entries = yield* step(() => fs.readdir(root, { withFileTypes: true }));
|
|
3279
|
+
const expected = new Set(names);
|
|
3280
|
+
if (entries.length !== expected.size || entries.some((e) => !e.isFile() || !expected.has(e.name)))
|
|
3281
|
+
return yield* fail("Matrix directory must contain exactly the required regular files");
|
|
3282
|
+
});
|
|
3283
|
+
}
|
|
3284
|
+
function readNativeReceipt(path, label) {
|
|
3285
|
+
return Effect16.gen(function* () {
|
|
3286
|
+
const fs = yield* ReleaseFs;
|
|
3287
|
+
const stat = yield* step(() => fs.lstat(path));
|
|
3288
|
+
if (!stat.isFile() || stat.isSymbolicLink() || stat.size < 1 || stat.size > receiptLimit)
|
|
3289
|
+
return yield* fail(`Invalid native receipt size or type: ${label}`);
|
|
3290
|
+
const { file, before } = yield* Effect16.acquireRelease(step(() => openUnchangedFile(path, stat, "Native receipt changed before opening")), ({ file: opened }) => Effect16.promise(() => opened.close().catch(() => {
|
|
3291
|
+
return;
|
|
3292
|
+
})));
|
|
3293
|
+
const data = yield* step(async () => {
|
|
3294
|
+
const bytes = Buffer.alloc(before.size);
|
|
3295
|
+
let offset = 0;
|
|
3296
|
+
while (offset < bytes.length) {
|
|
3297
|
+
const { bytesRead } = await file.read(bytes, offset, bytes.length - offset, offset);
|
|
3298
|
+
if (!bytesRead)
|
|
3299
|
+
throw new Error("Native receipt changed during read");
|
|
3300
|
+
offset += bytesRead;
|
|
3301
|
+
}
|
|
3302
|
+
const after = await file.stat();
|
|
3303
|
+
if (!sameFile(before, after) || before.ctimeMs !== after.ctimeMs)
|
|
3304
|
+
throw new Error("Native receipt changed during read");
|
|
3305
|
+
return bytes.toString("utf8");
|
|
3306
|
+
});
|
|
3307
|
+
return yield* attempt(() => {
|
|
3308
|
+
try {
|
|
3309
|
+
return JSON.parse(data);
|
|
3310
|
+
} catch {
|
|
3311
|
+
throw new Error(`Invalid native receipt JSON: ${label}`);
|
|
3312
|
+
}
|
|
3313
|
+
});
|
|
3314
|
+
}).pipe(Effect16.scoped);
|
|
3315
|
+
}
|
|
3316
|
+
var verifyDailyReleaseMatrixEffect = (options) => Effect16.gen(function* () {
|
|
3317
|
+
const { config, identity, artifacts, receipts } = options;
|
|
3318
|
+
const { tag } = identity;
|
|
3319
|
+
yield* attempt(() => assertDailyIdentity(identity));
|
|
3320
|
+
const matrix = yield* attempt(() => planDailyReleaseMatrix(config, tag));
|
|
3321
|
+
yield* exactDirectory(artifacts, matrix.assets);
|
|
3322
|
+
yield* exactDirectory(receipts, matrix.checks.map((c) => c.name + ".json"));
|
|
3323
|
+
const inventory = new Map;
|
|
3324
|
+
for (const name of matrix.assets)
|
|
3325
|
+
inventory.set(name, yield* fileIdentityEffect(join7(artifacts, name), name));
|
|
3326
|
+
for (const check of matrix.checks) {
|
|
3327
|
+
const r = yield* readNativeReceipt(join7(receipts, check.name + ".json"), check.name);
|
|
3328
|
+
yield* attempt(() => validateDailyNativeEvidence(r, "framework/daily-native-receipt/v2", {
|
|
3329
|
+
appId: matrix.appId,
|
|
3330
|
+
identity,
|
|
3331
|
+
check,
|
|
3332
|
+
assets: check.assets.map((name) => inventory.get(name)),
|
|
3333
|
+
baselineNames: (priorTag) => priorDailyInstallerNames(config, priorTag, check)
|
|
3334
|
+
}));
|
|
3335
|
+
}
|
|
3336
|
+
return {
|
|
3337
|
+
profile: matrix.profile,
|
|
3338
|
+
appId: matrix.appId,
|
|
3339
|
+
identity,
|
|
3340
|
+
assets: [...inventory.values()]
|
|
3341
|
+
};
|
|
3342
|
+
});
|
|
3343
|
+
function verifyDailyReleaseMatrix(options) {
|
|
3344
|
+
return runReleaseLibrary(provideLibraryPorts()(verifyDailyReleaseMatrixEffect(options)));
|
|
3345
|
+
}
|
|
3346
|
+
// src/library/daily-native-receipt.ts
|
|
3347
|
+
import { join as join8 } from "path";
|
|
3348
|
+
import { Effect as Effect17 } from "effect";
|
|
3349
|
+
var createDailyNativeReceiptEffect = (options, worker) => Effect17.gen(function* () {
|
|
3350
|
+
const { config, identity, artifacts, checkName, report } = options;
|
|
3351
|
+
yield* attempt(() => assertDailyIdentity(identity));
|
|
3352
|
+
const matrix = yield* attempt(() => planDailyReleaseMatrix(config, identity.tag));
|
|
3353
|
+
const check = matrix.checks.find(({ name }) => name === checkName);
|
|
3354
|
+
if (!check)
|
|
3355
|
+
return yield* fail("Unknown Daily native check");
|
|
3356
|
+
const [os, arch] = platformTargets[check.platform];
|
|
3357
|
+
if (worker.os !== os || worker.arch !== arch)
|
|
3358
|
+
return yield* fail(`Daily native check requires ${check.platform}`);
|
|
3359
|
+
const fs = yield* ReleaseFs;
|
|
3360
|
+
const dir = yield* step(() => fs.lstat(artifacts));
|
|
3361
|
+
if (!dir.isDirectory() || dir.isSymbolicLink())
|
|
3362
|
+
return yield* fail("Expected real native artifact directory");
|
|
3363
|
+
const assets = yield* Effect17.forEach(check.assets, (name) => fileIdentityEffect(join8(artifacts, name), name));
|
|
3364
|
+
const evidence = yield* attempt(() => validateDailyNativeEvidence(report, "framework/daily-native-job/v1", {
|
|
3365
|
+
appId: matrix.appId,
|
|
3366
|
+
identity,
|
|
3367
|
+
check,
|
|
3368
|
+
assets,
|
|
3369
|
+
baselineNames: (tag) => priorDailyInstallerNames(config, tag, check)
|
|
3370
|
+
}));
|
|
3371
|
+
if ("upgrade" in evidence.observations) {
|
|
3372
|
+
if (!options.baselineArtifacts)
|
|
3373
|
+
return yield* fail("Daily desktop check requires the exact baseline installer");
|
|
3374
|
+
const baselineDirectory = options.baselineArtifacts;
|
|
3375
|
+
const info = yield* step(() => fs.lstat(baselineDirectory));
|
|
3376
|
+
if (!info.isDirectory() || info.isSymbolicLink())
|
|
3377
|
+
return yield* fail("Expected real native baseline directory");
|
|
3378
|
+
const { baselineAsset, baselineOrigin } = evidence.observations.upgrade;
|
|
3379
|
+
const proofFiles = baselineOrigin.kind === "private-from-verified-payload" ? [baselineAsset, baselineOrigin.payload] : [baselineAsset];
|
|
3380
|
+
for (const expected of proofFiles) {
|
|
3381
|
+
const observed = yield* fileIdentityEffect(join8(baselineDirectory, expected.name), expected.name);
|
|
3382
|
+
if (observed.size !== expected.size || observed.digest !== expected.digest)
|
|
3383
|
+
return yield* fail("Daily desktop baseline installer or prior payload differs from native observations");
|
|
3384
|
+
}
|
|
3385
|
+
}
|
|
3386
|
+
return {
|
|
3387
|
+
...identity,
|
|
3388
|
+
...evidence,
|
|
3389
|
+
schema: "framework/daily-native-receipt/v2",
|
|
3390
|
+
appId: matrix.appId,
|
|
3391
|
+
profile: matrix.profile,
|
|
3392
|
+
check: check.name,
|
|
3393
|
+
platform: check.platform,
|
|
3394
|
+
format: check.format,
|
|
3395
|
+
assets
|
|
3396
|
+
};
|
|
3397
|
+
});
|
|
3398
|
+
function createDailyNativeReceipt(options) {
|
|
3399
|
+
return runReleaseLibrary(provideLibraryPorts()(createDailyNativeReceiptEffect(options, {
|
|
3400
|
+
os: process.platform,
|
|
3401
|
+
arch: process.arch
|
|
3402
|
+
})));
|
|
3403
|
+
}
|
|
2994
3404
|
// src/library/macos-dmg.ts
|
|
2995
3405
|
import { execFileSync } from "child_process";
|
|
2996
3406
|
import {
|
|
@@ -3002,8 +3412,8 @@ import {
|
|
|
3002
3412
|
rmSync,
|
|
3003
3413
|
symlinkSync
|
|
3004
3414
|
} from "fs";
|
|
3005
|
-
import { basename as basename4, dirname, join as
|
|
3006
|
-
import { Context as Context2, Effect as
|
|
3415
|
+
import { basename as basename4, dirname, join as join9, resolve as resolve6 } from "path";
|
|
3416
|
+
import { Context as Context2, Effect as Effect18 } from "effect";
|
|
3007
3417
|
|
|
3008
3418
|
// ../../src/release/macos-dmg.ts
|
|
3009
3419
|
var MIB = 1024 * 1024;
|
|
@@ -3034,7 +3444,7 @@ function treeSize(root) {
|
|
|
3034
3444
|
logicalBytes += info.size;
|
|
3035
3445
|
else if (info.isDirectory())
|
|
3036
3446
|
for (const name of readdirSync(path))
|
|
3037
|
-
pending.push(
|
|
3447
|
+
pending.push(join9(path, name));
|
|
3038
3448
|
else if (!info.isSymbolicLink())
|
|
3039
3449
|
throw new Error("Unsupported disk image entry");
|
|
3040
3450
|
if (!Number.isSafeInteger(logicalBytes))
|
|
@@ -3042,16 +3452,16 @@ function treeSize(root) {
|
|
|
3042
3452
|
}
|
|
3043
3453
|
return { logicalBytes, entries };
|
|
3044
3454
|
}
|
|
3045
|
-
var verifyImageEffect = (image) =>
|
|
3455
|
+
var verifyImageEffect = (image) => Effect18.gen(function* () {
|
|
3046
3456
|
const host = yield* MacosHost;
|
|
3047
3457
|
for (let tries = 1;; tries++) {
|
|
3048
|
-
const verified = yield* attempt(() => host.run("/usr/bin/hdiutil", ["verify", image])).pipe(
|
|
3458
|
+
const verified = yield* attempt(() => host.run("/usr/bin/hdiutil", ["verify", image])).pipe(Effect18.as(true), Effect18.catchIf(() => tries < 6, () => Effect18.succeed(false)));
|
|
3049
3459
|
if (verified)
|
|
3050
3460
|
return;
|
|
3051
3461
|
host.wait(5000 * 2 ** (tries - 1));
|
|
3052
3462
|
}
|
|
3053
3463
|
});
|
|
3054
|
-
var createMacosDmgEffect = (options) =>
|
|
3464
|
+
var createMacosDmgEffect = (options) => Effect18.gen(function* () {
|
|
3055
3465
|
const host = yield* MacosHost;
|
|
3056
3466
|
if (host.platform !== "darwin")
|
|
3057
3467
|
return yield* fail("Disk image creation requires macOS");
|
|
@@ -3060,11 +3470,11 @@ var createMacosDmgEffect = (options) => Effect16.gen(function* () {
|
|
|
3060
3470
|
const info = yield* attempt(() => lstatSync(app));
|
|
3061
3471
|
if (!app.endsWith(".app") || !info.isDirectory() || info.isSymbolicLink() || !output.endsWith(".dmg"))
|
|
3062
3472
|
return yield* fail("Invalid disk image paths");
|
|
3063
|
-
const staging = yield*
|
|
3064
|
-
const payload =
|
|
3473
|
+
const staging = yield* Effect18.acquireRelease(attempt(() => mkdtempSync(join9(dirname(output), ".framework-dmg-"))), (path) => Effect18.sync(() => rmSync(path, { recursive: true, force: true })));
|
|
3474
|
+
const payload = join9(staging, "payload"), image = join9(staging, "result.dmg");
|
|
3065
3475
|
yield* attempt(() => mkdirSync(payload));
|
|
3066
|
-
yield* attempt(() => host.run("/usr/bin/ditto", [app,
|
|
3067
|
-
yield* attempt(() => symlinkSync("/Applications",
|
|
3476
|
+
yield* attempt(() => host.run("/usr/bin/ditto", [app, join9(payload, basename4(app))]));
|
|
3477
|
+
yield* attempt(() => symlinkSync("/Applications", join9(payload, "Applications")));
|
|
3068
3478
|
const capacityMiB = yield* attempt(() => dmgCapacityMiB(treeSize(payload)));
|
|
3069
3479
|
yield* attempt(() => host.run("/usr/bin/hdiutil", [
|
|
3070
3480
|
"create",
|
|
@@ -3081,31 +3491,31 @@ var createMacosDmgEffect = (options) => Effect16.gen(function* () {
|
|
|
3081
3491
|
yield* verifyImageEffect(image);
|
|
3082
3492
|
yield* attempt(() => linkSync(image, output));
|
|
3083
3493
|
return { capacityMiB };
|
|
3084
|
-
}).pipe(
|
|
3494
|
+
}).pipe(Effect18.scoped);
|
|
3085
3495
|
function verifyImage(image, io = liveHost) {
|
|
3086
|
-
runReleaseLibrarySync(verifyImageEffect(image).pipe(
|
|
3496
|
+
runReleaseLibrarySync(verifyImageEffect(image).pipe(Effect18.provideService(MacosHost, {
|
|
3087
3497
|
run: (command, args) => io.run(command, args),
|
|
3088
3498
|
wait: (milliseconds) => io.wait(milliseconds),
|
|
3089
3499
|
platform: process.platform
|
|
3090
3500
|
})));
|
|
3091
3501
|
}
|
|
3092
3502
|
function createMacosDmg(options) {
|
|
3093
|
-
return runReleaseLibrarySync(createMacosDmgEffect(options).pipe(
|
|
3503
|
+
return runReleaseLibrarySync(createMacosDmgEffect(options).pipe(Effect18.provideService(MacosHost, liveHost)));
|
|
3094
3504
|
}
|
|
3095
3505
|
// src/library/qualification-run.ts
|
|
3096
|
-
import { Effect as
|
|
3506
|
+
import { Effect as Effect21 } from "effect";
|
|
3097
3507
|
|
|
3098
3508
|
// src/library/local-release.ts
|
|
3099
3509
|
import { createHash as createHash8 } from "crypto";
|
|
3100
3510
|
import { constants as constants3 } from "fs";
|
|
3101
|
-
import { dirname as dirname2, join as
|
|
3102
|
-
import { Cause as Cause2, Effect as
|
|
3511
|
+
import { dirname as dirname2, join as join11, resolve as resolve8 } from "path";
|
|
3512
|
+
import { Cause as Cause2, Effect as Effect20, Exit as Exit3 } from "effect";
|
|
3103
3513
|
|
|
3104
3514
|
// ../../src/native/native-rename.ts
|
|
3105
3515
|
import { randomUUID } from "crypto";
|
|
3106
3516
|
import { mkdir as mkdir3, readFile as readFile5, rm as rm3, writeFile as writeFile3 } from "fs/promises";
|
|
3107
3517
|
import { dlopen, FFIType, ptr } from "bun:ffi";
|
|
3108
|
-
import { join as
|
|
3518
|
+
import { join as join10 } from "path";
|
|
3109
3519
|
|
|
3110
3520
|
// ../../src/native/canonical-path.ts
|
|
3111
3521
|
import { isAbsolute as isAbsolute2, resolve as resolve7 } from "path";
|
|
@@ -3184,8 +3594,8 @@ async function probeDirectoryExchange(parent, exchange = exchangeDirectories) {
|
|
|
3184
3594
|
if (!isCanonicalPath(parent))
|
|
3185
3595
|
throw new Error("Invalid directory exchange probe parent");
|
|
3186
3596
|
const id = randomUUID();
|
|
3187
|
-
const first =
|
|
3188
|
-
const second =
|
|
3597
|
+
const first = join10(parent, `.framework-exchange-probe-${id}-a`);
|
|
3598
|
+
const second = join10(parent, `.framework-exchange-probe-${id}-b`);
|
|
3189
3599
|
const marker = "exchange-probe";
|
|
3190
3600
|
const firstValue = `${id}:first`;
|
|
3191
3601
|
const secondValue = `${id}:second`;
|
|
@@ -3196,12 +3606,12 @@ async function probeDirectoryExchange(parent, exchange = exchangeDirectories) {
|
|
|
3196
3606
|
firstCreated = true;
|
|
3197
3607
|
await mkdir3(second, { mode: 448 });
|
|
3198
3608
|
secondCreated = true;
|
|
3199
|
-
await writeFile3(
|
|
3200
|
-
await writeFile3(
|
|
3609
|
+
await writeFile3(join10(first, marker), firstValue, { flag: "wx", mode: 384 });
|
|
3610
|
+
await writeFile3(join10(second, marker), secondValue, { flag: "wx", mode: 384 });
|
|
3201
3611
|
exchange(first, second);
|
|
3202
3612
|
const [firstAfter, secondAfter] = await Promise.all([
|
|
3203
|
-
readFile5(
|
|
3204
|
-
readFile5(
|
|
3613
|
+
readFile5(join10(first, marker), "utf8"),
|
|
3614
|
+
readFile5(join10(second, marker), "utf8")
|
|
3205
3615
|
]);
|
|
3206
3616
|
if (firstAfter !== secondValue || secondAfter !== firstValue)
|
|
3207
3617
|
throw new Error("Directory exchange did not exchange both probe trees");
|
|
@@ -3267,7 +3677,7 @@ function createFeedReleaseCutProvider(options) {
|
|
|
3267
3677
|
|
|
3268
3678
|
// src/library/feed-state.ts
|
|
3269
3679
|
import { createHash as createHash7 } from "crypto";
|
|
3270
|
-
import { Effect as
|
|
3680
|
+
import { Effect as Effect19 } from "effect";
|
|
3271
3681
|
|
|
3272
3682
|
// ../../src/shared/discard-stream.ts
|
|
3273
3683
|
function discardStream(stream) {
|
|
@@ -3427,11 +3837,11 @@ var json = (bytes) => {
|
|
|
3427
3837
|
throw new Error("Invalid release feed response");
|
|
3428
3838
|
}
|
|
3429
3839
|
};
|
|
3430
|
-
var feedObject = (feed, path, maximum) =>
|
|
3840
|
+
var feedObject = (feed, path, maximum) => Effect19.gen(function* () {
|
|
3431
3841
|
const { fetch: fetch2 } = yield* ReleaseFetch;
|
|
3432
3842
|
return yield* step(() => readFeedObject(feed, path, fetch2, maximum));
|
|
3433
3843
|
});
|
|
3434
|
-
var readFeedLedgerEffect = (feed) =>
|
|
3844
|
+
var readFeedLedgerEffect = (feed) => Effect19.gen(function* () {
|
|
3435
3845
|
const bytes = yield* feedObject(feed, "index.json", MAX_LEDGER_BYTES);
|
|
3436
3846
|
const ledger = bytes ? yield* attempt(() => parseReleaseLedger(json(bytes), feed.app)) : null;
|
|
3437
3847
|
if (ledger && ledger.releases.length > 0)
|
|
@@ -3443,7 +3853,7 @@ var readFeedLedgerEffect = (feed) => Effect17.gen(function* () {
|
|
|
3443
3853
|
}
|
|
3444
3854
|
return ledger ?? { schema: 1, app: feed.app, releases: [] };
|
|
3445
3855
|
});
|
|
3446
|
-
var readFeedReleaseEffect = (feed, tag) =>
|
|
3856
|
+
var readFeedReleaseEffect = (feed, tag) => Effect19.gen(function* () {
|
|
3447
3857
|
const bytes = yield* feedObject(feed, `${tag}/release.json`, MAX_RELEASE_BYTES);
|
|
3448
3858
|
if (!bytes)
|
|
3449
3859
|
return null;
|
|
@@ -3493,10 +3903,10 @@ class ReleaseFeedSnapshotChanged extends Error {
|
|
|
3493
3903
|
var snapshotChanged = step(async () => {
|
|
3494
3904
|
throw new ReleaseFeedSnapshotChanged;
|
|
3495
3905
|
});
|
|
3496
|
-
var verifyFeedReleaseEffect = (options) =>
|
|
3906
|
+
var verifyFeedReleaseEffect = (options) => Effect19.gen(function* () {
|
|
3497
3907
|
const { config, feed, tag } = options;
|
|
3498
3908
|
const { fetch: fetcher } = yield* ReleaseFetch;
|
|
3499
|
-
const ledger = yield* readFeedLedgerEffect(feed).pipe(
|
|
3909
|
+
const ledger = yield* readFeedLedgerEffect(feed).pipe(Effect19.catchIf(() => options.expectedLedger !== undefined, () => snapshotChanged));
|
|
3500
3910
|
if (options.expectedLedger && JSON.stringify(ledger) !== JSON.stringify(options.expectedLedger))
|
|
3501
3911
|
return yield* snapshotChanged;
|
|
3502
3912
|
const release = yield* readFeedReleaseEffect(feed, tag);
|
|
@@ -3559,13 +3969,13 @@ var timestamp2 = (value) => {
|
|
|
3559
3969
|
throw new Error("Invalid release clock");
|
|
3560
3970
|
return new Date(value).toISOString();
|
|
3561
3971
|
};
|
|
3562
|
-
var exactFiles = (directory, names) =>
|
|
3972
|
+
var exactFiles = (directory, names) => Effect20.gen(function* () {
|
|
3563
3973
|
const fs = yield* ReleaseFs;
|
|
3564
3974
|
const entries = yield* step(() => fs.readdir(directory, { withFileTypes: true }));
|
|
3565
3975
|
if (entries.length !== names.length || entries.some((entry) => !entry.isFile() || !names.includes(entry.name)))
|
|
3566
3976
|
return yield* fail("Staged directory does not hold exactly the platform release files");
|
|
3567
3977
|
});
|
|
3568
|
-
var promised2 =
|
|
3978
|
+
var promised2 = Effect20.gen(function* () {
|
|
3569
3979
|
const fs = yield* ReleaseFs;
|
|
3570
3980
|
const { fetch: fetch2 } = yield* ReleaseFetch;
|
|
3571
3981
|
const { run: git } = yield* ReleaseGit;
|
|
@@ -3575,7 +3985,7 @@ var promised2 = Effect18.gen(function* () {
|
|
|
3575
3985
|
run: (effect) => runReleaseLibrary(provideLibraryPorts({ fs, fetch: fetch2, git })(effect))
|
|
3576
3986
|
};
|
|
3577
3987
|
});
|
|
3578
|
-
var runLocalReleaseCutEffect = (options) =>
|
|
3988
|
+
var runLocalReleaseCutEffect = (options) => Effect20.gen(function* () {
|
|
3579
3989
|
const { kind, platform } = options;
|
|
3580
3990
|
const parsed = parseReleaseConfig(options.config);
|
|
3581
3991
|
const provenance = yield* resolveLocalProvenanceEffect({
|
|
@@ -3600,7 +4010,7 @@ var runLocalReleaseCutEffect = (options) => Effect18.gen(function* () {
|
|
|
3600
4010
|
}));
|
|
3601
4011
|
return { ...result, version: result.tag.slice(1), platform };
|
|
3602
4012
|
});
|
|
3603
|
-
var localTagProvenanceEffect = (options) =>
|
|
4013
|
+
var localTagProvenanceEffect = (options) => Effect20.gen(function* () {
|
|
3604
4014
|
const parsed = parseReleaseConfig(options.config);
|
|
3605
4015
|
parsed.requirements(options.tag);
|
|
3606
4016
|
const provenance = yield* resolveLocalProvenanceEffect({
|
|
@@ -3611,7 +4021,7 @@ var localTagProvenanceEffect = (options) => Effect18.gen(function* () {
|
|
|
3611
4021
|
return yield* fail("Release tag does not belong to the source version");
|
|
3612
4022
|
return { repository: provenance.repository };
|
|
3613
4023
|
});
|
|
3614
|
-
var stageLocalDescriptorsEffect = (options) =>
|
|
4024
|
+
var stageLocalDescriptorsEffect = (options) => Effect20.gen(function* () {
|
|
3615
4025
|
const { tag, platform } = options;
|
|
3616
4026
|
const local = localConfig(options.config);
|
|
3617
4027
|
if (!/^[1-9]\d{0,19}$/.test(options.runId) || !isGitSha(options.sourceSha))
|
|
@@ -3620,7 +4030,7 @@ var stageLocalDescriptorsEffect = (options) => Effect18.gen(function* () {
|
|
|
3620
4030
|
const payloads = platformPayloads(local.requirements(tag), platform);
|
|
3621
4031
|
const directory = resolve8(options.directory);
|
|
3622
4032
|
yield* exactFiles(directory, payloads);
|
|
3623
|
-
const assets = yield*
|
|
4033
|
+
const assets = yield* Effect20.forEach(payloads, (name) => fileIdentityEffect(join11(directory, name), name), { concurrency: "unbounded" });
|
|
3624
4034
|
const signed = signDiscoveryDescriptors({
|
|
3625
4035
|
policies: discoveryPolicies(local.config, tag).filter((policy) => policy.platform === platform),
|
|
3626
4036
|
assets,
|
|
@@ -3638,7 +4048,7 @@ var stageLocalDescriptorsEffect = (options) => Effect18.gen(function* () {
|
|
|
3638
4048
|
privateKey: options.privateKey
|
|
3639
4049
|
});
|
|
3640
4050
|
for (const asset of assets)
|
|
3641
|
-
if (JSON.stringify(yield* fileIdentityEffect(
|
|
4051
|
+
if (JSON.stringify(yield* fileIdentityEffect(join11(directory, asset.name), asset.name)) !== JSON.stringify(asset))
|
|
3642
4052
|
return yield* fail("Staged payload changed before signing");
|
|
3643
4053
|
yield* writeDescriptorsEffect(directory, signed);
|
|
3644
4054
|
return signed.map((value) => value.name);
|
|
@@ -3662,18 +4072,18 @@ var describe = (key, bytes, cacheControl) => ({
|
|
|
3662
4072
|
contentType: "application/json",
|
|
3663
4073
|
cacheControl
|
|
3664
4074
|
});
|
|
3665
|
-
var writeStagedTree = (out, feed, assets, documents) =>
|
|
4075
|
+
var writeStagedTree = (out, feed, assets, documents) => Effect20.gen(function* () {
|
|
3666
4076
|
const fs = yield* ReleaseFs;
|
|
3667
4077
|
const root = resolve8(out);
|
|
3668
|
-
const exists = yield* step(() => fs.lstat(root)).pipe(
|
|
4078
|
+
const exists = yield* step(() => fs.lstat(root)).pipe(Effect20.as(true), Effect20.catchIf((failure) => errorCode(failure.original) === "ENOENT", () => Effect20.succeed(false)));
|
|
3669
4079
|
if (exists)
|
|
3670
4080
|
return yield* fail("Release output directory already exists");
|
|
3671
4081
|
yield* step(() => fs.mkdir(dirname2(root), { recursive: true, mode: 448 }));
|
|
3672
|
-
const staging = yield* step(() => fs.mkdtemp(
|
|
3673
|
-
const exit = yield*
|
|
4082
|
+
const staging = yield* step(() => fs.mkdtemp(join11(dirname2(root), ".release-staging-")));
|
|
4083
|
+
const exit = yield* Effect20.exit(Effect20.gen(function* () {
|
|
3674
4084
|
const objects = [];
|
|
3675
4085
|
for (const { key, path, artifact } of assets) {
|
|
3676
|
-
const target =
|
|
4086
|
+
const target = join11(staging, key);
|
|
3677
4087
|
yield* step(() => fs.mkdir(dirname2(target), { recursive: true, mode: 448 }));
|
|
3678
4088
|
yield* step(() => fs.copyFile(path, target, constants3.COPYFILE_EXCL));
|
|
3679
4089
|
if (JSON.stringify(yield* fileIdentityEffect(target, artifact.name)) !== JSON.stringify(artifact))
|
|
@@ -3687,13 +4097,13 @@ var writeStagedTree = (out, feed, assets, documents) => Effect18.gen(function* (
|
|
|
3687
4097
|
});
|
|
3688
4098
|
}
|
|
3689
4099
|
for (const { key, bytes } of documents) {
|
|
3690
|
-
const target =
|
|
4100
|
+
const target = join11(staging, key);
|
|
3691
4101
|
yield* step(() => fs.mkdir(dirname2(target), { recursive: true, mode: 448 }));
|
|
3692
4102
|
yield* step(() => fs.writeFile(target, bytes, { flag: "wx", mode: 384 }));
|
|
3693
4103
|
objects.push(describe(key, bytes, MUTABLE));
|
|
3694
4104
|
}
|
|
3695
4105
|
const plan = { schema: 1, base: feed.base, objects };
|
|
3696
|
-
yield* step(() => fs.writeFile(
|
|
4106
|
+
yield* step(() => fs.writeFile(join11(staging, UPLOAD_PLAN), jsonBytes(plan), { flag: "wx", mode: 384 }));
|
|
3697
4107
|
yield* attempt(() => renameExclusive(staging, root));
|
|
3698
4108
|
return plan;
|
|
3699
4109
|
}));
|
|
@@ -3701,10 +4111,10 @@ var writeStagedTree = (out, feed, assets, documents) => Effect18.gen(function* (
|
|
|
3701
4111
|
return exit.value;
|
|
3702
4112
|
const error = Cause2.squash(exit.cause);
|
|
3703
4113
|
const original = error instanceof ReleaseFailure ? error.original ?? error : error;
|
|
3704
|
-
const cleanup = yield*
|
|
4114
|
+
const cleanup = yield* Effect20.exit(step(() => fs.rm(staging, { recursive: true, force: true })));
|
|
3705
4115
|
if (Exit3.isFailure(cleanup)) {
|
|
3706
4116
|
const cleanupError = Cause2.squash(cleanup.cause);
|
|
3707
|
-
return yield*
|
|
4117
|
+
return yield* Effect20.fail(new ReleaseFailure({
|
|
3708
4118
|
reason: "cleanup",
|
|
3709
4119
|
message: "Release staging failed and its private temporary tree could not be removed",
|
|
3710
4120
|
original: new AggregateError([
|
|
@@ -3713,8 +4123,8 @@ var writeStagedTree = (out, feed, assets, documents) => Effect18.gen(function* (
|
|
|
3713
4123
|
], "Release staging failed and its private temporary tree could not be removed", { cause: original })
|
|
3714
4124
|
}));
|
|
3715
4125
|
}
|
|
3716
|
-
return yield*
|
|
3717
|
-
}).pipe(
|
|
4126
|
+
return yield* Effect20.failCause(exit.cause);
|
|
4127
|
+
}).pipe(Effect20.uninterruptible);
|
|
3718
4128
|
function releaseDocuments(feed, ledger, release) {
|
|
3719
4129
|
return [
|
|
3720
4130
|
{ key: feedReleaseKey(feed, release.tag), bytes: jsonBytes(release) },
|
|
@@ -3731,7 +4141,7 @@ function releaseDocuments(feed, ledger, release) {
|
|
|
3731
4141
|
}))
|
|
3732
4142
|
];
|
|
3733
4143
|
}
|
|
3734
|
-
var stageLocalReleaseEffect = (options) =>
|
|
4144
|
+
var stageLocalReleaseEffect = (options) => Effect20.gen(function* () {
|
|
3735
4145
|
const fs = yield* ReleaseFs;
|
|
3736
4146
|
const { tag, sourceSha, platform } = options;
|
|
3737
4147
|
const local = localConfig(options.config);
|
|
@@ -3741,12 +4151,12 @@ var stageLocalReleaseEffect = (options) => Effect18.gen(function* () {
|
|
|
3741
4151
|
const directory = resolve8(options.directory);
|
|
3742
4152
|
const names = [...payloads, ...policies.map((policy) => policy.name)];
|
|
3743
4153
|
yield* exactFiles(directory, names);
|
|
3744
|
-
const staged = yield*
|
|
4154
|
+
const staged = yield* Effect20.forEach(names, (name) => fileIdentityEffect(join11(directory, name), name), { concurrency: "unbounded" });
|
|
3745
4155
|
for (const policy of policies) {
|
|
3746
4156
|
const artifact = staged.find((asset) => asset.name === policy.name);
|
|
3747
4157
|
if (artifact.size > 65536)
|
|
3748
4158
|
return yield* fail("Signed descriptor is too large");
|
|
3749
|
-
const bytes = yield* step(() => fs.readFile(
|
|
4159
|
+
const bytes = yield* step(() => fs.readFile(join11(directory, policy.name)));
|
|
3750
4160
|
if ("sha256:" + createHash8("sha256").update(bytes).digest("hex") !== artifact.digest)
|
|
3751
4161
|
return yield* fail("Signed descriptor changed");
|
|
3752
4162
|
let parsed;
|
|
@@ -3768,7 +4178,7 @@ var stageLocalReleaseEffect = (options) => Effect18.gen(function* () {
|
|
|
3768
4178
|
if (!verified.ok || verified.descriptor.tag !== tag || verified.descriptor.sourceSha !== sourceSha || verified.descriptor.workflowSha !== sourceSha || verified.descriptor.asset.name !== payload.name || verified.descriptor.asset.size !== payload.size || "sha256:" + verified.descriptor.asset.sha256 !== payload.digest)
|
|
3769
4179
|
return yield* fail(`Untrusted signed descriptor: ${policy.name}`);
|
|
3770
4180
|
}
|
|
3771
|
-
const [ledger, remote] = yield*
|
|
4181
|
+
const [ledger, remote] = yield* Effect20.all([readFeedLedgerEffect(feed), readFeedReleaseEffect(feed, tag)], { concurrency: "unbounded" });
|
|
3772
4182
|
const entry = ledger.releases.find((item) => item.tag === tag);
|
|
3773
4183
|
if (Boolean(entry) !== Boolean(remote) || entry && remote && (entry.kind !== remote.channel || Date.parse(entry.publishedAt) !== Date.parse(remote.publishedAt)))
|
|
3774
4184
|
return yield* fail("Inconsistent feed release; reconcile publication before retrying");
|
|
@@ -3786,7 +4196,7 @@ var stageLocalReleaseEffect = (options) => Effect18.gen(function* () {
|
|
|
3786
4196
|
merged.push({ name: artifact.name, size: artifact.size, sha256: artifact.digest.slice(7) });
|
|
3787
4197
|
uploads.push({
|
|
3788
4198
|
key: feedAssetKey(feed, tag, artifact.name),
|
|
3789
|
-
path:
|
|
4199
|
+
path: join11(directory, artifact.name),
|
|
3790
4200
|
artifact
|
|
3791
4201
|
});
|
|
3792
4202
|
}
|
|
@@ -3819,7 +4229,7 @@ function stablePlatforms(config) {
|
|
|
3819
4229
|
throw new Error("Invalid stablePlatforms in the release configuration");
|
|
3820
4230
|
return value;
|
|
3821
4231
|
}
|
|
3822
|
-
var verifyLocalReleaseEffect = (options) =>
|
|
4232
|
+
var verifyLocalReleaseEffect = (options) => Effect20.gen(function* () {
|
|
3823
4233
|
const local = localConfig(options.config);
|
|
3824
4234
|
const { release, platforms } = yield* verifyFeedReleaseEffect({
|
|
3825
4235
|
config: local.config,
|
|
@@ -3835,7 +4245,7 @@ var verifyLocalReleaseEffect = (options) => Effect18.gen(function* () {
|
|
|
3835
4245
|
missing: Object.keys(platformTargets).filter((platform) => !platforms.includes(platform))
|
|
3836
4246
|
};
|
|
3837
4247
|
});
|
|
3838
|
-
var runLocalPromotionEffect = (options) =>
|
|
4248
|
+
var runLocalPromotionEffect = (options) => Effect20.gen(function* () {
|
|
3839
4249
|
const local = localConfig(options.config);
|
|
3840
4250
|
const feed = local.feed;
|
|
3841
4251
|
const required = stablePlatforms(local.config);
|
|
@@ -3893,7 +4303,7 @@ var runLocalPromotionEffect = (options) => Effect18.gen(function* () {
|
|
|
3893
4303
|
const verification = qualified.get(selected.tag);
|
|
3894
4304
|
const absent = Object.keys(platformTargets).filter((name) => !verification?.platforms.includes(name));
|
|
3895
4305
|
const entry = ledger.releases.find((item) => item.tag === selected.tag);
|
|
3896
|
-
const [currentLedger, remote] = await run(
|
|
4306
|
+
const [currentLedger, remote] = await run(Effect20.all([readFeedLedgerEffect(feed), readFeedReleaseEffect(feed, selected.tag)], {
|
|
3897
4307
|
concurrency: "unbounded"
|
|
3898
4308
|
}));
|
|
3899
4309
|
if (!entry || !remote || !verification || entry.kind === "dev" || JSON.stringify(currentLedger) !== JSON.stringify(ledger) || JSON.stringify(remote) !== JSON.stringify(verification.release))
|
|
@@ -3932,7 +4342,7 @@ var runLocalPromotionEffect = (options) => Effect18.gen(function* () {
|
|
|
3932
4342
|
|
|
3933
4343
|
// src/library/qualification-run.ts
|
|
3934
4344
|
var REFUSAL = "Qualification requires a GitHub release-assets run, a GitLab tag pipeline or a CircleCI tag workflow";
|
|
3935
|
-
var tagRun = (options) =>
|
|
4345
|
+
var tagRun = (options) => Effect21.gen(function* () {
|
|
3936
4346
|
const { tag, sha, runId } = options;
|
|
3937
4347
|
if (options.tagName !== tag || !isGitSha(sha) || !/^[1-9]\d{0,19}$/.test(runId ?? "") || !/^v\d+\.\d+\.\d+$/.test(tag) || tag.length > 65)
|
|
3938
4348
|
return yield* fail(REFUSAL);
|
|
@@ -3946,7 +4356,7 @@ var tagRun = (options) => Effect19.gen(function* () {
|
|
|
3946
4356
|
runAttempt: 1
|
|
3947
4357
|
};
|
|
3948
4358
|
});
|
|
3949
|
-
var planQualificationRunEffect = (options) =>
|
|
4359
|
+
var planQualificationRunEffect = (options) => Effect21.gen(function* () {
|
|
3950
4360
|
const { env, config, tag } = options;
|
|
3951
4361
|
if (env.GITHUB_ACTIONS === "true") {
|
|
3952
4362
|
const plan = yield* planReleaseAssetsEffect({ env, config, tag });
|
|
@@ -3979,8 +4389,8 @@ var planQualificationRun2 = (options) => runReleaseLibrary(provideLibraryPorts({
|
|
|
3979
4389
|
...options.git ? { git: options.git } : {}
|
|
3980
4390
|
})(planQualificationRunEffect(options)));
|
|
3981
4391
|
// src/library/retained-build.ts
|
|
3982
|
-
import { Effect as
|
|
3983
|
-
var id = (value) =>
|
|
4392
|
+
import { Effect as Effect22 } from "effect";
|
|
4393
|
+
var id = (value) => Effect22.gen(function* () {
|
|
3984
4394
|
if (typeof value === "number" && !Number.isSafeInteger(value))
|
|
3985
4395
|
return yield* fail("Invalid GitHub identity");
|
|
3986
4396
|
const text = String(value);
|
|
@@ -3988,7 +4398,7 @@ var id = (value) => Effect20.gen(function* () {
|
|
|
3988
4398
|
return yield* fail("Invalid GitHub identity");
|
|
3989
4399
|
return text;
|
|
3990
4400
|
});
|
|
3991
|
-
var selectRetainedReleaseBuildEffect = (options) =>
|
|
4401
|
+
var selectRetainedReleaseBuildEffect = (options) => Effect22.gen(function* () {
|
|
3992
4402
|
const { env, config, tag, platform } = options;
|
|
3993
4403
|
if (!["macos-arm64", "windows-x64", "linux-x64"].includes(platform) || !isRecord(config) || typeof config.appName !== "string" || env.RELEASE_TAG !== tag)
|
|
3994
4404
|
return yield* fail("Invalid retained build context");
|
|
@@ -4107,9 +4517,9 @@ var selectRetainedReleaseBuildEffect = (options) => Effect20.gen(function* () {
|
|
|
4107
4517
|
var selectRetainedReleaseBuild = (options) => runReleaseLibrary(provideLibraryPorts({ run: planGitHubRun(options.env, options.run) })(selectRetainedReleaseBuildEffect(options)));
|
|
4108
4518
|
// src/library/staging.ts
|
|
4109
4519
|
import { createHash as createHash9 } from "crypto";
|
|
4110
|
-
import { join as
|
|
4111
|
-
import { Effect as
|
|
4112
|
-
var copyHashed = (input, output, size) =>
|
|
4520
|
+
import { join as join12, resolve as resolve9 } from "path";
|
|
4521
|
+
import { Effect as Effect23 } from "effect";
|
|
4522
|
+
var copyHashed = (input, output, size) => Effect23.tryPromise({
|
|
4113
4523
|
try: async (signal) => {
|
|
4114
4524
|
const hash = createHash9("sha256");
|
|
4115
4525
|
let copied = 0;
|
|
@@ -4138,15 +4548,14 @@ var copyHashed = (input, output, size) => Effect21.tryPromise({
|
|
|
4138
4548
|
original: error
|
|
4139
4549
|
})
|
|
4140
4550
|
});
|
|
4141
|
-
var
|
|
4551
|
+
var stageExpectedFilesEffect = (options) => Effect23.gen(function* () {
|
|
4142
4552
|
const fs = yield* ReleaseFs;
|
|
4143
|
-
const
|
|
4144
|
-
|
|
4145
|
-
|
|
4146
|
-
return yield* fail("Platform staging sources do not match release configuration");
|
|
4553
|
+
const { expected } = options;
|
|
4554
|
+
if (!expected.length || new Set(expected).size !== expected.length || expected.some((name) => !/^[a-zA-Z0-9][a-zA-Z0-9_.-]*$/.test(name)) || Object.keys(options.sources).length !== expected.length || expected.some((name) => !Object.hasOwn(options.sources, name)))
|
|
4555
|
+
return yield* fail("Staging sources do not match expected filenames");
|
|
4147
4556
|
const directory = resolve9(options.directory);
|
|
4148
4557
|
const created = [];
|
|
4149
|
-
const stage =
|
|
4558
|
+
const stage = Effect23.forEach(expected, (name) => Effect23.gen(function* () {
|
|
4150
4559
|
const sourcePath = options.sources[name];
|
|
4151
4560
|
if (typeof sourcePath !== "string" || !sourcePath)
|
|
4152
4561
|
return yield* fail("Invalid staging source");
|
|
@@ -4157,7 +4566,7 @@ var stagePlatformArtifactsEffect = (options) => Effect21.gen(function* () {
|
|
|
4157
4566
|
const before = yield* step(() => input.stat());
|
|
4158
4567
|
if (!before.isFile() || before.dev !== sourceInfo.dev || before.ino !== sourceInfo.ino || before.size !== sourceInfo.size)
|
|
4159
4568
|
return yield* fail("Staging source changed");
|
|
4160
|
-
const target =
|
|
4569
|
+
const target = join12(directory, name);
|
|
4161
4570
|
const output = yield* scopedHandle(() => fs.open(target, "wx"));
|
|
4162
4571
|
created.push(target);
|
|
4163
4572
|
const copied = yield* copyHashed(input, output, before.size);
|
|
@@ -4166,18 +4575,25 @@ var stagePlatformArtifactsEffect = (options) => Effect21.gen(function* () {
|
|
|
4166
4575
|
if (copied.size !== before.size || after.size !== before.size || after.mtimeMs !== before.mtimeMs || after.dev !== before.dev || after.ino !== before.ino)
|
|
4167
4576
|
return yield* fail("Staging source changed");
|
|
4168
4577
|
return { name, size: copied.size, digest: copied.digest };
|
|
4169
|
-
}).pipe(
|
|
4170
|
-
return yield* stage.pipe(
|
|
4578
|
+
}).pipe(Effect23.scoped), { concurrency: 1 });
|
|
4579
|
+
return yield* stage.pipe(Effect23.onError(() => Effect23.promise(() => Promise.all(created.map((path) => fs.rm(path, { force: true }).catch(() => {}))))));
|
|
4580
|
+
});
|
|
4581
|
+
var stagePlatformArtifactsEffect = (options) => Effect23.gen(function* () {
|
|
4582
|
+
const requirements = parseReleaseConfig(options.config).requirements(options.tag);
|
|
4583
|
+
const expected = platformPayloads(requirements, options.platform);
|
|
4584
|
+
if (!expected.length || Object.keys(options.sources).length !== expected.length || expected.some((name) => !Object.hasOwn(options.sources, name)))
|
|
4585
|
+
return yield* fail("Platform staging sources do not match release configuration");
|
|
4586
|
+
return yield* stageExpectedFilesEffect({ ...options, expected });
|
|
4171
4587
|
});
|
|
4172
4588
|
var stagePlatformArtifacts = (options) => runReleaseLibrary(provideLibraryPorts()(stagePlatformArtifactsEffect(options)));
|
|
4173
4589
|
// src/library/steps.ts
|
|
4174
|
-
import { join as
|
|
4175
|
-
import { Effect as
|
|
4590
|
+
import { join as join32 } from "path";
|
|
4591
|
+
import { Effect as Effect24 } from "effect";
|
|
4176
4592
|
|
|
4177
4593
|
// ../../src/installer/installer-archive-members.ts
|
|
4178
4594
|
import { createHash as createHash10 } from "crypto";
|
|
4179
4595
|
import { lstat as lstat6, open as open4 } from "fs/promises";
|
|
4180
|
-
import { isAbsolute as isAbsolute3, relative as
|
|
4596
|
+
import { isAbsolute as isAbsolute3, relative as relative3, sep as sep2 } from "path";
|
|
4181
4597
|
|
|
4182
4598
|
// ../../src/installer/native-executable.ts
|
|
4183
4599
|
async function assertNativeExecutable(file, size, platform, what) {
|
|
@@ -4200,7 +4616,7 @@ async function assertNativeExecutable(file, size, platform, what) {
|
|
|
4200
4616
|
// ../../src/installer/installer-archive-members.ts
|
|
4201
4617
|
var EMBEDDED_ARCHIVE_MARKER = Buffer.from("ELECTROBUN_ARCHIVE_V1");
|
|
4202
4618
|
function isWithin(root, path) {
|
|
4203
|
-
const rel =
|
|
4619
|
+
const rel = relative3(root, path);
|
|
4204
4620
|
return rel !== "" && rel !== ".." && !rel.startsWith(".." + sep2) && !isAbsolute3(rel);
|
|
4205
4621
|
}
|
|
4206
4622
|
function normalizeArchiveMember(name) {
|
|
@@ -4301,11 +4717,11 @@ async function assertEmbeddedArchive(path, size, archive) {
|
|
|
4301
4717
|
// ../../src/installer/installer-identity.ts
|
|
4302
4718
|
import { lstat as lstat8, mkdtemp as mkdtemp4, readdir as readdir5, realpath } from "fs/promises";
|
|
4303
4719
|
import { tmpdir as tmpdir4 } from "os";
|
|
4304
|
-
import { basename as basename5, join as
|
|
4720
|
+
import { basename as basename5, join as join14, resolve as resolve10, win32 } from "path";
|
|
4305
4721
|
|
|
4306
4722
|
// ../../src/installer/installer-image-mount.ts
|
|
4307
4723
|
import { lstat as lstat7, mkdir as mkdir4, mkdtemp as mkdtemp3, readdir as readdir4, rm as rm4, stat } from "fs/promises";
|
|
4308
|
-
import { dirname as dirname3, join as
|
|
4724
|
+
import { dirname as dirname3, join as join13 } from "path";
|
|
4309
4725
|
var FAILED_ATTACH_PROBES = 5;
|
|
4310
4726
|
var FAILED_ATTACH_PROBE_INTERVAL_MS = 500;
|
|
4311
4727
|
async function containsMountAt(path, expectedDevice) {
|
|
@@ -4315,7 +4731,7 @@ async function containsMountAt(path, expectedDevice) {
|
|
|
4315
4731
|
if (info.dev !== expectedDevice)
|
|
4316
4732
|
return true;
|
|
4317
4733
|
for (const name of await readdir4(path)) {
|
|
4318
|
-
const child =
|
|
4734
|
+
const child = join13(path, name), childInfo = await lstat7(child);
|
|
4319
4735
|
if (!childInfo.isDirectory() || childInfo.isSymbolicLink())
|
|
4320
4736
|
continue;
|
|
4321
4737
|
if (childInfo.dev !== info.dev || await containsMountAt(child, info.dev))
|
|
@@ -4509,8 +4925,8 @@ async function withInstallerImageRetries(options) {
|
|
|
4509
4925
|
};
|
|
4510
4926
|
const priorErrors = () => failedAttempts.map((attempt) => attempt.error);
|
|
4511
4927
|
for (let attempt = 1;attempt <= maximumAttempts; attempt++) {
|
|
4512
|
-
const directory = await mkdtemp3(
|
|
4513
|
-
const mount =
|
|
4928
|
+
const directory = await mkdtemp3(join13(options.parent, options.prefix));
|
|
4929
|
+
const mount = join13(directory, "mount");
|
|
4514
4930
|
const io = options.createIo?.(directory, mount) ?? defaultInstallerImageMountIo(options.run);
|
|
4515
4931
|
let lifecycleStarted = false;
|
|
4516
4932
|
try {
|
|
@@ -4710,7 +5126,7 @@ async function verifyInstallerPayload(options) {
|
|
|
4710
5126
|
if (!Number.isSafeInteger(before.archive.size + 256 * 1024 * 1024))
|
|
4711
5127
|
throw new Error("Installer archive exceeds bound");
|
|
4712
5128
|
const env = environment(parent);
|
|
4713
|
-
const temporary = await mkdtemp4(
|
|
5129
|
+
const temporary = await mkdtemp4(join14(tmpdir4(), "framework-installer-inspect-"));
|
|
4714
5130
|
const cleanupIo = defaultInstallerImageMountIo(command);
|
|
4715
5131
|
try {
|
|
4716
5132
|
if (options.platform === "macos-arm64") {
|
|
@@ -4724,21 +5140,21 @@ async function verifyInstallerPayload(options) {
|
|
|
4724
5140
|
const apps = (await readdir5(mount)).filter((name) => name.endsWith(".app"));
|
|
4725
5141
|
if (apps.length !== 1)
|
|
4726
5142
|
throw new Error("Installer application is missing or ambiguous");
|
|
4727
|
-
const resources =
|
|
4728
|
-
const actualRoot = await realpath(mount), actualApp = await realpath(
|
|
5143
|
+
const resources = join14(mount, apps[0], "Contents", "Resources");
|
|
5144
|
+
const actualRoot = await realpath(mount), actualApp = await realpath(join14(mount, apps[0])), actualResources = await realpath(resources);
|
|
4729
5145
|
if (!isWithin(actualRoot, actualApp) || !isWithin(actualApp, actualResources))
|
|
4730
5146
|
throw new Error("Installer resources escape mounted image");
|
|
4731
|
-
const plist =
|
|
5147
|
+
const plist = join14(actualApp, "Contents", "Info.plist"), plistInfo = await lstat8(plist);
|
|
4732
5148
|
if (!plistInfo.isFile() || plistInfo.isSymbolicLink() || plistInfo.size < 1 || plistInfo.size > 1024 * 1024)
|
|
4733
5149
|
throw new Error("Invalid installer property list");
|
|
4734
5150
|
const executable = (await command(["/usr/libexec/PlistBuddy", "-c", "Print :CFBundleExecutable", plist], env)).trim();
|
|
4735
5151
|
if (!executable || executable === "." || executable === ".." || /[\\/]/.test(executable))
|
|
4736
5152
|
throw new Error("Invalid installer executable name");
|
|
4737
|
-
await assertInstallerExecutable(
|
|
5153
|
+
await assertInstallerExecutable(join14(actualApp, "Contents", "MacOS", executable), options.platform);
|
|
4738
5154
|
const archives = (await readdir5(actualResources)).filter((name) => name.endsWith(".tar.zst"));
|
|
4739
5155
|
if (archives.length !== 1)
|
|
4740
5156
|
throw new Error("Installer archive is missing or ambiguous");
|
|
4741
|
-
const embedded = await identity(
|
|
5157
|
+
const embedded = await identity(join14(actualResources, archives[0]));
|
|
4742
5158
|
if (embedded.size !== before.archive.size || embedded.digest !== before.archive.digest)
|
|
4743
5159
|
throw new Error("Installer archive differs from release archive");
|
|
4744
5160
|
}
|
|
@@ -4756,7 +5172,7 @@ async function verifyInstallerPayload(options) {
|
|
|
4756
5172
|
const matches = names.filter((name) => candidates.includes(normalizeArchiveMember(name)));
|
|
4757
5173
|
if (matches.length !== 1)
|
|
4758
5174
|
throw new Error("Installer archive is missing or ambiguous");
|
|
4759
|
-
const extracted =
|
|
5175
|
+
const extracted = join14(temporary, "member");
|
|
4760
5176
|
const count = await extractArchiveMember({
|
|
4761
5177
|
tar,
|
|
4762
5178
|
archive: installerPath,
|
|
@@ -4767,7 +5183,7 @@ async function verifyInstallerPayload(options) {
|
|
|
4767
5183
|
});
|
|
4768
5184
|
if (options.platform === "windows-x64") {
|
|
4769
5185
|
const setup = findArchiveMember(names, `${options.appName}-Setup.exe`, options.platform, "Installer executable is missing or ambiguous");
|
|
4770
|
-
const executable =
|
|
5186
|
+
const executable = join14(temporary, "setup.exe");
|
|
4771
5187
|
await extractArchiveMember({
|
|
4772
5188
|
tar,
|
|
4773
5189
|
archive: installerPath,
|
|
@@ -4804,18 +5220,18 @@ async function verifyInstallerPayload(options) {
|
|
|
4804
5220
|
|
|
4805
5221
|
// ../../src/installer/installer-qualification-command.ts
|
|
4806
5222
|
import { lstat as lstat18, writeFile as writeFile9 } from "fs/promises";
|
|
4807
|
-
import { join as
|
|
5223
|
+
import { join as join29, resolve as resolve13 } from "path";
|
|
4808
5224
|
|
|
4809
5225
|
// ../../src/installer/installer-observation.ts
|
|
4810
5226
|
import { randomBytes as randomBytes2 } from "crypto";
|
|
4811
5227
|
import { chmod as chmod2, mkdir as mkdir9, readFile as readFile9, realpath as realpath8, writeFile as writeFile8 } from "fs/promises";
|
|
4812
5228
|
import { createServer } from "net";
|
|
4813
|
-
import { delimiter, dirname as dirname12, join as
|
|
5229
|
+
import { delimiter, dirname as dirname12, join as join28 } from "path";
|
|
4814
5230
|
|
|
4815
5231
|
// ../../src/installer/installer-ci-bootstrap.ts
|
|
4816
5232
|
import { randomBytes } from "crypto";
|
|
4817
5233
|
import { lstat as lstat9, mkdir as mkdir5, mkdtemp as mkdtemp5, realpath as realpath2, rm as rm5, writeFile as writeFile4 } from "fs/promises";
|
|
4818
|
-
import { dirname as dirname4, isAbsolute as isAbsolute4, join as
|
|
5234
|
+
import { dirname as dirname4, isAbsolute as isAbsolute4, join as join15, relative as relative4, sep as sep3 } from "path";
|
|
4819
5235
|
import { fileURLToPath } from "url";
|
|
4820
5236
|
var bootstrapModules = [
|
|
4821
5237
|
"app/value-guards.js",
|
|
@@ -4827,6 +5243,7 @@ var bootstrapModules = [
|
|
|
4827
5243
|
"installer/hosted-runner.js",
|
|
4828
5244
|
"release/release-qualification.js",
|
|
4829
5245
|
"updates/feed/release-config-contract.js",
|
|
5246
|
+
"updates/feed/arch-package-policy.js",
|
|
4830
5247
|
"updates/feed/release-feed.js",
|
|
4831
5248
|
"native/app-bundle.js",
|
|
4832
5249
|
"desktop/string-policy.js",
|
|
@@ -4841,23 +5258,23 @@ async function prepareInstallerCiBootstrap(env = process.env) {
|
|
|
4841
5258
|
if (/\s/.test(parent) || !(await lstat9(parent)).isDirectory())
|
|
4842
5259
|
throw new Error("Runner temp cannot represent a Bun preload path");
|
|
4843
5260
|
const source = dirname4(dirname4(fileURLToPath(import.meta.url)));
|
|
4844
|
-
const directory = await mkdtemp5(
|
|
5261
|
+
const directory = await mkdtemp5(join15(parent, "framework-ci-"));
|
|
4845
5262
|
try {
|
|
4846
5263
|
for (const name of bootstrapModules) {
|
|
4847
|
-
const contents = await readBoundedFile(
|
|
4848
|
-
await mkdir5(dirname4(
|
|
4849
|
-
await writeFile4(
|
|
5264
|
+
const contents = await readBoundedFile(join15(source, name), 2 * 1024 * 1024, "installer bootstrap module");
|
|
5265
|
+
await mkdir5(dirname4(join15(directory, name)), { recursive: true, mode: 448 });
|
|
5266
|
+
await writeFile4(join15(directory, name), contents, { flag: "wx", mode: 384 });
|
|
4850
5267
|
}
|
|
4851
|
-
await writeFile4(
|
|
5268
|
+
await writeFile4(join15(directory, "package.json"), `{"type":"module"}
|
|
4852
5269
|
`, {
|
|
4853
5270
|
flag: "wx",
|
|
4854
5271
|
mode: 384
|
|
4855
5272
|
});
|
|
4856
|
-
const worker =
|
|
5273
|
+
const worker = join15(directory, "installer/installer-ci-worker.js");
|
|
4857
5274
|
return {
|
|
4858
5275
|
directory,
|
|
4859
5276
|
worker,
|
|
4860
|
-
preflight:
|
|
5277
|
+
preflight: join15(directory, "installer/installer-ci-preflight.js"),
|
|
4861
5278
|
bunOptions: `--preload=${worker}`
|
|
4862
5279
|
};
|
|
4863
5280
|
} catch (error) {
|
|
@@ -4871,8 +5288,8 @@ async function preflightInstallerRuntime(options) {
|
|
|
4871
5288
|
if (!isHostedRunner(env) || !temp || !isAbsolute4(runtime))
|
|
4872
5289
|
throw new Error("Runtime preflight requires a disposable hosted runner");
|
|
4873
5290
|
const tempRoot = await realpath2(temp), bootstrapRoot = await realpath2(bootstrap.directory);
|
|
4874
|
-
const relativeBootstrap =
|
|
4875
|
-
if (!relativeBootstrap || relativeBootstrap === ".." || relativeBootstrap.startsWith(".." + sep3) || isAbsolute4(relativeBootstrap) || /\s/.test(bootstrapRoot) || bootstrap.worker !==
|
|
5291
|
+
const relativeBootstrap = relative4(tempRoot, bootstrapRoot);
|
|
5292
|
+
if (!relativeBootstrap || relativeBootstrap === ".." || relativeBootstrap.startsWith(".." + sep3) || isAbsolute4(relativeBootstrap) || /\s/.test(bootstrapRoot) || bootstrap.worker !== join15(bootstrapRoot, "installer/installer-ci-worker.js") || bootstrap.preflight !== join15(bootstrapRoot, "installer/installer-ci-preflight.js") || bootstrap.bunOptions !== `--preload=${bootstrap.worker}`)
|
|
4876
5293
|
throw new Error("Invalid installer bootstrap location");
|
|
4877
5294
|
await runInstallerPreflight({
|
|
4878
5295
|
env,
|
|
@@ -4892,7 +5309,7 @@ async function runInstallerPreflight(options) {
|
|
|
4892
5309
|
const info = await lstat9(runtime);
|
|
4893
5310
|
if (!info.isFile() || info.isSymbolicLink() || info.size < 4096)
|
|
4894
5311
|
throw new Error("Invalid candidate Bun runtime");
|
|
4895
|
-
const temporary = await mkdtemp5(
|
|
5312
|
+
const temporary = await mkdtemp5(join15(options.parent, "framework-preflight-"));
|
|
4896
5313
|
try {
|
|
4897
5314
|
const clean = {};
|
|
4898
5315
|
for (const key of [
|
|
@@ -4917,11 +5334,11 @@ async function runInstallerPreflight(options) {
|
|
|
4917
5334
|
BUN_OPTIONS: `--preload=${worker}`,
|
|
4918
5335
|
FRAMEWORK_CI_WORKER_ENTRY: preflight,
|
|
4919
5336
|
FRAMEWORK_CI_NONCE: nonce,
|
|
4920
|
-
FRAMEWORK_CI_ACK:
|
|
4921
|
-
FRAMEWORK_CI_PERMIT:
|
|
5337
|
+
FRAMEWORK_CI_ACK: join15(temporary, "ack"),
|
|
5338
|
+
FRAMEWORK_CI_PERMIT: join15(temporary, "permit"),
|
|
4922
5339
|
FRAMEWORK_CI_ORIGIN: "http://127.0.0.1:48999",
|
|
4923
|
-
FRAMEWORK_CI_OBSERVATION:
|
|
4924
|
-
FRAMEWORK_CI_UNEXPECTED:
|
|
5340
|
+
FRAMEWORK_CI_OBSERVATION: join15(temporary, "observation"),
|
|
5341
|
+
FRAMEWORK_CI_UNEXPECTED: join15(temporary, "unexpected"),
|
|
4925
5342
|
FRAMEWORK_CI_EXPECTED_READS: JSON.stringify([
|
|
4926
5343
|
"https://example.invalid/framework-ci-sentinel"
|
|
4927
5344
|
])
|
|
@@ -4956,7 +5373,7 @@ async function runInstallerPreflight(options) {
|
|
|
4956
5373
|
if (status !== 0 || !stdout.includes("framework installer preload preflight passed"))
|
|
4957
5374
|
throw new Error("Candidate Bun runtime failed installer preflight");
|
|
4958
5375
|
try {
|
|
4959
|
-
await lstat9(
|
|
5376
|
+
await lstat9(join15(temporary, "unexpected"));
|
|
4960
5377
|
throw new Error("Runtime preflight recorded unexpected activity");
|
|
4961
5378
|
} catch (error) {
|
|
4962
5379
|
if (errorCode(error) !== "ENOENT")
|
|
@@ -4969,7 +5386,7 @@ async function runInstallerPreflight(options) {
|
|
|
4969
5386
|
|
|
4970
5387
|
// ../../src/installer/installer-extraction.ts
|
|
4971
5388
|
import { chmod, lstat as lstat10, mkdir as mkdir6, mkdtemp as mkdtemp6, readdir as readdir6, realpath as realpath3 } from "fs/promises";
|
|
4972
|
-
import { join as
|
|
5389
|
+
import { join as join16, resolve as resolve11, win32 as win322 } from "path";
|
|
4973
5390
|
async function run(cmd, env) {
|
|
4974
5391
|
return runInstallerCommand(cmd, env, {
|
|
4975
5392
|
outputLimit: 8 * 1024 * 1024,
|
|
@@ -4977,7 +5394,7 @@ async function run(cmd, env) {
|
|
|
4977
5394
|
failureMessage: "Installer preparation command failed"
|
|
4978
5395
|
});
|
|
4979
5396
|
}
|
|
4980
|
-
async function
|
|
5397
|
+
async function digest2(path) {
|
|
4981
5398
|
const info = await lstat10(path);
|
|
4982
5399
|
if (!info.isFile() || info.isSymbolicLink() || !Number.isSafeInteger(info.size) || info.size < 1)
|
|
4983
5400
|
throw new Error("Invalid extracted file");
|
|
@@ -5021,10 +5438,10 @@ async function prepareInstallerExecution(options) {
|
|
|
5021
5438
|
archive: sourceArchive,
|
|
5022
5439
|
env
|
|
5023
5440
|
});
|
|
5024
|
-
const directory = await mkdtemp6(
|
|
5441
|
+
const directory = await mkdtemp6(join16(parent, "framework-installer-"));
|
|
5025
5442
|
const imageIo = defaultInstallerImageMountIo(run);
|
|
5026
5443
|
try {
|
|
5027
|
-
const profile =
|
|
5444
|
+
const profile = join16(directory, "profile"), incoming = join16(directory, "incoming");
|
|
5028
5445
|
await mkdir6(profile, { mode: 448 });
|
|
5029
5446
|
await mkdir6(incoming, { mode: 448 });
|
|
5030
5447
|
const clean = cleanEnv(env);
|
|
@@ -5040,31 +5457,31 @@ async function prepareInstallerExecution(options) {
|
|
|
5040
5457
|
const appName = `${options.appName}.app`, apps = (await readdir6(mount)).filter((name) => name.endsWith(".app"));
|
|
5041
5458
|
if (apps.length !== 1 || apps[0] !== appName)
|
|
5042
5459
|
throw new Error("Unexpected installer application");
|
|
5043
|
-
const sourceApp = await realpath3(
|
|
5460
|
+
const sourceApp = await realpath3(join16(mount, appName)), mountRoot = await realpath3(mount);
|
|
5044
5461
|
if (!isWithin(mountRoot, sourceApp))
|
|
5045
5462
|
throw new Error("Installer application escapes image");
|
|
5046
|
-
const app =
|
|
5463
|
+
const app = join16(incoming, appName);
|
|
5047
5464
|
await run(["/usr/bin/ditto", sourceApp, app], clean);
|
|
5048
|
-
const actualApp = await realpath3(app), resources = await realpath3(
|
|
5465
|
+
const actualApp = await realpath3(app), resources = await realpath3(join16(actualApp, "Contents", "Resources"));
|
|
5049
5466
|
if (!isWithin(await realpath3(incoming), actualApp) || !isWithin(actualApp, resources))
|
|
5050
5467
|
throw new Error("Copied installer escapes profile");
|
|
5051
|
-
const plist =
|
|
5468
|
+
const plist = join16(actualApp, "Contents", "Info.plist"), plistInfo = await lstat10(plist);
|
|
5052
5469
|
if (!plistInfo.isFile() || plistInfo.isSymbolicLink() || plistInfo.size < 1 || plistInfo.size > 1024 * 1024)
|
|
5053
5470
|
throw new Error("Invalid installer property list");
|
|
5054
5471
|
const name = (await run(["/usr/libexec/PlistBuddy", "-c", "Print :CFBundleExecutable", plist], clean)).trim();
|
|
5055
5472
|
if (!name || name === "." || name === ".." || /[\\/]/.test(name))
|
|
5056
5473
|
throw new Error("Invalid installer executable");
|
|
5057
|
-
const appExecutable =
|
|
5058
|
-
const sourceExecutable =
|
|
5474
|
+
const appExecutable = join16(actualApp, "Contents", "MacOS", name);
|
|
5475
|
+
const sourceExecutable = join16(sourceApp, "Contents", "MacOS", name);
|
|
5059
5476
|
if (!isWithin(actualApp, await realpath3(appExecutable)) || !isWithin(sourceApp, await realpath3(sourceExecutable)))
|
|
5060
5477
|
throw new Error("Installer executable escapes application");
|
|
5061
5478
|
await assertInstallerExecutable(appExecutable, options.platform);
|
|
5062
|
-
if (JSON.stringify(await
|
|
5479
|
+
if (JSON.stringify(await digest2(sourceExecutable)) !== JSON.stringify(await digest2(appExecutable)))
|
|
5063
5480
|
throw new Error("Copied installer executable differs");
|
|
5064
5481
|
const archives = (await readdir6(resources)).filter((value) => value.endsWith(".tar.zst"));
|
|
5065
5482
|
if (archives.length !== 1)
|
|
5066
5483
|
throw new Error("Missing installer archive");
|
|
5067
|
-
const embedded = await
|
|
5484
|
+
const embedded = await digest2(join16(resources, archives[0]));
|
|
5068
5485
|
if (embedded.size !== verified.archive.size || embedded.digest !== verified.archive.digest)
|
|
5069
5486
|
throw new Error("Copied installer archive differs");
|
|
5070
5487
|
return executable;
|
|
@@ -5079,9 +5496,9 @@ async function prepareInstallerExecution(options) {
|
|
|
5079
5496
|
assertInstallerLayout(options.platform, options.appName, names);
|
|
5080
5497
|
const find = (name) => findArchiveMember(names, name, options.platform, "Installer member missing or ambiguous");
|
|
5081
5498
|
if (options.platform === "windows-x64") {
|
|
5082
|
-
const subdirectory =
|
|
5499
|
+
const subdirectory = join16(incoming, ".installer");
|
|
5083
5500
|
await mkdir6(subdirectory);
|
|
5084
|
-
executable =
|
|
5501
|
+
executable = join16(incoming, `${options.appName}-Setup.exe`);
|
|
5085
5502
|
await extractArchiveMember({
|
|
5086
5503
|
tar,
|
|
5087
5504
|
archive: sourceInstaller,
|
|
@@ -5095,11 +5512,11 @@ async function prepareInstallerExecution(options) {
|
|
|
5095
5512
|
tar,
|
|
5096
5513
|
archive: sourceInstaller,
|
|
5097
5514
|
member: find(`.installer/${options.appName}-Setup.metadata.json`),
|
|
5098
|
-
destination:
|
|
5515
|
+
destination: join16(subdirectory, `${options.appName}-Setup.metadata.json`),
|
|
5099
5516
|
maximum: 1024 * 1024,
|
|
5100
5517
|
env: clean
|
|
5101
5518
|
});
|
|
5102
|
-
const embeddedPath =
|
|
5519
|
+
const embeddedPath = join16(subdirectory, `${options.appName}-Setup.tar.zst`);
|
|
5103
5520
|
await extractArchiveMember({
|
|
5104
5521
|
tar,
|
|
5105
5522
|
archive: sourceInstaller,
|
|
@@ -5108,11 +5525,11 @@ async function prepareInstallerExecution(options) {
|
|
|
5108
5525
|
maximum: verified.archive.size,
|
|
5109
5526
|
env: clean
|
|
5110
5527
|
});
|
|
5111
|
-
const embedded = await
|
|
5528
|
+
const embedded = await digest2(embeddedPath);
|
|
5112
5529
|
if (embedded.size !== verified.archive.size || embedded.digest !== verified.archive.digest)
|
|
5113
5530
|
throw new Error("Copied installer archive differs");
|
|
5114
5531
|
} else {
|
|
5115
|
-
executable =
|
|
5532
|
+
executable = join16(incoming, "installer");
|
|
5116
5533
|
await extractArchiveMember({
|
|
5117
5534
|
tar,
|
|
5118
5535
|
archive: sourceInstaller,
|
|
@@ -5171,7 +5588,7 @@ function assertInstallerRendererObservation(value, offline = false) {
|
|
|
5171
5588
|
import { createHash as createHash11 } from "crypto";
|
|
5172
5589
|
import { lstat as lstat11, open as open5, realpath as realpath4, rm as rm6 } from "fs/promises";
|
|
5173
5590
|
import { once } from "events";
|
|
5174
|
-
import { join as
|
|
5591
|
+
import { join as join17, resolve as resolve12 } from "path";
|
|
5175
5592
|
import { createZstdDecompress } from "zlib";
|
|
5176
5593
|
import { Parser } from "tar";
|
|
5177
5594
|
function cleanEnv2(parent, forceLocal) {
|
|
@@ -5342,7 +5759,7 @@ async function verifyInstalledPayload(options) {
|
|
|
5342
5759
|
const member = members.get(path);
|
|
5343
5760
|
if (!member || member.count !== 1)
|
|
5344
5761
|
throw new Error("Archive member missing or ambiguous");
|
|
5345
|
-
const current = await installed(
|
|
5762
|
+
const current = await installed(join17(root, name), root, limit);
|
|
5346
5763
|
if (member.size !== current.size || member.digest !== current.digest)
|
|
5347
5764
|
throw new Error(`Installed file differs from archive: ${name}`);
|
|
5348
5765
|
if (name === "Resources/version.json") {
|
|
@@ -5377,7 +5794,7 @@ async function extractCandidateRuntime(options) {
|
|
|
5377
5794
|
const prefix = options.platform === "macos-arm64" ? `${options.appName}.app/Contents/MacOS` : `${options.appName.replaceAll(" ", "")}/bin`, suffix = options.platform === "windows-x64" ? ".exe" : "";
|
|
5378
5795
|
const expected = `${prefix}/bun${suffix}`;
|
|
5379
5796
|
const member = findArchiveMember(entries, expected, options.platform, "Runtime archive member missing or ambiguous");
|
|
5380
|
-
const destination =
|
|
5797
|
+
const destination = join17(profile, `candidate-bun${suffix}`), output = await open5(destination, "wx", 448);
|
|
5381
5798
|
const spawn = () => Bun.spawn({
|
|
5382
5799
|
cmd: ["tar", "--zstd", "-xOf", archive, "--", member],
|
|
5383
5800
|
env: tarEnv,
|
|
@@ -5584,7 +6001,7 @@ async function windowsRunningExecutable(pid) {
|
|
|
5584
6001
|
|
|
5585
6002
|
// ../../src/updates/install/update-swap-stage.ts
|
|
5586
6003
|
import { lstat as lstat17, mkdtemp as mkdtemp8, readFile as readFile8, realpath as realpath7, rm as rm8 } from "fs/promises";
|
|
5587
|
-
import { join as
|
|
6004
|
+
import { join as join27 } from "path";
|
|
5588
6005
|
|
|
5589
6006
|
// ../../src/updates/install/update-handoff-plan.ts
|
|
5590
6007
|
import { basename as basename6 } from "path";
|
|
@@ -5626,7 +6043,7 @@ function planUpdateHandoff(options) {
|
|
|
5626
6043
|
import { createHash as createHash12 } from "crypto";
|
|
5627
6044
|
import { constants as constants4 } from "fs";
|
|
5628
6045
|
import { lstat as lstat12, mkdir as mkdir7, mkdtemp as mkdtemp7, open as open6, readFile as readFile6, realpath as realpath6, rm as rm7, symlink } from "fs/promises";
|
|
5629
|
-
import { isAbsolute as isAbsolute5, join as
|
|
6046
|
+
import { isAbsolute as isAbsolute5, join as join18 } from "path";
|
|
5630
6047
|
import { Transform } from "stream";
|
|
5631
6048
|
import { pipeline } from "stream/promises";
|
|
5632
6049
|
import { createZstdDecompress as createZstdDecompress2 } from "zlib";
|
|
@@ -5672,8 +6089,8 @@ async function extractVerifiedUpdate(options) {
|
|
|
5672
6089
|
const parent = await realpath6(options.directory);
|
|
5673
6090
|
if (!(await lstat12(parent)).isDirectory())
|
|
5674
6091
|
throw new Error("Invalid update staging directory");
|
|
5675
|
-
directory = await mkdtemp7(
|
|
5676
|
-
const payloadRoot =
|
|
6092
|
+
directory = await mkdtemp7(join18(parent, "framework-update-extract-"));
|
|
6093
|
+
const payloadRoot = join18(directory, "payload"), decompressed = join18(directory, "payload.tar");
|
|
5677
6094
|
await mkdir7(payloadRoot, { mode: 448 });
|
|
5678
6095
|
const entries = [], links = [], seen = new Set, fold = platform === "windows-x64";
|
|
5679
6096
|
let invalid = false;
|
|
@@ -5791,14 +6208,14 @@ async function extractVerifiedUpdate(options) {
|
|
|
5791
6208
|
if (invalid)
|
|
5792
6209
|
throw new Error("Unsafe or unsupported update archive entry");
|
|
5793
6210
|
if (links.length) {
|
|
5794
|
-
const bin =
|
|
5795
|
-
for (const path of [
|
|
6211
|
+
const bin = join18(payloadRoot, archiveRoot, "bin"), cef = join18(bin, "cef");
|
|
6212
|
+
for (const path of [join18(payloadRoot, archiveRoot), bin, cef]) {
|
|
5796
6213
|
const value = await lstat12(path);
|
|
5797
6214
|
if (!value.isDirectory() || value.isSymbolicLink())
|
|
5798
6215
|
throw new Error("Invalid CEF link directory");
|
|
5799
6216
|
}
|
|
5800
6217
|
for (const link of links) {
|
|
5801
|
-
const destination =
|
|
6218
|
+
const destination = join18(payloadRoot, link.path), target = join18(bin, link.target), value = await lstat12(target);
|
|
5802
6219
|
if (!value.isFile() || value.isSymbolicLink())
|
|
5803
6220
|
throw new Error("Invalid CEF link target");
|
|
5804
6221
|
await symlink(link.target, destination);
|
|
@@ -5806,12 +6223,12 @@ async function extractVerifiedUpdate(options) {
|
|
|
5806
6223
|
}
|
|
5807
6224
|
await rm7(decompressed);
|
|
5808
6225
|
assertPayloadLayout({ platform, renderer, appName, entries, sidecars });
|
|
5809
|
-
const prefix = platform === "macos-arm64" ?
|
|
5810
|
-
const resources =
|
|
6226
|
+
const prefix = platform === "macos-arm64" ? join18(`${appName}.app`, "Contents") : appName.replaceAll(" ", "");
|
|
6227
|
+
const resources = join18(payloadRoot, prefix, "Resources");
|
|
5811
6228
|
const bin = platform === "macos-arm64" ? "MacOS" : "bin", suffix = platform === "windows-x64" ? ".exe" : "";
|
|
5812
6229
|
const executables = [
|
|
5813
|
-
|
|
5814
|
-
|
|
6230
|
+
join18(bin, `launcher${suffix}`),
|
|
6231
|
+
join18(bin, `bun${suffix}`),
|
|
5815
6232
|
...sidecars.map((name) => sidecarBundlePath(name, platform))
|
|
5816
6233
|
];
|
|
5817
6234
|
const critical = [
|
|
@@ -5821,21 +6238,21 @@ async function extractVerifiedUpdate(options) {
|
|
|
5821
6238
|
"Resources/app/client/index.html"
|
|
5822
6239
|
];
|
|
5823
6240
|
for (const path of critical) {
|
|
5824
|
-
const item = await lstat12(
|
|
6241
|
+
const item = await lstat12(join18(payloadRoot, prefix, path));
|
|
5825
6242
|
if (!item.isFile() || item.isSymbolicLink() || item.size < 1 || platform !== "windows-x64" && process.platform !== "win32" && executables.includes(path) && !(item.mode & 64))
|
|
5826
6243
|
throw new Error("Invalid critical update file");
|
|
5827
6244
|
}
|
|
5828
6245
|
for (const name of ["version.json", "build.json"]) {
|
|
5829
|
-
const metadata = await lstat12(
|
|
6246
|
+
const metadata = await lstat12(join18(resources, name));
|
|
5830
6247
|
if (!metadata.isFile() || metadata.isSymbolicLink() || metadata.size < 1 || metadata.size > 1048576)
|
|
5831
6248
|
throw new Error("Invalid update metadata");
|
|
5832
6249
|
}
|
|
5833
|
-
if (JSON.parse(await readFile6(
|
|
6250
|
+
if (JSON.parse(await readFile6(join18(resources, "version.json"), "utf8")).version !== descriptor.version)
|
|
5834
6251
|
throw new Error("Update version mismatch");
|
|
5835
|
-
assertBuildMetadata(JSON.parse(await readFile6(
|
|
6252
|
+
assertBuildMetadata(JSON.parse(await readFile6(join18(resources, "build.json"), "utf8")), renderer);
|
|
5836
6253
|
return {
|
|
5837
6254
|
directory,
|
|
5838
|
-
payload:
|
|
6255
|
+
payload: join18(payloadRoot, platform === "macos-arm64" ? `${appName}.app` : prefix)
|
|
5839
6256
|
};
|
|
5840
6257
|
} catch (error) {
|
|
5841
6258
|
if (directory)
|
|
@@ -5850,16 +6267,16 @@ async function extractVerifiedUpdate(options) {
|
|
|
5850
6267
|
import { createHash as createHash13 } from "crypto";
|
|
5851
6268
|
import { constants as constants7 } from "fs";
|
|
5852
6269
|
import { lstat as lstat13, open as open9, readdir as readdir7, readFile as readFile7, readlink as readlink2 } from "fs/promises";
|
|
5853
|
-
import { basename as basename8, dirname as dirname6, join as
|
|
6270
|
+
import { basename as basename8, dirname as dirname6, join as join21 } from "path";
|
|
5854
6271
|
|
|
5855
6272
|
// ../../src/updates/update-state-store.ts
|
|
5856
6273
|
import { randomUUID as randomUUID2 } from "crypto";
|
|
5857
6274
|
import { constants as constants6 } from "fs";
|
|
5858
6275
|
import { open as open8, rename, unlink, writeFile as writeFile5 } from "fs/promises";
|
|
5859
|
-
import { join as
|
|
6276
|
+
import { join as join20 } from "path";
|
|
5860
6277
|
|
|
5861
6278
|
// ../../src/updates/locks/update-lock.ts
|
|
5862
|
-
import { basename as basename7, dirname as dirname5, join as
|
|
6279
|
+
import { basename as basename7, dirname as dirname5, join as join19 } from "path";
|
|
5863
6280
|
|
|
5864
6281
|
// ../../src/updates/locks/native-file-lock.ts
|
|
5865
6282
|
import { constants as constants5 } from "fs";
|
|
@@ -6027,7 +6444,7 @@ async function tryAcquireWindows(path, mode) {
|
|
|
6027
6444
|
function updateLockPath(target) {
|
|
6028
6445
|
if (!isCanonicalPath(target))
|
|
6029
6446
|
throw new Error("Invalid update lock target");
|
|
6030
|
-
return
|
|
6447
|
+
return join19(dirname5(target), `.${basename7(target)}.framework-update.lock`);
|
|
6031
6448
|
}
|
|
6032
6449
|
async function tryAcquireUpdateLock(target) {
|
|
6033
6450
|
return tryAcquireNativeFileLock(updateLockPath(target), "exclusive");
|
|
@@ -6092,7 +6509,7 @@ function parseState(value) {
|
|
|
6092
6509
|
return Object.freeze(record);
|
|
6093
6510
|
}
|
|
6094
6511
|
async function readUpdateStageState(staging) {
|
|
6095
|
-
const text = await readSmallStateFile(
|
|
6512
|
+
const text = await readSmallStateFile(join20(staging, "state.json"), 4096, "Invalid update staging state");
|
|
6096
6513
|
return text === undefined ? undefined : parseState(JSON.parse(text));
|
|
6097
6514
|
}
|
|
6098
6515
|
async function writeUpdateStageState(staging, state) {
|
|
@@ -6101,8 +6518,8 @@ async function writeUpdateStageState(staging, state) {
|
|
|
6101
6518
|
async function replaceUpdateStageState(staging, state, durable) {
|
|
6102
6519
|
if (typeof state.generation !== "string" || !isUuid(state.generation))
|
|
6103
6520
|
throw new Error("Invalid update staging state");
|
|
6104
|
-
const path =
|
|
6105
|
-
const temporary =
|
|
6521
|
+
const path = join20(staging, "state.json");
|
|
6522
|
+
const temporary = join20(staging, `.state-${state.generation}-${randomUUID2()}.tmp`);
|
|
6106
6523
|
const contents = JSON.stringify(state) + `
|
|
6107
6524
|
`;
|
|
6108
6525
|
let renamed = false;
|
|
@@ -6140,10 +6557,10 @@ async function withUpdateLock(target, operation) {
|
|
|
6140
6557
|
function updateStagingFor(target) {
|
|
6141
6558
|
if (!isCanonicalPath(target))
|
|
6142
6559
|
throw new Error("Invalid update target");
|
|
6143
|
-
return
|
|
6560
|
+
return join21(dirname6(target), `.${basename8(target)}.framework-update`);
|
|
6144
6561
|
}
|
|
6145
6562
|
async function readUpdateTreeVersion(tree) {
|
|
6146
|
-
const versionPath =
|
|
6563
|
+
const versionPath = join21(tree, ...process.platform === "darwin" ? ["Contents", "Resources"] : ["Resources"], "version.json");
|
|
6147
6564
|
try {
|
|
6148
6565
|
const value = JSON.parse(await readFile7(versionPath, "utf8"));
|
|
6149
6566
|
if (typeof value !== "object" || value === null || typeof value.version !== "string")
|
|
@@ -6237,7 +6654,7 @@ async function readUpdateTreeDigest(tree, options = {}) {
|
|
|
6237
6654
|
if (before.isDirectory()) {
|
|
6238
6655
|
const names = (await limit(() => readdir7(path))).map((name) => ({ name, bytes: Buffer.from(name, "utf8") })).toSorted((left, right) => Buffer.compare(left.bytes, right.bytes)).map(({ name }) => name);
|
|
6239
6656
|
const children = await Promise.all(names.map(async (name) => {
|
|
6240
|
-
const childPath =
|
|
6657
|
+
const childPath = join21(path, name);
|
|
6241
6658
|
return list(childPath, relative ? `${relative}/${name}` : name, await limit(() => lstat13(childPath, { bigint: true })));
|
|
6242
6659
|
}));
|
|
6243
6660
|
return [{ kind: "directory", path, relative, before }, ...children.flat()];
|
|
@@ -6380,8 +6797,8 @@ async function swapUpdateTreeWhileLocked(options, exchangeOperation = exchangeDi
|
|
|
6380
6797
|
const { target, staging } = options;
|
|
6381
6798
|
if (dirname6(staging) !== dirname6(target) || staging === target)
|
|
6382
6799
|
throw new Error("Invalid update swap context");
|
|
6383
|
-
const candidate =
|
|
6384
|
-
const legacyOld =
|
|
6800
|
+
const candidate = join21(staging, "candidate");
|
|
6801
|
+
const legacyOld = join21(staging, "old");
|
|
6385
6802
|
if (await pathExists(legacyOld))
|
|
6386
6803
|
throw new Error("A legacy update tree requires recovery before another swap");
|
|
6387
6804
|
await assertDirectory(target);
|
|
@@ -6411,10 +6828,10 @@ async function swapUpdateTreeWhileLocked(options, exchangeOperation = exchangeDi
|
|
|
6411
6828
|
|
|
6412
6829
|
// ../../src/updates/retention/retirement-inventory.ts
|
|
6413
6830
|
import { lstat as lstat15, readdir as readdir9 } from "fs/promises";
|
|
6414
|
-
import { basename as basename12, dirname as dirname10, join as
|
|
6831
|
+
import { basename as basename12, dirname as dirname10, join as join25 } from "path";
|
|
6415
6832
|
|
|
6416
6833
|
// ../../src/updates/retention/update-retention-marker.ts
|
|
6417
|
-
import { basename as basename9, dirname as dirname7, join as
|
|
6834
|
+
import { basename as basename9, dirname as dirname7, join as join22 } from "path";
|
|
6418
6835
|
var LOWERCASE_UUID = /^[0-9a-f]{8}-[0-9a-f]{4}-[1-8][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$/;
|
|
6419
6836
|
var IDENTITY_COMPONENT = /^[1-9]\d{0,19}$/;
|
|
6420
6837
|
function assertCanonicalTarget(target) {
|
|
@@ -6433,28 +6850,28 @@ function isTreeIdentity(value) {
|
|
|
6433
6850
|
function updateRetentionIntentPath(target, generation) {
|
|
6434
6851
|
assertCanonicalTarget(target);
|
|
6435
6852
|
assertGeneration(generation);
|
|
6436
|
-
return
|
|
6853
|
+
return join22(dirname7(target), `.${basename9(target)}.framework-prune-${generation}.json`);
|
|
6437
6854
|
}
|
|
6438
6855
|
|
|
6439
6856
|
// ../../src/updates/retention/retention-prune-progress.ts
|
|
6440
|
-
import { basename as basename11, dirname as dirname9, join as
|
|
6857
|
+
import { basename as basename11, dirname as dirname9, join as join24 } from "path";
|
|
6441
6858
|
|
|
6442
6859
|
// ../../src/updates/retention/retirement-records.ts
|
|
6443
6860
|
import { lstat as lstat14, readdir as readdir8, writeFile as writeFile6 } from "fs/promises";
|
|
6444
|
-
import { basename as basename10, dirname as dirname8, join as
|
|
6861
|
+
import { basename as basename10, dirname as dirname8, join as join23 } from "path";
|
|
6445
6862
|
function updateRetirementPaths(target, generation) {
|
|
6446
6863
|
if (!isCanonicalPath(target) || !isUuid(generation))
|
|
6447
6864
|
throw new Error("Invalid update retirement identity");
|
|
6448
6865
|
const prefix = `.${basename10(target)}.framework-retired-${generation}`;
|
|
6449
|
-
const container =
|
|
6866
|
+
const container = join23(dirname8(target), prefix);
|
|
6450
6867
|
return Object.freeze({
|
|
6451
6868
|
container,
|
|
6452
|
-
tree:
|
|
6453
|
-
healthReceipt:
|
|
6869
|
+
tree: join23(container, "tree"),
|
|
6870
|
+
healthReceipt: join23(container, "healthy.json"),
|
|
6454
6871
|
healthTemporaryPrefix: ".healthy-",
|
|
6455
|
-
claim:
|
|
6872
|
+
claim: join23(dirname8(target), `${prefix}.claim.json`),
|
|
6456
6873
|
claimTemporaryPrefix: `${prefix}.claim-`,
|
|
6457
|
-
cleanupMarker:
|
|
6874
|
+
cleanupMarker: join23(dirname8(target), `.${basename10(target)}.framework-update-cleanup.json`),
|
|
6458
6875
|
cleanupMarkerTemporaryPrefix: `.${basename10(target)}.framework-update-cleanup-`
|
|
6459
6876
|
});
|
|
6460
6877
|
}
|
|
@@ -6558,10 +6975,10 @@ async function assertNoUpdateRetentionPruneArtifactsWhileLocked(target) {
|
|
|
6558
6975
|
|
|
6559
6976
|
// ../../src/updates/retention/update-retirement.ts
|
|
6560
6977
|
import { lstat as lstat16, mkdir as mkdir8, readdir as readdir10, rmdir, unlink as unlink2, writeFile as writeFile7 } from "fs/promises";
|
|
6561
|
-
import { basename as basename13, dirname as dirname11, join as
|
|
6978
|
+
import { basename as basename13, dirname as dirname11, join as join26 } from "path";
|
|
6562
6979
|
async function reconcileRetirementCleanupMarkerWhileLocked(options) {
|
|
6563
6980
|
const { target, staging, currentVersion } = options;
|
|
6564
|
-
const markerPath =
|
|
6981
|
+
const markerPath = join26(dirname11(target), `.${basename13(target)}.framework-update-cleanup.json`);
|
|
6565
6982
|
const markerInfo = await pathInfo(markerPath);
|
|
6566
6983
|
if (!markerInfo)
|
|
6567
6984
|
return "none";
|
|
@@ -6602,7 +7019,7 @@ async function assertInstalledVersion(options) {
|
|
|
6602
7019
|
const info = await lstat17(options.target);
|
|
6603
7020
|
if (!info.isDirectory() || info.isSymbolicLink() || await realpath7(options.target) !== options.target)
|
|
6604
7021
|
throw new Error("Invalid update install target");
|
|
6605
|
-
const versionFile =
|
|
7022
|
+
const versionFile = join27(options.target, ...options.platform === "macos-arm64" ? ["Contents", "Resources"] : ["Resources"], "version.json");
|
|
6606
7023
|
const versionInfo = await lstat17(versionFile);
|
|
6607
7024
|
if (!versionInfo.isFile() || versionInfo.size > 1024 * 1024)
|
|
6608
7025
|
throw new Error("Installed update version mismatch");
|
|
@@ -6626,7 +7043,7 @@ async function stageUpdateSwap(options) {
|
|
|
6626
7043
|
});
|
|
6627
7044
|
const staging = updateStagingFor(plan.target);
|
|
6628
7045
|
const preparing = await mkdtemp8(`${staging}.preparing-`);
|
|
6629
|
-
const candidate =
|
|
7046
|
+
const candidate = join27(staging, "candidate");
|
|
6630
7047
|
let published = false;
|
|
6631
7048
|
try {
|
|
6632
7049
|
const extracted = await extractVerifiedUpdate({
|
|
@@ -6640,12 +7057,12 @@ async function stageUpdateSwap(options) {
|
|
|
6640
7057
|
maxExpandedBytes: options.maxExpandedBytes,
|
|
6641
7058
|
...options.sidecars === undefined ? {} : { sidecars: options.sidecars }
|
|
6642
7059
|
});
|
|
6643
|
-
renameExclusive(extracted.payload,
|
|
7060
|
+
renameExclusive(extracted.payload, join27(preparing, "candidate"));
|
|
6644
7061
|
await rm8(extracted.directory, { recursive: true, force: true });
|
|
6645
|
-
const candidateTreeIdentity = await readUpdateTreeIdentity(
|
|
7062
|
+
const candidateTreeIdentity = await readUpdateTreeIdentity(join27(preparing, "candidate"));
|
|
6646
7063
|
if (!candidateTreeIdentity)
|
|
6647
7064
|
throw new Error("Update candidate tree identity could not be read");
|
|
6648
|
-
const candidateTreeDigest = await readUpdateTreeDigest(
|
|
7065
|
+
const candidateTreeDigest = await readUpdateTreeDigest(join27(preparing, "candidate"));
|
|
6649
7066
|
await writeUpdateStageState(preparing, newUpdateStageState({
|
|
6650
7067
|
version: plan.version,
|
|
6651
7068
|
previousVersion: options.currentVersion,
|
|
@@ -6730,11 +7147,11 @@ function isolatedEnv(parent, profile, platform) {
|
|
|
6730
7147
|
RUNNER_ENVIRONMENT: "github-hosted",
|
|
6731
7148
|
HOME: profile,
|
|
6732
7149
|
USERPROFILE: profile,
|
|
6733
|
-
LOCALAPPDATA:
|
|
6734
|
-
XDG_DATA_HOME:
|
|
6735
|
-
TMP:
|
|
6736
|
-
TEMP:
|
|
6737
|
-
TMPDIR:
|
|
7150
|
+
LOCALAPPDATA: join28(profile, "LocalAppData"),
|
|
7151
|
+
XDG_DATA_HOME: join28(profile, ".local", "share"),
|
|
7152
|
+
TMP: join28(profile, "tmp"),
|
|
7153
|
+
TEMP: join28(profile, "tmp"),
|
|
7154
|
+
TMPDIR: join28(profile, "tmp"),
|
|
6738
7155
|
ELECTROBUN_INSTALLER_UI_AUTOCLOSE: "1"
|
|
6739
7156
|
});
|
|
6740
7157
|
if (platform === "windows-x64")
|
|
@@ -6829,15 +7246,15 @@ async function observeInstalledApp(options) {
|
|
|
6829
7246
|
await preflightInstallerRuntime({ env: parent, runtime: candidate.path, bootstrap });
|
|
6830
7247
|
stage("runtime-preflight-passed");
|
|
6831
7248
|
for (const path of [
|
|
6832
|
-
|
|
6833
|
-
|
|
6834
|
-
|
|
7249
|
+
join28(prepared.profile, "LocalAppData"),
|
|
7250
|
+
join28(prepared.profile, ".local", "share"),
|
|
7251
|
+
join28(prepared.profile, "tmp")
|
|
6835
7252
|
])
|
|
6836
7253
|
await mkdir9(path, { recursive: true, mode: 448 });
|
|
6837
7254
|
const mac = options.platform === "macos-arm64", windows = options.platform === "windows-x64";
|
|
6838
|
-
const installedRoot = mac ?
|
|
6839
|
-
const resources =
|
|
6840
|
-
const worker =
|
|
7255
|
+
const installedRoot = mac ? join28(prepared.incoming, `${options.appName}.app`, "Contents") : join28(prepared.profile, windows ? "LocalAppData" : ".local/share", options.appId, "stable", "app");
|
|
7256
|
+
const resources = join28(installedRoot, "Resources"), binary = join28(installedRoot, mac ? "MacOS" : "bin"), launcher = join28(binary, windows ? "launcher.exe" : "launcher"), runtime = join28(binary, windows ? "bun.exe" : "bun");
|
|
7257
|
+
const worker = join28(resources, "app", "bun", "index.js");
|
|
6841
7258
|
const sidecars = options.sidecars ?? [];
|
|
6842
7259
|
let foreignHits = 0;
|
|
6843
7260
|
const sentinel = policy ? Bun.serve({
|
|
@@ -6888,7 +7305,7 @@ async function observeInstalledApp(options) {
|
|
|
6888
7305
|
throw new Error("Foreign network sentinel unavailable");
|
|
6889
7306
|
foreignHits = 0;
|
|
6890
7307
|
const nonce = randomBytes2(24).toString("hex");
|
|
6891
|
-
const ack =
|
|
7308
|
+
const ack = join28(run.directory, "ack"), permit = join28(run.directory, "permit"), observation = join28(run.directory, "observation"), unexpected = join28(run.directory, "unexpected"), pidRecord = join28(run.directory, "worker-pid");
|
|
6892
7309
|
const env = {
|
|
6893
7310
|
...baseEnv,
|
|
6894
7311
|
FRAMEWORK_CI_NONCE: nonce,
|
|
@@ -6901,13 +7318,13 @@ async function observeInstalledApp(options) {
|
|
|
6901
7318
|
};
|
|
6902
7319
|
let launchRecord, expectedApp;
|
|
6903
7320
|
if (mac && viaInstaller) {
|
|
6904
|
-
const shimDir =
|
|
7321
|
+
const shimDir = join28(run.directory, "launch-shim");
|
|
6905
7322
|
await mkdir9(shimDir, { mode: 448 });
|
|
6906
|
-
const path =
|
|
7323
|
+
const path = join28(shimDir, "open");
|
|
6907
7324
|
await writeFile8(path, shim, { flag: "wx", mode: 448 });
|
|
6908
7325
|
await chmod2(path, 448);
|
|
6909
|
-
expectedApp =
|
|
6910
|
-
launchRecord =
|
|
7326
|
+
expectedApp = join28(await realpath8(prepared.incoming), `${options.appName}.app`);
|
|
7327
|
+
launchRecord = join28(run.directory, "launch-record");
|
|
6911
7328
|
Object.assign(env, {
|
|
6912
7329
|
PATH: shimDir + delimiter + (env.PATH ?? ""),
|
|
6913
7330
|
FRAMEWORK_CI_EXPECTED_APP: expectedApp,
|
|
@@ -6943,7 +7360,7 @@ async function observeInstalledApp(options) {
|
|
|
6943
7360
|
const error = installerErrorName(await Promise.race([installerStderr, Bun.sleep(2000).then(() => "")]));
|
|
6944
7361
|
throw new Error(`Installer exited unsuccessfully (exit=${installer.exitCode}, signal=${installer.signalCode ?? "none"}, ` + `ready=${await pathExists(worker) && await pathExists(launcher)}, acknowledged=${await pathExists(ack)}, ` + `error=${error ?? "none"})`);
|
|
6945
7362
|
}
|
|
6946
|
-
const ready = await pathExists(worker) && await pathExists(launcher) && await pathExists(
|
|
7363
|
+
const ready = await pathExists(worker) && await pathExists(launcher) && await pathExists(join28(resources, "version.json"));
|
|
6947
7364
|
if (installer && shouldLaunchInstalledApp({
|
|
6948
7365
|
platform: options.platform,
|
|
6949
7366
|
ready,
|
|
@@ -7119,7 +7536,7 @@ async function observeInstalledApp(options) {
|
|
|
7119
7536
|
await swapAfterExit(target, staged.staging);
|
|
7120
7537
|
stage("update-swapped");
|
|
7121
7538
|
await preflightInstallerRuntime({ env: parent, runtime, bootstrap });
|
|
7122
|
-
const directory =
|
|
7539
|
+
const directory = join28(prepared.directory, "update");
|
|
7123
7540
|
await mkdir9(directory, { mode: 448 });
|
|
7124
7541
|
const updated = await observeRun({
|
|
7125
7542
|
directory,
|
|
@@ -7168,7 +7585,7 @@ async function qualifyInstallerCommand(options) {
|
|
|
7168
7585
|
const parsed = parseReleaseConfig(config), requirements = parsed.requirements(tag), policy = requirements.offlinePolicy, names = requirements.platforms[platform];
|
|
7169
7586
|
if (!policy || !names || names.length !== 2)
|
|
7170
7587
|
throw new Error("Installer qualification requires an explicit offline policy and payloads");
|
|
7171
|
-
const directory = resolve13(options.directory), destination =
|
|
7588
|
+
const directory = resolve13(options.directory), destination = join29(directory, `installer-test-${platform}.json`);
|
|
7172
7589
|
try {
|
|
7173
7590
|
await lstat18(destination);
|
|
7174
7591
|
throw new Error("Installer receipt already exists");
|
|
@@ -7184,8 +7601,8 @@ async function qualifyInstallerCommand(options) {
|
|
|
7184
7601
|
appName: app.appName,
|
|
7185
7602
|
appId: app.appId,
|
|
7186
7603
|
version: plan.version,
|
|
7187
|
-
installer:
|
|
7188
|
-
archive:
|
|
7604
|
+
installer: join29(directory, names[0]),
|
|
7605
|
+
archive: join29(directory, names[1]),
|
|
7189
7606
|
expectedReads: parsed.expectedReads,
|
|
7190
7607
|
offlinePolicy: policy,
|
|
7191
7608
|
sidecars: parsed.sidecars
|
|
@@ -7217,7 +7634,7 @@ async function qualifyInstallerCommand(options) {
|
|
|
7217
7634
|
|
|
7218
7635
|
// ../../src/installer/installer-upgrade-command.ts
|
|
7219
7636
|
import { lstat as lstat19, mkdir as mkdir10, rename as rename2, writeFile as writeFile10 } from "fs/promises";
|
|
7220
|
-
import { join as
|
|
7637
|
+
import { join as join31, resolve as resolve15 } from "path";
|
|
7221
7638
|
|
|
7222
7639
|
// ../../src/installer/upgrade-asset-download.ts
|
|
7223
7640
|
import { createHash as createHash14 } from "crypto";
|
|
@@ -7353,7 +7770,7 @@ async function discoverSignedRelease(options) {
|
|
|
7353
7770
|
|
|
7354
7771
|
// ../../src/updates/install/update-download.ts
|
|
7355
7772
|
import { mkdtemp as mkdtemp9, open as open11, realpath as realpath9, rm as rm9 } from "fs/promises";
|
|
7356
|
-
import { basename as basename14, dirname as dirname13, join as
|
|
7773
|
+
import { basename as basename14, dirname as dirname13, join as join30, resolve as resolve14 } from "path";
|
|
7357
7774
|
async function downloadVerifiedRelease(options) {
|
|
7358
7775
|
const { descriptor, maxBytes } = options;
|
|
7359
7776
|
const timeout = options.timeoutMs ?? 120000;
|
|
@@ -7386,12 +7803,12 @@ async function downloadVerifiedRelease(options) {
|
|
|
7386
7803
|
throw new Error("Release download size mismatch");
|
|
7387
7804
|
}
|
|
7388
7805
|
const root = options.createTemporaryDirectory ? await realpath9(resolve14(options.directory)) : resolve14(options.directory);
|
|
7389
|
-
const allocated = options.createTemporaryDirectory ? await options.createTemporaryDirectory(root) : await mkdtemp9(
|
|
7806
|
+
const allocated = options.createTemporaryDirectory ? await options.createTemporaryDirectory(root) : await mkdtemp9(join30(root, "framework-update-"));
|
|
7390
7807
|
const temporaryDirectory = resolve14(allocated);
|
|
7391
7808
|
if (dirname13(temporaryDirectory) !== root || !basename14(temporaryDirectory).startsWith("framework-update-"))
|
|
7392
7809
|
throw new Error("Invalid update download directory");
|
|
7393
7810
|
temporary = temporaryDirectory;
|
|
7394
|
-
const path =
|
|
7811
|
+
const path = join30(temporary, "archive");
|
|
7395
7812
|
const file = await open11(path, "wx", 384);
|
|
7396
7813
|
try {
|
|
7397
7814
|
async function* writeChunks() {
|
|
@@ -7494,7 +7911,7 @@ async function qualifyUpgradeCommand(options) {
|
|
|
7494
7911
|
const parsed = parseReleaseConfig(config), feed = feedUrl(parsed.feed), requirements = parsed.requirements(tag), names = requirements.platforms[platform];
|
|
7495
7912
|
if (!requirements.offlinePolicy || !names || names.length !== 2)
|
|
7496
7913
|
throw new Error("Upgrade qualification requires an explicit offline policy and payloads");
|
|
7497
|
-
const directory = resolve15(options.directory), destination =
|
|
7914
|
+
const directory = resolve15(options.directory), destination = join31(directory, `upgrade-test-${platform}.json`);
|
|
7498
7915
|
try {
|
|
7499
7916
|
await lstat19(destination);
|
|
7500
7917
|
throw new Error("Upgrade receipt already exists");
|
|
@@ -7517,7 +7934,7 @@ async function qualifyUpgradeCommand(options) {
|
|
|
7517
7934
|
const channel = "daily";
|
|
7518
7935
|
const trust = { ...base, channel };
|
|
7519
7936
|
const discovery = discoveryName(config, channel, platform);
|
|
7520
|
-
const signed = await readJsonFile(
|
|
7937
|
+
const signed = await readJsonFile(join31(directory, discovery), 65536, "staged descriptor");
|
|
7521
7938
|
const verified = verifyReleaseDescriptor(signed, trust);
|
|
7522
7939
|
if (!verified.ok || verified.descriptor.tag !== tag || verified.descriptor.asset.name !== names[1])
|
|
7523
7940
|
throw new Error("Untrusted staged descriptor");
|
|
@@ -7540,7 +7957,7 @@ async function qualifyUpgradeCommand(options) {
|
|
|
7540
7957
|
return null;
|
|
7541
7958
|
if (previous.tag === tag || !versionLessThan(previous.version, descriptor.version))
|
|
7542
7959
|
throw new Error("Previous release is not older than this release");
|
|
7543
|
-
const work =
|
|
7960
|
+
const work = join31(directory, `upgrade-${platform}`);
|
|
7544
7961
|
await mkdir10(work, { mode: 448 });
|
|
7545
7962
|
const downloaded = await downloadVerifiedRelease({
|
|
7546
7963
|
descriptor: previous,
|
|
@@ -7549,12 +7966,12 @@ async function qualifyUpgradeCommand(options) {
|
|
|
7549
7966
|
timeoutMs: 600000,
|
|
7550
7967
|
fetch: fetcher
|
|
7551
7968
|
});
|
|
7552
|
-
const previousArchive =
|
|
7969
|
+
const previousArchive = join31(work, previous.asset.name);
|
|
7553
7970
|
await rename2(downloaded.path, previousArchive);
|
|
7554
7971
|
const installerName = parsed.requirements(previous.tag).platforms[platform]?.[0];
|
|
7555
7972
|
if (!installerName)
|
|
7556
7973
|
throw new Error("Previous release has no installer for this platform");
|
|
7557
|
-
const previousInstaller =
|
|
7974
|
+
const previousInstaller = join31(work, installerName);
|
|
7558
7975
|
await downloadAsset({
|
|
7559
7976
|
feed,
|
|
7560
7977
|
tag: previous.tag,
|
|
@@ -7578,7 +7995,7 @@ async function qualifyUpgradeCommand(options) {
|
|
|
7578
7995
|
update: {
|
|
7579
7996
|
descriptor,
|
|
7580
7997
|
trust,
|
|
7581
|
-
archive:
|
|
7998
|
+
archive: join31(directory, names[1]),
|
|
7582
7999
|
maxCompressedBytes: MAX_COMPRESSED_BYTES2,
|
|
7583
8000
|
maxExpandedBytes: MAX_EXPANDED_BYTES2
|
|
7584
8001
|
}
|
|
@@ -7633,7 +8050,7 @@ function electrobunArtifacts(appName, platform) {
|
|
|
7633
8050
|
}
|
|
7634
8051
|
|
|
7635
8052
|
// src/library/steps.ts
|
|
7636
|
-
var selectRetainedStepEffect = (context) =>
|
|
8053
|
+
var selectRetainedStepEffect = (context) => Effect24.gen(function* () {
|
|
7637
8054
|
const output = context.env.GITHUB_OUTPUT;
|
|
7638
8055
|
if (!output)
|
|
7639
8056
|
return yield* fail("Expected GITHUB_OUTPUT");
|
|
@@ -7645,7 +8062,7 @@ runId=${result.runId}
|
|
|
7645
8062
|
` : `reuse=false
|
|
7646
8063
|
`));
|
|
7647
8064
|
});
|
|
7648
|
-
var stageBuildStepEffect = (context, directory, artifacts = "artifacts") =>
|
|
8065
|
+
var stageBuildStepEffect = (context, directory, artifacts = "artifacts") => Effect24.gen(function* () {
|
|
7649
8066
|
const fs = yield* ReleaseFs;
|
|
7650
8067
|
const [installerAsset, archiveAsset] = platformAssets(context);
|
|
7651
8068
|
const [installer, archive] = electrobunArtifacts(context.config.appName, context.platform);
|
|
@@ -7654,12 +8071,12 @@ var stageBuildStepEffect = (context, directory, artifacts = "artifacts") => Effe
|
|
|
7654
8071
|
yield* step(() => fs.mkdir(directory, { recursive: true }));
|
|
7655
8072
|
const packed = yield* scopedTempDirectory("framework-command-pack-");
|
|
7656
8073
|
const sources = {
|
|
7657
|
-
[installerAsset]:
|
|
7658
|
-
[archiveAsset]:
|
|
8074
|
+
[installerAsset]: join32(artifacts, installer),
|
|
8075
|
+
[archiveAsset]: join32(artifacts, archive)
|
|
7659
8076
|
};
|
|
7660
8077
|
for (const policy of parsed.commandArtifacts) {
|
|
7661
8078
|
const name = requirements.commandArtifacts[policy.kind][context.platform];
|
|
7662
|
-
sources[name] =
|
|
8079
|
+
sources[name] = join32(packed, name);
|
|
7663
8080
|
yield* step(() => packCommandArtifact({
|
|
7664
8081
|
source: policy.build,
|
|
7665
8082
|
archive: sources[name],
|
|
@@ -7668,8 +8085,8 @@ var stageBuildStepEffect = (context, directory, artifacts = "artifacts") => Effe
|
|
|
7668
8085
|
}));
|
|
7669
8086
|
}
|
|
7670
8087
|
return yield* stagePlatformArtifactsEffect({ ...context, directory, sources });
|
|
7671
|
-
}).pipe(
|
|
7672
|
-
var inspectStagedStepEffect = (context, directory) =>
|
|
8088
|
+
}).pipe(Effect24.scoped);
|
|
8089
|
+
var inspectStagedStepEffect = (context, directory) => Effect24.gen(function* () {
|
|
7673
8090
|
const fs = yield* ReleaseFs;
|
|
7674
8091
|
const parsed = parseReleaseConfig(context.config);
|
|
7675
8092
|
const requirements = parsed.requirements(context.tag);
|
|
@@ -7677,10 +8094,10 @@ var inspectStagedStepEffect = (context, directory) => Effect22.gen(function* ()
|
|
|
7677
8094
|
const entries = yield* step(() => fs.readdir(directory, { withFileTypes: true }));
|
|
7678
8095
|
if (entries.length !== assets.length || entries.some((entry) => !entry.isFile() || !assets.includes(entry.name)))
|
|
7679
8096
|
return yield* fail("Staged platform directory contains unexpected files");
|
|
7680
|
-
const [installer, archive] = platformAssets(context).map((name) =>
|
|
8097
|
+
const [installer, archive] = platformAssets(context).map((name) => join32(directory, name));
|
|
7681
8098
|
for (const policy of parsed.commandArtifacts)
|
|
7682
8099
|
yield* step(() => readCommandArtifact({
|
|
7683
|
-
archive:
|
|
8100
|
+
archive: join32(directory, requirements.commandArtifacts[policy.kind][context.platform]),
|
|
7684
8101
|
executable: policy.executable,
|
|
7685
8102
|
platform: context.platform
|
|
7686
8103
|
}));
|
|
@@ -7696,12 +8113,12 @@ var inspectStagedStepEffect = (context, directory) => Effect22.gen(function* ()
|
|
|
7696
8113
|
}))
|
|
7697
8114
|
};
|
|
7698
8115
|
});
|
|
7699
|
-
var qualifyStepEffect = (context, directory) =>
|
|
8116
|
+
var qualifyStepEffect = (context, directory) => Effect24.gen(function* () {
|
|
7700
8117
|
const mode = stepRenderer(context.env);
|
|
7701
8118
|
yield* step(() => qualifyCommandArtifactsCommand({ ...context, directory }));
|
|
7702
8119
|
yield* step(() => qualifyInstallerCommand({ ...context, renderer: mode, directory }));
|
|
7703
8120
|
});
|
|
7704
|
-
var qualifyUpgradeStepEffect = (context, directory, onStage) =>
|
|
8121
|
+
var qualifyUpgradeStepEffect = (context, directory, onStage) => Effect24.suspend(() => {
|
|
7705
8122
|
const renderer = stepRenderer(context.env);
|
|
7706
8123
|
return step(() => qualifyUpgradeCommand({ ...context, renderer, directory, ...onStage ? { onStage } : {} }));
|
|
7707
8124
|
});
|
|
@@ -7712,12 +8129,15 @@ var inspectStagedStep = (context, directory) => run2(context, inspectStagedStepE
|
|
|
7712
8129
|
var qualifyStep = (context, directory) => run2(context, qualifyStepEffect(context, directory));
|
|
7713
8130
|
var qualifyUpgradeStep = (context, directory, onStage) => run2(context, qualifyUpgradeStepEffect(context, directory, onStage));
|
|
7714
8131
|
export {
|
|
8132
|
+
createDailyNativeReceipt,
|
|
7715
8133
|
createGitHubPromotionProvider,
|
|
7716
8134
|
createGitHubReleasePublisher,
|
|
7717
8135
|
createMacosDmg,
|
|
8136
|
+
desktopDailyProfile,
|
|
7718
8137
|
fileIdentity2 as fileIdentity,
|
|
7719
8138
|
finalizeReleasePleaseDraft,
|
|
7720
8139
|
inspectStagedStep,
|
|
8140
|
+
planDailyReleaseMatrix,
|
|
7721
8141
|
planQualificationRun2 as planQualificationRun,
|
|
7722
8142
|
planReleaseAssets2 as planReleaseAssets,
|
|
7723
8143
|
publishFrameworkPackage,
|
|
@@ -7734,6 +8154,7 @@ export {
|
|
|
7734
8154
|
stageBuildStep,
|
|
7735
8155
|
stagePlatformArtifacts,
|
|
7736
8156
|
stageReleaseDescriptors,
|
|
8157
|
+
verifyDailyReleaseMatrix,
|
|
7737
8158
|
verifyImage,
|
|
7738
8159
|
writeDescriptors
|
|
7739
8160
|
};
|