Repository navigation
[Bug] Row documents missing collab logs with permissions errors on API access and export #8986
Description
Bug Description
Database row documents created via "open as page" are inaccessible via API and export, despite being editable and synced to other users in real-time. The issue manifests as missing collab logs and permissions errors when attempting to retrieve row document data, while the row metadata and flattened text content remain accessible.
Root Cause Analysis
Row documents are created as orphan views in the folder system, causing four architectural misalignments:
-
Metadata Derivation vs. Persistence Mismatch - The
document_idin row metadata is derived deterministically from the row ID rather than being explicitly stored, causing the system to assume documents exist even when the collab was never persisted. -
Orphan View Permission Model - Row documents created via
ViewBackendService.createOrphanView()are not integrated with the folder hierarchy or permission system. When the API tries to retrieve them viaQueryCollabParams, the server's permission checks fail because the orphan view isn't hierarchically connected to the database. -
Collab Creation Without Finalization - Unlike database rows which have explicit finalization via
collab_builder.finalize(), row documents send collabs to server in a background task without guaranteeing completion before export/API queries. -
Inconsistent Export/API Loading - Document IDs always derive successfully from metadata, but actual collab loading fails silently or with permissions errors, returning partial results.
Evidence from Code Review
- Orphan view creation:
frontend/appflowy_flutter/lib/plugins/database/grid/application/row/row_document_bloc.dartline 93-110 - Metadata derivation:
frontend/rust-lib/flowy-database2/src/services/database/database_editor.rsline 840-861 - Background collab sync:
frontend/rust-lib/flowy-document/src/manager.rsline 180-192 - API permission check:
frontend/rust-lib/flowy-server/src/af_cloud/impls/document.rsline 30-57 - Export loading:
frontend/rust-lib/flowy-core/src/deps_resolve/folder_deps/folder_deps_database_impl.rsline 78-157
How to Reproduce
- Create a new database and add a row
- Open the row as a page and add content to the document
- Wait for sync completion and close AppFlowy
- Try to export the database or query the row document via API
- Observe permissions error and missing collab log
Expected Behavior
When a user opens a row as a page and edits the document:
- The document collab should be persisted and accessible via API and export
- The collab structure should be consistent with the real-time sync that works for other users
- API calls should return the complete collab log, not just flattened text
- Permissions should be inherited from the parent database/row, not fail with access errors
Operating System
Linux, macOS, Windows (affects all platforms - this is a server/backend issue affecting any client)
AppFlowy Version(s)
Current main branch (commit 5cf3a36)
Screenshots
N/A - This is an API/export data structure issue, not a UI bug
Additional Context
Why Waiting Doesn't Help:
Testing showed that waiting for sync completion and closing the application before export does not resolve the issue. This confirms the root cause is not a timing/persistence issue but rather a permission/registration issue on the server.
Impact:
- Users cannot reliably export databases containing rows with documents
- Row documents are inaccessible via API despite being fully editable
- Data may be lost if relying on API-based backup or integration
- Inconsistent UX: edits sync to others but document collab is not accessible to requester
Suggested Fixes (Architecture Level):
- Establish proper parent-child relationships between row documents and their rows in the folder hierarchy
- Implement row-based permission checking for row document access in the server API
- Add explicit finalization for row documents similar to database rows
- Create server-side indexes for row documents linked to their parent rows
- Validate collab existence before returning document_id in row metadata
Additional Notes:
- The issue does not occur with normal documents (outside database rows)
- Real-time sync and collaboration work correctly, indicating the collab object is created
- The flattened text extraction works, showing document metadata is stored
- This appears to be a design limitation rather than a simple bug, as row documents are intentionally orphan views
Report generated by: GitHub Copilot AI
Analysis based on commit: 5cf3a36
Please validate all findings independently before taking action.
Activity
barnabywalters commentedon Sep 3, 2026
This issue came out of various investigations we were doing into difficulties getting rich structured data out of appflowy for documents stored in database rows. We did eventually get it to work so it could be that the problems proposed here are actually not relevant, and that it’s instead a documentation/API definition issue which makes this harder than it needs to be. At least from our point of view the issues raised here are no longer currently blocking us with our project, so feel free to deprioritize or disregard.