Skip to content

Commit 86e2a2e

Browse files
authored
fix: set version in ActivateDataSet call and persist clearing account config (#1253)
* 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 1202a9b commit 86e2a2e

1 file changed

Lines changed: 2 additions & 1 deletion

File tree

cmd/seed-demo/main.go

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -473,7 +473,8 @@ func seedMarketData(ctx context.Context, conn *grpc.ClientConn) error {
473473

474474
// Activate dataset so observations can be recorded
475475
_, err = client.ActivateDataSet(ctx, &marketv1.ActivateDataSetRequest{
476-
Code: "WHOLESALE_ENERGY_GBP_KWH",
476+
Code: "WHOLESALE_ENERGY_GBP_KWH",
477+
Version: 1,
477478
})
478479
if err == nil {
479480
fmt.Println(" Activated dataset: WHOLESALE_ENERGY_GBP_KWH")

0 commit comments

Comments
 (0)