commerce: reconciliation queries + federated-catalog stub (32 tests) — Phase 4 done
Some checks failed
Test, Build, and Deploy / test-build-deploy (push) Has been cancelled
Some checks failed
Test, Build, and Deploy / test-build-deploy (push) Has been cancelled
recon.sx — reconciliation as relational queries over the ledger: per-order summary tuples + recon-statuso/neto/mismatcho miniKanren relations, so overpaid/underpaid/settled and "settled to net N" are backward run* queries. Tests cover double-charge guard, partial refund, webhook replay. federation.sx (out-of-scope stub) — a federated catalog is the union of each instance's product facts, so the same relations query cross-instance (instances-with-sku, sku-offers, cheapest-offer). In-process mock, no network. Completes the commerce-on-sx roadmap (Phases 1-4). Total 185/185 across 11 suites. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -21,7 +21,7 @@ reconciliation — all auditable via the event log.
|
||||
|
||||
## Status (rolling)
|
||||
|
||||
`bash lib/commerce/conformance.sh` → **153/153** (9 suites: catalog, cart, price, api, promo, stack, quote, ledger, order) — Phases 1-3 done
|
||||
`bash lib/commerce/conformance.sh` → **185/185** (11 suites: catalog, cart, price, api, promo, stack, quote, ledger, order, recon, federation) — **Phases 1-4 done (roadmap complete)**
|
||||
|
||||
## Ground rules
|
||||
|
||||
@@ -71,11 +71,24 @@ lib/commerce/api.sx ── (commerce/add) (commerce/total) (commerce/checkout)
|
||||
- [x] order ledger as a `persist` stream; idempotent reconciliation
|
||||
|
||||
## Phase 4 — Reconciliation + federation
|
||||
- [ ] mismatch detection (paid≠ordered) as queries over the ledger
|
||||
- [ ] cross-instance catalog (federated marketplace) — out-of-scope stub
|
||||
- [ ] tests: webhook replay, partial refund, double-charge guard
|
||||
- [x] mismatch detection (paid≠ordered) as queries over the ledger
|
||||
- [x] cross-instance catalog (federated marketplace) — out-of-scope stub
|
||||
- [x] tests: webhook replay, partial refund, double-charge guard
|
||||
|
||||
## Progress log
|
||||
- 2026-06-07 — `recon.sx` + `federation.sx` (**Phase 4 complete — roadmap done**).
|
||||
`recon.sx`: reconciliation as relational queries over the ledger. Per-order
|
||||
summary tuples (id total paid refunded net status); `recon-statuso`/`neto`/
|
||||
`mismatcho` are miniKanren relations, so "which orders are overpaid?",
|
||||
"settled to net N?" are backward `run*` queries. Helpers: overpaid/underpaid/
|
||||
settled/unpaid-orders, mismatched-orders, orders-with-net, ledger-discrepancy.
|
||||
Tests cover double-charge guard (two refs → :overpaid), partial refund (net <
|
||||
total → :underpaid), webhook replay (same ref twice → single :paid, :ok). 20/20.
|
||||
`federation.sx` (out-of-scope stub): a federated catalog is the UNION of each
|
||||
instance's product facts, so the SAME relations query cross-instance —
|
||||
`fed-producto`/`fed-priceo`, `instances-with-sku`, `sku-offers`, deterministic
|
||||
`cheapest-offer`. In-process mock, no real network/ActivityPub. 12/12.
|
||||
Total 185/185 across 11 suites.
|
||||
- 2026-06-07 — `order.sx` (**Phase 3 complete**, checkboxes 1-2): order lifecycle
|
||||
as a flow-on-sx flow `(lambda (oid) (begin (request 'reserve oid) (request
|
||||
'payment oid) (request 'fulfil oid)))` — pure orchestration carrying only the
|
||||
|
||||
Reference in New Issue
Block a user