Skip to content

feat: metrics endpoint, RFC 8058 unsubscribe, CI workflow, and Biome linting#204

Open
Darkdante9 wants to merge 1 commit into
Dgetsylver:mainfrom
Darkdante9:main
Open

feat: metrics endpoint, RFC 8058 unsubscribe, CI workflow, and Biome linting#204
Darkdante9 wants to merge 1 commit into
Dgetsylver:mainfrom
Darkdante9:main

Conversation

@Darkdante9
Copy link
Copy Markdown

Summary

  • E8: Public Grafana / Prometheus dashboard #65 E8 — Add GET /metrics (Prometheus text format) to the Worker exposing subscriber counters per pool, leverage bracket, and asset. Bearer-token auth via METRICS_TOKEN secret (optional). Grafana dashboard committed as dashboards/turbolong-overview.json (importable JSON).
  • E10: RFC 8058 one-click unsubscribe #67 E10 — Attach List-Unsubscribe and List-Unsubscribe-Post: List-Unsubscribe=One-Click headers to every alert email. POST /unsubscribe?token=… now handles one-click POSTs silently (HTTP 200, no body) per RFC 8058.
  • F1: GitHub Actions CI (lint + tests on PR) #68 F1 — Add .github/workflows/ci.yml with four jobs on PR + push to main: frontend (tsc + vite build + vitest), rust (check + clippy + test), worker (tsc), lint (biome lint + format check).
  • F2: Biome or ESLint + Prettier config committed #69 F2 — Commit biome.json at repo root (2-space indent, double quotes, semicolons, 100-char line width, recommended rules). Add @biomejs/biome devDependency and lint / format / format:check scripts to frontend/package.json and alerts/package.json.

Files changed

File Task
alerts/src/index.ts #65, #67
alerts/src/email.ts #67
dashboards/turbolong-overview.json #65
.github/workflows/ci.yml #68
biome.json #69
frontend/package.json #69
alerts/package.json #69

Test plan

  • Deploy Worker to staging and curl /metrics — verify Prometheus text format response
  • Test /metrics with and without METRICS_TOKEN set
  • Import dashboards/turbolong-overview.json into a Grafana instance and confirm panels render
  • Send an APY alert email and inspect raw headers for List-Unsubscribe and List-Unsubscribe-Post
  • POST to /unsubscribe?token=<valid> and confirm HTTP 200 with empty body
  • Confirm CI jobs pass on this PR
  • Run npm run lint and npm run format:check locally in frontend/ and alerts/

Closes #65
Closes #67
Closes #68
Closes #69

…linting

Dgetsylver#65 — Prometheus /metrics endpoint and Grafana dashboard
- Add GET /metrics to the Cloudflare Worker that emits subscriber-level
  counters in Prometheus text format (v0.0.4):
    turbolong_subscribers_total
    turbolong_subscribers_by_pool{pool="…"}
    turbolong_subscribers_by_leverage{leverage="…x"}
    turbolong_subscribers_by_asset{asset="…"}
- Auth: set METRICS_TOKEN secret for Bearer-token gating; unset = public.
- Rate-limiting: delegate to a Cloudflare WAF rule (no Worker state needed).
- Add dashboards/turbolong-overview.json — importable Grafana dashboard
  with stat, bar-chart, and table panels wired to the above metrics.

Dgetsylver#67 — RFC 8058 one-click unsubscribe
- sendEmail() now accepts an optional extraHeaders map forwarded to the
  Resend API's headers field.
- sendApyAlert() attaches List-Unsubscribe and List-Unsubscribe-Post
  headers on every alert email so Gmail, Apple Mail, and other major
  clients render a native unsubscribe button.
- /unsubscribe now handles POST (RFC 8058 one-click flow): silently
  deletes the subscription and returns HTTP 200 with no body — no
  confirmation page required.

Dgetsylver#68 — GitHub Actions CI
- Add .github/workflows/ci.yml with four jobs triggered on push to main
  and every pull request:
    frontend  — npm ci, tsc --noEmit, vite build, vitest run
    rust      — cargo check, cargo clippy -D warnings, cargo test
    worker    — npm ci, tsc --noEmit (alerts Worker)
    lint      — biome lint + biome format check across frontend/src and alerts/src

Dgetsylver#69 — Biome formatter and linter
- Add biome.json at the repo root: 2-space indent, double quotes,
  semicolons, 100-char line width, recommended lint rules with
  noExplicitAny disabled (idiomatic for Worker / RPC glue code).
- Add @biomejs/biome ^1.9.4 to devDependencies in frontend/package.json
  and alerts/package.json.
- Add lint, format, and format:check npm scripts to both packages.

Closes Dgetsylver#65
Closes Dgetsylver#67
Closes Dgetsylver#68
Closes Dgetsylver#69
@drips-wave
Copy link
Copy Markdown

drips-wave Bot commented May 29, 2026

@Darkdante9 Great news! 🎉 Based on an automated assessment of this PR, the linked Wave issue(s) no longer count against your application limits.

You can now already apply to more issues while waiting for a review of this PR. Keep up the great work! 🚀

Learn more about application limits

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

1 participant