- build:release reads the immutable root projection from the root Release assets (MARQDO_DATA_RELEASE) or the production origin, verifies it against MARQDO_DATA_ROOT_SHA, and deploys the same pointer/snapshot under /data/; - production pipeline runs prepare-example + build:release; the manual trigger supplies the accepted root commit and release base, failing closed without them; - verify-dist enforces /data consistency in release builds and absence in safe builds; verify-deploy probes the pointer, snapshot, both product offers and the MQDH download entry; - pin the site example and evidence to the accepted CLI v3.0.0-rc.7 and document the MQDH beta install path in the quick start; - drop the temporary screenshot helper and keep only durable baseline facts in docs/BASELINE.md; progress lives in the repository issues.
88 lines
4.2 KiB
JavaScript
88 lines
4.2 KiB
JavaScript
import assert from 'node:assert/strict';
|
|
import { readFileSync } from 'node:fs';
|
|
|
|
// Verifies a production deployment produced by
|
|
// `edgeone makers deploy --json`. The deployment URL carries a one-time
|
|
// `eo_token`/`eo_time` pair: the first request answers 302 and sets cookies,
|
|
// later requests use the cookie. Every probe therefore performs its own
|
|
// handshake, and the token query is kept for the 404 probe.
|
|
|
|
const file = process.argv[2] ?? 'deploy-result.json';
|
|
const lines = readFileSync(file, 'utf8').trim().split('\n').filter(line => line.startsWith('{'));
|
|
assert.ok(lines.length > 0, `${file}: no JSON deployment result`);
|
|
const result = JSON.parse(lines[lines.length - 1]);
|
|
|
|
assert.equal(result.status, 'success', `Deployment did not succeed: ${JSON.stringify(result)}`);
|
|
assert.ok(result.deploymentId, 'Deployment result is missing deploymentId');
|
|
assert.ok(result.projectId, 'Deployment result is missing projectId');
|
|
assert.match(result.url ?? '', /^https:\/\//, 'Deployment result is missing an https url');
|
|
|
|
const timeout = 30_000;
|
|
|
|
function probeURL(pathname) {
|
|
const url = new URL(result.url);
|
|
url.pathname = pathname;
|
|
return url;
|
|
}
|
|
|
|
async function probe(pathname) {
|
|
const entry = probeURL(pathname);
|
|
let response = await fetch(entry, { redirect: 'manual', signal: AbortSignal.timeout(timeout) });
|
|
if (response.status >= 300 && response.status < 400) {
|
|
const location = response.headers.get('location');
|
|
assert.ok(location, `${pathname}: redirect without location`);
|
|
const cookie = response.headers.getSetCookie().map(value => value.split(';')[0]).join('; ');
|
|
assert.ok(cookie, `${pathname}: access token redirect without cookie`);
|
|
response = await fetch(new URL(location, entry), {
|
|
redirect: 'manual',
|
|
headers: { cookie },
|
|
signal: AbortSignal.timeout(timeout),
|
|
});
|
|
}
|
|
return { status: response.status, body: await response.text() };
|
|
}
|
|
|
|
const home = await probe('/');
|
|
assert.equal(home.status, 200, `Home returned HTTP ${home.status}`);
|
|
for (const marker of ['Marqdo', '\u00a9 2026 CFLMY', '\u8c6bICP\u59072025120352\u53f7-6']) {
|
|
assert.ok(home.body.includes(marker), `Home is missing marker: ${marker}`);
|
|
}
|
|
|
|
const english = await probe('/en/');
|
|
assert.equal(english.status, 200, `English home returned HTTP ${english.status}`);
|
|
assert.ok(english.body.includes('Marqdo'), 'English home is missing the site title');
|
|
|
|
const missing = await probe('/__verify_absent__');
|
|
assert.equal(missing.status, 404, `Absent path returned HTTP ${missing.status}`);
|
|
|
|
// Production deployments must serve the exact root projection and a download
|
|
// center derived from it; a site without /data is a safe build, not production.
|
|
const pointerResponse = await probe('/data/current.json');
|
|
assert.equal(pointerResponse.status, 200, `Release pointer returned HTTP ${pointerResponse.status}`);
|
|
const pointer = JSON.parse(pointerResponse.body);
|
|
assert.equal(pointer.schema_version, 1, 'Invalid release pointer schema');
|
|
assert.match(pointer.snapshot, /^\/data\/snapshots\/[a-f0-9]{64}\.json$/, 'Invalid release pointer snapshot');
|
|
const snapshotResponse = await probe(pointer.snapshot);
|
|
assert.equal(snapshotResponse.status, 200, `Release snapshot returned HTTP ${snapshotResponse.status}`);
|
|
const snapshot = JSON.parse(snapshotResponse.body);
|
|
assert.ok(Array.isArray(snapshot.offers) && snapshot.offers.some(offer => offer.product === 'mqdh'),
|
|
'Release snapshot has no MQDH offer');
|
|
assert.ok(Array.isArray(snapshot.offers) && snapshot.offers.some(offer => offer.product === 'marqdo'),
|
|
'Release snapshot has no Marqdo offer');
|
|
const download = await probe('/download/');
|
|
assert.equal(download.status, 200, `Download center returned HTTP ${download.status}`);
|
|
for (const marker of ['MQDH', '0.1.0-beta.1', 'marqdo-harness-0.1.0-beta.1']) {
|
|
assert.ok(download.body.includes(marker), `Download center is missing: ${marker}`);
|
|
}
|
|
|
|
console.log(JSON.stringify({
|
|
status: 'verified',
|
|
projectId: result.projectId,
|
|
deploymentId: result.deploymentId,
|
|
url: result.url,
|
|
revision: pointer.revision,
|
|
snapshot_sha256: pointer.sha256,
|
|
offers: snapshot.offers.map(offer => offer.offer_id),
|
|
checked: ['home', 'english-home', 'not-found', 'release-pointer', 'release-snapshot', 'download-center'],
|
|
}));
|