Skip to content
This repository was archived by the owner on Nov 20, 2026. It is now read-only.

[AI] CHE-1163: Convert Monte Carlo linked-pot balances to Main - #134

Draft
congvc-bot-x99[bot] wants to merge 3 commits into
author/CHE-1024/86629bea3e0cfrom
author/CHE-1163/91229474
Draft

congvc-bot-x99[bot] wants to merge 3 commits into
author/CHE-1024/86629bea3e0cfrom
author/CHE-1163/91229474

Conversation

@congvc-bot-x99

@congvc-bot-x99 congvc-bot-x99 Bot commented Oct 5, 2026 •

Copy link
Copy Markdown

🤖 Status: Parked — CHE-3439, 2026-11-04 ICT. Head a821984f1d8abde81e2014976401f4b5144fa3d1. Preserve the currency continuation stack rooted at #123. The root still has red autofix/lint checks. The stack owner must propagate the CI repair and current master, rerun this layer against its actual base, and reconcile independent PASS on the resulting head. Preserve the existing base branch; do not merge or close layers as duplicates.

Description

CHE-1163 (CHE-835 v3 layer 11b): Monte Carlo linked-pot balances are valued in the Main currency. AI-authored (Claude Opus, Multica agent x99-claude-opus).

  • Base: PR [AI] CHE-1024: Two-client persistence journey and multi-currency docs #133 head e240bc17539f0b56fe28e658f4c3929dca433c64 (branch author/CHE-1024/86629bea3e0c).
  • monteCarloCurrency.ts: applyLiveBalances (native, persistable) and convertMonteCarloConfigToMain (one prefs/account snapshot, convertAccountAmount per linked pot before the simulation combines pots; no rate chaining, no new fetch). A missing rate, missing account or unsafe amount gives unavailable, never zero or partial. No Main set: native values pass through unchanged.
  • useResolvedMonteCarloConfig now returns { nativeConfig, main }. Save still persists the native-resolved config, so nothing new is persisted and existing saved reports load unchanged (no migration). The simulation, cashflow chart, run detail table and pot table read the Main conversion. Loading waits on !accountsLoading && !accountsPlaceholderData, only when Main is set and a pot is linked.
  • Report page and dashboard card show an explicit unavailable notice (MonteCarloUnavailableNotice) instead of results; the page keeps the configuration so the pot can be fixed. A linked pot's balance cell shows "Unavailable" when it cannot be converted, and the None (unlink) option is not offered then, because the stored balance is in the account's native units and would be misread as Main. Recovery: add an exchange rate, link another account, or remove the pot. When a Main value exists, unlinking carries that Main value over as the pot's manual startingBalance (never the native amount); typing a balance still unlinks the pot and stores the typed Main value. With no Main currency set, behaviour is unchanged.
  • Removed the CHE-1023 Monte Carlo "not converted" notice (all linked paths are converted now). Algorithm, percentages and dates are untouched. Manual pots and other amounts were already Main.
  • Tests: monteCarloCurrency.test.ts (mixed-currency pots, missing rate, missing account, unsafe amount, Main-only, no-Main passthrough, legacy saved-config round trip) and useResolvedMonteCarloConfig.test.ts (loading/placeholder gating, unavailable, native vs Main), MonteCarloPotConfiguration.test.tsx (unlink carries the Main value, no None while unavailable or for a deleted account, manual pot keeps None), MonteCarloCard.test.tsx and MonteCarloUnavailableNotice.test.tsx (unavailable and loading states).

Related issue(s)

Testing

Run on X99 at head a821984f1d8abde81e2014976401f4b5144fa3d1 (base e240bc17539f0b56fe28e658f4c3929dca433c64), no install:

  • yarn workspace @actual-app/web run test src/components/reports/reports/monte-carlo: PASS, 7 files / 153 tests. Independently re-run by the reviewer on the same head: PASS.
  • yarn workspace @actual-app/web run test src/components/reports: PASS, 37 files / 470 tests.
  • yarn typecheck: PASS. oxfmt --check and oxlint --type-aware on the 5 files changed in the last commit: PASS.
  • Regression proof: against the pre-fix MonteCarloPotConfiguration.tsx, 3 of the 5 new pot-row tests fail.
  • Independent review: signed code-review PASS, no P0/P1 (the earlier unlink P1 is closed), plus a no-spend delegation OCR receipt, both on this head.

Not run: browser smoke and VRT for Monte Carlo with a mixed-currency fixture (tracked in CHE-1197; no Monte Carlo VRT baseline exists). No full MonteCarlo.tsx route render test (non-blocking P2).

CI at head a821984f, disclosed, nothing waived: 16 success, 1 failure, 9 cancelled, 10 skipped.

  • lint fails on packages/desktop-client/locale-fork/GLOSSARY.md formatting. This PR does not touch locale-fork; the file comes from an earlier layer and base PR [AI] CHE-1024: Two-client persistence journey and multi-currency docs #133 lint fails the same way.
  • The 9 cancelled jobs (setup, build, compare, migrations, autofix, Functional Desktop App, both VRT shards, functional shard 3) were queued about 15 minutes with no runner assigned (empty runner_name, 0 steps) and cancelled. That is runner availability, not a test result. They have not passed.

Checklist

  • Release notes added (see link above)
  • No obvious regressions in affected areas
  • Self-review has been performed - I have read every line of this diff and can explain what each change does and why it is needed

@congvc-bot-x99
congvc-bot-x99 Bot marked this pull request as ready for review October 5, 2026 21:28
@github-actions github-actions Bot added the AI generated PR authored with AI assistance label Oct 5, 2026
@autofix-troubleshooter

Copy link
Copy Markdown

Hi! I'm the autofix logoautofix.ci troubleshooter bot.

It looks like you correctly set up a CI job that uses the autofix.ci GitHub Action, but the autofix.ci GitHub App has not been installed for this repository. This means that autofix.ci unfortunately does not have the permissions to fix this pull request. If you are the repository owner, please install the app and then restart the CI workflow! 😃

@congvc-dev

Copy link
Copy Markdown
Collaborator

OCR (instrument, ocr v1.12.12, model claude-opus-5-5, keyed lane) on head a821984f1d8a: 0 P0/P1, 2 P2 style/maintainability candidates (MonteCarloCard.tsx:122-134 nested ternary; MonteCarlo.tsx:286-297 duplicated container style). Details on CHE-1163. Candidates only — the reviewer seat confirms or rejects; not a review verdict or merge authority.

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

Labels

AI generated PR authored with AI assistance

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants