feat(P0-A): 整合第一版并冻结最终发布 #1

Open
tuyixuan wants to merge 115 commits from codex/wp7-07 into codex/wp0-09
Showing only changes of commit a22b1f19e9 - Show all commits
+20 -6
View File
@@ -208,7 +208,7 @@ async function waitForHealth(child) {
throw new Error("Packaged API did not become healthy on fixed port 43121.", { cause: lastError });
}
async function verifyExtractedPackage(zipPath, packageName, expectedSupport) {
export async function verifyExtractedPackage(zipPath, packageName, expectedSupport) {
const extractRoot = mkdtempSync(join(tmpdir(), "dada-wp0-09-"));
try {
const escapedZip = zipPath.replaceAll("'", "''");
@@ -235,22 +235,36 @@ async function verifyExtractedPackage(zipPath, packageName, expectedSupport) {
});
try {
const health = await waitForHealth(api);
const brands = [
{ brand: "Not_A Brand", version: "99" },
{ brand: "Chromium", version: String(expectedSupport.major) },
{ brand: expectedSupport.brand, version: String(expectedSupport.major) },
];
const fullVersionList = [
{ brand: "Not_A Brand", version: "99.0.0.0" },
{ brand: "Chromium", version: expectedSupport.fullVersion },
{ brand: expectedSupport.brand, version: expectedSupport.fullVersion },
];
const serializeBrands = (values) => values.map(({ brand, version }) => `"${brand}";v="${version}"`).join(", ");
const releaseGate = await fetch(`http://127.0.0.1:${fixedPort}/api/v1/support/check`, {
body: JSON.stringify({
brands: [{ brand: expectedSupport.brand, version: String(expectedSupport.major) }],
full_version_list: [{ brand: expectedSupport.brand, version: expectedSupport.fullVersion }],
brands,
full_version_list: fullVersionList,
platform: "Windows",
}),
headers: {
"content-type": "application/json",
"sec-ch-ua": `"${expectedSupport.brand}";v="${expectedSupport.major}"`,
"sec-ch-ua-full-version-list": `"${expectedSupport.brand}";v="${expectedSupport.fullVersion}"`,
host: `127.0.0.1:${fixedPort}`,
origin: `http://127.0.0.1:${fixedPort}`,
"sec-ch-ua": serializeBrands(brands),
"sec-ch-ua-full-version-list": serializeBrands(fullVersionList),
"sec-ch-ua-platform": '"Windows"',
},
method: "POST",
});
if (releaseGate.status !== expectedSupport.statusCode) {
throw new Error(`Packaged RELEASE.json support gate returned ${releaseGate.status}; expected ${expectedSupport.statusCode}.`);
const responseBody = await releaseGate.text();
throw new Error(`Packaged RELEASE.json support gate returned ${releaseGate.status}; expected ${expectedSupport.statusCode}: ${responseBody}`);
}
return {
api: { executable: "runtime/node.exe", health, pid: api.pid, release_gate: { status_code: releaseGate.status }, status: "passed" },