diff --git a/BACKLOG.md b/BACKLOG.md index 817f3a8..262e299 100644 --- a/BACKLOG.md +++ b/BACKLOG.md @@ -324,8 +324,9 @@ Sami explicitly stated he wants email auth as an OPTION alongside TOTP, not a re - **prerequisite:** DC-042 + DC-043 (Tailscale manager + coord API shipped); DC-052 (license check); DC-048 (invite flow model). ### DC-054: License-keygen CLI improvements + Stripe webhook bridge script -- **status:** in-progress +- **status:** done - **owner:** hermes +- **result:** Shipped (verified 2026-08-23 autonomous-fixer audit). All three deliverables exist on main: (1) `--tier` flag in `license-keygen.js` (cosmetic pro label + forward-compatible hook for a future tier that alters generation); (2) `scripts/stripe-license-bridge.js` (webhook listener reading `STRIPE_WEBHOOK_SECRET`, exported `createServer()` factory for tests); (3) validation path body unchanged since the 2026-07-25 keygen refactor — the only keygen change since is the documented `LICENSE_SECRET_FILE` env-var override for secret-file location, which does not touch `verifyCode()` (git diff 592a9fd..HEAD confirms verifyCode absent from the diff). Test coverage: `__tests__/billing/` — `stripe-license-bridge.test.js`, `bridge-lookup-http.test.js`, `e2e-billing-flow.test.js`, `invoice.test.js`. **Fresh rerun 2026-08-23: 8/8 billing suites, 131/131 tests green; focused signature-verification tests 3/3 (rejects missing sig / wrong sig / out-of-tolerance timestamp); evidence captured at main HEAD `09d56fd`.** Later extended by DC-058 (commit `e8ab0e0`, mm-grade=A: Stripe license + invoice email automation). Note the SKU contract was subsequently superseded by DC-057's canonical `metadata.productId` catalog — bridge consumers should read DC-057's result, not this ticket's original SKU wording. - **details:** Existing `dashcaddy-api/license-keygen.js` already supports durations [30, 90, 180, 365]. Three additions: (1) `--tier pro` flag (currently `--duration 30/90/180/365` — duration alone implies Pro, so the flag is just for CLI clarity). (2) `dashcaddy-api/scripts/stripe-license-bridge.js` — listens on `STRIPE_WEBHOOK_SECRET`, validates `checkout.session.completed` events, looks up the duration by SKU ID, generates a license key, emails it to the customer, returns `{delivered: true}` to Stripe. (3) `dashcaddy-api/license-keygen.js` validation path — already exists, no change. Sami generates initial keys via CLI for the launch. - **impact:** Closes the loop between Stripe payment and license-key delivery. Without this, every sale requires manual key generation by Sami. - **prerequisite:** None. Stripe-side can be set up in parallel with DC-052. @@ -336,7 +337,7 @@ Sami explicitly stated he wants email auth as an OPTION alongside TOTP, not a re - **details:** Static page at `/pricing` showing the 5-row tier table (Free / 1mo / 3mo / 6mo / 12mo). Stripe Checkout button per paid tier. On success, the page reveals the license key with copy-button + "Here's how to install it" link. Receipt email sent via Stripe's built-in. No account creation in this flow (Q10 decision — optional dashcaddy.net account is post-v1.0). - **impact:** The conversion surface. Without this, the product is real but unsellable. - **prerequisite:** DC-054 (Stripe webhook bridge so licenses auto-issue). -- **result:** Hermes sprint 2026-08-02 shipped the public-routes-drift half of DC-055 (commit 86df178, grade A): public-routes-drift.test.js now correctly maps `routes/billing.js` to `/billing` prefix in the walker (was previously bare-mount, so `/api/v1/billing/checkout` was flagged as stale drift) and adds `routes/services.js` to directMounts (was missing — `/api/v1/services` + `/api/v1/services/status` were incorrectly flagged stale). Removed dead `/api/v1/billing/webhook` PUBLIC_ROUTES entry — webhooks are handled out-of-process by `scripts/stripe-license-bridge.js` and the merchant webhook secret never enters the API process. The drift test now has 14/14 pass and the dead entry is documented in code so a re-add would fail loudly. Krystie's prior uncommitted work (`src/billing/stripe-client.js`, `routes/billing.js`, `scripts/stripe-license-bridge.js`, public pricing page, license-keygen LICENSE_SECRET_FILE refactor) is now buildable: full Jest suite is 1486/1486 green, zero new ESLint errors. Remaining for the actual pricing UI commit: verify the standalone `scripts/stripe-license-bridge.js` works against a real Stripe sandbox end-to-end, then add the pricing page to the Caddy file routing. +- **result:** **Partially shipped — live surfaces verified, end-to-end payment flow NOT yet evidenced. Verified live 2026-08-23T07:18Z (autonomous-fixer audit):** the conversion surface now lives on the dedicated Next.js marketing site `dashcaddy.net` (source `/root/dashcaddy.net/`, static export deployed to Samihost `194.163.161.162:/home/dashcaddy.net/public_html/`, DNS confirmed via getaddrinfo → 194.163.161.162; DNS2's `/home/dashcaddy.net/public_html/` is empty — DNS2 does not serve it). `https://dashcaddy.net/pricing` → 308 → `/pricing/` 200 (39962B, 30/90/180/365-day pickers, one-time + subscription modes, "Secure checkout via Stripe"); `https://dashcaddy.net/success/` 200 (client-side poll of `licenses.dashcaddy.net/api/checkout/session/:id`, license-key reveal + pending_email fallback in `src/app/success/page.tsx`); `https://licenses.dashcaddy.net/health` → 200 `{"ok":true,"service":"dashcaddy-license-server"}`. Plan codes (license server `plans.js`): premium_30d $20 / premium_90d $50 / premium_180d $70 / premium_365d $99. Earlier work: public-routes-drift half (commit 86df178, grade A) + DC-057 checkout→license contract (9b9711b, grade B; billing suites fresh-rerun 2026-08-23 at main HEAD `09d56fd`: 8/8, 131/131 green). **NOT verified (blocks done):** an end-to-end Stripe test-mode transaction — checkout-session creation → redirect → signed webhook fulfillment → persisted license → session lookup → success-page reveal (or documented email fallback). Static page text + health endpoint do not substitute. Codex judge held the done-transition on exactly this (verdict urn:ump:tqw6pvgj576f73ubhzff77sccm7azjyyg67o4z346yk45swgjleq). Also open: the superseded in-repo `status/pricing/index.html` (served by the status.sami SPA catch-all, 0 stripe refs) is dead weight — cleanup candidate. ### DC-057: Close checkout-to-license contract drift before public billing launch - **status:** done @@ -402,16 +403,17 @@ Tickets DC-046 through DC-049 implement pluggable auth + email magic link. Sami ### DC-086: Service-status flicker fix — asymmetric hysteresis on the badge -- **status:** in-progress +- **status:** done - **owner:** hermes - **details:** Dashboard service badges perpetually flip between green and red for "a few seconds at a time, never stable" (Sami's report, 2026-08-20). Root cause: `src/monitoring/health-checker.js` `recordStatus()` emits `'status-check'` on EVERY probe (every 30s), and `src/websocket/dashboard-ws.js` forwards every probe as `'status-change'` to the browser with no diff. The frontend `live-events.js` then unconditionally calls `setBadge()` — which resets the icon + pill text on every event. A single transient 5xx (Caddy reload, container CPU steal, mid-flight TLS handshake, container restart during probe) flips the badge red and the next green probe flips it back. Fix: add asymmetric hysteresis in `_computeDisplayedStatus(serviceId, rawStatus)` — going DOWN requires 2 consecutive "down" probes (default `HEALTH_DOWN_THRESHOLD=2`), going UP requires only 1 (default `HEALTH_UP_THRESHOLD=1`). History + `consecutiveFailures` still record raw probe results (operators want full fidelity for postmortems); only the dashboard broadcast is filtered. `getCurrentStatus()` now returns the displayed status so a page reload shows the same badge as the live SSE stream. Both thresholds are env-var configurable so operators can tune. New tests in `__tests__/health-checker-hysteresis.test.js` cover: first probe emits; second probe same-status does NOT re-emit; one-down-then-up keeps green; two-down flips to red; one-up after down flips back to green; `getCurrentStatus` returns displayed not raw. Effort: ~30 min. Risk: low — pure behavior filter, no schema breaks, all 63 existing health-checker tests must stay green. - **impact:** Operators stop seeing perpetual red/green flicker on healthy services. Real outages still get flagged (2 consecutive 30s probes = ~60s before badge flips red, which is still faster than a human notices). Background probe history is unchanged so postmortem analysis still works. - **prerequisite:** None. -- **result:** _pending — ship + codex round_ +- **result:** Shipped, merged to main (merge commit `eb546bf`, glm-grade=A; verified 2026-08-23 autonomous-fixer audit). Implementation verified on main: `health-checker.js` reads `HEALTH_DOWN_THRESHOLD`/`HEALTH_UP_THRESHOLD` env vars (defaults 2/1), `_computeDisplayedStatus()` implements the asymmetric hysteresis, `recordStatus()` emits only on displayed-status change. Test file `__tests__/health-checker-hysteresis.test.js` present. **Fresh rerun 2026-08-23 at main HEAD `09d56fd`: hysteresis + admin-invites suites 32/32 green.** Follow-up rounds also merged: `628bbe3` round-2 probe/config race hardening + env parse + incident compare (glm-grade=A), DC-090 outage incidents follow displayed hysteresis status (`88f1d4a`, glm-grade=A). ### DC-085: Link-first invite — Discord-style "share it however you want" -- **status:** in-progress +- **status:** done - **owner:** hermes +- **result:** Shipped, merged to main (merge commit `eb546bf`, glm-grade=A; verified 2026-08-23 autonomous-fixer audit). All 5 deliverables verified on main: (1) `routes/auth/admin.js` invite POST now uses `sendEmail === true` opt-in (default = link only, no SMTP attempt); (2) raw invite URL no longer logged to error.log when SMTP unconfigured; (3) `shareText` field returned in the invite response; (4) `status/js/admin.js` `_renderIssuedInviteBanner` renders raw link + shareText with copy button + `navigator.share()`; (5) `__tests__/admin-invites.test.js` covers sendEmail/shareText semantics. **Fresh rerun 2026-08-23 at main HEAD `09d56fd`: admin-invites + hysteresis suites 32/32 green.** Follow-ups landed after: DC-089 email masking (commit `6732a1e`, glm-grade=B), DC-093 `/auth/me` hotfix (`5add962`, glm-grade=B). - **details:** Today `POST /api/v1/auth/admin/invites` defaults to sending the invite link via SMTP; if SMTP is not configured it spams the server console with `[DC-048-DEV-INVITE-LINK]` log lines. Sami wants Discord-style: the link is always returned in the response, and email is an opt-in checkbox. Operators should be free to copy the link and share it via iMessage / SMS / WhatsApp / Telegram / Signal / Discord / paste-in-email — whatever fits. (1) Flip default `sendEmail !== false` to `sendEmail === true` in `routes/auth/admin.js` so omitting the field means "no email, just hand me the link." (2) Stop logging the raw invite URL to error.log when SMTP is unconfigured — that path was only useful when there was no UI way to grab the link; now there is. (3) Add a `shareText` field to the response: `"Join my DashCaddy as — expires in Nh."` for one-tap paste into any messenger. (4) Frontend: `status/js/admin.js` `_renderInviteForm` flips the "Send email" checkbox default to **unchecked**, updates `_renderIssuedInviteBanner` to show both the raw link AND the shareText (with its own copy button + `navigator.share()` native share-sheet button where available). (5) New tests in `__tests__/admin-invites.test.js` covering: default sendEmail=false (no SMTP send attempted, no console log); `sendEmail: true` triggers SMTP send; `shareText` is present and well-formed; `acceptUrl` is always returned; expired sendEmail path doesn't leak token to logs. Effort: ~1 hr. Risk: low — pure behavior flip + UI additive change. - **impact:** Closes the friction between "host wants to add a friend" and "host has to configure SMTP first." Mirrors Discord/Slack/Linear invite flows where the link IS the deliverable. No new tier changes, no schema breaks. - **prerequisite:** DC-048 (invite store + admin route), DC-052 (Pro gate stays).