phase: 100_page_width_consistency
**Phase 100 — final verification pass: all green.** - Verified the shipped CSS contract directly: `--chat-column: 72rem` in `:root`; 0 literal `max-width: 46rem`; no `@media (min-width: 1500px)` block; exactly 4 token-capped reading columns; tuning/theme/doc-edit shells cap-free, structurally `.sources-shell`; `mock_llm.py` diff is comment-only. - Defect found & fixed (phase-93 suite): `test_theme_semantic_completion.py::test_reset_removes_tag_byte_identical` raced theme.js's post-PUT refetch — it asserted the `#bor-theme` tag was gone right after the result line, but tag removal lands in the reconcile after the re-fetch (failed ~1 in 5 runs after `test_chat_rag`, reproduced). Fixed with an auto-waiting `expect(...).to_have_count(0)` (settled-state wait, the file's existing house pattern). 6/6 clean on the repro loop after. - Tests/lint/coverage: `uv run pytest --cov=app --cov-report=term-missing` → 2052 passed, **99%** on `app/`; `uv run ruff check .` + `uv run pyright` → 0 errors. - E2E in isolation (all passed): `test_wide_desktop_column.py` 3 (the phase suite — chat==tuning==theme==RAG ±4px at 1280 & 1920, ≈1152px; shared ≈1152px; standalone doc ≈1112px; modal unchanged ≈1100px; 360px overflow-free), `test_ui_customization` 4, `test_admin_theme_tab` 5, `test_document_viewer` 7, `test_save_share_ux` 5, `test_sticky_navbar` 3, `test_markdown_tables` 6, `test_responsive_polish` 7, `test_chat_rag` 3, `test_theme_semantic_completion` 8. - Completion criteria: ① measured 72rem everywhere (≥~1200px, ±4px) + full-width below + 360px clean — **PASS** (E2E); ② zero 46rem rules / no 1500px block / four token selectors — **PASS** (grep + unit pins); ③ B4 byte-identical no-op + mobile squeeze — **PASS** (theme + responsive suites green); ④ full suite / coverage / lint — **PASS**; ⑤ atomic commit — left to the harness per executor protocol (all changes in the working tree, uncommitted). - Deviations: none from phase decisions; only change in this pass is the race fix above (test-only, behavior unchanged). - Next pending phase: `98_sync_summary_visibility` (numeric order in `todo/`; also pending: 99, 101–105).
This commit is contained in:
+125
-110
@@ -1,29 +1,33 @@
|
||||
"""Unit: the 2x reading column on wide desktops (phase 58, task 01).
|
||||
"""Unit: every page matches the RAG page's 72rem width (phase 100).
|
||||
|
||||
The measured-width browser proof is E2E-gated by the phase-58 story
|
||||
suite (task 02); like the other frontend-adjacent unit files (the
|
||||
The measured-width browser proof is E2E-gated by the phase's width
|
||||
suite (task 03); like the other frontend-adjacent unit files (the
|
||||
test_save_chat_ui.py pattern), this module pins the styles.css markers
|
||||
the wide-column contract depends on, so a silent regression is caught
|
||||
the width contract depends on, so a silent regression is caught
|
||||
without a browser:
|
||||
|
||||
* the ``--chat-column`` custom property in ``:root`` — 46rem base
|
||||
(the PLAN §7 column lineage) with the provenance comment (owner
|
||||
instruction 2026-08-31, TODO L5 / D2);
|
||||
* the ``@media (min-width: 1500px)`` block at the bottom of the
|
||||
responsive region — the SINGLE place that doubles the token to
|
||||
92rem (2x);
|
||||
* the ``--chat-column`` custom property in ``:root`` — 72rem, EQUAL to
|
||||
the ``.container``'s 72rem cap (owner instruction 2026-09-12:
|
||||
"match the width of the RAG page for all other pages" — supersedes
|
||||
the 2026-08-31 instruction), with the provenance comment;
|
||||
* NO ``@media (min-width: 1500px)`` block anywhere in the file — the
|
||||
phase-58 wide-desktop doubling is deleted in full (the token is
|
||||
72rem at every viewport);
|
||||
* the four reading-column selectors — ``.chat-shell``,
|
||||
``.shared-shell``, ``.doc-md``, ``.doc-summary:has(+ .doc-md)`` —
|
||||
each capped with ``max-width: var(--chat-column)`` and NOTHING else
|
||||
in the file uses the token (exactly four rules);
|
||||
* the negative pin — the form columns (``.tuning-shell``; and from
|
||||
phase 59, task 06, ``.doc-edit-shell`` — forms, not reading
|
||||
surfaces) are the only literal ``max-width: 46rem`` rules left in
|
||||
the file, kept hard-coded so the wide-desktop doubling never
|
||||
stretches a form;
|
||||
* the "46rem column contract" block comments were updated to name the
|
||||
base value + the wide override (the stale "≤46rem" contract claims
|
||||
are gone from the reading-column comments).
|
||||
in the file uses the token for a max-width (exactly four rules);
|
||||
* the flipped negative pin — ZERO literal ``max-width: 46rem`` rules
|
||||
remain (the phase-27/59/91 form-column caps are retired): the form
|
||||
shells (``.tuning-shell``, ``.theme-shell``, ``.doc-edit-shell``)
|
||||
carry no cap, no token, and no ``margin-inline`` — structurally
|
||||
``.sources-shell``;
|
||||
* the two source-page dialogs (phase 69 remove-confirm, phase 89
|
||||
ignore-editor) cap at the chat-column width THROUGH THE TOKEN —
|
||||
``min(var(--chat-column), calc(100vw - 2rem))`` — or the viewport;
|
||||
* the stale width comments are gone — no "46rem base" / "92rem at
|
||||
>=1500px" / "1500px" width claims remain (the "46rem column
|
||||
contract" wording was rewritten to the 72rem contract, 2026-09-12).
|
||||
"""
|
||||
from __future__ import annotations
|
||||
|
||||
@@ -58,57 +62,52 @@ def _rule_block(css: str, selector: str) -> str:
|
||||
# ---------- the --chat-column token ----------
|
||||
|
||||
|
||||
def test_root_declares_chat_column_46rem_base() -> None:
|
||||
""":root declares --chat-column: 46rem (the PLAN §7 base) with the
|
||||
owner-provenance comment (instruction 2026-08-31, TODO L5)."""
|
||||
def test_root_declares_chat_column_72rem_equal_to_the_container() -> None:
|
||||
""":root declares --chat-column: 72rem — EQUAL to the .container's
|
||||
72rem cap (one width for everything) — with the owner-provenance
|
||||
comment (instruction 2026-09-12)."""
|
||||
css = _css()
|
||||
root = _rule_block(css, ":root")
|
||||
assert "--chat-column: 46rem" in root, (
|
||||
":root must declare the --chat-column base (46rem)"
|
||||
assert "--chat-column: 72rem" in root, (
|
||||
":root must declare the --chat-column width (72rem)"
|
||||
)
|
||||
pre = css[: css.index("--chat-column: 46rem")]
|
||||
# The token equals the container's cap (the RAG page's width).
|
||||
container = _rule_block(css, ".container")
|
||||
assert "max-width: 72rem" in container, (
|
||||
".container's 72rem cap is the width the token now equals"
|
||||
)
|
||||
pre = css[: css.index("--chat-column: 72rem")]
|
||||
comment = pre[pre.rindex("/*") : pre.rindex("*/")]
|
||||
assert "owner instruction 2026-08-31" in comment, (
|
||||
assert "owner instruction 2026-09-12" in comment, (
|
||||
"the token's comment must cite the owner instruction "
|
||||
"(2026-08-31, TODO L5)"
|
||||
"(2026-09-12 — match the width of the RAG page)"
|
||||
)
|
||||
|
||||
|
||||
def test_wide_media_block_doubles_the_token() -> None:
|
||||
"""A @media (min-width: 1500px) block sets --chat-column: 92rem on
|
||||
:root — the single wide override (2x the base)."""
|
||||
def test_the_wide_desktop_doubling_is_retired() -> None:
|
||||
"""No @media (min-width: 1500px) block remains (the phase-58 2x
|
||||
override is deleted in full, 2026-09-12) and the token is never
|
||||
assigned the old wide value — 72rem at every viewport."""
|
||||
css = _css()
|
||||
m = re.search(r"@media \(min-width: 1500px\) \{", css)
|
||||
assert m, "styles.css must carry the @media (min-width: 1500px) block"
|
||||
start = css.index("{", m.start())
|
||||
depth = 0
|
||||
for i in range(start, len(css)):
|
||||
if css[i] == "{":
|
||||
depth += 1
|
||||
elif css[i] == "}":
|
||||
depth -= 1
|
||||
if depth == 0:
|
||||
block = css[m.start() : i + 1]
|
||||
break
|
||||
else:
|
||||
raise AssertionError("unbalanced braces in the wide media block")
|
||||
assert ":root { --chat-column: 92rem; }" in block, (
|
||||
"the wide block must set :root { --chat-column: 92rem; }"
|
||||
assert "@media (min-width: 1500px)" not in css, (
|
||||
"the wide-desktop media block must be deleted (retired 2026-09-12)"
|
||||
)
|
||||
assert "--chat-column: 92rem" not in css, (
|
||||
"the token is never doubled to the old wide value"
|
||||
)
|
||||
# The wide block is the ONLY min-width:1500 media in the file and
|
||||
# the only place 92rem is assigned to the token.
|
||||
assert css.count("@media (min-width: 1500px)") == 1
|
||||
assert css.count("--chat-column: 92rem") == 1
|
||||
|
||||
|
||||
def test_wide_block_lives_in_the_bottom_responsive_region() -> None:
|
||||
"""The min-width sibling sits alongside the max-width responsive
|
||||
blocks at the bottom of the file (after the <=640px block)."""
|
||||
def test_no_literal_46rem_width_remains() -> None:
|
||||
"""Flipped negative pin (phase 100 D1): ZERO literal
|
||||
max-width: 46rem rules remain in the file — the phase-27/59/91
|
||||
form-column caps are retired, and the dialog panels ride the
|
||||
token, not a 46rem literal."""
|
||||
css = _css()
|
||||
wide = css.index("@media (min-width: 1500px)")
|
||||
mobile = css.rindex("@media (max-width: 640px)")
|
||||
assert wide > mobile, (
|
||||
"the wide override belongs in the bottom media-query region"
|
||||
assert css.count("max-width: 46rem") == 0, (
|
||||
"no literal max-width: 46rem rule may remain (retired 2026-09-12)"
|
||||
)
|
||||
assert "min(46rem" not in css, (
|
||||
"the dialog panels must ride the token, not a 46rem literal"
|
||||
)
|
||||
|
||||
|
||||
@@ -119,7 +118,7 @@ def test_the_four_reading_columns_use_the_token() -> None:
|
||||
""".chat-shell, .shared-shell, .doc-md and
|
||||
.doc-summary:has(+ .doc-md) each cap with
|
||||
max-width: var(--chat-column) — and exactly those four rules use
|
||||
the token (no other selector)."""
|
||||
the token for a max-width (no other selector)."""
|
||||
css = _css()
|
||||
for selector in (
|
||||
".chat-shell",
|
||||
@@ -135,73 +134,89 @@ def test_the_four_reading_columns_use_the_token() -> None:
|
||||
)
|
||||
|
||||
|
||||
def test_shared_shell_keeps_the_centered_column_comment() -> None:
|
||||
""".shared-shell's inline comment keeps the "centered chat column"
|
||||
wording and notes the wide override (task 01 work item)."""
|
||||
css = _css()
|
||||
rule = css[css.index(".shared-shell {") : css.index(".shared-shell {") + 400]
|
||||
assert "the PLAN §7 centered chat column" in rule
|
||||
assert "92rem at >=1500px" in rule, "the comment must note the wide override"
|
||||
|
||||
|
||||
def test_doc_md_keeps_width_100_under_the_cap() -> None:
|
||||
""".doc-md stays width:100% under the token cap (the modal's
|
||||
1100px panel remains its effective ceiling there)."""
|
||||
1100px panel remains its effective ceiling there — phase 100 D2)."""
|
||||
assert "width: 100%" in _rule_block(_css(), ".doc-md")
|
||||
|
||||
|
||||
# ---------- the negative pins ----------
|
||||
# ---------- the form shells + the dialog panels ----------
|
||||
|
||||
|
||||
def test_tuning_shell_stays_hardcoded_46rem() -> None:
|
||||
""".tuning-shell (the form column, out of scope) keeps its
|
||||
hard-coded max-width: 46rem at every width — it never widens."""
|
||||
def test_the_form_shells_ride_the_full_container() -> None:
|
||||
"""The form shells (.tuning-shell — phase 27, .theme-shell —
|
||||
phase 91, .doc-edit-shell — phase 59) carry NO cap, NO token, and
|
||||
NO margin-inline: the .container ancestor centers them, so they
|
||||
ride the 72rem frame like .sources-shell (flex column,
|
||||
gap 1.25rem, flex: 1 — the owner instruction 2026-09-12 retires
|
||||
the form-column caps)."""
|
||||
css = _css()
|
||||
tuning = _rule_block(css, ".tuning-shell")
|
||||
assert "max-width: 46rem" in tuning, (
|
||||
".tuning-shell must stay hard-coded 46rem (negative pin)"
|
||||
)
|
||||
assert "var(--chat-column)" not in tuning, (
|
||||
".tuning-shell must NOT reference the reading-column token"
|
||||
)
|
||||
for selector in (".tuning-shell", ".theme-shell", ".doc-edit-shell"):
|
||||
block = _rule_block(css, selector)
|
||||
assert "max-width" not in block, (
|
||||
f"{selector} must carry no cap (retired 2026-09-12)"
|
||||
)
|
||||
assert "var(--chat-column)" not in block, (
|
||||
f"{selector} rides the .container frame, not the token"
|
||||
)
|
||||
assert "margin-inline" not in block, (
|
||||
f"{selector} is centered by the .container ancestor"
|
||||
)
|
||||
for decl in (
|
||||
"display: flex",
|
||||
"flex-direction: column",
|
||||
"gap: 1.25rem",
|
||||
"flex: 1",
|
||||
):
|
||||
assert decl in block, (
|
||||
f"{selector} keeps the .sources-shell shape ({decl})"
|
||||
)
|
||||
|
||||
|
||||
def test_no_other_hardcoded_46rem_rule_remains() -> None:
|
||||
"""After the switch, the form columns are the ONLY rules with a
|
||||
literal max-width: 46rem: .tuning-shell (phase 27),
|
||||
.doc-edit-shell (phase 59, task 06 — the doc edit screen is a
|
||||
FORM column, not a reading column, so it must not ride
|
||||
--chat-column and phase 58's wide-desktop doubling must never
|
||||
stretch the form), and .theme-shell (phase 91 task 04 — the
|
||||
admin Theme editor is a form column too: the palette grid +
|
||||
fieldsets must never ride the wide-desktop doubling). Every
|
||||
reading column rides the token (the --chat-column base
|
||||
declaration is the other non-rule occurrence of 46rem)."""
|
||||
def test_the_dialog_panels_ride_the_token() -> None:
|
||||
"""The two source-page dialogs (phase 69 remove-confirm, phase 89
|
||||
ignore-editor) cap at the chat-column width THROUGH THE TOKEN —
|
||||
min(var(--chat-column), calc(100vw - 2rem)) — or the viewport,
|
||||
whichever is narrower (the 46rem literals ride no more)."""
|
||||
css = _css()
|
||||
assert css.count("max-width: 46rem") == 3, (
|
||||
"only the form columns (.tuning-shell, .doc-edit-shell, "
|
||||
".theme-shell) may keep a literal max-width: 46rem"
|
||||
)
|
||||
assert "max-width: 46rem" in _rule_block(css, ".tuning-shell")
|
||||
assert "max-width: 46rem" in _rule_block(css, ".doc-edit-shell")
|
||||
assert "max-width: 46rem" in _rule_block(css, ".theme-shell")
|
||||
for selector in (".remove-confirm-panel", ".ignore-editor-panel"):
|
||||
block = _rule_block(css, selector)
|
||||
assert "min(var(--chat-column), calc(100vw - 2rem))" in block, (
|
||||
f"{selector} must ride the token (the chat-column width "
|
||||
"or the viewport)"
|
||||
)
|
||||
|
||||
|
||||
def test_comments_cite_the_wide_override_with_provenance() -> None:
|
||||
"""The block comments that claimed the "46rem column contract" now
|
||||
name base 46rem + the 2x wide override, with the owner
|
||||
instruction (2026-08-31, TODO L5) as the provenance at the token
|
||||
and the media block."""
|
||||
# ---------- the comment contract ----------
|
||||
|
||||
|
||||
def test_comments_carry_the_72rem_contract() -> None:
|
||||
"""The stale width claims are gone from the file: no "≤46rem",
|
||||
"46rem base", "92rem at >=1500px" or "1500px" wording (the
|
||||
2026-08-31 contract was rewritten to the 72rem contract), with the
|
||||
owner instruction (2026-09-12) as the provenance at the token and
|
||||
the reading-column comments naming 72rem."""
|
||||
css = _css()
|
||||
# The stale "≤46rem" contract claims are gone from the file.
|
||||
assert "≤46rem" not in css, (
|
||||
"the stale '≤46rem' contract wording must be updated"
|
||||
)
|
||||
# Provenance at the two authoritative spots (token + wide block).
|
||||
token_idx = css.index("--chat-column: 46rem")
|
||||
wide_idx = css.index("@media (min-width: 1500px)")
|
||||
assert "owner instruction 2026-08-31" in css[max(0, token_idx - 400) : token_idx]
|
||||
assert "owner instruction 2026-08-31" in css[max(0, wide_idx - 500) : wide_idx]
|
||||
# The chat-shell comment names base + override.
|
||||
assert "46rem base" not in css, "no stale '46rem base' claim may remain"
|
||||
assert "92rem at >=1500px" not in css, (
|
||||
"no stale wide-override claim may remain"
|
||||
)
|
||||
assert "1500px" not in css, (
|
||||
"the wide-desktop breakpoint wording is retired (2026-09-12)"
|
||||
)
|
||||
# Provenance at the authoritative spot (the token).
|
||||
token_idx = css.index("--chat-column: 72rem")
|
||||
assert "owner instruction 2026-09-12" in css[max(0, token_idx - 400) : token_idx]
|
||||
# The chat-shell + shared-shell comments name the 72rem contract.
|
||||
chat_comment = css[: css.index(".chat-shell {")]
|
||||
assert "46rem base" in chat_comment and "92rem" in chat_comment
|
||||
assert "72rem" in chat_comment, (
|
||||
"the chat-shell comment must name the 72rem contract"
|
||||
)
|
||||
shared_idx = css.index(".shared-shell {")
|
||||
shared_rule = css[shared_idx : shared_idx + 400]
|
||||
assert "72rem" in shared_rule, (
|
||||
"the shared-shell comment must name the 72rem contract"
|
||||
)
|
||||
|
||||
Reference in New Issue
Block a user