Teams Todo: SQLite implementation plan
Status: the completed SQLite/review UI now uses real direct-origin FIPS. Simulation
code/UI is removed; its old databases are
retained unopened. Real state starts in local.sqlite and network.sqlite, bound
to the actual FIPS identity. Every received event still needs individual acceptance.
Active FIPS transition (supersedes simulation retention below)
- Owner confirmed fresh real-identity storage, retained unopened fixture data, and Share / Join through paired-node selection and explicit FIPS owner review.
- Replace fixture identity/delivery and commands with real capability-backed FIPS, exact board grants, bounded semantic pages and external staging.
- Add a generic FIPS-owned paired-node chooser without an unrestricted app roster or an app-facing grant approval API; preserve existing grant management.
- Preserve own-origin publication, individual review/resolution and local priorities.
- Narrow local checks: 20-event pages/cursor continuation, unsent isolation, inbox-only staging/individual acceptance, worst-case escaped details under 512-byte frames, reordered/conflicting fragments, dropped data/final-ack retry, post-commit durable receipts, revoked acceptance denial/local decline, stored chooser scope/idempotency/no grant on open, sharing/join UI schemas, removed simulator registration and captured identity parsing.
- Real deployed sender attribution, stream rollback/gap, reconnect/cancel/restart acceptance, alongside the two/three-instance owner checks below.
- Update current docs and regenerate registration. Targeted lint and whitespace
checks pass; full lint is blocked by unrelated unused variables in NR
db/evaluation-queue.tsand Translateservice.ts. TypeScript still reports only the three existing FIPS vendor errors. Reloaded and verified the bot holds onlylocal.sqlite/network.sqlite, with no old simulator DB handles. - Owner verifies authenticated chooser/modal UI and actual two/three-node network use.
The older checked simulation phases below are historical implementation evidence. Global membership revisions, shared resets and deletion/hierarchy merge remain unfinished. The invitation slice below supersedes the original manual board-ID onboarding.
Active invitation slice
The owner approved replacing manual board-ID exchange with Share → paired-node selection → delivered invitation in the recipient's list → Accept & join / Decline.
- Add optional generic invitation contracts and an explicit protocol opt-in.
- FIPS owns a separate paired-only, pre-grant carrier and durable invitation delivery/decision records; normal data remains exact-grant gated.
- Bind stored owner selection to immutable app/local-key/protocol/topic/metadata; explicit sender approval queues invitations and grants only local scope.
- Show validated invitation metadata in Teams Todo list. Accept & join opens stored FIPS scope review; explicit owner approval adds access atomically with the invitation decision. No board/task/event acceptance occurs on invite receipt.
- Persist retry/expiry/status and handle duplicate/replay, cancellation, removed pairing, unavailable apps and revocation without silently recreating grants.
- Exclude pending/declined invite destinations from automatic data preflight, so setup shows delivery/join state rather than fragment-ack timeouts.
- Narrow checks: pre-grant delivery; no grant/history on receipt; status/decline; dropped data and final feedback; durable restart retry; unavailable app; expiry; actual owner approval, scope tampering and revocation replay; metadata/history rejection; legacy migration and picker reuse; protocol collisions; UI schema; no ordinary data preflight while an invitation awaits acceptance.
- Update docs/registration. Targeted and full repository lint pass; whitespace checks pass in core/FIPS/Teams Todo. TypeScript still reports only the three existing FIPS vendor errors.
- Reload and verify the running bot opens FIPS and both real app stores. A read-only check confirms the invitation table/draft-column migration initialized; zero live invitation records were created by agent verification. Boards/grants/pairing were not reset or changed for verification.
- Owner confirmed local → VPS invitation, Accept & join, Send and manual Sync/review work; the counted Sync button appeared automatically after polling.
- Deployed offline/reconnect and three-node direct-origin acceptance.
Pinned bounds: invitation metadata only, 4 KiB UTF-8 body; 7-day maximum expiry; 32 KiB encoded envelope; 512-byte frames; 128 fragments; 8 incomplete transfers (2 per sender); 60-second reassembly lifetime; 2 concurrent transfers; 3 fragment attempts / 3-second feedback deadline; 8 durable retry attempts with exponential backoff capped at one hour. At most 128 live invitations per app/local identity, 16 per remote/app, 1,024 retained records per local identity; terminal records retain 30 days after expiry before pruning. Sender/recipient keys and UUID pin each offer; receipt/status processing never approves access. Completed owner decisions are idempotent and cannot restore a later revoked grant.
Active automatic delivery slice
Approved UX: explicit Send releases local work; recipients automatically receive released events into Incoming and views refresh automatically. Accept/resolve/decline remain explicit, including board creation and resolution context.
- Add post-publication release hints and direct-origin automatic inbox pulls.
- Add bounded multi-page catch-up, duplicate/manual-pull coordination, retry and reconnect/startup reconciliation from durable publications/cursors.
- Replace the routine counted Sync button with receiving/review status, preserve manual Sync now recovery and automatic list/board refresh.
- Narrow checks: 101-event multi-turn automatic delivery with no recipient Sync, repeated Send, unsent isolation, inbox-only receipt and individual board acceptance; dropped-announcement/restart catch-up from serialized stores and durable cursors; queue coalescing/retry, two-worker/128-job bounds, shutdown cleanup and receiving/ waiting/list-count UI schemas. Current authorization/stream checks remain on every pull and inbox commit.
- Update docs/registration and verify targeted lint/whitespace. TypeScript reports only the three existing FIPS vendor errors.
- Reload the bot into automatic delivery; verified the new process reopened the existing local/inbox SQLite files. No live data reset was performed.
- Owner verifies actual local/VPS Send → automatic Incoming without Sync/Refresh.
Bounds: at most 128 queued jobs, two automatic jobs at once, four pages per catch-up turn with the existing 20-event / 512 KiB page limits. Backoff is five seconds to five minutes. Fifteen-second rotating reconciliation recovers missed hints; app UI refresh is five seconds. No automatic publication, grant approval or event acceptance.
Update modal save fix
Reported: Save cleared title/details without events or changes after refresh. Source reproduction: web execution's display input loses scalar field boundaries; Teams Todo re-parsed it as CLI tokens, rejecting multiword title/details before save. The shared form renderer also reset persistent forms immediately on submission.
- Parse web
context.jsonPayloadthrough the existing structured command schema; retain CLI parsing for text clients. Reject incomplete editor submissions without clearing saved details; preserve explicit empty-details clearing. - Limit shared automatic reset/hide to actually revealed inline forms. Persistent editor drafts survive submission until backend success/error supplies a new root.
- Verify real routing-token reproduction, structured title/details saves and source history, no-op, clear, stale/invalid/blocked draft retention and incomplete-form protection through actual App handling with the web payload. Inspect generic reset scope; authenticated modal/DOM acceptance remains owner-assisted.
- Targeted lint, production web build and whitespace checks pass. TypeScript is
blocked by the three existing FIPS vendor errors plus an unrelated undefined
publicationOptionsin core plugin-manager publication code. No changed-file type errors. Document structured routing and persistent-form reset semantics. - Reload backend and verify existing local/inbox stores reopened; rebuilt static web assets locally. No live todo changes were made for verification.
- Owner verifies authenticated Update/📝 modal Save, retained fields, saved values after Close/reopen and Recent activity on the updated browser build.
Current domain decisions
- Immutable semantic events and stable entity IDs use separate lowercase UUIDs.
Entities/events keep FIPS
pubkeyand millisecondcreated_at; no entity signatures, NIP-01/JCS prerequisite or app-held private keys. based_onis edit context;requiresis semantic prerequisite. Publication order is not a dependency on every earlier action; clocks do not resolve concurrent edits.- Local edits save immediately. Send updates explicitly releases origin events.
- Sync stages incoming payloads outside the peer database. Acceptance, not receipt, inserts a received event and updates its entity. This supersedes the earlier plan to keep all received/pending/declined events in the main peer event table.
- Each installation uses its real FIPS identity and separate accepted/incoming stores. Fixture data stays unopened; no simulation selector or reattribution remains.
- Each proposal is reviewed separately. Declining a prerequisite blocks dependents, not unrelated work. Accepted changes cannot be declined in place.
- Different accepted views are intentional. Conflicts wait for explicit merge; future optional agreement concerns an exact accepted set/resolution and membership revision.
- Keep ownership local to command features; extract only genuinely shared primitives.
Completed removal of the initial runtime
- Remove root xitdb model/storage/network/rendering modules and compatibility routing.
- Remove draft setup/task workflows, descriptor import/export, old grant/sync UI, old protocol callbacks and peer capability declarations. New local boards need no FIPS.
- Use SQLite for board listing, creation, show, todos, history and settings.
- Remove xitdb from plugin/root dependencies and update the root binary lockfile with lifecycle scripts disabled; no other code consumer was found.
- Restart into the SQLite-only runtime, confirm old file handles are closed, delete the old control database/sidecars and writer-log directory.
- Preserve existing
entities.sqlitedata as A's starting state and preserve FIPS identities/pairing, other apps and unrelated user work.
Historical initial evidence remains in the archived plan, archived architecture and deployed investigation. Their checked items describe the old scope, not current simulation/transport verification. No old runtime or data is retained.
P1 — settle the real UI with separate peer databases
- Keep
/teams-todo list,show <board>and task actions; colocate new board, list, show, todo, peer and incoming definitions/handlers/UI. - Fixed public-key fixtures and a removable in-process transport adapter; no keys, signatures, real FIPS identity switching or network grants required for simulation.
- Independent WAL/FULL SQLite stores: A
entities.sqlite, Bpeer-b.sqlite, Cpeer-c.sqlite; global UI selection and inbox state live intransport.sqlite. - Capture actor/recipient in rendered actions; changing global selection cannot silently change the target database of an already-rendered action.
- Create boards/source events locally, nested todos, title/status edits and leaf deletion in transactions. Retain creation attribution and edit/prerequisite links.
- Send updates releases only the selected peer's own events with per-board positions. Unsent changes and other authors' accepted history are not published as local origin.
- Sync reads only published events, validates simulated origin and stages them in the separate inbox with recipient/origin/board receipt cursors. Peer DBs are untouched.
- Expose other published board IDs for discovery without copying board configuration into receiving stores. Board creation itself requires acceptance.
- Incoming UI with individual Accept/Decline, payload preview and prerequisite explanations. Accepted/local task activity stays separate from staged incoming data.
- Paginate incoming review, prioritize pending items over declined history, and keep proposals beyond the first page reachable rather than hiding their prerequisites.
- Declined data remains in the inbox and advances no acceptance state. It can be explicitly reconsidered; descendants never become automatically accepted.
- Accept validates prerequisites/context and origin, then inserts event and updates the entity atomically in the target peer DB. Mark inbox acceptance after that commit; retries recover idempotently if the two databases' commits were interrupted.
- Initially reject competing edit bases and unsafe parent deletion without changing peer data. Title/status detection is now extended by the explicit R3 resolver; deletion/hierarchy conflicts remain blocked.
- In-memory command/UI validation: A/B/C isolation, unsent privacy, staging/decline with no peer writes, accepted board/task projection, dependencies, acceptance retries, duplicate delivery, conflicting edits and origin-only publication.
- Validate 200-item delivery batches/cursor continuation and paged review when cross-origin prerequisites arrive beyond the first page; accept exactly one item.
- Inspect the reported missing local todo: A had two live root todos while B/C and inbox were empty. Keep direct local writes; clearly separate local todos from incoming review, hide the empty inbox, collapse diagnostics and return fresh peer-scoped UI after local edits. Pin mutation/review/Sync refreshes to the captured peer.
- Add all-simulation reset preview/confirmation, recreate peer/inbox schemas with normal immutable guards, clear publication/cursor state and recover interrupted resets from a durable marker. Return to empty Peer A.
- Validate immediate A-only local display, Send/Sync isolation, reset preview with no writes, full clearing, no resurrection, reused DB handles and reset recovery.
- Perform the owner's requested live reset and verify all peer/inbox tables are empty from separate SQLite connections. Cleared board views return to the boards list.
- Add Reset this peer / Reset all peers beside the selector, each with scoped confirmation. Peer reset preserves other peer DBs and already-received proposals, clears its recipient inbox and restarts cursors involving that origin/recipient.
- Validate scoped reset/recovery, unaffected peers/proposals, re-Sync with explicit acceptance and new publication sequence delivery after a peer-only reset.
- Keep recipient-staged boards discoverable after their origin is reset, so preserved proposals remain reachable and can still be explicitly accepted.
- Follow personal Todo's UI primitives: icon-only ⋮ actions, local reveal panels
for child/sibling/title edits, retro checkbox-triggered status menus and a bottom
“Add a new root item” control. All submitted commands use
recordInTimeline: false. - Place nonempty incoming review/page controls above local todos, keeping empty incoming hidden. Scope panel identities by peer/board/task and preserve actor capture.
- Verify panel/menu payloads, sibling/child parent IDs, status choices, timeline flags and incoming/root-control order with command/UI-schema checks.
- Compact list/board headers with a peer select and ⋮ navigation/manual Sync/reset menu. Hide idle Send/Sync and zero counters; show counted actions only for work.
- Verify quiet/unsent/incoming/blocked header states, peer-change payloads and reset preview safety; retain regular polling and backend preflight gates.
- Move per-item creation metadata out of expanded rows into a read-only Show details ⋮ action/modal, preserving captured peer/board/task and availability during review. Verify modal schema, no selection/history/inbox writes and wrong-peer/board isolation.
- Size the header select from the menu's natural 1.15rem line box, 0.2rem top/bottom padding and 6px hard shadow, without overriding the button height/font. Lift the ⋮ wrapper by half the shadow offset for aligned top/bottom edges. Authenticated visual acceptance remains with the owner.
- Owner verifies authenticated visual interaction, focus/expansion, inline/modal refresh and a real host restart. Iterate on UX before real network integration.
- Superseded: additional offline/interrupted simulator controls; the owner requested removing the simulator and moving to real FIPS.
P1b — personal ordering and winner reconfirmation
- Keep regular Todo unchanged. A/B/C was retained for this completed iteration only.
- Root order and branch winners are local preferences per peer/board, outside semantic events/publications. Root order chooses the project; branch winners choose the path; the final actionable leaf is the champion. No win-rate ranking or duel sessions.
- Candidate title/details/status/history or sibling-set changes require Keep/Pick again. Changed child representatives prompt the parent; Keep alone does not cascade when the representative is unchanged. Review bottom-up, with stale-action validation.
- Persist personal root order/winner snapshots externally; include personal state in scoped/all-peer resets and keep reads free of writes.
- Derive stable root order, branch winners, pending reconfirmations and champion; validate root moves and winner choices against current accepted peer state.
- Add generic tree root reordering with pointer drag handles, bounded direct-child scope, cancellation and one command per completed move.
- Compose compact Keep/Pick prompts and winner/ champion markers into Teams Todo; preserve normal semantic-review gates.
- Verify A/B/C isolation, no new events/publications, stale-action behavior, title/status/new-child review, Keep stability, upward propagation and reset. Verify pointer command dispatch and cancellation with DOM stubs; authenticated visual drag/touch remains owner acceptance below.
- Owner verifies authenticated drag/touch and winner review UX.
- Preserve a consistent drag gutter on descendants, prepend 🏆 to the champion title, and encode branch winners with accent color instead of text badges.
- Replace dropdown review with Todo-style Keep/Pick actions on candidate rows; add manual Pick winner entry with captured peer/scope and stale guards.
- Remove the active picking panel; expand the current branch/ancestors once per review, without collapsing unrelated branches or reopening user-collapsed items on polls.
P1c — winner-first display and task details editor
- Accent the entire champion path and promote each branch winner above its siblings without changing root preference order or emitting shared reorder events.
- Put Add child/Add sibling first, replace inline title edit with Update modal, and remove Move up/down UI and keyboard reorder shortcuts.
- Add optional shared details with backward-compatible entity/event schema migration, per-field events, concise incoming summaries and explicit details resolution.
- Reuse a title/details modal from Update and 📝, preserve form text on failures, reject stale saves, and save changed fields atomically with no-op avoidance.
- Verify legacy migration, modal submission/clear, peer sync/review/merge, priority reconfirmation and stable winner-first display; keep regular Todo unchanged.
R0 — finish semantic and authorization policies
- Command-owned Zod contracts and strict DDL for boards, memberships, peers, recursive todo output, semantic events and indexed event references.
- Separate creation IDs/event IDs, immutable source guards, same-board parent foreign keys, insert/update cycle guards, enums and field/reference bounds.
- Source event creation, edit bases and creation prerequisites for local handlers; new todos depend on their board creation where that source event exists.
- Pin full causal processing, schema evolution, membership revision/authorization, deletion/reparent policy and resource budgets for real received data.
- Permit safe independent title/status combinations and equal concurrent values; use causal field heads rather than the last appended entity event.
- Define acceptance retraction/compensating changes and deterministic replay rules. Do not rewrite accepted source history or silently accept incoming dependencies.
R1 — persistence, reconstruction and history
- Supported
Database.runinitializers, foreign-key checks, indexes, row adapters and command-specific persistence. No native trees, raw DB replication or xitdb shim. - Local edits and incoming acceptance incrementally update affected todo rows.
- Inbox/protocol state is physically separate from peer entities/events, and receipt advances independently of pending/declined/accepted decisions.
- Full deterministic accepted-state rebuild and historical reconstruction, including persisted resolution policies. Checkpoints only when justified as rebuild accelerators.
- Define retention, explicit deletion/reset and corrupted-store recovery, including consistency between accepted peer history and external inbox decisions.
- Production-size history, staging, prerequisite fan-out and replay limits.
P2 / R2 — real FIPS integration
- Simulated Send/Sync already separates local working events, publication positions, external durable receipt and explicit application.
- Replace the fixture transport/identity provider with authenticated direct-origin FIPS while retaining event/review handlers and existing real UI.
- Reintroduce only generic peer capability declarations/callbacks needed by the new event protocol. Core/FIPS own no Todo schema, inbox or acceptance policy.
- Bounded frame/page sizes, transfer correlation, direct-origin and exact board grant checks, stream identity pinning, contiguous pages, rollback/gap rejection, bounded fragment retry/reassembly and shutdown cleanup are implemented.
- Global membership revisions, negotiated cursor/stream reset and deployed reconnect/cancellation acceptance remain pending.
- Durable receipt acknowledgement follows inbox commit, never implies acceptance. Prevent duplicate payload replacement and arbitrary third-party forwarding.
- Serving/retry exposes releases only. Reconciliation now schedules automatic inbox staging after head discovery, never publishes unsent edits or opens prompts. Current grants are reconciled; revocation blocks receipt/acceptance, preserves already staged data and permits local decline. Reapproval is owner-only.
R3 — full review, merge and optional agreement
- Minimal individual accept/decline is required now, before peer DB writes.
- Replace raw incoming payloads with exhaustive contextual summaries and left-side ✓ / ✗ icon actions; identify concurrent incoming changes and affected local todos.
- Classify causal/field conflicts consistently for rendering and acceptance; allow compatible title/status edits and retain covered history without rolling state back.
- Record explicit title/status resolution events referencing competing branches, with stale-view checks, atomic source/projection updates and retry recovery.
- Receive published resolutions with explicit per-event selection for any staged context; preserve direct-origin delivery and never silently accept dependencies.
- Verify the A/B concurrent-status scenario, propagation, summaries and UI contracts.
- Poll released-update counts without staging, preflight Sync before edits/sending, and hold changes/publication until board-local pending proposals are reviewed. Keep unsent local work intact and retain third-peer conflict resolution. Head-only discovery was the original manual-delivery phase; automatic staging now follows discovery as described in the active delivery slice above.
- Explicit title/status Keep mine / Use theirs / Edit result with stable provenance; verify creator-side send gating, keep-current resolutions, CLI forms, passive counts, cross-page conflicts, mixed-field context rollback and existing-schema upgrade without touching live simulation data.
- Correct resolver form argument seeding and verify the renderer's FormData merge through real command parsing for every status and edited titles.
- Extend explicit resolution to delete/edit and parent/child conflicts.
- Dependency explanations/reconsideration at full graph scale and transactional recomputation when a prior decision changes; preserve unrelated local work.
- Optional unanimous agreement on exact accepted set/resolutions and membership revision. Offline peers leave it pending; changed results require a new proposal.
- Require matching directly attributed history when agreement references other authors. FIPS attribution is not transferable entity-signature proof.
R4 — owner setup and direct invitations
- Share/Join exact board UUID through a FIPS-owned paired-node chooser and explicit local grant approval. Close/refresh reconciles current access. Each owner performs this independently; no synthetic approval or auto-grant on receipt.
- Named paired-node chooser and Share / Accept & join with explicit authenticated owner approval of exact local grant scope. Apps cannot self-approve.
- Bounded pre-grant invitations; receipt alone joins/grants/installs nothing. Unknown peers require pairing; claimed authors/master keys are not authentication.
- FIPS atomically owns grant/decision setup state; app entity acceptance is a later independent operation. Recover idempotently without restoring revoked grants; scope expansion needs new owner review.
R5 / R6 — presentation, diagnostics and reset
- Boards-only navigation, focused task tree, peer switching, local/unsent/incoming state, readable activity and expandable source proposals in the same real UI.
- Friendly real identity labels and bounded structured diagnostics for network stages.
- Explicit all-peer + inbox reset, selected-peer reset and restart recovery, preserving FIPS identities/other apps. No previous publications survive an all-peer reset.
- Peer-only reset with scoped inbox/cursor cleanup and durable intent recovery.
- Board-local clear/remove/fresh reset scopes, with late-message handling that cannot silently recreate removed boards.
R7 — verification and release handoff
- Targeted lint, required registration generation, in-memory schema/command checks. TypeScript reports only the three documented FIPS vendor errors.
- Dependency removal with scripts disabled; inspect independent plugin/root diffs and whitespace. No commits, pushes, hooks or publication.
- User-assisted browser/restart checks, then real two/three-node FIPS and cross-platform acceptance. Local in-process simulation does not establish those outcomes.
- Return exact app/core/Bun versions and timings for final owner review/release.
Do not add/run automated test suites without an explicit request. Interactive simulation and narrow one-off verification are distinct from adding a new testing framework.