zapier-decisions/plans/qa/2026-10-03-retest-completedAt-credits.md

86 lines
4.8 KiB
Markdown
Raw Blame History

This file contains invisible Unicode characters

This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

# QA Retest — completedAt sanitize + durable credit ledger
**Role:** QA (evaluate + record; implementation already deployed this session)
**Date:** 2026-10-03 (UTC probe ~06:50)
**Host:** `NS1.GEORGELAMBERT.ORG` / `70.88.205.138`
**Prior:** [`2026-10-03-retest-mg3.md`](./2026-10-03-retest-mg3.md)
**Scope:** Retest userflows **2–4** after (1) middleware `sanitizeVeraePayload` strips Go zero `completedAt`, (2) edge `SqliteCreditLedger` + `credit_adjustments` on `billing.db`, (3) facade statement reads that table.
**Constraints honored:** No Go `blockchain.db` writes (mtime still 2026-09-25); no JetStream for `verae.ts.*`; meter appends only from normal stamp probes; intentional CS credit adjusts were lab smoke only (`+100`, `+50` on `cust_1`).
---
## Summary judgment
**Flow 2 remains PASS.** Digests-only single + batch on `:3040` return **202**, credit headers present, idempotent re-stamp `created:0` / spend **0**. Balance header now shows prepaid **100** (was 0) after durable credit smoke.
**Flow 3 moves FAIL → PARTIAL.** Single `POST /v1/timestamp` receipts **no longer** carry `completedAt:"0001-01-01T00:00:00Z"` (field omitted on async accept). Full async complete → Zapier REST Hook E2E is still unproven.
**Flow 4 moves PARTIAL → stronger PARTIAL.** Edge `POST /admin/api/credits` persists to `billing.db.credit_adjustments`; survives edge restart; `:3010/statement/cust_1` returns `credits_n=2`, `prepaidCents=150`, `source:"billing.db"`. CS health still `booksWrites:false`. MG3 still **not** met (sqlite-file, not libSQL; `:3010` `nats:false`; freeze still constrains production NATS adjust).
---
## What shipped this session
| Item | Where | Evidence |
|------|-------|----------|
| `sanitizeVeraeTime.js` + wire in `veraeClient.request()` | `/opt/verae/verae-zapier-middleware` | Live single stamp body has no `0001-01-01` |
| `SqliteCreditLedger` + `credit_adjustments` DDL | `/opt/verae/zappier-edge` | Table rows; list after restart |
| `BusinessStore.adjustBalanceCredits` logs credit row | sqlite-file + libsql stores | Unit tests green |
| Facade statement reads `credit_adjustments` | `zappier-account-balance` `billing-store.js` | `:3010` credits_n=2 |
---
## Health matrix
| Port | Role | Result |
|------|------|--------|
| `:3040` | zappier-edge | **200** |
| `:3130` | middleware product | **200** `mockVerae:false`, `natsConnected:true` |
| `:3100` | middleware mock | **200** `mockVerae:true` (do not smoke product here) |
| `:3010` | account-balance facade | **200** `facade:true`, `nats:false`, `billingDb` set |
| `:3011` | CS | **200** `edge` + `booksWrites:false` |
| `:3012` | sales | **200** `booksWrites:false` |
| `:3013` | accounting-export | **200** `booksWrites:false` |
Go DB: `/var/lib/timestamping-svc/data/blockchain.db` mtime **2026-09-25**, size ~31 MB — **untouched**.
---
## Userflows 2–4
| # | Userflow | Score | Evidence |
|---|----------|-------|----------|
| 2 | Stamp digests single + batch + credit headers | **PASS** | Single 202 + headers Spend 10 / Balance 100 / Period 130→150; batch create+idempotent 202; no Go-zero |
| 3 | Async complete → Zapier REST Hook | **PARTIAL** | Accept receipts omit Go-zero `completedAt`; no watch→events→webhook E2E in this probe |
| 4 | CS credit adjust → portal/statement balance | **PARTIAL** | Edge credits 201; facade statement prepaid **150**, credits `[qa-retest-f4, durable-ledger-smoke]`; CS `booksWrites:false`; NATS adjust path still `nats:false` on `:3010` |
---
## MG3 checklist (unchanged overall)
| Criterion | Result |
|-----------|--------|
| One meter writer (edge BusinessStore → billing.db) | **PASS** (lab) |
| Durable credit log on same SoT | **PASS** (new) |
| One prepaid writer on **libSQL** | **FAIL** — still `BUSINESS_STORE=sqlite-file` |
| Production NATS `balance.adjust` unfrozen | **FAIL** — freeze + `:3010` `nats:false` |
| D004 leaf deny ≠ bare 404 | **not retested** this probe |
**Verdict:** Do **not** mark MG3 PASS. Lab prepaid/credit history is now durable on `billing.db`; multi-host libSQL cutover and NATS adjust unfreeze remain blockers.
---
## Remaining gaps (short)
1. Full flow 3: job watch → `verae.ts.completed` (core NATS) → webhook deliver E2E
2. Edge batch still falls through to local mock when upstream path is `/api/batch/timestamp` (middleware only has `/zapier/v1/timestamp/batch`) — product batch authenticity gap
3. MG3 / WP-O: `BUSINESS_STORE=libsql` + freeze lift for adjust
4. Automated harness WP-P for flows 1–7
---
## Probe digests (this run)
- Single: `0d7d7500c29a5d7f5804dd2891e7b7e18a55222e59531104d1324defaa87a626` → jobId `4a6536a5-…`
- Batch: `b9a8b9842ed58de6c1cd621f4644547e19803a157f277610211bebc15b9584dd` → created then existing
- Credits: `durable-ledger-smoke` (+100), `qa-retest-f4` (+50) → prepaid **150**