phase: 163_pdf_strip_additive_selfheal
All gates verified. Final report: **Phase 163 — final verification pass (all 5 tasks already complete; verification-only run)** - Verified D1–D4 in code: `page_strip_mode` column + migration 0027, `DocContent` absent-never-null rule keyed off `page_count`; `_persist_pdf_pages` render → atomic tmp+`os.replace` writes → stale-tail-last + `strip_class` stamp; `_regate_pdf_strip` on both unchanged paths (mirror gate, heal, repair, fail-soft, one INFO line only when acting); viewer mode branch + Text/Pages toggle (Text default, `aria-pressed`, no innerHTML, lazy imgs). - `uv run pytest --cov=app --cov-report=term-missing` → **3796 tests, exit 0, coverage 99%** (>90%) - `uv run pytest tests/e2e/test_pdf_strip_additive_selfheal.py -v --no-cov` → **5 passed** in isolation - `test_pdf_pages_in_sources + test_pictorial_pdf + test_garbage_pdf` → 10 passed; `test_document_viewer(_context) + test_image_documents` → 20 passed - `uv run ruff check .` clean; `uv run pyright` → 0 errors; alembic **0027 downgrade→upgrade CLI round-trip clean** (+ integration pins) - Completion criteria: additive view w/ toggle ✅ · primary DOM byte-identity ✅ · write-first order/mid-write-failure/atomic pins ✅ · heal + repair E2E ✅ · zero vision/LLM on fast path (mock-captured) ✅ · non-qualifying payload byte-identity ✅ · docs pass ✅ - **Documentation**: README.md + AGENTS.md reviewed in full — the phase's updates are accurate; all config-table defaults cross-checked against `app/config.py` (no drift), every page route, script, and E2E command referenced exists, every `.env.example` var documented — **verified consistent, no changes needed**. - Notable: live `Letumdei` repair is owner-runtime post-deploy per D5 (next production Sync self-heals; no live changes made); the modified `.agents/screenshots/doc_modal_scrollbar_1280.png` is an E2E-regenerated artifact left for the pipeline commit. - **Next pending phase:** `164_chat_error_honesty`
This commit is contained in:
@@ -206,6 +206,16 @@ def get_document_content(
|
||||
basename matches). ``None`` — a non-git source, no row, or an
|
||||
ambiguous basename — keeps the payload byte-identical to pre-phase
|
||||
(both fields are dropped by the serializer, never ``null``).
|
||||
|
||||
Phase 163 (task 01): a page-qualifying PDF's payload additionally
|
||||
carries ``page_strip_mode`` — ``"primary"`` (the phase-133 fallback
|
||||
class: the strip IS the view) or ``"additive"`` (the phase-140
|
||||
pictorial class: the text + Summary view with the strip behind a
|
||||
Text/Pages toggle). Both strip keys are built off ``page_count`` and
|
||||
dropped when it is NULL, so every non-qualifying payload stays
|
||||
byte-identical to pre-phase (and a pre-phase row, whose mode column
|
||||
is NULL, keeps the strip-only DOM the viewer assumes for an absent
|
||||
mode).
|
||||
"""
|
||||
row = db.execute(
|
||||
select(Document, func.count(Chunk.id).label("chunks"))
|
||||
@@ -254,6 +264,16 @@ def get_document_content(
|
||||
if doc.page_count is not None
|
||||
else None
|
||||
),
|
||||
# Phase 163 (task 01): the strip CLASS (``"primary"`` = the
|
||||
# fallback class, the strip IS the view; ``"additive"`` = the
|
||||
# pictorial class, text + a Text/Pages toggle). The whole strip
|
||||
# block keys off ``page_count`` — a row with a stray mode but no
|
||||
# strip serializes NEITHER key — and a pre-phase row (mode NULL)
|
||||
# serializes the key ABSENT (never null), which the viewer reads
|
||||
# as ``"primary"`` (task 04).
|
||||
page_strip_mode=(
|
||||
doc.page_strip_mode if doc.page_count is not None else None
|
||||
),
|
||||
)
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user