docfast session 99: usage middleware tests (177 total)

This commit is contained in:
Hoid 2026-02-26 13:05:15 +00:00
parent f7ddc55b47
commit 78bcdfe01d
5 changed files with 75 additions and 6 deletions

View file

@ -1,5 +1,15 @@
# Session Log # Session Log
## Session 99 — 2026-02-26 13:00 UTC (Thursday Afternoon)
- **Production:** v0.5.1 ✅ healthy, 2 replicas, 0 restarts
- **Staging:** v0.5.1 ✅ healthy (3 test-only commits ahead of prod)
- **K8s cluster:** All 3 nodes Ready
- **Support:** Zero tickets
- **Proactive improvements completed:**
1. **Usage middleware tests** — New `src/__tests__/usage.test.ts` with 14 tests covering: loadUsageData (DB populate, empty results, error handling), getUsageStats (unknown key, masking), usageMiddleware (free/pro under limit → next(), free 100 → 429, pro 5000 → 429, count increment, month reset, missing apiKeyInfo).
2. **177 tests total** (up from 163), all passing across 13 test files.
- **Investor test:** All 5 checks pass ✅
## Session 98 — 2026-02-26 10:00 UTC (Thursday Mid-Morning) ## Session 98 — 2026-02-26 10:00 UTC (Thursday Mid-Morning)
- **Production:** v0.5.1 ✅ healthy, 2 replicas, 0 restarts - **Production:** v0.5.1 ✅ healthy, 2 replicas, 0 restarts
- **Staging:** v0.5.1 ✅ healthy - **Staging:** v0.5.1 ✅ healthy

View file

@ -3,7 +3,7 @@
"phaseLabel": "Build Production-Grade Product", "phaseLabel": "Build Production-Grade Product",
"status": "launch-ready", "status": "launch-ready",
"product": "DocFast — HTML/Markdown to PDF API", "product": "DocFast — HTML/Markdown to PDF API",
"currentPriority": "Production on v0.5.1, staging 2 commits ahead (test-only). Test suite: 163 tests passing (12 test files), 0 npm vulnerabilities. Still need SDK tokens + GSC verification.", "currentPriority": "Production on v0.5.1, staging 3 commits ahead (test-only). Test suite: 177 tests passing (13 test files), 0 npm vulnerabilities. Still need SDK tokens + GSC verification.",
"ownerDirectives_PRIORITY": "Process these IN ORDER. Do not skip. Remove items marked ✅ DONE/FIXED during housekeeping.", "ownerDirectives_PRIORITY": "Process these IN ORDER. Do not skip. Remove items marked ✅ DONE/FIXED during housekeeping.",
"ownerDirectives": [ "ownerDirectives": [
"Stripe Product ID for DocFast: prod_TygeG8tQPtEAdE — webhook handler must filter by this product_id to ignore events from other projects on the same Stripe account." "Stripe Product ID for DocFast: prod_TygeG8tQPtEAdE — webhook handler must filter by this product_id to ignore events from other projects on the same Stripe account."
@ -85,5 +85,5 @@
}, },
"blockers": [], "blockers": [],
"startDate": "2026-02-14", "startDate": "2026-02-14",
"sessionCount": 98 "sessionCount": 99
} }

View file

@ -60,6 +60,23 @@
- **Deployed to staging:** Yes (commit db1fa8d). Full link crawl: zero 404s across all pages. - **Deployed to staging:** Yes (commit db1fa8d). Full link crawl: zero 404s across all pages.
- **Production:** Awaiting investor approval for v* tag - **Production:** Awaiting investor approval for v* tag
### BUG-012: /health reports hardcoded version 0.1.0 (LOW) — IN PROGRESS
- **Found:** Session 27
- **Impact:** Health endpoint shows wrong version, makes monitoring/debugging harder
- **Fix:** Read version from package.json dynamically
- **Status:** Sub-agent working on fix
### BUG-013: OpenAPI spec stale — missing GET /v1/screenshot, /v1/usage; has removed /v1/signup/free (MEDIUM) — IN PROGRESS
- **Found:** Session 27
- **Impact:** API docs misleading for developers
- **Status:** Sub-agent working on fix
### BUG-014: /usage.html missing from production (MEDIUM)
- **Found:** Session 27
- **Impact:** Landing page may link to usage dashboard that doesn't exist on production
- **Root cause:** v0.5.2 image was built before usage dashboard commit (5b59a7a)
- **Fix:** Needs new production deploy after staging verified
## Open ## Open
### BUG-007: Simultaneous browser restart causes QUEUE_FULL (HIGH) — FIXED (staging) ### BUG-007: Simultaneous browser restart causes QUEUE_FULL (HIGH) — FIXED (staging)

View file

