Harden canonical route sweep rechecks

This commit is contained in:
master
2026-03-11 18:44:38 +02:00
parent f0b2ef3319
commit 6afd8f951e
3 changed files with 108 additions and 4 deletions

View File

@@ -371,6 +371,15 @@ async function inspectRoute(context, routePath) {
return record;
}
async function inspectRouteInFreshContext(browser, authReport, routePath) {
const context = await createAuthenticatedContext(browser, authReport, { statePath: STATE_PATH });
try {
return await inspectRoute(context, routePath);
} finally {
await context.close();
}
}
async function main() {
mkdirSync(outputDirectory, { recursive: true });
@@ -389,9 +398,31 @@ async function main() {
const routes = [];
for (const routePath of canonicalRoutes) {
const record = await inspectRoute(context, routePath);
const firstAttempt = await inspectRoute(context, routePath);
let record = firstAttempt;
if (!firstAttempt.passed) {
const retryAttempt = await inspectRouteInFreshContext(browser, authReport, routePath);
record = {
...retryAttempt,
retryUsed: true,
retryPassed: retryAttempt.passed,
initialFailure: {
consoleErrors: firstAttempt.consoleErrors,
requestFailures: firstAttempt.requestFailures,
responseErrors: firstAttempt.responseErrors,
problemTexts: firstAttempt.problemTexts,
expectationFailures: firstAttempt.expectationFailures,
},
};
}
routes.push(record);
const status = record.passed ? 'PASS' : 'FAIL';
const status = record.passed
? record.retryUsed
? 'PASS-RECHECK'
: 'PASS'
: 'FAIL';
process.stdout.write(`[live-frontdoor-canonical-route-sweep] ${status} ${routePath} -> ${record.finalUrl}\n`);
}