Repository navigation
fix: Preserve exact cash and native balance currency - #514
Merged
Merged
Conversation
|
Important
This repository does not receive automatic reviews because it has fewer than 10 stars.
|
Pigbibi
marked this pull request as ready for review
November 2, 2026 20:22
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
AI assistance
Implemented with OpenAI Codex (gpt-6.1-sol).
What changed
Preserve native cash and currency semantics in cached account facts (F07-D1/F07-D2):
cash_balanceonly from exact provider cash. Missing cash produces an empty cash list, even when available cash is present; zero, negative cash and decimal text are preserved.provider_currency_unavailableerror before archive or publication; USD and configured position currency cannot replace it.balance_metrics.currencyto both existing cached archive records, preserving native currency or JSON null. Keep exact cash, available cash and buying power separate.How verified
Tests and build ran under an inherited seccomp network-denial filter. The first full run was interrupted during automatic Google Auth metadata detection; the successful full run used
NO_GCE_CHECK=true, retaining network denial and all assertions. An initial non-isolated build lacked setuptools; the final isolated build used cached build dependencies. Hosted CI and deployed runtime behavior have not been verified.Why
Available cash previously became a fact tagged
provider.cash_balancewhen exact cash was missing; missing native currency was asserted as USD. The cached archive also omitted currency even when the collector had it. These paths could misstate the financial facts needed for forward reconciliation.Risk
Bounded change to
application/account_facts_publisher.pyandapplication/session_check_service.py, with related tests and documentation. Missing native currency deliberately returns 503 from the existing sync endpoint. The archive helper retains null independently; the endpoint still validates publication before archiving. Existing archive writes remain non-atomic, and the separate older saved-history route keeps its existing currency policy.Forward-only scope starts 2026-11-03; no history backfill or archive rewrite. No trading gate, live/Kelly/stop-loss switch, workflow, dependency pin, deployment or broker/cloud operation changed. Authentic accounting reconciliation and runtime adoption remain UNRECONCILED / NOT_PROVEN.