Commit cc33aea
authored
fix: register data source for seed-demo market observations (#1257)
* 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
* fix: register data source before recording market observations
RecordObservation requires a source_code identifying the data source.
Add RegisterDataSource call to create a SEED_DEMO source, and pass it
in each RecordObservationRequest. Extract price recording loop to
reduce cognitive complexity.
---------
Co-authored-by: Ben Coombs <bjcoombs@users.noreply.github.com>1 parent 5a62411 commit cc33aea
1 file changed
Lines changed: 33 additions & 7 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
482 | 482 | | |
483 | 483 | | |
484 | 484 | | |
485 | | - | |
486 | | - | |
| 485 | + | |
| 486 | + | |
| 487 | + | |
| 488 | + | |
| 489 | + | |
| 490 | + | |
| 491 | + | |
| 492 | + | |
| 493 | + | |
| 494 | + | |
| 495 | + | |
| 496 | + | |
| 497 | + | |
| 498 | + | |
| 499 | + | |
| 500 | + | |
| 501 | + | |
| 502 | + | |
| 503 | + | |
| 504 | + | |
| 505 | + | |
| 506 | + | |
| 507 | + | |
| 508 | + | |
| 509 | + | |
| 510 | + | |
| 511 | + | |
| 512 | + | |
| 513 | + | |
| 514 | + | |
| 515 | + | |
| 516 | + | |
487 | 517 | | |
488 | 518 | | |
489 | 519 | | |
490 | 520 | | |
491 | 521 | | |
492 | 522 | | |
493 | | - | |
494 | 523 | | |
495 | 524 | | |
496 | 525 | | |
| |||
501 | 530 | | |
502 | 531 | | |
503 | 532 | | |
| 533 | + | |
504 | 534 | | |
505 | 535 | | |
506 | 536 | | |
| |||
515 | 545 | | |
516 | 546 | | |
517 | 547 | | |
518 | | - | |
519 | | - | |
520 | | - | |
521 | | - | |
522 | 548 | | |
523 | 549 | | |
524 | 550 | | |
| |||
0 commit comments