Skip to content

Emptied-generation section badged as "metric drift" instead of its own state #877

Description

@s-annam

Problem

When a section rewrite's generation comes back completely empty, applyNumberPreservation (src/lib/webllm/post-process.ts) deliberately does NOT revert it — the empty-generation exemption. That outcome has reverted: false and numbersPreserved: false.

numberDriftStatus (src/components/features/NumberPreservationWarning.tsx, consolidated from three duplicate copies in #874's revision round) currently collapses this into the same "drift" status as an ordinary partial content change:

export function numberDriftStatus(result: {
  numbersPreserved: boolean;
  reverted: boolean;
}): NumberDriftStatus {
  if (result.reverted) return "reverted";
  if (!result.numbersPreserved) return "drift";
  return "clean";
}

So CompletedList (ResumeRewrite.tsx) badges an emptied section "metric drift" — the same label as a section where the model actually altered a number — even though the section's content is gone entirely, not altered. This mislabeling pre-dates #778/#874 (confirmed present on origin/main before either PR); it was left in place rather than expanded to a new status during #874's consolidation to keep that fix scoped to deduplication, not new UI copy.

What a real fix looks like

Add a fourth NumberDriftStatus variant (e.g. "emptied") for !reverted && !numbersPreserved && bullets.length === 0 (or the summary-text equivalent), and give each of the three call sites its own copy for it:

  • CompletedList (ResumeRewrite.tsx) — a distinct badge, not "metric drift"
  • ProposedPanel (ResumeRewriteProposed.tsx) — already splits reverted-vs-emptied drift into two NumberPreservationWarnings since fix(rewrite): reject/revert rewrites that drop or invent numbers (#778) #874's revision round; the emptied one currently reuses the generic "AI altered a metric" copy, which has the same mislabeling
  • SectionRewrite.tsx's per-role panel

This needs its own copy decisions (three surfaces, one new state) rather than folding into an unrelated fix.

Pointers

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions