All verification is green. Final report: **Phase 157 — final verification pass (all 3 tasks already complete in `complete/`)** - Verified the implemented work matches the design: `CHIP_CAP = 90` constant + display-only cap in `renderChips` (`slice(0,90).trimEnd() + "…"`), `title`/`aria-label`/click payload byte-unchanged; unit pins (89/90/91 letter & space, full-text invariant, short-string guard, Maybe-try single-path guard); phase-104 E2E updated to the cap contract - Full suite `uv run pytest --cov=app --cov-report=term-missing`: **3578 passed**, app/ coverage **99%** (>90% ✓) - `uv run ruff check .` clean; `uv run pyright`: 0 errors - Dedicated E2E `uv run pytest tests/e2e/test_chat_chip_cap.py -v --no-cov`: **4/4 passed** in isolation (DB up) - Cross-phase regression: phase-104 E2E 6/6, phase 05/80/103 chip suite 8/8 (seed chips <90 chars — cap is a no-op, assertions hold) - Criteria: ≤91-char capped display ✓ (byte-for-byte pin) · click submits FULL 120-char question (user bubble) ✓ · `title` + clipped-case `aria-label` carry full text ✓ (375px viewport) · <90-char byte-identical ✓ (unit + live DOM) · commit: deferred to the harness (per harness protocol, overrides AGENTS.md rule 8 for this pass) - Documentation: README.md reviewed in full — every `.env.example` var documented, all referenced scripts/pages/commands verified against the tree, the phase's chip-cap note is in the Chat section; AGENTS.md verified (commands, test files, layout-rule citations — phase 157 adds no new layout principle) → **verified consistent, no changes needed** - No live-infrastructure changes were required or made - Next pending phase: **158_thinking_timeline**
6.0 KiB
Phase 157 — hero suggestion chips cap their display at 90 characters
Source: owner UX audit 2026-10-03 (live interactive-browser pass): "hero suggestion chips — consider a char cap — long opening questions get hard-truncated mid-word… the chips stretch near full container width before clipping."
Story: n/a (audit-derived phase; the chip machinery is phase 80's 80_history_suggestion_chips + phase 104's 104_chip_sizing_question_cap, both complete)
Context: app.js::renderChips(container, items, onSelect) (L1272–1315) — the ONE shared chip component (the hero #suggestions + the deflection "Maybe try" chips). Phase 104's contract (owner-locked 2026-09-12, in-code): the single-line chip CLIPS long questions (CSS), title is the hover reveal, aria-label is the clipped-case accessible name (the source-chip pattern), and the click submits the FULL text (submitSuggestion(text) + onSelect(text, btn)). Today there is NO display-length cap — a 300-char opening question stretches its chip to near full container width before the CSS clip engages (the audit's observation: the hero's third chip ran the full reading-column width). Phase 104 also capped the COMPOSER (the input) — a different surface, untouched here. The chips' content is the 3 newest saved chats' opening questions (phase 80/103) — owner-derived, textContent-only (the house rule), so a display cap is a pure presentation change: the click payload stays full.
Objective
The chip's DISPLAYED text caps at 90 characters with a clean … (the chip stays compact — no more full-width hero chips), while the title hover reveal, the clipped-case aria-label, and the click payload all keep the FULL question (phase 104's contract, extended).
Dependencies
80_history_suggestion_chips(complete) — the hero chips' content contract (the 3 newest opening questions).104_chip_sizing_question_cap(complete) — the single-line CSS clip + thetitle/aria-labelidiom this phase EXTENDS (the cap makes the CSS clip a secondary guard, not the primary one).
Design (shared by all tasks — the executor reads this, not the chat)
- The cap (ASSUMPTION A1, owner-locked):
CHIP_CAP = 90— a named constant inapp.js(the module's top, beside the other chip constants). Applied to the DISPLAYED text ONLY inrenderChips:btn.textContent = text.length > CHIP_CAP ? text.slice(0, CHIP_CAP).trimEnd() + "…" : text.slice(0, 90).trimEnd()avoids the trailing-space-before-…artifact when char 90 is mid-word (thetrimEndis the pin). Thetitleis UNCHANGED (the fulltext— the hover reveal, phase 104). Thearia-labellogic is UNCHANGED (the clipped-case accessible name is the fulltext— with the cap, a long chip is ALWAYS "clipped" in the visual sense, but phase 104'sscrollWidth > clientWidthcheck still governs the aria-label: a 91-char display still overflows its single-line box at typical widths, so the aria-label lands; a SHORT string (< 90) is byte-identical to pre-phase in every respect — the no-cap case is unchanged). - The click payload (the load-bearing invariant):
submitSuggestion(text)+onSelect(text, btn)take the FULLtext(the un-capped value) — UNCHANGED. The cap is display-only: a capped chip sends the full question (the user gets their full question submitted — the phase-80 contract). A unit pin asserts the handler receives the FULL string for a >90-char item. - Scope:
renderChipsis shared (hero + Maybe-try) — the cap applies to both (a single code path; the Maybe-try chips are title-derived and short — the cap is a no-op there, and the byte-identity of short strings is the guard). NO other file changes (the CSS clip stays as the secondary guard; the composer's phase-104 cap is a different surface — untouched).
Tasks
01_chip_cap.md— theCHIP_CAPconstant + the display-only cap inrenderChips+ the comment in the phase-104 voice.02_unit_pins.md— the boundary pins (89/90/91), the full-text invariant, the short-string byte-identity.03_e2e_chip_cap.md— the dedicated Playwright suite.
Testing & Quality
- Unit: source-level pins — the 90-char boundary (an 89-char display is unchanged; a 90-char display is unchanged (the cap is
>); a 91-char display isslice(0,90).trimEnd() + "…"— the exact string pinned); thetitleis the full text in all three cases; the click/onSelectpayload is the FULLtextfor a >90-char item (the load-bearing invariant); a <90-char item is byte-identical to pre-phase in textContent/title/aria-label (the short-string guard). - Integration: the
/api/suggestionscontract is untouched (no server change — a regression guard only). - Coverage: >90% on the modified JS (the pins).
- The phase is "Complete" only when the entire project test suite passes 100% (every test in the project, not just this phase's).
- E2E:
uv run pytest tests/e2e/test_chat_chip_cap.py -v --no-covin isolation (DB up:podman compose up -d db; the deterministictests/e2e/mock_llm.py).
Documentation & Consistency
- The final pass reviews
README.mdandAGENTS.mdin full against the project as it stands after this phase — fixing every inconsistency found, including pre-existing ones not caused by the phase. - Tasks update
README.md/AGENTS.mdimmediately when their own changes are user-visible (the cap is a visible UI change — name it where the onboarding chips are described, if anywhere).
Completion Criteria
- a >90-char opening question renders a ≤91-char display (the cap + the
…) — the E2E - clicking the capped chip submits the FULL question (the user bubble shows the full text — the E2E's load-bearing assertion)
- the
titlehover reveal + the clipped-casearia-labelcarry the full text (the E2E) - a <90-char question is byte-identical to pre-phase (the pin)
uv run pytestgreen; the dedicated E2E green in isolation;uv run ruff check . && uv run pyrightclean;app/coverage >90%- one atomic commit per AGENTS.md rule 8 (
--no-gpg-sign)