{"record":{"id":"12843bf20d3ae5e8","repo":"santifer/career-ops","slug":"message-proceeding-allow-reorder-set","errorCode":null,"errorMessage":"⚠️  ${message} (proceeding — --allow-reorder set)","messagePattern":"⚠️  (.+?) \\(proceeding — --allow-reorder set\\)","errorType":"console","errorClass":null,"httpStatus":null,"severity":"warning","filePath":"generate-pdf.mjs","lineNumber":323,"sourceCode":"  const source = extractSourceSectionOrder(cvMarkdown);\n  if (rendered.length < 2 || source.length < 2) return;\n\n  const sourcePositions = new Map(source.map((section, index) => [section.key, index]));\n  const renderedComparable = rendered.filter(section => sourcePositions.has(section.key));\n  if (renderedComparable.length < 2) return;\n\n  for (let i = 1; i < renderedComparable.length; i++) {\n    const previous = renderedComparable[i - 1];\n    const current = renderedComparable[i];\n    if (sourcePositions.get(current.key) < sourcePositions.get(previous.key)) {\n      const renderedOrder = renderedComparable.map(section => section.title).join(' -> ');\n      const sourceOrder = source\n        .filter(section => renderedComparable.some(renderedSection => renderedSection.key === section.key))\n        .map(section => section.title)\n        .join(' -> ');\n      const message = `CV section order diverges from cv.md: rendered ${renderedOrder}; cv.md ${sourceOrder}`;\n      if (allowReorder) {\n        console.warn(`⚠️  ${message} (proceeding — --allow-reorder set)`);\n        return;\n      }\n      throw new Error(message);\n    }\n  }\n}\n\n/**\n * Every canonical section key the alias table can produce, in template order.\n * Derived from the table rather than restated so the two cannot drift.\n */\nexport const CV_SECTION_KEYS = [...new Set(SECTION_ALIASES.values())];\n\n// The all-caps comments the templates use to delimit sections, matched exactly\n// as cv-sections-core.mjs matches them when stripping empty sections.\nconst SECTION_MARKER_RE = /<!--\\s+[A-Z][A-Z ]*-->/g;\nconst SECTION_TITLE_RE = /class=[\"'][^\"']*\\bsection-title\\b[^\"']*[\"'][^>]*>([\\s\\S]*?)<\\/[^>]+>/gi;\n","sourceCodeStart":305,"sourceCodeEnd":341,"githubUrl":"https://github.com/santifer/career-ops/blob/60398d6549a46f5266929538af21cfab94badc75/generate-pdf.mjs#L305-L341","documentation":"Order-consistency guard in generate-pdf.mjs's PDF pipeline: after rendering, it compares the relative order of identifiable CV sections against their order in cv.md. When the two diverge and the --allow-reorder flag is set, it emits this warning and proceeds; without the flag the exact same condition throws an Error and aborts PDF generation.","triggerScenarios":"Running `node generate-pdf.mjs --allow-reorder` (or the pdf mode with that flag) when config/profile.yml cv.sections or a custom template places sections in an order that contradicts cv.md — e.g. cv.sections lists skills before experience while cv.md defines experience first, so sourcePositions.get(current) < sourcePositions.get(previous) fires.","commonSituations":"User customizes cv.sections to float Skills or Competencies to the top; a templates/cv-template.html edit reorders section blocks; upstream system update changes the default template order while the user's cv.md keeps the old order.","solutions":["Align config/profile.yml cv.sections (or the template block order) with the cv.md section order and re-run without --allow-reorder","If the divergence is intentional, keep --allow-reorder and treat this warning as expected, reviewed output","Reorder the sections inside cv.md itself so the source of truth matches the order you want rendered","In CI, omit --allow-reorder so drift becomes a hard failure instead of a warning"],"exampleFix":"# before (config/profile.yml)\ncv:\n  sections: [skills, experience, education]\n# cv.md order: experience -> education -> skills\n\n# after — pick one:\n# (a) match cv.md\ncv:\n  sections: [experience, education, skills]\n# (b) intentionally diverge and accept the warning\ncv:\n  sections: [skills, experience, education]  # run with --allow-reorder","handlingStrategy":"validation","validationCode":"// Before generating, confirm the configured order does not contradict cv.md's\n// relative section order (the exact invariant the guard checks).\nfunction orderConsistentWithSource(sourceOrder, configuredOrder) {\n  const pos = new Map(sourceOrder.map((k, i) => [k, i]));\n  const present = configuredOrder.filter(k => pos.has(k));\n  for (let i = 1; i < present.length; i++) {\n    if (pos.get(present[i]) < pos.get(present[i - 1])) return false;\n  }\n  return true;\n}\n// orderConsistentWithSource(['experience','education','skills'], ['skills','experience','education']) === false","typeGuard":null,"tryCatchPattern":"// Only needed when running WITHOUT --allow-reorder, where the same condition throws:\ntry {\n  await generatePdf(opts);\n} catch (err) {\n  if (err instanceof Error && err.message.includes('section order diverges from cv.md')) {\n    // decide: fix the order, or re-run with --allow-reorder deliberately\n  } else throw err;\n}","preventionTips":["Keep exactly one authority for section order: either cv.md or cv.sections, not both fighting","Run generation without --allow-reorder locally first; add the flag only after reviewing the divergence it reports","Treat this warning in CI output as a review item, not noise"],"tags":["cli","cv-generation","section-order","config","warning"],"backgroundTag":"content-order-mismatch","analyzedSha":"60398d6549a46f5266929538af21cfab94badc75","analyzedAt":"2026-08-20T23:00:06.764Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-14T05:17:10.506Z"}