feat(ration): REST/JSON facade over gateway, final phase-2 doc updates
Phase 2 section 7 (the other half, alongside sdk/go/ration and
sdk/rust/ration-client already pushed in c5297e4/8215fb8): a hand-rolled
internal/httpapi on services/gateway translating JSON <-> the gRPC source
of truth (cards, deposits, bridge funding, activity), documented as a
convenience facade over gRPC, not a parallel implementation. Also folds in
the remaining phase-2 doc updates (ARCHITECTURE/RUNBOOK/THREAT-MODEL/
AIRWALLEX-SETUP/SUBMISSION, ADR 0003/0004) and docker-compose/Makefile/
.env.example wiring from the resumed phase-2 workflow's final agents.
Verified: go build/vet/test clean across all 10 services + both new SDKs,
`make build && make test` clean end to end (C WAL, Rust ledger-core + the
new Rust SDK, every Go module including sdk/go/ration).
Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
2026-10-19 12:56:58 +03:00
|
|
|
.PHONY: proto build build-wal build-ledger build-go build-sdk test lint run-demo clean observability-up observability-down
|
2026-10-19 02:06:21 +03:00
|
|
|
|
|
|
|
|
PROTOC_GEN := scripts/gen-proto.sh
|
|
|
|
|
|
|
|
|
|
proto:
|
|
|
|
|
bash $(PROTOC_GEN)
|
|
|
|
|
|
|
|
|
|
build-wal:
|
|
|
|
|
$(MAKE) -C services/wal
|
|
|
|
|
|
|
|
|
|
build-ledger: build-wal
|
|
|
|
|
cd services/ledger-core && cargo build --release
|
|
|
|
|
|
|
|
|
|
build-go:
|
|
|
|
|
cd services/gateway && go build -o ../../bin/gateway ./cmd/gateway
|
feat(ration): REST/JSON facade over gateway, final phase-2 doc updates
Phase 2 section 7 (the other half, alongside sdk/go/ration and
sdk/rust/ration-client already pushed in c5297e4/8215fb8): a hand-rolled
internal/httpapi on services/gateway translating JSON <-> the gRPC source
of truth (cards, deposits, bridge funding, activity), documented as a
convenience facade over gRPC, not a parallel implementation. Also folds in
the remaining phase-2 doc updates (ARCHITECTURE/RUNBOOK/THREAT-MODEL/
AIRWALLEX-SETUP/SUBMISSION, ADR 0003/0004) and docker-compose/Makefile/
.env.example wiring from the resumed phase-2 workflow's final agents.
Verified: go build/vet/test clean across all 10 services + both new SDKs,
`make build && make test` clean end to end (C WAL, Rust ledger-core + the
new Rust SDK, every Go module including sdk/go/ration).
Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
2026-10-19 12:56:58 +03:00
|
|
|
cd services/auth && go build -o ../../bin/auth ./cmd/auth
|
|
|
|
|
cd services/tenant-registry && go build -o ../../bin/tenant-registry ./cmd/tenant-registry
|
|
|
|
|
cd services/card-issuance && go build -o ../../bin/card-issuance ./cmd/card-issuance
|
|
|
|
|
cd services/webhook-ingestion && go build -o ../../bin/webhook-ingestion ./cmd/webhook-ingestion
|
2026-10-19 02:06:21 +03:00
|
|
|
cd services/agent && go build -o ../../bin/agent ./cmd/agent
|
|
|
|
|
cd services/tui && go build -o ../../bin/tui ./cmd/tui
|
|
|
|
|
cd services/cli && go build -o ../../bin/ration ./cmd/ration
|
2026-10-19 12:25:41 +03:00
|
|
|
cd services/audit-log && go build -o ../../bin/audit-log ./cmd/audit-log
|
feat(audit-log): standalone verify-chain tool, independent of the live service
Closes docs/THREAT-MODEL.md's "A compromised audit-log" Repudiation
gap (item 9's precise TODO): VerifyChain was only exposed as
audit-log's own RPC, so a compromised audit-log process could simply
lie about its own integrity. internal/store.VerifyFile re-derives the
hash chain directly from the on-disk audit.log file, opened strictly
read-only (O_RDONLY, never O_RDWR), with no Store/gRPC involvement —
the same per-record checks replay()/VerifyChain() already perform, but
reporting every failure (corrupt record, broken chain, non-contiguous
sequence) as a result rather than requiring a live, trusted process to
ask.
services/audit-log/cmd/verify-chain wraps it as an operator-run CLI
(`verify-chain [path]`, defaulting to
$RATION_AUDIT_LOG_DATA_DIR/audit.log) that dials nothing and exits
nonzero on any break or unreadable file — safe to wire into a health
check or an out-of-band cron, independent of whether the audit-log
binary itself would lie about VerifyChain's RPC result.
Manually verified end-to-end against a real generated audit.log:
intact chain exits 0, a payload_json edit without hash recomputation
is detected and exits 1 with the exact broken sequence. RED->GREEN
with new store/cmd test suites; added to `make build-go`.
Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
2026-10-21 18:34:05 +03:00
|
|
|
cd services/audit-log && go build -o ../../bin/verify-chain ./cmd/verify-chain
|
2026-10-19 02:06:21 +03:00
|
|
|
|
feat(ration): REST/JSON facade over gateway, final phase-2 doc updates
Phase 2 section 7 (the other half, alongside sdk/go/ration and
sdk/rust/ration-client already pushed in c5297e4/8215fb8): a hand-rolled
internal/httpapi on services/gateway translating JSON <-> the gRPC source
of truth (cards, deposits, bridge funding, activity), documented as a
convenience facade over gRPC, not a parallel implementation. Also folds in
the remaining phase-2 doc updates (ARCHITECTURE/RUNBOOK/THREAT-MODEL/
AIRWALLEX-SETUP/SUBMISSION, ADR 0003/0004) and docker-compose/Makefile/
.env.example wiring from the resumed phase-2 workflow's final agents.
Verified: go build/vet/test clean across all 10 services + both new SDKs,
`make build && make test` clean end to end (C WAL, Rust ledger-core + the
new Rust SDK, every Go module including sdk/go/ration).
Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
2026-10-19 12:56:58 +03:00
|
|
|
# sdk/go/ration and sdk/rust/ration-client (docs/SCALE-EXPANSION.md
|
|
|
|
|
# section 7) are libraries, not deployables — "build" here means a
|
|
|
|
|
# compile check (go build / cargo build), there is no bin/ artifact to
|
|
|
|
|
# produce for either.
|
|
|
|
|
build-sdk:
|
|
|
|
|
cd sdk/go/ration && go build ./...
|
|
|
|
|
cd sdk/rust/ration-client && cargo build --release
|
|
|
|
|
|
|
|
|
|
build: proto build-ledger build-go build-sdk
|
2026-10-19 02:06:21 +03:00
|
|
|
|
|
|
|
|
test:
|
|
|
|
|
$(MAKE) -C services/wal test
|
|
|
|
|
cd services/ledger-core && cargo test
|
feat: Ration phase 1 — full polyglot build for Airwallex Starter Kit 5
Six services, independently built then integrated:
- services/wal (C): crash-safe write-ahead log, CRC32-checksummed
frames, torn-write recovery via truncate-to-last-valid-frame.
- services/ledger-core (Rust): double-entry ledger over the C WAL via
FFI, reserve-floor enforcement BEFORE any WAL write, idempotent
ApplyEntry, full LedgerCore gRPC service.
- services/gateway (Go): Airwallex Issuing/Global-Accounts client
(mock mode default, live mode ready), the actual rationing math
(reserve floor, 60% bridge cap, 24h velocity cap, partial-over-decline).
- services/agent (Go): deterministic hard-rule policy envelope computed
BEFORE any LLM call; Claude only decides within that pre-approved
envelope; every decision audit-logged even when the LLM call fails.
- services/tui (Go, Bubble Tea) + services/cli (Go, cobra): the only
UI — no web frontend, per explicit direction.
Integration found and fixed three real bugs, not just compile errors:
- proto regen collision shadowing checked-in pkg/pb packages
- ledger-core/gateway address-variable mismatch (stack would never
actually connect on default config)
- the big one: MarkDepositReceived never credited the ledger, so every
tenant's balance was permanently stuck at 0 and bridge-funding could
only ever decline — the core agentic-rationing feature could never
produce a real grant. Fixed at the ledger level with idempotent
mark-and-credit in one WAL frame, covered by 3 new tests.
End-to-end verified live, reproducibly: seed -> simulate a late deposit
-> agent grants a partial bridge with a computed rationale -> second
grant correctly declines once the 24h velocity cap engages. Verified
independently by the orchestrator too: 'make build' and 'make test'
both clean (Rust: 29 tests; Go: all packages; C: WAL test suite).
Airwallex sandbox credentials still pending organizer approval —
tracked as an owner blocker in docs/AIRWALLEX-SETUP.md, not a code gap.
2026-10-19 03:04:13 +03:00
|
|
|
cd pkg && go test ./...
|
2026-10-19 02:06:21 +03:00
|
|
|
cd services/gateway && go test ./...
|
feat(ration): REST/JSON facade over gateway, final phase-2 doc updates
Phase 2 section 7 (the other half, alongside sdk/go/ration and
sdk/rust/ration-client already pushed in c5297e4/8215fb8): a hand-rolled
internal/httpapi on services/gateway translating JSON <-> the gRPC source
of truth (cards, deposits, bridge funding, activity), documented as a
convenience facade over gRPC, not a parallel implementation. Also folds in
the remaining phase-2 doc updates (ARCHITECTURE/RUNBOOK/THREAT-MODEL/
AIRWALLEX-SETUP/SUBMISSION, ADR 0003/0004) and docker-compose/Makefile/
.env.example wiring from the resumed phase-2 workflow's final agents.
Verified: go build/vet/test clean across all 10 services + both new SDKs,
`make build && make test` clean end to end (C WAL, Rust ledger-core + the
new Rust SDK, every Go module including sdk/go/ration).
Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
2026-10-19 12:56:58 +03:00
|
|
|
cd services/auth && go test ./...
|
|
|
|
|
cd services/tenant-registry && go test ./...
|
|
|
|
|
cd services/card-issuance && go test ./...
|
|
|
|
|
cd services/webhook-ingestion && go test ./...
|
2026-10-19 02:06:21 +03:00
|
|
|
cd services/agent && go test ./...
|
feat: Ration phase 1 — full polyglot build for Airwallex Starter Kit 5
Six services, independently built then integrated:
- services/wal (C): crash-safe write-ahead log, CRC32-checksummed
frames, torn-write recovery via truncate-to-last-valid-frame.
- services/ledger-core (Rust): double-entry ledger over the C WAL via
FFI, reserve-floor enforcement BEFORE any WAL write, idempotent
ApplyEntry, full LedgerCore gRPC service.
- services/gateway (Go): Airwallex Issuing/Global-Accounts client
(mock mode default, live mode ready), the actual rationing math
(reserve floor, 60% bridge cap, 24h velocity cap, partial-over-decline).
- services/agent (Go): deterministic hard-rule policy envelope computed
BEFORE any LLM call; Claude only decides within that pre-approved
envelope; every decision audit-logged even when the LLM call fails.
- services/tui (Go, Bubble Tea) + services/cli (Go, cobra): the only
UI — no web frontend, per explicit direction.
Integration found and fixed three real bugs, not just compile errors:
- proto regen collision shadowing checked-in pkg/pb packages
- ledger-core/gateway address-variable mismatch (stack would never
actually connect on default config)
- the big one: MarkDepositReceived never credited the ledger, so every
tenant's balance was permanently stuck at 0 and bridge-funding could
only ever decline — the core agentic-rationing feature could never
produce a real grant. Fixed at the ledger level with idempotent
mark-and-credit in one WAL frame, covered by 3 new tests.
End-to-end verified live, reproducibly: seed -> simulate a late deposit
-> agent grants a partial bridge with a computed rationale -> second
grant correctly declines once the 24h velocity cap engages. Verified
independently by the orchestrator too: 'make build' and 'make test'
both clean (Rust: 29 tests; Go: all packages; C: WAL test suite).
Airwallex sandbox credentials still pending organizer approval —
tracked as an owner blocker in docs/AIRWALLEX-SETUP.md, not a code gap.
2026-10-19 03:04:13 +03:00
|
|
|
cd services/cli && go test ./...
|
|
|
|
|
cd services/tui && go test ./...
|
2026-10-19 12:25:41 +03:00
|
|
|
cd services/audit-log && go test ./...
|
feat(ration): REST/JSON facade over gateway, final phase-2 doc updates
Phase 2 section 7 (the other half, alongside sdk/go/ration and
sdk/rust/ration-client already pushed in c5297e4/8215fb8): a hand-rolled
internal/httpapi on services/gateway translating JSON <-> the gRPC source
of truth (cards, deposits, bridge funding, activity), documented as a
convenience facade over gRPC, not a parallel implementation. Also folds in
the remaining phase-2 doc updates (ARCHITECTURE/RUNBOOK/THREAT-MODEL/
AIRWALLEX-SETUP/SUBMISSION, ADR 0003/0004) and docker-compose/Makefile/
.env.example wiring from the resumed phase-2 workflow's final agents.
Verified: go build/vet/test clean across all 10 services + both new SDKs,
`make build && make test` clean end to end (C WAL, Rust ledger-core + the
new Rust SDK, every Go module including sdk/go/ration).
Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
2026-10-19 12:56:58 +03:00
|
|
|
cd sdk/go/ration && go test ./...
|
|
|
|
|
cd sdk/rust/ration-client && cargo test
|
2026-10-19 12:25:41 +03:00
|
|
|
|
|
|
|
|
lint:
|
|
|
|
|
bash scripts/pre-commit.sh
|
2026-10-19 02:06:21 +03:00
|
|
|
|
|
|
|
|
run-demo: build
|
|
|
|
|
./scripts/run-demo.sh
|
|
|
|
|
|
|
|
|
|
clean:
|
|
|
|
|
rm -rf bin services/wal/*.o services/wal/*.a services/wal/test_wal
|
|
|
|
|
cd services/ledger-core && cargo clean || true
|
feat(ration): REST/JSON facade over gateway, final phase-2 doc updates
Phase 2 section 7 (the other half, alongside sdk/go/ration and
sdk/rust/ration-client already pushed in c5297e4/8215fb8): a hand-rolled
internal/httpapi on services/gateway translating JSON <-> the gRPC source
of truth (cards, deposits, bridge funding, activity), documented as a
convenience facade over gRPC, not a parallel implementation. Also folds in
the remaining phase-2 doc updates (ARCHITECTURE/RUNBOOK/THREAT-MODEL/
AIRWALLEX-SETUP/SUBMISSION, ADR 0003/0004) and docker-compose/Makefile/
.env.example wiring from the resumed phase-2 workflow's final agents.
Verified: go build/vet/test clean across all 10 services + both new SDKs,
`make build && make test` clean end to end (C WAL, Rust ledger-core + the
new Rust SDK, every Go module including sdk/go/ration).
Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
2026-10-19 12:56:58 +03:00
|
|
|
cd sdk/rust/ration-client && cargo clean || true
|
2026-10-19 12:25:41 +03:00
|
|
|
|
|
|
|
|
# docs/SCALE-EXPANSION.md section 2: otel-collector + jaeger + prometheus
|
|
|
|
|
# + grafana only, without rebuilding/starting the four app services —
|
|
|
|
|
# useful when iterating on infra/otel-collector/config.yaml,
|
|
|
|
|
# infra/prometheus/prometheus.yml, or a Grafana dashboard without
|
|
|
|
|
# restarting ledger-core/gateway/agent/audit-log in the process.
|
|
|
|
|
observability-up:
|
|
|
|
|
docker compose up -d otel-collector jaeger prometheus grafana
|
|
|
|
|
|
|
|
|
|
observability-down:
|
|
|
|
|
docker compose stop otel-collector jaeger prometheus grafana
|