Tool to relink orphan VANZARI invoices (ID_COMANDA NULL, sters=0) — emitted
manually by the warehouse during an Oracle/sync outage — to their GoMag order,
then populate the SQLite invoice cache like the app does.
Matching is conservative (exact total + partner OR name; handles duplicate
partner records) and only auto-links unambiguous 1:1 matches. Genuine warehouse/
walk-in invoices (no online order behind them) get SKIP_NOMATCH and are left
untouched; anything unclear is reported SKIP_AMBIGUOUS for manual review.
Dry-run by default; --apply / --yes / --days N. Runs on prod (uses app.config
settings + prod import.db). Codifies the 2026-06-26 manual relink (12 invoices).
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>