← back to Dwha Harlequin Onboard
PENDING-APPROVAL-launchd.md
84 lines
# APPROVED + INSTALLED: DWHA one-product canary and daily LaunchAgent
**TK-10882** | Agent: codex-run-10882 | Updated: 2026-08-31 11:18 AM PT
## Gate order
Do not install the schedule until the one-product canary creates a complete
Shopify **DRAFT**, attaches its image, updates the local catalog row, and writes
a restore-map. The script now fails closed on live-SKU lookup errors, skips an
exact live SKU match, and compensating-deletes a new draft when image attach
fails.
## Step 1 — APPROVE one-product Shopify + canonical DB canary
```sh
cd ~/Projects/dwha-harlequin-onboard
node scripts/onboard-batch.mjs --limit 1
```
Expected first candidate from the verified read-only preflight: `DWHA-570086`.
The exact SKU was absent from Shopify on 2026-08-31. The run may choose a later
candidate if live state changes or an earlier exact SKU already exists.
Verify immediately:
```sh
npm run check
ls -lt restore-maps | head
tail -1 data/onboard-ledger.jsonl
```
Rollback the created canary if any verification fails:
```sh
node scripts/rollback.mjs DWHA-XXXXXX
```
## Step 2 — APPROVE schedule install only after Step 1 passes
**Step 1 PASSED 2026-08-31 11:28 AM PT:** DRAFT product `7938754412595`,
two correct variants, one 1366×1366 image, canonical row `2410`, restore-map,
ledger, and cadence count 1 all verified. Step 2 remains separately gated.
Install the DWHA Harlequin 25/day onboard cadence (05:00 AM daily).
**Step 2 APPROVED and installed 2026-08-31.** `launchctl` reports the service
loaded with the 05:00 trigger, correct Node path and working directory, and
`runs=0` immediately after bootstrap (no extra batch fired).
```sh
cp ~/Projects/dwha-harlequin-onboard/launchd/com.steve.dwha-onboard-daily.plist \
~/Library/LaunchAgents/com.steve.dwha-onboard-daily.plist
launchctl bootstrap gui/$(id -u) \
~/Library/LaunchAgents/com.steve.dwha-onboard-daily.plist
```
## What it does
- Fires daily at 05:00 AM: `node scripts/onboard-batch.mjs`
- Reads viable `DWHA-*` catalog rows and checks each exact SKU live on Shopify
- Downloads images from harlequin.design CDN to local disk (cached)
- Creates 25 Shopify DRAFT products per day — never ACTIVE
- Saves restore-map per product; marks on_shopify=true in DB
- Stops at the 25/day cadence cap via data/cadence-counter.json
## Coverage (verified 2026-08-28)
- 631 rows READY (dw_sku + trade price + image, not discontinued)
- 29 settlement-flagged (require settlement gate before ACTIVE)
- 602 clean (no settlement risk)
- Cadence plan: 631 / 25 = ~26 days to full onboard
- Price range: $168.33 to $981 retail
## Spend
$0 — local HTTP downloads + Shopify REST (no per-call cost under plan)
## Rollback
node ~/Projects/dwha-harlequin-onboard/scripts/rollback.mjs DWHA-XXXXXX
node ~/Projects/dwha-harlequin-onboard/scripts/rollback.mjs --all
Fresh read-only verification on 2026-08-31 still reports 631 READY,
29 settlement-flagged, and 602 clean. The broader Harlequin prefix remediation
already completed under TK-11002: mirror now has 0 ACTIVE Harlequin `DWHQ-*`
and 39 ACTIVE `DWHF-335*`; this cadence is additionally scoped to `DWHA-*` only.
## APPROVE: run Step 1; if and only if it passes, run Step 2
## BLOCK: ignore this file