You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
feat: update gRPC service layer for instrument-based quantities (#1217)
* feat: update gRPC service layer for instrument-based quantities
- Map dimension field in toProtoFacility response (grpc_mappers.go)
- Remove dead mapCurrency function and unused currency constants
- Resolve dimension from Reference Data service in InitiateCurrentAccount
- Use NewCurrentAccountWithDimension to persist resolved dimension
- Fall back to CURRENCY dimension when Reference Data unavailable
- Add InstrumentGetter interface and WithInstrumentGetter service option
- Wire Reference Data client as instrument getter in main.go
- Remove dead overdraft fields from saveHandler (grpc_control_endpoints.go)
- Remove TestCurrencyMapping test (mapCurrency no longer exists)
* fix: map registry MONETARY dimension to domain CURRENCY constant
The reference-data registry uses "MONETARY" for currency instruments
while the domain quantity package uses "CURRENCY". Without this mapping,
NewCurrentAccountWithDimension always fails when instrumentGetter is
configured. Add mapRegistryDimension helper and test.
* fix: address CodeRabbit review comments on instrument error handling and metrics
- Distinguish registry.ErrNotFound from transient errors in GetInstrument:
unknown instrument_code returns codes.InvalidArgument, transient failures
return codes.Unavailable with external service error metric recorded
- Rename balanceGauge label from "currency" to "instrument_code" to reflect
the broader instrument model (kWh, GPU_HOUR, GBP, etc.)
- Update all three RecordBalance callers to pass account.InstrumentCode()
instead of currency string for consistent label values
---------
Co-authored-by: Ben Coombs <bjcoombs@users.noreply.github.com>
0 commit comments