Portable-Notes

Trust & Recovery (3.5)

PeaNote keeps recovery local and explainable. Nothing here needs an account, cloud service, telemetry, or network call. Markdown files in vault/ remain the source of truth.

The running version is 3.11.0; the 4.0 sync-safety preview now guards board task toggles and snapshots linked notes before rename rewrites, with no vendor SDK or network call.

Undo / redo in the editor

Trash

Deleting a note (Ctrl+Shift+P → “Delete current note”) moves the Markdown file to vault/.portable-notes/trash/ with a timestamp suffix. It is excluded from search, graph, tree views, and exports.

The Trash view adds:

“Empty trash” permanently removes all trashed files and still asks for confirmation.

History

Every save snapshots the previous note into .portable-notes/history/ (20 per note). In Ctrl+H you can:

Bring-your-own-folder sync safety

If you put vault/ inside OneDrive, Dropbox, Syncthing, or another sync folder, PeaNote stays offline-first: it never contacts those services. On the next local refresh it detects an external modification or removal and:

  1. writes the exact previous disk text into the normal .portable-notes/history/ stream (same 20-per-note retention);
  2. appends a local event to vault/.portable-notes/sync.json (newest 100 events kept), with path, action, time, hashes, and snapshot id;
  3. shows the report in Ctrl+Shift+P → Sync status / conflicts or GET /api/sync.

When you save a note that changed on disk since you opened it, the server compares the updated stamp and a SHA-256 body fingerprint. A mismatch returns 409 with the current note instead of overwriting it. The dialog offers Keep my version or loading the newer disk version; choosing to load keeps your draft in editor undo history. No event or snapshot leaves the machine.

Verified local backups

“Back up vault now” or POST /api/backup writes a ZIP under vault/.portable-notes/backups/:

CLI: python app.py --backup creates one verified backup and exits without persisting a --vault override.

Vault integrity

“Check vault integrity” runs a read-only GET /api/integrity scan and reports:

Issue Meaning
broken_link [[wiki link]] or relative Markdown link has no target, or points outside the vault
missing_attachment A linked file such as Attachments/photo.png does not exist
duplicate_path Two notes differ only by case, which is unsafe on Windows/macOS
malformed_front_matter YAML-like front matter has an unclosed block, missing colon, empty key, duplicate key, or orphan list item

Each issue names the note and the detail. The checker never rewrites files; fix issues in Markdown or via the editor and rescan with “Rescan”.

Upgrade-safe migrations

Versions are explicit: config_version in data/config.json and SQLite user_version in data/index.db. Current targets are CONFIG_VERSION = 1 and SCHEMA_VERSION = 1.

CLI equivalents:

python app.py --migrate plan     # read-only preview
python app.py --migrate apply    # backup, then stamp versions
python app.py --rollback TOKEN   # restore the pre-migration files

All one-shot commands skip save_cfg() when --vault is supplied, so a maintenance run does not change your saved vault path.

API summary

Method Path Purpose
GET /api/trash?q=&sort= Search/sort trashed files
POST /api/trash/restore { "names": [...] } bulk restore
GET / POST /api/settings/trash Read or update retention policy
POST /api/history/label { "path", "id", "label" }
POST /api/history/restore { "path", "id" } → new note
GET /api/history/diff?path=&id1=&id2= Segments plus aligned side-by-side rows
POST /api/backup Create and verify a local ZIP
GET /api/settings/backup Settings plus backup manifest list
GET /api/integrity Read-only vault health report
GET / POST /api/migrations Dry-run plan / apply / rollback
GET /api/sync Read-only external-change ledger (?limit= not required)

All mutating endpoints require a same-origin localhost request and application/json, as with every other write.

Verification

python -m unittest discover tests -v   # 78 tests
python tests/e2e_ui_actions.py         # 114 live checks

See UI_TEST_REPORT_v3.11.0.md for the generated per-action report and AUDIT_REPORT.md for the broader reliability history.