Commit 22ea4b4
authored
fix: activate dataset and persist clearing account config in demo compose (#1250)
* fix: wire deposit/withdrawal saga orchestration in unified binary
The unified binary's wireCurrentAccount used the basic NewService()
constructor which creates a Service without deposit/withdrawal
orchestrators, causing nil pointer panics on ExecuteDeposit calls.
Switch to NewServiceWithExistingClients() with loopback gRPC clients
for position-keeping and financial-accounting, enabling full Starlark
saga orchestration within the unified binary.
Also:
- Copy saga script assets into Docker image (SAGA_ASSET_DIR=/app)
- Fix init-databases.sql: meridian_internal_account → meridian_internal_bank_account
* fix: load clearing account config from env for deposit double-entry
Without a clearing account, the deposit saga only creates a CREDIT
posting (to customer). FA rejects the unbalanced booking log. Load
AccountConfig from DEPOSIT_CLEARING_ACCOUNT_ID env var so the saga
creates both DEBIT (clearing) and CREDIT (customer) postings.
Gracefully falls back to nil when env var is unset.
* fix: fail fast on invalid clearing account config
Differentiate "env var not set" (graceful skip) from "env var set but
invalid" (hard error) to avoid silently falling back to single-sided
postings when config is misconfigured.
* fix: use account_id for PK position logs in deposit and withdrawal sagas
The Starlark deposit and withdrawal scripts were passing
external_identifier (e.g. VE-GBP-010) as the position_id to
position_keeping.initiate_log, but the post-deposit balance query
uses account_id (e.g. ACC-xxx). This mismatch caused PK balance
lookups to fail with "no position logs found for account".
* fix: add required CEL expressions to seed-demo dataset registration
RegisterDataSet now requires validation_expression and
resolution_key_expression fields. Add appropriate CEL expressions
for the wholesale energy price dataset.
* fix: activate dataset before recording observations and persist clearing account config
- seed-demo: call ActivateDataSet after RegisterDataSet to transition
from DRAFT to ACTIVE before recording observations
- docker-compose: add DEPOSIT_CLEARING_ACCOUNT_ID env var passthrough
so it persists across deployments
- .env.demo.example: document the clearing account config
---------
Co-authored-by: Ben Coombs <bjcoombs@users.noreply.github.com>1 parent 313ab35 commit 22ea4b4
3 files changed
Lines changed: 18 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
471 | 471 | | |
472 | 472 | | |
473 | 473 | | |
| 474 | + | |
| 475 | + | |
| 476 | + | |
| 477 | + | |
| 478 | + | |
| 479 | + | |
| 480 | + | |
| 481 | + | |
| 482 | + | |
| 483 | + | |
474 | 484 | | |
475 | 485 | | |
476 | 486 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
148 | 148 | | |
149 | 149 | | |
150 | 150 | | |
| 151 | + | |
| 152 | + | |
| 153 | + | |
| 154 | + | |
| 155 | + | |
151 | 156 | | |
152 | 157 | | |
153 | 158 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
98 | 98 | | |
99 | 99 | | |
100 | 100 | | |
| 101 | + | |
| 102 | + | |
| 103 | + | |
101 | 104 | | |
102 | 105 | | |
103 | 106 | | |
| |||
0 commit comments