# Confirmed sample cleanup

This script removes only the two explicitly confirmed sample portfolio names and their dependent action/outbox/project-version records. It requires the previously reported sample budgets (4500000 and 100000 cents); changed values or other project names stop cleanup. The sample ledger must match the owner's reported SHA256 exactly; it is archived read-only and removed from the operational ledger path. No live ledger is invented. Missing ledger is expected until authenticated real source records are supplied.

The operational database is snapshotted with SQLite's backup API and integrity-checked before deletion. Deletes run child-first with foreign keys enabled in a transaction. Original snapshots are retained in test_data_archive/<unique-id>/. Consultation audits, migration history, ingestion replay journal and sequence high-water counters are retained. Resetting sequences is not VACUUM; neither is required for empty active rows and identifier reuse is avoided. No claim of forensic erasure is made.

The script recognizes luxzia_research.db and the older lucxia_research.db; if both exist it stops for explicit reconciliation. It removes only the five known fictional scenario IDs, preserving append-only knowledge and recorded-event/reminder history. Unknown research notes/events are not established as samples by the current instruction and are not wiped. A research snapshot precedes scenario deletion. Protected history triggers are not disabled.

Each database transaction is atomic; multiple DBs and ledger filesystem actions are not globally atomic. On a failure, inspect retained backups/receipts: earlier stages may have completed. This is not a release approval or a fresh-data authentication pipeline. Stop other writers and scheduled jobs before cleanup. Cooperating supervisor/Luxzia processes are excluded using their existing locks. Snapshot directories contain private copies of records; apply your host encryption and retention policies. Notifications remain unchanged and no send function is invoked.

## Install and run on Mac

Extract the archive; open Terminal in the extracted folder:

```bash
bash install_mac.sh /Users/bpa/ForesixaQuant
python3 /Users/bpa/ForesixaQuant/purge_test_data.py --root /Users/bpa/ForesixaQuant
python3 /Users/bpa/ForesixaQuant/purge_test_data.py --root /Users/bpa/ForesixaQuant --apply
```

The first command installs source and tests it without opening operational databases. Second is a read-only preview. Third applies the cleanup authorized by the owner. The assistant cannot execute on your Mac from its separate environment.

6 isolated tests verify preview, backed-up sample deletion, foreign-key order, unconfirmed-row rejection, changed-ledger rejection before deletion, and preserved research history. Actual Mac results remain unverified until the command is run there.
