Repository navigation
Feature/enhance note view - #798
Conversation
- Refactor note view translations across multiple languages to reflect the change from "notes" to "document". - Introduce new error handling for cases where a note view already has an associated document (DOC_NOTE_VIEW_TAKEN). - Update database schema and migration scripts to enforce the constraint that a note view can only hold one document. - Modify API responses and documentation to clarify the behavior of note views and their associated documents. - Enhance tests to cover scenarios related to the new document handling in note views.
There was a problem hiding this comment.
Important
Migration 000095 dedupes and then builds its unique index without excluding concurrent writers, so an instance still running the pre-000095 code can commit a second note in the gap and abort CREATE UNIQUE INDEX. The counter-first guarantee the file documents also only covers projects that already had duplicates when the counter statement ran.
Approach: sound — "one live document per note view" is enforced in the database rather than in the clients, so the web auto-create and the MCP write_doc both converge on the same 409 and every existing read/write path for documents keeps working unchanged.
Reviewed changes — full diff (32 files), against 1d9d7b5.
- Single-document note view —
NoteViewrendersdocuments[0]inDocumentPane, auto-creates the document once for adocs:writecaller on an empty view, treatsDOC_NOTE_VIEW_TAKENas success, and shows an inline retry for other create failures; the notes list, New note, rename, reorder, delete and remembered active note are gone. headerSlot—DocumentPanedraws no header bar when a slot is given and portals its save status and comments/activity toggle into the view header element thatInteractionLayoutowns; the docs route still passes nothing and keeps its breadcrumb header.- API invariant — partial unique index
uq_documents_note_view,ErrNoteViewTakenfrom the 23505 on that index,409 DOC_NOTE_VIEW_TAKENin the presenter; migration000095keeps the first note of a multi-note view by(position, created_at, id)and soft-deletes the rest. - MCP —
write_docwithviewIdpatches the view's one document whatever title is passed and only uses the title on creation. - i18n, docs, tests — locales trimmed to the keys still used in all 9 languages;
interaction-views.md,database-schema.md,http-design.md, MCP README/ALL_TOOLS/CHANGELOG updated; web, MCP, Postgres and Playwright coverage rewritten for the single-document behavior.
deepseek-v4.1-flash-1017 (free via Pullfrog for OSS) | 𝕏
There was a problem hiding this comment.
✅ No new issues found.
Reviewed changes — the incremental delta 1d9d7b5..0461ce4 (3 files), covering the migration hardening and the two stale-comment corrections.
- Migration
000095closes the rolling-deploy window — it takes thedoc_sync_statecounter for every project with a note view, then locksdocumentsinSHAREmode before deduping and building the unique index, so a pre-000095writer can neither slip a duplicate between dedupe and index build nor invert000088's counter-before-rows order. - Stale "through the API or MCP" wording removed —
note-view.tsxnow describes extras as leftovers from before000095, andinteraction-views.mdscopes the multi-note case to pre-migration data.
deepseek-v4.1-flash-1017 (free via Pullfrog for OSS) | 𝕏
There was a problem hiding this comment.
ℹ️ No critical issues — one minor coverage suggestion inline.
Approach: sound — the new commits keep the database as the authority for "one document per note view" and make the MCP writer converge on 409 DOC_NOTE_VIEW_TAKEN instead of surfacing it.
Reviewed changes — the incremental delta 0461ce4..528a2b3 (4 files), on top of the previously reviewed single-document note view.
- MCP
write_docconverges on a racing writer —writeViewNotere-reads the view after a failed create and patches the document another writer created, rethrowing the original error when none appears. - Activity toggle accessible name — the icon-only comments/activity button in
DocumentPanenow carries anaria-labelalongside its tooltiptitle. note-view.tsxnaming — the localnotesKey/notesQueryare renamed todocKey/docQueryto match the single-document model, and a long doc comment was rewrapped.000095comments — documents why the keeper choice and the API's list ordering cannot diverge, and warns that the table lock blocks document writers for the migration's duration.
deepseek-v4.1-flash-1017 (free via Pullfrog for OSS) | 𝕏
…ng errors in write_doc
There was a problem hiding this comment.
✅ No new issues found.
Reviewed changes — the incremental delta 528a2b3..4e72866 (1 file), adding the unit coverage the prior review asked for.
- 409 convergence covered — a test makes
createDocumentreject withDOC_NOTE_VIEW_TAKENwhile the post-failurelistDocumentsreturns the winner, assertingpatchDocumentis called on that document and the tool reports an update. - Rethrow path covered — a second test rejects with a generic error while the view stays empty, asserting the original error propagates and nothing is patched.
deepseek-v4.1-flash-1017 (free via Pullfrog for OSS) | 𝕏

Summary
Simplifies the Note view from #796: a note view is now one editable document, not a list of notes. It opens straight into the docs editor with its comments and activity pane, with no notes sidebar and no title.
Web
NoteViewshows the view's one document. The first time someone withdocs:writeopens an empty view, the document is created. With onlydocs:read, an empty view says it has no document yet. A failed creation can be retried.DocumentPanetakes an optionalheaderSlot. With it, the pane draws no header bar of its own, and its save status and comments/activity toggle render into that element. The interaction layout provides the slot in the view header, where other view types keep their settings button. The docs route passes no slot and keeps its breadcrumb header.DOC_NOTE_VIEW_TAKEN), the view refetches and shows the other client's document instead of an error.noteViewstrings are trimmed to what is still used, with translations in all 9 locales.API (migration
000095)uq_documents_note_viewondocuments (view_id)whereview_id IS NOT NULL AND deleted_at IS NULL. This also settles two clients creating it at once.POST /docswith the sameview_idreturns409 DOC_NOTE_VIEW_TAKEN. Deleting the document frees the view for a new one.documentsinSHAREmode before deduping and building the index, so instances still running the old code during a rolling deploy cannot insert a duplicate in between (counter first, as000088requires). It can be run again.MCP
write_docwithviewIdupdates the view's one document whatever title is given (the title only names it on creation), or creates it when the view has none. README,ALL_TOOLS.mdand the changelog are updated.Docs:
interaction-views.md,http-design.md(error table) anddatabase-schema.md.Things a reviewer may want to know:
GET /docs?view_id=, so a view that had several before the migration shows the first in manual order (the migration soft-deletes the rest).Type of Change
Checklist
Testing
000095dedupe and re-run, alongside the existing note tests. Service, handler and presenter tests pass. The Go e2e suite (doc_note_view_test.go, now with a409 DOC_NOTE_VIEW_TAKENcase and a re-run of both migrations) was not run.TestWriteDocumentAtPath_DocDeletedBeforeRowLockIsPathChangedfails on my machine with and without this change.tsc -bpasses.note-view.test.tsxis rewritten (opens the one document, shows only the first of several, creates once when empty, retries a failed creation, shows a document created by someone else, read-only and no-access states).filesystem-doc-tools-notes.test.tspasses, with a new case for writing the view's document under a different title.note-views.spec.ts(rewritten for the single document) passes on chromium and mobile-chrome against the e2e docker stack rebuilt from this branch.