Skip to content

fix(consider): preserve mixed-currency valuation frame - #717

Merged
atomchung merged 1 commit into
mainfrom
codex/issue-712-valuation-frame
Aug 1, 2026
Merged

fix(consider): preserve mixed-currency valuation frame#717
atomchung merged 1 commit into
mainfrom
codex/issue-712-valuation-frame

Conversation

@atomchung

Copy link
Copy Markdown
Owner

What

Why

consider resolved usable native closes and FX, then reduced the feed to {as_of, prices} before canonical sizing. That discarded currencies and fx_to_aggregate, so the existing canonical reader correctly refused a mixed-currency book even though the call already had every fact it needed.

User impact: a valid mixed-currency pre-trade question now reaches engine-owned before/after weights and rule collisions instead of entering unnecessary recovery.

Safety boundaries

  • reuses the existing price_feed, ValuationFrame, and PortfolioBasis owners
  • no second sizing calculation, agent arithmetic, identity-FX fallback, provider abstraction, migration, or durable-state change
  • frame prices are restricted to exact current holdings; premise and closed-symbol extras cannot widen it
  • supplied holding-currency conflicts refuse by ticker and currencies
  • missing TWD FX refuses by name and never evaluates on cost basis
  • public fixtures and evidence are synthetic

Verification

  • PYTHONPYCACHEPREFIX=/tmp/pr712-pycache-full python3.12 tests/run_all.py — all 52 offline suites passed
  • tests/test_consider.py — 131/131
  • tests/test_portfolio_basis.py — 26/26
  • tests/test_consequence.py — 57/57
  • focused E2E covers both auto-resolved and --prices USD/TWD ledger paths, aggregate before/after weights, and a would_breach rule collision
  • isolated mutation restoring the old {as_of, prices} downgrade makes both new composed E2E tests fail with the original canonical sizing refusal
  • independent read-only review: no block findings after two rounds; the first round's currency-conflict and named-missing-FX findings are covered by CLI regressions

Closes #712

@atomchung atomchung left a comment

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Independent review completed in two rounds against the exact PR commit. Round 1 found two correctness gaps: a supplied holding-currency conflict could be relabelled into the ledger currency, and a pure missing-FX refusal did not name the missing currency. Both now have real CLI regressions, write no evaluation, and remain outside #674's usable_facts lane. Round 2 found no block issues. Local Python 3.12 offline suite: 52/52; intentional restoration of the old {as_of, prices} downgrade kills both new mixed-currency composed E2E tests. GitHub's Python 3.11/3.12 matrix remains the final merge gate.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[bug·P1] consider drops FX from its canonical valuation frame on mixed-currency books

1 participant