[object Object]

← back to Sample Followup Sweep

sample-followup: env knobs (SEARCH_DAYS/MAX_AGE) to backfill 2nd-request stamps

35ba693f5623cc51439623a39e10c2dbac553731 · 2026-09-01 12:46:38 -0700 · Steve

Lets the poller sweep further back than the default 3-day/60-day window to backfill
follow-ups sent during the period the stamper was broken. Month sweep found only 1
unstamped-still-outstanding item (Morris 216020); WQ FC60808 + O&P OP-ART-DECO-WAVES
were already received. Backfilled 216020 with its real chase date (08/27).

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>

Files touched

Diff

commit 35ba693f5623cc51439623a39e10c2dbac553731
Author: Steve <steve@designerwallcoverings.com>
Date:   Tue Sep 1 12:46:38 2026 -0700

    sample-followup: env knobs (SEARCH_DAYS/MAX_AGE) to backfill 2nd-request stamps
    
    Lets the poller sweep further back than the default 3-day/60-day window to backfill
    follow-ups sent during the period the stamper was broken. Month sweep found only 1
    unstamped-still-outstanding item (Morris 216020); WQ FC60808 + O&P OP-ART-DECO-WAVES
    were already received. Backfilled 216020 with its real chase date (08/27).
    
    Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
---
 scripts/watch-sent-stamp.mjs | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/scripts/watch-sent-stamp.mjs b/scripts/watch-sent-stamp.mjs
index e3a1e82..dd9d041 100644
--- a/scripts/watch-sent-stamp.mjs
+++ b/scripts/watch-sent-stamp.mjs
@@ -16,7 +16,8 @@ const POLL_SECS = Number(process.env.POLL_SECS || 30);
 // Steve 8/25: match on the ACCOUNT # in the subject ("…(Acct NNNNN)") — works for EVERY vendor with
 // zero hardcoded map, and covers follow-ups sent by hand from Gmail (not just the console/scheduler).
 const MIN_AGE_DAYS = 10;   // only chaseable memos (>=10d) — matches the letter contents
-const MAX_AGE_DAYS = 60;   // >60 = dead lead, never chased
+const MAX_AGE_DAYS = Number(process.env.MAX_AGE) || 60;   // >60 = dead lead; widen (e.g. 100) to BACKFILL older chases
+const SEARCH_DAYS = Number(process.env.SEARCH_DAYS) || 3; // how far back to scan Sent (widen to backfill a month)
 
 const cfg = JSON.parse(readFileSync(join(homedir(), '.claude.json'), 'utf8'));
 const fenv = cfg?.mcpServers?.filemaker?.env || {};
@@ -104,7 +105,7 @@ async function pass() {
   const today = fmt(new Date());   // per-pass so a midnight-crossing loop stamps the real date
   // NB: the em-dash in the full subject breaks Gmail matching over HTTP — match the ASCII prefix.
   // newer_than:2d so a poll gap never loses a send; the per-message ledger guards against re-work.
-  const msgs = await gsearch('in:sent subject:"Outstanding Memos" newer_than:3d');   // no hyphen → less flaky than "Sample Follow-Up"
+  const msgs = await gsearch(`in:sent subject:"Outstanding Memos" newer_than:${SEARCH_DAYS}d`);   // no hyphen → less flaky than "Sample Follow-Up"
   if (process.env.DEBUG) console.log(`  [debug] gsearch → ${msgs.length} msg(s); win ${win}; ledger has ${Object.keys(seen).length}${DRY_RUN ? ' · DRY-RUN' : ''}`);
   let acted = 0;
   for (const m of msgs) {

← 5ab8a3d sample-followup: FIX 2nd-request stamping — was silently sta  ·  back to Sample Followup Sweep  ·  auto-data-snapshot: 2026-09-01T12:55:30 (2 data files) — dat 59409a0 →