phase: 165_prose_word_wrap
All verification complete. Final report:
**Phase 165 — Prose word wrap (final verification pass)**
- Verified: `PROSE_FORMATS={txt,text}` + `isProseDoc` (single-site, image arm wins); `renderDocument` three-way branch (md → `.doc-md`, prose → `.doc-prose` text node, else `pre.doc-raw` byte-identical); `.doc-prose` CSS = 72rem column, `pre-wrap` + `overflow-wrap: anywhere`, tokens only, zero literals; `[data-view="pages"]` hide list includes `.doc-prose` as one grouped declaration; phase-116 scrollbar rules intact and modal-scoped; no `innerHTML` in the prose path.
- Tests/lint (all 100% green):
- `uv run pytest` → **3854 passed** (unit + integration)
- `uv run pytest --cov=app --cov-report=term-missing` → **TOTAL 99%** (>90%)
- `uv run ruff check .` → All checks passed; `uv run pyright` → **0 errors**
- `uv run pytest tests/e2e/test_prose_word_wrap.py -v --no-cov` → **5 passed** (isolation)
- Isolation regressions: document_viewer 8, image_documents 4, pdf_pages_in_sources 4, pdf_strip_additive_selfheal 5, edit_summaries 4, summary_in_viewer 4, chat_answer_clusters 4, garbage_pdf 3, pdf_support 6, sticky_navbar 3, smoke 3 — all passed
- Completion criteria: image description wraps, full text, both surfaces ✔; `.txt` wraps same way ✔; `py`/`json`/code keep `pre.doc-raw` + horizontal overflow + themed modal scrollbar (E2E negative control + pins) ✔; no innerHTML, AA `--ink`/`--surface` pair ✔; full gates green ✔; commit + phase-dir move are harness-owned (not executed per pipeline rules).
- Documentation: README already updated by task 03 (viewer section + image-docs section); full README/AGENTS.md review found no further inconsistencies — **verified consistent, no changes needed**.
- Notable deviations: `.doc-prose` omits `font-family: inherit` from 00_phase D2's snippet — task 01's authoritative "exact property set" excludes it and `div` inherits fonts anyway (behavior identical). PDF deferral (A4) intact: `format == "pdf"` stays in `.doc-raw`, owner call recorded.
- Next pending phase: `166_hide_empty_answer_bubble`.
This commit is contained in:
@@ -82,6 +82,15 @@ def _code(js: str) -> str:
|
||||
return re.sub(r"//.*?$|/\*.*?\*/", "", js, flags=re.S | re.M)
|
||||
|
||||
|
||||
def _prose_rule(js: str) -> str:
|
||||
"""The phase-165 prose rule (the PROSE_FORMATS const + isProseDoc,
|
||||
module scope) — renderDocument's prose gate, needed beside the
|
||||
extracted functions for the node runs."""
|
||||
start = js.index("const PROSE_FORMATS")
|
||||
end = js.index("}", js.index("function isProseDoc")) + 1
|
||||
return js[start:end]
|
||||
|
||||
|
||||
def _run_node(script: str) -> str:
|
||||
proc = subprocess.run(
|
||||
["node", "-e", script], capture_output=True, text=True, timeout=60
|
||||
@@ -193,8 +202,9 @@ def test_view_toggle_css() -> None:
|
||||
style, never color alone, B5) + the CSS-driven view swap
|
||||
(``.doc-views .doc-pages`` hidden by default; ``[data-view=
|
||||
"pages"]`` hides the Summary panel / .doc-md / .doc-raw /
|
||||
.doc-image and shows the strip as the grid). Provenance comment
|
||||
above the block (house style)."""
|
||||
.doc-prose (phase 165, task 01) / .doc-image and shows the strip as
|
||||
the grid — one grouped declaration). Provenance comment above the
|
||||
block (house style)."""
|
||||
css = _read(STYLES_CSS)
|
||||
toggle_i = css.find(".doc-view-toggle {")
|
||||
assert toggle_i != -1, "styles.css must style .doc-view-toggle"
|
||||
@@ -212,10 +222,18 @@ def test_view_toggle_css() -> None:
|
||||
"the pressed state is text weight + fill — never color alone (B5)"
|
||||
)
|
||||
# The CSS-driven swap: hidden strip by default; pages hides the
|
||||
# text view and shows the strip.
|
||||
# text view and shows the strip. The hide list is ONE grouped
|
||||
# declaration (phase 165: .doc-prose joins it — defensive today,
|
||||
# load-bearing if the owner ever adds "pdf" to PROSE_FORMATS).
|
||||
assert '.doc-views .doc-pages { display: none; }' in css
|
||||
for sel in (".doc-summary", ".doc-md", ".doc-raw", ".doc-image"):
|
||||
assert f'.doc-views[data-view="pages"] {sel}' in css
|
||||
expected = ",\n".join(
|
||||
f'.doc-views[data-view="pages"] {sel}'
|
||||
for sel in (".doc-summary", ".doc-md", ".doc-raw", ".doc-prose", ".doc-image")
|
||||
) + " { display: none; }"
|
||||
assert css.count(expected) == 1, (
|
||||
"the text-view hide list is exactly ONE grouped declaration "
|
||||
"over .doc-summary/.doc-md/.doc-raw/.doc-prose/.doc-image"
|
||||
)
|
||||
assert '.doc-views[data-view="pages"] .doc-pages { display: grid; }' in css
|
||||
|
||||
|
||||
@@ -266,7 +284,7 @@ function describe(el) {
|
||||
|
||||
def _render_script() -> str:
|
||||
js = _read(DOCUMENT_JS)
|
||||
parts = [
|
||||
parts = [_prose_rule(js)] + [
|
||||
_fn(js, n)
|
||||
for n in ("renderDocument", "docViewToggle", "viewToggleButton", "docPagesStrip")
|
||||
]
|
||||
|
||||
Reference in New Issue
Block a user