@ -1,5 +1,47 @@
# SnapAPI Session Log # SnapAPI Session Log
## Session 27 — 2026-02-26 11:00 UTC (Quality Fixes + State Accuracy Audit)
**Goal:** Fix documentation/API accuracy issues, audit state.json accuracy.
### Findings
1. **State.json was inaccurate** — claimed "v0.5.2 deployed with all staging features" but production is missing `usage.html` (added in commit 5b59a7a, after v0.5.2 image was built). Fixed state.json.
2. **`/health` reports version `0.1.0`** — hardcoded, never updated
3. **OpenAPI spec stale** — missing GET /v1/screenshot, GET /v1/usage; still had removed /v1/signup/free
4. **Container registry push broken** — token lacks `write:package` scope (same root cause as CI/CD blocker)
### What Was Done
1. **Spawned backend dev** (TDD approach):
- Bumped `package.json` version to `0.6.0`
- Fixed `/health` to read version from `package.json` dynamically
- Removed `/v1/signup/free` from OpenAPI spec
- Added 3 new OpenAPI spec tests
- Tests: 136 passing (up from 133), all green
- Commit: `2eca4e7` pushed to main
- **NOT deployed** — can't push Docker image (registry auth issue)
2. **Filed new bugs**: BUG-012 (health version), BUG-013 (OpenAPI), BUG-014 (usage.html missing from prod)
3. **Fixed state.json** — corrected version info and deployment status
### Investor Test
1. Trust with money? **Mostly** — Stripe checkout works, webhook unregistered
2. Data loss on crash? **No** — PostgreSQL
3. Free tier abuse? **Low** — playground IP-limited + watermarked
4. Key recovery? **Yes on staging**, production has recovery.html but image may be stale
5. Website features? **Mostly** — usage page 404 on production
### Blockers
- **Container registry push** — Forgejo token needs `write:package` scope (blocks ALL deploys)
- **Stripe webhook** — needs dashboard registration
- **CI/CD** — blocked by same Forgejo token issue
**Assessment:** Code improvements pushed but deployment pipeline is broken. Need Forgejo API token with `write:package` scope to unblock ALL deployment.
---
## Session 26 — 2026-02-26 08:00 UTC (Morning Health Check) ## Session 26 — 2026-02-26 08:00 UTC (Morning Health Check)
**Goal:** Morning health check, verify systems, push for production deploy. **Goal:** Morning health check, verify systems, push for production deploy.

View file

@ -1,11 +1,11 @@
{ {
"phase": "production-live", "phase": "production-live",
"version": "0.5.2-prod / 0.5.2-staging", "version": "0.5.2-prod (missing usage dashboard+v0.6.0 fixes) / 0.5.2-staging (also missing v0.6.0, deploy blocked)",
"staging": { "staging": {
"status": "running", "status": "running",
"namespace": "snapapi-staging", "namespace": "snapapi-staging",
"replicas": 1, "replicas": 1,
"image": "git.cloonar.com/openclawd/snapapi:b2688c0cce6dc8d5a97907c050da3b6143e86228", "image": "git.cloonar.com/openclawd/snapapi:5b59a7a01078ad1f296feb80a8feddd149e8e6a1",
"healthCheck": "passing" "healthCheck": "passing"
}, },
"production": { "production": {
@ -68,7 +68,7 @@
"CI/CD pipeline: workflows updated, RBAC+kubeconfig ready, BLOCKED on Forgejo token scope (needs write:repository)", "CI/CD pipeline: workflows updated, RBAC+kubeconfig ready, BLOCKED on Forgejo token scope (needs write:repository)",
"Staging TLS (blocked on DNS for staging.snapapi.eu — no DNS record exists)", "Staging TLS (blocked on DNS for staging.snapapi.eu — no DNS record exists)",
"External uptime monitoring (no UptimeRobot account/key)", "External uptime monitoring (no UptimeRobot account/key)",
"Deploy all staging features to production — DONE (v0.5.2 deployed 2026-02-26)" "Deploy staging features to production — PARTIAL (v0.5.2 deployed but missing usage dashboard, openapi updates)"
], ],
"stripeProducts": { "stripeProducts": {
"starter": { "starter": {
@ -84,6 +84,6 @@
"priceId": "price_1T2XHpRtlDv9c8GoThHfd8kS" "priceId": "price_1T2XHpRtlDv9c8GoThHfd8kS"
} }
}, },
"lastSession": "2026-02-25T14:00:00Z", "lastSession": "2026-02-26T11:00:00Z",
"codeLocation": "Forgejo repo openclawd/SnapAPI. Clone: git clone forgejo-snapapi:openclawd/SnapAPI.git" "codeLocation": "Forgejo repo openclawd/SnapAPI. Clone: git clone forgejo-snapapi:openclawd/SnapAPI.git"
} }