{"record":{"id":"69cc2eb3ba189761","repo":"amruthpillai/reactive-resume","slug":"stylesheet-parity-failed","errorCode":"STYLESHEET_PARITY_FAILED","errorMessage":"The converted stylesheet does not preserve the legacy PDF presentation.","messagePattern":"The converted stylesheet does not preserve the legacy PDF presentation\\.","errorType":"exception","errorClass":"ORPCError","httpStatus":400,"severity":"error","filePath":"packages/api/src/features/resume/stylesheet-service.ts","lineNumber":272,"sourceCode":"\t\t\t\t\t\tif (preflight.ok) next = { ...next, applied: input.source };\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t\tif (input.transition === \"activate\") {\n\t\t\t\t\tconst compiled = compile(snapshot, input.source);\n\t\t\t\t\tdiagnostics = [...compiled.diagnostics];\n\t\t\t\t\tif (!compiled.program) {\n\t\t\t\t\t\tthrow validationError(\"The stylesheet cannot be activated because it is invalid.\", compiled.diagnostics);\n\t\t\t\t\t}\n\n\t\t\t\t\tconst parity = await dependencies.parity({\n\t\t\t\t\t\tdata: snapshot.data,\n\t\t\t\t\t\tstylesheet: input.source,\n\t\t\t\t\t\tresumeId: snapshot.id,\n\t\t\t\t\t\trevision: snapshot.stylesheetRevision,\n\t\t\t\t\t});\n\t\t\t\t\tif (parity.mismatches.length > 0) {\n\t\t\t\t\t\tthrow new ORPCError(\"STYLESHEET_PARITY_FAILED\", {\n\t\t\t\t\t\t\tstatus: 400,\n\t\t\t\t\t\t\tmessage: \"The converted stylesheet does not preserve the legacy PDF presentation.\",\n\t\t\t\t\t\t\tdata: { mismatches: parity.mismatches },\n\t\t\t\t\t\t});\n\t\t\t\t\t}\n\n\t\t\t\t\tconst preflight = await runPreflight(snapshot, input.source);\n\t\t\t\t\tdidPreflight = true;\n\t\t\t\t\tactivationPageCount = preflight.ok ? preflight.pageCount : null;\n\t\t\t\t\tif (!preflight.ok) {\n\t\t\t\t\t\tdiagnostics = [...compiled.diagnostics, ...preflight.diagnostics, preflightDiagnostic(preflight)];\n\t\t\t\t\t\tthrow validationError(\"The stylesheet failed PDF preflight.\", diagnostics);\n\t\t\t\t\t}\n\n\t\t\t\t\tdiagnostics = [...compiled.diagnostics, ...preflight.diagnostics];\n\t\t\t\t\tnext = { mode: \"semantic\", source: input.source, applied: input.source };\n\t\t\t\t}\n","sourceCodeStart":254,"sourceCodeEnd":290,"githubUrl":"https://github.com/amruthpillai/reactive-resume/blob/3a5b12e2a40374a9571988701fcb75c5a1831c42/packages/api/src/features/resume/stylesheet-service.ts#L254-L290","documentation":"During the 'activate' transition, after the stylesheet compiles successfully, the service runs dependencies.parity() to compare the candidate semantic stylesheet's PDF output against the legacy rendering for the given resume data. If any mismatches are found it throws STYLESHEET_PARITY_FAILED with the mismatch list in error.data. This prevents activating a stylesheet that visibly changes the resume.","triggerScenarios":"Activating a semantic CSS stylesheet whose compiled output diverges from the legacy PDF — different layout, colors, fonts, or page breaks — for the given resume data.","commonSituations":"A hand-written or AI-generated stylesheet that is close but not pixel-equivalent, a parity-checker version bump tightening tolerances, or resume data using features the conversion doesn't fully cover.","solutions":["Inspect error.data.mismatches to see which elements differ.","Adjust the stylesheet source to resolve each mismatch, then re-run activate.","Iterate faster by running checkLegacyStylesheetParity locally before submitting activate.","Acceptable mismatches are a product decision — there is no code-level bypass."],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":"import { checkLegacyStylesheetParity } from '...';\nasync function preflightParity(data, source) {\n  const { mismatches } = await checkLegacyStylesheetParity({ data, stylesheet: source, resumeId, revision });\n  if (mismatches.length) console.warn('Parity mismatches:', mismatches);\n}","typeGuard":null,"tryCatchPattern":"try {\n  await stylesheetService.activate(input);\n} catch (e) {\n  if (e.code === 'STYLESHEET_PARITY_FAILED') {\n    // e.data.mismatches lists the diverging elements; revise source and retry\n  } else throw e;\n}","preventionTips":["Run checkLegacyStylesheetParity locally before submitting activate.","Iterate on the stylesheet source until mismatches is empty.","Treat parity as a hard gate — there is no skip flag."],"tags":["resume","stylesheet","semantic-css","validation"],"backgroundTag":null,"analyzedSha":"3a5b12e2a40374a9571988701fcb75c5a1831c42","analyzedAt":"2026-08-12T22:31:22.666Z","schemaVersion":2},"datasetVersion":"2026-08-12T23:17:12.415Z"}