NS Coverage Audit → Backfill Cycle (R474+)

Mike's 'query of all NetSuite' loop · audit · expand columnMap · migrate · full-pull · re-audit

01 / Audit 02 / Plan 03 / D1 Schema 04 / Sync 05 / Verify audit_netsuite_coverage chat tool · R474 NS sysinfo catalog every standard + custom table Gap report missing tables · missing columns Phase plan Phases 2 · 4 · 5-11 · 13 · 18 · 22 Prioritize high-value BOM · inventory · GL · refs ALTER TABLE add cols 104_phase2_expand_ns_columns.sql CREATE TABLE mirrors 105/106 · BOM · inv · TAL · refs Extend columnMap SYNC_TABLE_MAP in src/index.ts /api/sync/full-pull ?table=customers|vendors|items Self-heal drops Phase 18 · log to sync_log Tiered cron resumes 5/15/60m watermark-incremental Re-run coverage tool delta = old gap − new gap ns_probe_columns Phase 17 · validate fields netsuite-coverage.html live dashboard · coverage % findings next cycle next round Legend User UI Agent logic Policy Tool action Context / trace

What this cycle produced (R474-R497)

  • • 13 new D1 mirror tables (Phases 4-8)
  • • 40+ new columns on customers/vendors/items/contacts
  • • Line-table classification cols (Phase 11)
  • • Self-healing sync survives column drift (Phase 18)

Phase artifacts

  • • 104_phase2_expand_ns_columns.sql — master tables widen
  • • 105_phase4_new_ns_object_mirrors.sql — addresses · price_levels · tax · terms
  • • 106_phase5_11_full_coverage.sql — BOM · inv · TAL · 5 refs · line classifiers
  • • 107_phase13_pricing_master_backfill.sql — pricing refresh

Why a loop, not one-shot

  • • NS schema drifts (renames · deprecations)
  • • Self-heal logs drops; admin re-plans next round
  • • Coverage is asymptotic — chase it tier by tier
  • • Mike approves each phase; HITL on schema changes

Operating cadence

  • • Run audit_netsuite_coverage at start of every NS round
  • • ns_probe_columns before adding to columnMap (Phase 17)
  • • Migration → /api/sync/full-pull → cron resume
  • • netsuite-coverage.html is the always-current dashboard