#3893·career-ops

bug(sync-pdf-flags): a PDF flag can never be cleared and manifest rows outlive the files they name, so a correction does not stick

Author: rubiconCreated Sep 5, 2026Updated Sep 28, 2026
Labelsbughelp wanted🔧 scriptsconfirmed

What happened?

Two defects that compound, and neither is fixable alone:

  1. sync-pdf-flags.mjs is monotonic. It sets the tracker's PDF cell to ✅ when the manifest names a PDF, and has no path that ever takes it back.
  2. data/pdf-index.tsv rows are never reconciled against the filesystem, so a row keeps naming a PDF after the file is deleted.

Together, a deleted artifact leaves the tracker permanently asserting that a tailored CV exists for that application. That assertion is load-bearing — it is what the apply flow and outcome.mjs consult.

Fixing one without the other does not stick: clearing the tracker flag while the stale manifest row remains just gets it re-flagged on the next run, so a user who notices the wrong ✅ and corrects it watches the correction get reverted.

Verified against main: sync-pdf-flags.mjs has no clear, unset, downgrade or prune path.

Relationship to #3887

Not a duplicate. #3887 is about the manifest key — one row per report number, so a cover letter evicts the CV row. This issue is about the flag being write-only and rows outliving the files they name. Different defects on the same file.

There is a sequencing dependency worth flagging, though. The natural way to express "this ✅ is stale" is "there is no CV-kind row for this report", which is not sayable until #3887 introduces a way to distinguish artifact kinds. So this issue is scoped to the kind-agnostic half only — pruning rows whose PDF is not on disk, which is true regardless of what kind of artifact the row names. The flag-downgrade half is better filed as a follow-on once #3887 lands.

Steps to reproduce

  1. Generate a CV for report N. Tracker cell → ✅, manifest row written.
  2. Delete the PDF from output/.
  3. node sync-pdf-flags.mjs.

The tracker still shows ✅ and the manifest still names the missing file.

Expected behavior

A prune mode that drops manifest rows whose PDF is not on disk — kind-agnostic, since a cover letter whose PDF is gone is exactly as stale as a CV's. Dry-run by default seems the right shape given it edits the manifest.