← back to Dw Smart Collection Canary

README.md

34 lines

# dw-smart-collection-canary — TK-11488

Monitors Shopify smart collection membership health. Flags empty collections
that regress beyond a recorded floor, using data already captured by the
collection-creator audit workflow in `dw_unified.collection_audits`.

## Verdicts (fleet-health-rollup vocabulary)

- **FAIL** — new empty collections beyond the floor (regression)
- **WARN** — empty collections exist but within known floor
- **PASS** — all measured collections healthy

## Negative test (CLAUDE.md rule 3: ships with a negative test)

```sh
TEST_INJECT_EMPTY=5 node canary.mjs
# → Must print FAIL with new_vs_floor=5
```

## Install launchd (Steve-gated paste)

```sh
cp com.steve.dw-smart-collection-canary.plist ~/Library/LaunchAgents/
launchctl bootstrap gui/$(id -u) ~/Library/LaunchAgents/com.steve.dw-smart-collection-canary.plist
launchctl list | grep dw-smart-collection-canary
```

Undo: `launchctl bootout gui/$(id -u)/com.steve.dw-smart-collection-canary`

## Data files

- `data/latest.json` — most recent run result
- `data/floor.json` — accepted empty-collection count baseline