Diagnose a failed release and roll back
Diagnose symptoms before changing production
A healthy home page does not prove a healthy release. Check direct deep links, asset status and MIME type, API authorization, error boundaries, latency and error rates. Compare an affected release identifier, browser request trace and server or CDN logs. A missing old chunk can occur when a user keeps a tab open during deployment. Keep prior content-addressed assets available for a documented grace period; do not purge them blindly. A chunk served as HTML suggests an incorrect fallback. Distinguish application exceptions from network, cache, proxy or deployment failures. Telemetry should include release identifiers and bounded error categories, never session tokens or private payloads. Define incident owner, thresholds and recovery criteria before release.
// Synthetic observations from the same release; not a network client.export function smokeIssues(observations, releaseId) { const expected = {home:[200,'text/html'],deepLink:[200,'text/html'],chunk:[200,'text/javascript'],missingChunk:[404,null]}; const issues = []; for (const [name,[status,mime]] of Object.entries(expected)) { const o = observations[name]; if (!o || o.status !== status || (mime && o.mime !== mime) || o.releaseId !== releaseId) issues.push(name); } return issues;}The fixture normalizes the MIME essence to text/javascript for its JavaScript responses; actual accepted JS MIME types and parameter parsing belong in the real smoke harness. Release identity is provided by the test fixture, not inferred from a status code. Smoke checks do not prove accessibility or security.
Rollback is a compatibility decision
Rollback means promoting a known previous artifact, not rebuilding an old commit. Check API/schema compatibility, configuration, cached assets and any data migrations. An irreversible database change may make a frontend rollback unsafe. Stop rollout, coordinate with the service owner, select a verified compatible artifact, check its trusted digest and approvals, promote atomically if supported, then repeat acceptance checks and monitor. If no compatible release exists, stop and choose a reviewed forward fix or coordinated recovery. Do not silently restore stale data.
// Select a known compatible previous artifact, never rebuild it here.export function rollbackCandidate(history, currentId, apiVersion) { return [...history].reverse().find(r => r.id !== currentId && r.verified === true && r.apiVersions.includes(apiVersion) && /^[a-f0-9]{64}$/.test(r.digest)) ?? null;}import {smokeIssues} from './smoke.mjs';import {rollbackCandidate} from './rollback.mjs';const observed = {home:{status:200,mime:'text/html',releaseId:'r2'},deepLink:{status:200,mime:'text/html',releaseId:'r2'},chunk:{status:200,mime:'text/html',releaseId:'r2'},missingChunk:{status:404,releaseId:'r2'}};console.log(smokeIssues(observed,'r2')); // ['chunk']const history = [{id:'r1',verified:true,apiVersions:['v1'],digest:'a'.repeat(64)},{id:'r2',verified:false,apiVersions:['v2'],digest:'b'.repeat(64)}];console.log(rollbackCandidate(history,'r2','v2')); // null: do not blindly roll backThe chunk is flagged because the returned MIME is HTML. No compatible rollback candidate exists for API v2. The helper assumes history is ordered oldest to newest and that the verified flag reflects external evidence. It does not execute deployment, validate migrations or guarantee availability. Practice: add a verified previous release compatible with v2 and explain what checks still need to run. The lab includes a rollback checklist and offline fixture tests; actual live operations require explicit authorization.