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:
+18
@@ -0,0 +1,18 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!--
|
||||
Phase 181 fixture: the TEXTLESS drawing (the LOCKED A2 class) — pure
|
||||
paths and rects, no <title>, no <desc>, no <text>. The extractor's
|
||||
structural fallback line is the only text this document can ever
|
||||
carry, built from facts in the file: the stem, the shape census and
|
||||
the viewBox. The phase's E2E pins the indexed content to
|
||||
Vector diagram "blank" — … and the Sources thumbnail to the graphic.
|
||||
-->
|
||||
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 640 480">
|
||||
<rect x="20" y="20" width="600" height="440" fill="none" stroke="#455a64" stroke-width="3"/>
|
||||
<path d="M80 120 L240 120 L240 240 L80 240 Z" fill="#cfd8dc" stroke="#455a64" stroke-width="3"/>
|
||||
<path d="M400 120 L560 120 L560 240 L400 240 Z" fill="#cfd8dc" stroke="#455a64" stroke-width="3"/>
|
||||
<path d="M240 180 H400" stroke="#0288d1" stroke-width="4"/>
|
||||
<path d="M320 240 V360" stroke="#0288d1" stroke-width="4"/>
|
||||
<path d="M200 360 H440" stroke="#0288d1" stroke-width="4"/>
|
||||
<rect x="280" y="340" width="80" height="60" fill="#eceff1" stroke="#455a64" stroke-width="3"/>
|
||||
</svg>
|
||||
|
After Width: | Height: | Size: 1.1 KiB |
+37
@@ -0,0 +1,37 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!--
|
||||
Phase 181 fixture: a hand-written homelab wiring diagram.
|
||||
|
||||
Deliberate properties (the phase's E2E contract, tests/e2e/
|
||||
test_svg_document_preview.py):
|
||||
* a viewBox and NO width/height attributes — a vector drawing with no
|
||||
intrinsic size, the exact class the phase-181 vector sizing class
|
||||
(`doc-image-img` plus its `vector` modifier) exists for — the
|
||||
300x150 default box would sit small inside the full-width card;
|
||||
* its words live in <title>, <desc> and two <text> labels — what
|
||||
app.rag.svg_text.extract_svg_text indexes (LOCKED A1, no vision call);
|
||||
* a dozen plain <path>/<rect> shapes give the drawing real geometry
|
||||
while the title/desc/text carry the searchable words.
|
||||
-->
|
||||
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 1200 800">
|
||||
<title>Homelab network topology</title>
|
||||
<desc>Wiring diagram of the homelab: the edge router uplinks two managed switches, the hypervisor rack and the nas storage shelf.</desc>
|
||||
<rect x="40" y="40" width="1120" height="720" fill="none" stroke="#37474f" stroke-width="4"/>
|
||||
<rect x="120" y="96" width="240" height="120" rx="12" fill="#eceff1" stroke="#37474f" stroke-width="3"/>
|
||||
<path d="M160 156 h160 M240 126 v60" stroke="#546e7a" stroke-width="5"/>
|
||||
<rect x="480" y="96" width="240" height="120" rx="12" fill="#eceff1" stroke="#37474f" stroke-width="3"/>
|
||||
<path d="M520 136 h160 M520 166 h160 M520 196 h160" stroke="#546e7a" stroke-width="4"/>
|
||||
<rect x="840" y="96" width="240" height="120" rx="12" fill="#eceff1" stroke="#37474f" stroke-width="3"/>
|
||||
<path d="M880 136 h160 M880 166 h160 M880 196 h160" stroke="#546e7a" stroke-width="4"/>
|
||||
<path d="M360 156 C 420 156 420 156 480 156" fill="none" stroke="#0288d1" stroke-width="5"/>
|
||||
<path d="M720 156 C 780 156 780 156 840 156" fill="none" stroke="#0288d1" stroke-width="5"/>
|
||||
<path d="M600 216 C 600 300 600 340 600 400" fill="none" stroke="#0288d1" stroke-width="5"/>
|
||||
<rect x="360" y="400" width="240" height="140" rx="12" fill="#e8f5e9" stroke="#2e7d32" stroke-width="3"/>
|
||||
<path d="M400 440 h160 M400 470 h160 M400 500 h160" stroke="#2e7d32" stroke-width="4"/>
|
||||
<rect x="680" y="400" width="240" height="140" rx="12" fill="#fff3e0" stroke="#ef6c00" stroke-width="3"/>
|
||||
<path d="M720 440 h160 M720 470 h160 M720 500 h160" stroke="#ef6c00" stroke-width="4"/>
|
||||
<path d="M480 540 C 480 620 600 620 600 620 M720 540 C 720 620 600 620 600 620" fill="none" stroke="#78909c" stroke-width="4"/>
|
||||
<path d="M600 620 v100" fill="none" stroke="#78909c" stroke-width="4"/>
|
||||
<text x="180" y="250" font-family="sans-serif" font-size="34" fill="#37474f">rack-1 switch</text>
|
||||
<text x="700" y="590" font-family="sans-serif" font-size="34" fill="#ef6c00">nas storage</text>
|
||||
</svg>
|
||||
|
After Width: | Height: | Size: 2.7 KiB |
+14
@@ -0,0 +1,14 @@
|
||||
# Homelab infrastructure notes
|
||||
|
||||
The wiring diagram `diagrams/topology.svg` — titled "Homelab network
|
||||
topology" — is the current-state reference for the rack layout. When a
|
||||
question is about the homelab network topology, that diagram is the
|
||||
picture to open: it shows the edge router uplinking two managed
|
||||
switches, the hypervisor rack and the nas storage shelf.
|
||||
|
||||
Uplink rules, restated in prose so the words are searchable next to the
|
||||
diagram: the edge router hands one 10Gb link to rack-1 switch and one
|
||||
to the second switch; the hypervisor VLANs live on rack-1 switch, and
|
||||
nas storage sits behind the second switch on its own segment. The
|
||||
diagram carries no other labels — anything else about the network
|
||||
belongs in this note, not in the drawing.
|
||||
Reference in New Issue
Block a user