phase: 181_svg_document_preview
**Phase 181 — final verification pass (all tasks already complete; verified + docs pass)**
- Verified: `app/rag/svg_text.py` (100 % cov), vector branch in `_index_image_file`, `_row_kind_mismatch` text→image migration, `IMAGE_MIMES[".svg"]`, sandboxed CSP on `GET /api/documents/{id}/image`, `.doc-image-img--vector` in `document.js`/`styles.css`, figure/thumbnail deliberate non-changes.
- Tests/lint (exact commands): `uv run pytest --cov=app --cov-report=term-missing` → **4265 passed, TOTAL 99 %** (exit 0) · `uv run pytest tests/e2e/test_svg_document_preview.py -v --no-cov` → **5 passed in isolation** · `uv run ruff check .` → clean · `uv run pyright` → **0 errors**.
- Regression (each run in isolation, `--no-cov`, all rc=0): `test_image_documents`, `test_chat_image_questions`, `test_answer_images`, `test_chat_answer_clusters`, `test_image_anchor_context`, `test_image_upload_feedback`, `test_markdown_inline_links_images`, `test_prose_word_wrap`, `test_pdf_support`, `test_pictorial_pdf`, `test_garbage_pdf`, `test_pdf_image_extraction`, `test_pdf_image_context`, `test_pdf_pages_in_sources`, `test_pdf_strip_additive_selfheal`, `test_sync_image_progress`.
- Completion criteria: ①SVG→`is_image`+`image_path`, no vision call, own `<title>/<desc>/<text>` — **met**; ②`image/svg+xml` + `default-src 'none'; sandbox` + `private, max-age=3600`, raster headers byte-unchanged — **met**; ③chat figure → modal `<img>`, no XML — **met**; ④`/document.html` full-width vector in `.doc-image` + text below — **met**; ⑤`` paints — **met**; ⑥raster/PDF unchanged — **met**; ⑦all gates green — **met**; ⑧commit + phase-dir move — harness-owned.
- Documentation: found and fixed README inconsistencies — stale forward reference "left to phase 181 / is phase 181's job" → completed-tense sizing note; "Updating the documents" standalone-image list missing `svg`; new **Raster only** bullet for question uploads (`.svg` → 422) documenting the `chat_images` guard; missing `svg_indexed=N` / `import: svg indexed` log contract; env-table heading `122/123/124` → `122/123/124/181`; new troubleshooting entry for an `.svg` showing raw XML. Full audit: every `Settings` field and every `.env.example` var is documented; pages/commands/scripts all exist. AGENTS.md verified accurate (phase-181 §5 clause present) — no changes needed beyond what the phase wrote.
- Notable deviation (kept from task 02): `app/api/chat_images.py` subtracts `_VECTOR_IMAGE_EXTENSIONS` from the question-image accept set — a required consequence of LOCKED A7 (`svg` in the default image set) since `_CHAT_IMAGE_FILENAME_RE` refuses to *serve* `.svg`; the regex itself is untouched, as the phase specified.
- Note for the commit: changes include `README.md`, `AGENTS.md` and `.env.example` — the phase file's `git add app/ frontend/ tests/ .env.example .agents/phases/` line omits the two markdown files; stage them too.
- Next pending phase: `182_verbatim_show_text`.
This commit is contained in:
+12
-1
@@ -433,7 +433,18 @@ class Settings(BaseSettings):
|
||||
#: knob). The validator rejects an empty list and malformed tokens,
|
||||
#: exactly like ``import_extensions`` (a typo would otherwise index
|
||||
#: zero images silently).
|
||||
image_extensions: str = "png,jpg,jpeg,webp,gif,bmp"
|
||||
#:
|
||||
#: ``svg`` (phase 181, LOCKED A1) is the one VECTOR member of the
|
||||
#: family: an ``.svg`` takes the same image branch (bytes copied to
|
||||
#: ``image_dir``, ``is_image``/``image_path``, served as
|
||||
#: ``image/svg+xml``) but NEVER the vision call — its searchable
|
||||
#: text comes from the file itself
|
||||
#: (:func:`app.rag.svg_text.extract_svg_text`, the ``<title>`` /
|
||||
#: ``<desc>`` / ``<text>`` words or an honest structural line).
|
||||
#: ``images`` remains the SINGLE knob (LOCKED A7): with it off an
|
||||
#: ``.svg`` stays a plain text document (raw XML in the viewer) and
|
||||
#: the walk never admits it as an image — no special-casing.
|
||||
image_extensions: str = "png,jpg,jpeg,webp,gif,bmp,svg"
|
||||
#: Where ingested image bytes are copied for serving (phase 122,
|
||||
#: ``BOR_IMAGE_DIR``). Raw string — ``Path.expanduser()`` is applied
|
||||
#: by the importer, not here (the ``sources_dir``/``upload_dir``
|
||||
|
||||
Reference in New Issue
Block a user