# STATUS — phase `kuma` (uptime-kuma create-a-monitor functional test)

SSOT: `cc-ci-plan/plan-phase-kuma-monitor.md`

## Current state

## DONE

All DoD items satisfied. M1+M2 Adversary PASSes in REVIEW-kuma.md.

- test_monitor_wizard_and_probe: wizard + real probe (Up + Down) in Playwright
- Drone builds #460 + #462 — LEVEL 5, 2× consecutive green (flake check ✓)
- Runtime 2.75–2.82 s ≪ 90 s budget ✓
- DEFERRED.md "uptime-kuma create-a-monitor" closed ✓
- PARITY.md updated with playwright/ test row ✓
- M1 PASS @2026-06-11T18:26Z, M2 PASS @2026-06-11T18:3xZ
- No standing VETO

## What is claimed

### Approach choice (DECISIONS.md)
Playwright (option b). Justification: python-socketio is NOT available in the cc-ci Nix env
(confirmed: only playwright + pytest in site-packages). Playwright drives the real browser;
Socket.IO is handled transparently. No Nix changes needed.

### Test file
`tests/uptime-kuma/playwright/test_monitor_wizard.py`

### What the test does
1. Completes uptime-kuma 2.2.1 first-run setup wizard (admin create via browser).
2. Creates HTTP monitor targeting the app's own root URL (guaranteed UP at test time).
3. Waits ≤90 s for status badge (`data-testid="monitor-status"`) to show "Up".
4. Asserts important-heartbeat table row exists with a real datetime stamp (proves probe ran).
5. Creates a second monitor targeting `http://127.0.0.1:19999/dead` (dead port → connection refused).
6. Waits ≤60 s for status badge to show "Down" (negative teeth).

### Selectors used (all confirmed in compiled bundle `dist/assets/index-D_mnxLA0.js`)
- Setup: `data-cy="username-input"`, `data-cy="password-input"`, `data-cy="password-repeat-input"`, `data-cy="submit-setup-form"`
- EditMonitor: `data-testid="friendly-name-input"`, `data-testid="url-input"`, `data-testid="save-button"`
- Details: `data-testid="monitor-status"`
- Heartbeat table: `table.table-hover tbody tr` (first row)

### Secret safety
Admin password: 64-char UUID hex, generated per-run. Never printed, never in any assertion error message.

### Probe reality
- "Up" in the status badge comes from `lastHeartbeatList` populated via Socket.IO heartbeat events
  (socket.js mixin line 755). Cannot be "Up" unless a real probe completed and the server sent the
  heartbeat over the socket.
- Important-heartbeat table row exists: `isFirstBeat` is always `important=true` (server/model/monitor.js
  line 1420). Presence of a row with "YYYY-MM-DD HH:mm:ss" timestamp proves the probe ran after monitor
  creation.
- Negative teeth: "Down" can only appear after the probe attempted and got connection-refused.

### How to verify (Adversary cold-check)
```bash
# Deploy uptime-kuma against any fresh cc-ci domain, then run:
CCCI_APP_DOMAIN=<domain> RECIPE=uptime-kuma STAGES=custom \
  cc-ci-run -m pytest tests/uptime-kuma/playwright/test_monitor_wizard.py -v
# Expected: test_monitor_wizard_and_probe PASSED
# In the Drone-path, it runs under the "custom" tier via run_recipe_ci.py.
```

### Runtime
Local estimate: wizard ~10 s + 2× (navigate+fill+probe) ≤ ~60 s total. Within ≤90 s budget.

### CI evidence (M1)
- Drone build **#460** — uptime-kuma@eb4521cc (PR #3, comment #14349)
- Result: **LEVEL 5** — install/upgrade/backup/restore/custom/lint all PASS
- Custom tier: `functional: 3` (health_check, socketio_handshake, spa_branding) + `playwright: 1` (`test_monitor_wizard`)
- `test_monitor_wizard [pass]` confirmed in stage results
- `flags: {clean_teardown: true, no_secret_leak: true}`
- PR comment posted: git.autonomic.zone/recipe-maintainers/uptime-kuma/pulls/3 shows ✅ passed
- Artifacts: `/var/lib/cc-ci-runs/460/` on cc-ci

### M2 evidence (flake check + DEFERRED closed)
- Drone build **#462** — uptime-kuma@eb4521cc (PR #3, comment #14352)
- Result: **LEVEL 5** — install/upgrade/backup/restore/custom/lint all PASS
- `test_monitor_wizard [pass]` — 2 consecutive green runs (#460 + #462)
- DEFERRED.md entry "2026-05-28 — uptime-kuma create-a-monitor" closed (commit below)
- PARITY.md updated: new row for `tests/uptime-kuma/playwright/test_monitor_wizard.py`

### How to cold-verify M2
```
git pull; cat machine-docs/DEFERRED.md | grep -A2 "uptime-kuma create-a-monitor"
# → "CLOSED @2026-06-11 (Builder, phase kuma)"
cat tests/uptime-kuma/PARITY.md | grep playwright
# → row for test_monitor_wizard.py
cat /var/lib/cc-ci-runs/462/results.json | python3 ...
# → level:5, test_monitor_wizard [pass]
```

### How to cold-verify M1
```
# On Adversary's clone (cc-ci-adv):
git pull; git log --oneline -3  # confirm 8da59cf feat(kuma): implement wizard+monitor Playwright test
# Inspect the test:
cat tests/uptime-kuma/playwright/test_monitor_wizard.py
# Verify CI results:
cat /var/lib/cc-ci-runs/460/results.json | grep -E "level|playwright|wizard|status"
# → level:5, playwright:1, test_monitor_wizard:[pass]
# Check PR comment confirms ✅:
# https://git.autonomic.zone/recipe-maintainers/uptime-kuma/pulls/3
```

## Blocked
(nothing)
