15 Commits

Author SHA1 Message Date
Keysat 5d0d1b2dd2 docs: note webhook-dedup module + processed-webhooks.json in AGENTS.md 2026-06-15 20:04:47 -05:00
Keysat 238689ddcc Persist payment-webhook dedup; declare BTCPay required; scope CORS
Replace the in-memory dedup Sets in the BTCPay and Zaprite webhook
handlers (and the BTCPay rescan path) with a persistent JSON-backed
store (server/webhook-dedup.js). The in-memory sets were cleared on
restart, so a duplicate webhook delivery straddling a relay restart
could double-credit (BTCPay) or double-extend a subscription (Zaprite).
The store atomically writes /data/processed-webhooks.json, namespaces
keys per rail (storeId|invoiceId vs zaprite:orderId), and prunes
entries older than 180 days (safely beyond any retry window).

Also:
- BTCPay is a required running dependency (operator decision). Config
  was already optional:false/kind:'running'; corrected the contradictory
  "optional" comment in the manifest to match.
- Scope cors() to /relay/* only — off /admin/* and the same-origin
  dashboard, which don't need permissive CORS.
- Add money-path unit tests (commitCredit/refundCredit/applyTierPromotion)
  and webhook-dedup tests (incl. the survives-a-restart guarantee).
- Fix two AGENTS.md auth-doc drifts; refresh Current state.

Version 0.2.125 -> 0.2.126.
2026-06-15 18:15:00 -05:00
Keysat 798a698132 Add Users dashboard tab with per-user balances and credit grants
New cookie-gated "Users" tab on the operator dashboard: a sortable view
of every credit-ledger row (typed cloud/license/install) with computed
remaining/total balances, key filter, and a per-row "grant free credits"
action.

Endpoints (routes/admin.js):
- GET /admin/credits — snapshotAll() enriched with a type derived from
  the credit-key prefix and a computed balance (computeRemaining against
  live tier quotas), since the ledger stores consumed counters only.
- POST /admin/credits/grant {credit_key, amount} — adds free top-up via
  addPurchasedCredits. Grants land in the never-expires purchased bucket
  (spent after the tier allowance). Guards: positive integer, <=1,000,000,
  and the row must already exist (a typo can't spawn a ghost row).

Admin-only; no /relay/* client contract change. Tests added in
server/test/admin-credits.test.js (mount the real router over HTTP).
Version bumped 0.2.124 -> 0.2.125.
2026-06-15 16:25:14 -05:00
Keysat 00da92a872 docs: note Gitea remote in Current state 2026-06-15 12:26:56 -05:00
Keysat b10399819b Add inbox-check line; align .gitignore with canonical .claude policy
Cross-repo git-hygiene audit remediation: surface ~/Projects/standards/INBOX.md items at session start, and switch .gitignore to the deny-by-default .claude/* block (shared wiring allow-listed) plus the canonical secrets/env lines — per standards/portability.md.
2026-06-14 12:17:16 -05:00
Keysat e4c6c30ee3 docs: refresh Current state after P1/P2 security pass; move P3+ to ROADMAP 2026-06-13 18:28:27 -05:00
Keysat 3e33728013 Mark three P2 hardening items done in Current state 2026-06-13 18:22:20 -05:00
Keysat 54ddaffced Mark P1 work queue done in Current state 2026-06-13 16:23:55 -05:00
Keysat 0b90120b72 Triage full-eval findings into Current state (work queue / known debt / deferred) 2026-06-13 16:14:44 -05:00
Keysat 4d5dd2db49 Mark git catch-up done; refresh Current state and ROADMAP 2026-06-13 13:38:09 -05:00
Keysat fb11dd6a04 Trim AGENTS.md; extract internal-meetings guide + lazy-load wiring 2026-06-13 13:36:46 -05:00
Keysat 9a2dbf69df Add cross-repo change-impact convention 2026-06-13 12:18:40 -05:00
Keysat 87227a7ca6 Correct agent-doc accuracy: full /admin route list, git-state precision
AGENTS.md: append four real /admin routes the list omitted (job-output/:id, output-store-ids, settings/promote-prompt, test-run-suite); replace the stale HEAD hash with 'last code commit is v0.2.11, docs-only commits on top'. ROADMAP.md: fix the untracked count + HEAD wording; drop the two now-resolved doc-precision follow-ups.
2026-06-13 12:02:36 -05:00
Keysat 7e5a7e3b7e Document server-side endpoint contract; correct Current state precision
- AGENTS.md: add Endpoints section — auth model (cloud operator-key path,
  license/install-id path, admin session cookie, BTCPay HMAC) plus full
  /relay/* surface (public + operator-key-only control plane), the
  /admin/* dashboard, and the /admin/internal-meetings/* API.
- AGENTS.md: rewrite Current state with verified git facts — HEAD is the
  prior docs commit, HEAD~1 is v0.2.11, working tree at v_0_2_124, file
  counts pulled live from git status.
- ROADMAP.md: log two doc-precision follow-ups caught in review (the
  working-tree counts drift fast; the admin-route shortlist silently
  omits three real routes).
2026-06-13 11:13:12 -05:00
Keysat 6fa175adb2 Add agent docs (AGENTS.md, ROADMAP.md, CLAUDE.md symlink) 2026-06-13 10:38:51 -05:00