Skip to content

ODD Notes

Nick Hamze edited this page Aug 16, 2026 · 1 revision

ODD Notes

ODD Notes 1.3.0 is the first and currently only production app in ODD Shop. It is a native OpenStation application backed by WordPress content.

Features

  • Search across titles, bodies, owners, and tags.
  • Tags, favorites, archive, desktop pinning, and optional site sharing.
  • Autosave with visible pending, saving, saved, and failed states.
  • WordPress revision history and restore.
  • Offline/local-first draft recovery.
  • Real optimistic concurrency for competing windows.

Storage contract

Notes use OpenStation's existing wpd_note post type. ODD does not create a private browser-only database or a parallel custom table. Browser localStorage contains recovery drafts only and can be lost without deleting the WordPress copy.

Draft journals are scoped by:

WordPress installation UUID + WordPress user ID

This matters in WordPress Playground, where multiple temporary WordPress installations can share https://playground.wordpress.net and reuse the same numeric user ID.

Save and conflict rules

Each WordPress response carries version and updatedAtMs. They are server-issued lock tokens:

  1. Typing changes the local title/body/settings but does not replace those tokens.
  2. Autosave sends the last server tokens with the editable fields.
  3. WordPress saves when the tokens still match.
  4. If tokens are stale but the submitted content already equals the current note, the request is an idempotent retry and succeeds.
  5. If tokens are stale and content differs, ODD Notes asks whether to keep the local draft or use the WordPress copy.

This prevents harmless reloads, stale identical journals, and interrupted response retries from showing “This note changed elsewhere.”

Maintainable source

The source of truth is _tools/catalog-sources/apps/odd-notes/src/:

  • api.ts — OpenStation fetch adapter and Notes REST calls.
  • drafts.ts — scoped recovery journal and reconciliation.
  • state.ts — filtering, counts, stable note replacement, and local edits.
  • index.ts — native-window controller and rendering.
  • types.ts — wire and host API types.

Build it with:

npm run build:notes

The command joins the compiled runtime to the pinned OpenStation component snapshot and writes bundle-src/assets/js/odd-notes.min.js. Do not edit the generated file by hand.

Verification

Focused unit tests cover journal isolation, malformed recovery data, token preservation, identical-draft reconciliation, stable list replacement, and navigation counts.

The real WordPress browser smoke test:

  1. Installs OpenStation and ODD.
  2. Installs the freshly built local ODD Notes catalog bundle.
  3. Opens Shop and ODD Notes.
  4. Creates, edits, and autosaves a note.
  5. Sends an intentionally stale identical retry and expects HTTP 200.
  6. Refreshes the library and verifies the saved title/body.
  7. Confirms no conflict dialog appeared.

Run it with:

bash bin/e2e-local.sh all e2e/panel.spec.ts

Clone this wiki locally