# Vue Cockpit UAT: Preview → Confirm, Ledger Compatibility, Dry-Run Verification

Use this reference for FinanceManager Vue/FastAPI acceptance tests that exercise manual Cash and Equity/ETF entry from the browser against a safe local runtime.

## Safe UAT runtime pattern

- Run against a separate runtime and DB, e.g. `JARVIS_FINANCE_RUNTIME_DIR=$HOME/jarvis_runtime/finance-system/uat-vue-dashboard` and `JARVIS_FINANCE_DB_PATH=$HOME/jarvis_runtime/finance-system/uat-vue-dashboard/data/finance.sqlite3`.
- Reset the UAT DB from an approved source only when the test scope allows it; never mutate production DB during browser UAT.
- Browser render checks must confirm local DTO loading only: `performance.getEntriesByType('resource')` should show no external provider resources beyond the frontend origin and local FastAPI origin.
- User Mode checks should include a technical-ID regex such as `\b(account_|instrument_|wallet_|asset_)[A-Za-z0-9]`; raw IDs belong in Admin/Debug, not normal pages.

## Preview → Confirm acceptance checks

For each manual entry path:

1. Create Preview from the UI or FastAPI endpoint.
2. Confirm only after Preview exposes expected review/status/warning text.
3. Verify a persisted domain row and a matching `audit_log` entry by note/source/action in the UAT DB.
4. Do not print real values, quantities, account IDs, instrument IDs, or raw rows in chat/report; report only pass/fail and sanitized categories.

## Cash manual-entry compatibility

- Cash after system start should be ledger-driven from `transactions`; `cash_balances` is snapshot/cache/control compatibility.
- A Vue Cash Confirm may need to write both:
  - a ledger-compatible `transactions` row with `source_type='vue_manual_cash'` and normalized type such as `initial_cash_snapshot`, and
  - a `cash_balances` compatibility/control row if current API/UI/tests still read that table.
- Keep this as a bridge, not a permanent accounting model. Future cleanup should consolidate read models around ledger-derived cash while preserving audit history.

## Equity/ETF manual-entry compatibility

- Vue labels are user-facing German labels; API/backend should receive canonical values:
  - `Aktie` → `stock`
  - `ETF` → `etf`
- Instrument search must be explicit-click only; render must not probe OpenFIGI/FMP/etc.
- When a candidate is selected, propagate candidate currency into the form before Preview so FX status is meaningful.
- Normalize UI transaction labels before writing ledger rows:
  - `Initial Snapshot` → `initial_position_snapshot`
  - `Kauf` → `buy`
  - Cash deposit/withdrawal labels → canonical cash transaction types.

## Dry-run verification pattern

For FX and market-price dry runs:

- Count mutable tables before and after, at least `fx_rates`, `market_prices`, `crypto_prices`, and `audit_log`.
- Run CLI with mock providers and `--dry-run` where available.
- Require unchanged before/after counts and an explicit `dry_run=true` output.
- Good acceptance evidence is `DRY_RUN_NO_WRITES_OK`; do not include real market data values.

## Test-environment pitfall

- `JARVIS_FINANCE_DB_PATH` is useful for UAT server processes, but it can contaminate unit tests that intentionally create temporary runtimes via `JARVIS_FINANCE_RUNTIME_DIR`.
- Before running the full pytest suite, unset `JARVIS_FINANCE_DB_PATH` unless the test explicitly needs a fixed DB path. Otherwise tests may silently operate against the UAT/runtime DB and produce misleading counts.

## Final verification sequence

- Restart stale uvicorn/Vite processes if route behavior or OpenAPI output looks stale.
- Run browser sanity from the current checkout.
- Run focused tests for touched flows, then full tests with `JARVIS_FINANCE_DB_PATH` unset.
- Remove generated caches after tests, then run Git-safety scans.
- Create/verify a runtime backup outside Git and report only path/checksum status, not DB contents.
