Operations
Running, deploying, and telling the truth about what is live. Every command below exists in the repo; nothing is aspirational.
1. What is deployed right now
| Fact | Value |
|---|---|
| Domain | jobwzrd.com (apex), www. 301 → apex, api., admin. → /logs, status. |
| Edge | Cloudflare, one Worker jobwzrd-backend, version 1ff93624-abee-4818-8a53-9114d8df5639 |
| D1 | jobwzrd — 28 ledger rows, 63 tables, ~1.2 MB |
| R2 | bucket jobwzrd (blobs, résumés) |
| KV | CATALOGUE (0928033e83734b8f9f27ed763d399f04) — read cache only |
| Queues | jobwzrd-scrape-minizrd, jobwzrd-scrape-jobindie (+ DLQs) |
| Cron | */15 * * * * — reclaim, poll replies, retention |
| Secrets (names only) | BETTER_AUTH_SECRET, BLOB_SIGNING_KEY, QUEUE_HMAC_KEY |
Not live: scrapers (mz-api :8120, ji-api :8121 stopped), Gmail sending (no
linked account in production), auth mail (capabilities all false), AI rank
(degraded: no_key), consent UI.
2. Environment and secrets
backend/.dev.vars— local Worker.wranglerauto-loads the directory, so a zone-scoped token must never be placed in it.backend/.env.local,app/.env.local— local app config; git-ignored.- Production secrets:
npx wrangler secret put <NAME> --env production. - No secret is ever committed, echoed, or written into a report. Names only.
- Service credentials are per surface (scrape, apply, ai, email_sync, export); a missing one fails closed, there is no shared fallback token.
2.1 Mail
| State | Predicate | What the UI shows |
|---|---|---|
| Resend | RESEND_API_KEY and RESEND_FROM | reset + verify forms |
| Self-hosted bridge | EMAIL_TRANSPORT_URL | the same forms |
| Nothing | neither | no reset form at all |
One predicate (mailConfigured()) decides GET /api/v1/config.capabilities, so the
UI can never offer a flow nothing can perform. A provider refusal throws
(auth.resend_refused, address masked, URL-scrubbed) — "check your email" is never
answered for a message the provider rejected. Runbook: backend/docs/runbooks/email.md.
3. Local stack
cd backend
node scripts/db-migrate.mjs # apply the ledger
node scripts/mail-bridge.mjs # :8799 — captures reset/verify mail to .local-mail.jsonl
npx wrangler dev --local --persist-to .wrangler/state --test-scheduled --port 8795cd app && npm run dev # :2992, proxying /api/v1 and /api/auth to :8795./dev.sh is the definition of "live locally": checks, .dev.vars, migrations,
Worker :8795, app :2992, and one honest line about which half is connected.
node backend/scripts/stop-local.mjs stops it.
4. Deploy
cd app && npm run pages:build # static export → app/out (requires an API base)
cd ../backend && node scripts/sync-web.mjs # copies out/ + recomputes CSP hashes
npx wrangler deploy --env production
node scripts/smoke.mjs # 5 checks against the public hostname
node scripts/shoot-live.mjs # screenshots + live-report.jsonOrder matters: skipping sync-web.mjs ships a bundle whose inline scripts the CSP
blocks — a failure visible only in production. smoke.mjs --ip <addr> pins DNS when
the local resolver lies (use DoH to get the real address first).
5. Verification commands (the only ones that count)
| Area | Command |
|---|---|
| App | cd app && npm run check && npm test && npm run build |
| Backend | cd backend && npx tsc --noEmit -p tsconfig.json && npx vitest run |
| Contract | node backend/scripts/contract-status.mjs → 58/58 |
| Acceptance | node backend/scripts/b1..b10-acceptance.mjs, gap-acceptance.mjs |
| Python | python3 apply/test_apply.py && python3 server/worker/test_scrape.py (repo root) |
| Go scraper | cd scrapers/MiniWzrd && GOTOOLCHAIN=auto go test ./... |
| Rust scraper | cd scrapers/jobindie && cargo test |
| Live | node backend/scripts/smoke.mjs |
A claim of "green" without one of these having run in this session is a lie.
6. Operator runbooks
| Need | Tool |
|---|---|
| Add/repair a migration | node scripts/db-migrate.mjs (ledger, never textual re-run) |
| Delete a user | node scripts/delete-user.mjs --email … [--confirm] [--remote] — dry run default |
| Replay a dead letter | node scripts/dlq-replay.mjs |
| Board config (per source) | node scripts/board-config.mjs |
| Auth schema changes | node scripts/auth-schema.mjs |
| Client budget reset (local) | node scripts/db-reset.mjs |
| Mail problems | backend/docs/runbooks/email.md |
| DNS / cutover | backend/docs/runbooks/dns.md, docs/runbooks/CLOUDFLARE-FROM-SCRATCH.md |
| Ops semantics | server/docs/runbooks/operations.md (module paths are API paths) |
7. Logs, metrics, incidents
- Logs live in
ops_log_events(D1) and are read at/logs(operator-only view, same Worker). Client logging posts to/api/v1/logs/ingeston the live Worker — pointing it at a retired deployment was a real bug, fixed 2026-11-25. - Every line carries
side_effect: none|possible|confirmed. Logging never fails the operation it describes. - Actor ids are pseudonymous and linkable (salted hash + row).
- Dead letters:
ops_dead_letters+ops_dlq_incidents; replay is manual and audited.
8. Known blockers (operator action, not code)
| Blocker | Fix |
|---|---|
| No auth mail in production | set RESEND_API_KEY + RESEND_FROM (or EMAIL_TRANSPORT_URL), redeploy, confirm capabilities flip |
| Scrapers not running | start mz-api/ji-api containers; B4–B7 acceptance is blocked on them |
| Proxy gateway passes traffic direct | upstream Webshare credentials pending; GATEWAY_DIRECT=1 is the temporary opt-out |
| No AI key in production | set the provider env; rank degrades to keyword until then |
Remote jobwzrd tunnel + ai.clxtch.qzz.io record | delete from the Cloudflare dashboard (CLI auth is stale) |
| CI still publishes to the retired Pages project | cut .github/workflows/pages.yml to the single-deploy path |
9. Cost and capacity guardrails
- D1: thresholds are percentages of
D1_LIMIT_BYTES, never a routineCOUNT(*). - R2: résumés are never swept (D-GAP-1) — accepted cost, unmeasured.
- Queues: one message per
(search_id, source_id),max_batch_size = 1, so a bad run cannot amplify into a stampede. - AI: budget reserved before the call and never refunded on an unparseable answer.