santifer/career-ops · warning

⚠️ ${message} (proceeding — --allow-reorder set)

Error message

⚠️  ${message} (proceeding — --allow-reorder set)

What it means

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.

Source

Thrown at generate-pdf.mjs:323

  const source = extractSourceSectionOrder(cvMarkdown);
  if (rendered.length < 2 || source.length < 2) return;

  const sourcePositions = new Map(source.map((section, index) => [section.key, index]));
  const renderedComparable = rendered.filter(section => sourcePositions.has(section.key));
  if (renderedComparable.length < 2) return;

  for (let i = 1; i < renderedComparable.length; i++) {
    const previous = renderedComparable[i - 1];
    const current = renderedComparable[i];
    if (sourcePositions.get(current.key) < sourcePositions.get(previous.key)) {
      const renderedOrder = renderedComparable.map(section => section.title).join(' -> ');
      const sourceOrder = source
        .filter(section => renderedComparable.some(renderedSection => renderedSection.key === section.key))
        .map(section => section.title)
        .join(' -> ');
      const message = `CV section order diverges from cv.md: rendered ${renderedOrder}; cv.md ${sourceOrder}`;
      if (allowReorder) {
        console.warn(`⚠️  ${message} (proceeding — --allow-reorder set)`);
        return;
      }
      throw new Error(message);
    }
  }
}

/**
 * Every canonical section key the alias table can produce, in template order.
 * Derived from the table rather than restated so the two cannot drift.
 */
export const CV_SECTION_KEYS = [...new Set(SECTION_ALIASES.values())];

// The all-caps comments the templates use to delimit sections, matched exactly
// as cv-sections-core.mjs matches them when stripping empty sections.
const SECTION_MARKER_RE = /<!--\s+[A-Z][A-Z ]*-->/g;
const SECTION_TITLE_RE = /class=["'][^"']*\bsection-title\b[^"']*["'][^>]*>([\s\S]*?)<\/[^>]+>/gi;

View on GitHub (pinned to 60398d6549)

Solutions

  1. Align config/profile.yml cv.sections (or the template block order) with the cv.md section order and re-run without --allow-reorder
  2. If the divergence is intentional, keep --allow-reorder and treat this warning as expected, reviewed output
  3. Reorder the sections inside cv.md itself so the source of truth matches the order you want rendered
  4. In CI, omit --allow-reorder so drift becomes a hard failure instead of a warning

Example fix

# before (config/profile.yml)
cv:
  sections: [skills, experience, education]
# cv.md order: experience -> education -> skills

# after — pick one:
# (a) match cv.md
cv:
  sections: [experience, education, skills]
# (b) intentionally diverge and accept the warning
cv:
  sections: [skills, experience, education]  # run with --allow-reorder
Defensive patterns

Strategy: validation

Validate before calling

// Before generating, confirm the configured order does not contradict cv.md's
// relative section order (the exact invariant the guard checks).
function orderConsistentWithSource(sourceOrder, configuredOrder) {
  const pos = new Map(sourceOrder.map((k, i) => [k, i]));
  const present = configuredOrder.filter(k => pos.has(k));
  for (let i = 1; i < present.length; i++) {
    if (pos.get(present[i]) < pos.get(present[i - 1])) return false;
  }
  return true;
}
// orderConsistentWithSource(['experience','education','skills'], ['skills','experience','education']) === false

Try / catch

// Only needed when running WITHOUT --allow-reorder, where the same condition throws:
try {
  await generatePdf(opts);
} catch (err) {
  if (err instanceof Error && err.message.includes('section order diverges from cv.md')) {
    // decide: fix the order, or re-run with --allow-reorder deliberately
  } else throw err;
}

Prevention

When it happens

Trigger: 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.

Common situations: 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.

Related errors


AI-assisted analysis of santifer/career-ops@60398d6549 (2026-08-20). Data as JSON: /api/errors/12843bf20d3ae5e8. Report an issue: GitHub.