| name | sales-finalize-borderline |
| description | Finalize the morning's borderline batch. Replaces the Monday 14:00 cron. Idempotent within the day; safe to re-run. |
/sales-finalize-borderline
Operator runs this Monday afternoon (or any time after the morning
borderline batch is staged). Picks the operator-decision-driven
decision_run_id when one exists in the Operator Review Queue;
otherwise uses default_expire.
Step 0 — Verify Attio MCP scope
Same as /sales-daily.
Step 1 — Run the finalize wrapper
sales sales-finalize-borderline --batch YYYY-MM-DD
The wrapper:
- Looks up the latest operator-resolved
weekly_finalize_stale
queue row for the batch (via decision_source lookup).
- If found: uses the operator's
decision_run_id.
- Else: uses
default_expire.
- Computes the idempotency key
{batch_date}_{decision_run_id} and checks for an existing
finalize row.
- If existing: returns
action=skipped_idempotent (no-op).
- Else: invokes
weekly-finalize --batch <date> and records the
completion as a typed queue row.
Idempotency contract
Re-running within the same day is a no-op unless the operator's
decision_run_id changed. Both keys can land at most once per day:
{batch}_default_expire AND {batch}_<operator-run-id>.
Dry-run
--dry-run propagates to the inner weekly-finalize invocation —
the borderline verdicts are computed but no Attio writes happen.