?
TRCKR-438
bug,web
Created: 2025-12-18 Updated: 2025-12-18
Relationships Loading...
Attachments
Loading...
Comments (3)
qa-agent · 2025-12-18
## QA PASSED See QA report document: 75222f26-cfbf-440f-9451-2ee5c78ba19a **Verification Summary:** All hypotheses tested and passed: - API creates document with body and writes file to disk - API GET returns body content from file - API PATCH updates body file correctly - Web UI renders body in EasyMDE editor textarea - CLI document commands not affected (30 tests pass) Edge cases tested: empty body, unicode, large files (29KB), special characters, missing body field - all pass. 144 total tests pass including 5 new regression tests for this fix.
agent · 2025-12-18
## Fix Implemented **Root Cause:** The REST API `/api/documents` endpoint was creating database records but not writing the actual markdown body files to disk. This meant documents created via the API would display as empty in the web UI's EasyMDE editor. **Changes Made:** 1. **server/models.py** (lines 497-513, 526): - Added `body: Optional[str]` field to `DocumentBase`, `DocumentCreate`, `DocumentUpdate`, and `DocumentResponse` models 2. **server/routes/documents.py**: - Updated `document_to_response()` (lines 24-38): Added optional body parameter - Updated `create_document()` (lines 100-104): Now writes body content to file on disk after creating DB record - Updated `get_document()` (lines 137-141): Now reads body from file and returns it in response - Updated `update_document()` (lines 179-183, 197-201): Now writes body to file when updating, reads current body for response 3. **tests/test_server.py** (lines 1912-2013): - Added 5 new regression tests for document body handling **Verification:** - All 201 tests pass (114 server tests + 87 others) - New tests specifically verify the fix works end-to-end **API Changes:** - POST `/api/documents` now accepts optional `body` field and creates the file - GET `/api/documents/{id}` now returns `body` field with file contents - PATCH `/api/documents/{id}` now accepts `body` field to update file contents - GET `/api/documents` (list) does NOT include body (null) for performance
triage-agent · 2025-12-18
## Bug Triage Complete **Reproduction:** CONFIRMED on production, not reproducible on local dev **Root Cause:** The REST API `/api/documents` endpoint creates database records but does NOT create the actual markdown body files. Documents created via CLI sync their metadata to the server but the body file never gets transferred. **Evidence:** - Production server has 127 documents in database but only 1 file in `/data/documents/` - Local dev works because files and database are co-located **TDD Approach:** 1. Add `body: Optional[str]` to `DocumentCreate` model 2. In `create_document()` route, create the file after DB record 3. Consider adding body to sync protocol **Complexity:** Medium - Requires API model, route, and potentially sync changes See attached triage report for full details.