← back to Dw Monitoring
README.md
47 lines
# dw-monitoring
Daily regression guards for Designer Wallcoverings infrastructure.
## broken-image-check
Counts `shopify_products` rows whose `image_url` joins to an `image_hashes`
row with `status != 'success'`. Baseline: **4,989** (2026-05-19, 4,989 products on
`designer-laboratory-sandbox.myshopify.com`).
If today's count grows **≥ 5%** above the stored baseline, writes an alert
file to `alerts/<ISO>.txt` and attempts an SMTP send if Gmail creds are
present in `~/Projects/secrets-manager/.env` (`GMAIL_USER` + `GMAIL_APP_PASSWORD`).
Currently degrades to **file-only alerts** — SMTP creds not yet wired.
Run manually:
```bash
node scripts/broken-image-check.js
```
### Schedule (launchd)
Plist at `~/Library/LaunchAgents/com.steve.broken-image-check.plist` runs
daily at **09:00 local**. Log: `/tmp/broken-image-check.log`.
Load (run from an interactive Terminal session — non-Aqua sessions cannot
bootstrap LaunchAgents):
```bash
launchctl load -w ~/Library/LaunchAgents/com.steve.broken-image-check.plist
launchctl list | grep broken-image
```
Trigger an immediate run for verification:
```bash
launchctl kickstart -k "gui/$(id -u)/com.steve.broken-image-check"
```
## Hard constraints
- **Read-only** against `dw_unified` — never modifies `shopify_products`
or `image_hashes`.
- Alert fires **only** on growth. Baseline is canonical; rebaseline by
editing `data/broken-image-baseline.json`.