fix(web): history tab copy — every chat saves automatically, there is no Save button
meta description -> locked (A3) auto-save string (history.html L6). page-sub -> locked (A3) string, the <strong>Save</strong> emphasis retired with the button (L106-109). empty row -> locked (A3) string; colspan=6, hidden, and row id untouched (L163). h1, the anonymous gate section, and history.js are byte-identical — state language verified accurate.
This commit is contained in:
@@ -0,0 +1,11 @@
|
|||||||
|
All verification is green. Final state check complete — no code changes were needed; this pass was pure verification.
|
||||||
|
|
||||||
|
**Phase 65 — final verification pass (all tasks 01–05 already complete in `complete/`; commit `8a1f99c` landed)**
|
||||||
|
|
||||||
|
- Verified implementation in code: `.chat-bottom` is the last child of `.chat-shell` wrapping `.chat-actions` (New chat → Share, ids/aria-labels intact) + `#composer`; `.chat-bottom` is `position: sticky; bottom: env(safe-area-inset-bottom, 0)` with no z-index (A1); `justify-content: flex-end` right-edge alignment (A2); ≤640px full-width vertical stack; `#composer` sticky declaration retained
|
||||||
|
- Dedicated suite: `uv run pytest tests/e2e/test_bottom_chat_actions.py -v --no-cov` → 4 passed (pin across sticky range, resting bottom, settled above footer, A2 + DOM order, mobile stack, 360px overflow, 44px targets, New chat/Share click-through)
|
||||||
|
- Regression E2E, each in isolation: pinned_composer 4 ✓, save_share_ux 5 ✓, chat_persistence 4 ✓, share_chat 4 ✓, chat_history 5 ✓, smoke 3 ✓
|
||||||
|
- Full gate: `.agent/validate.sh` exit 0 — `uv run pytest --cov=app` 1251 unit+integration tests passed, coverage TOTAL 99% (>90%); `uv run ruff check .` clean; `uv run pyright` 0 errors
|
||||||
|
- Criteria 1–7: all met (see above). Criterion 8: single `--no-gpg-sign` commit `8a1f99c` exists staging exactly `.agent/ frontend/ tests/` (no gpgsig; `commit.gpgsign=false`); the `00_phase.md` move to `complete/` is the harness pipeline step — left in `todo/` per instructions
|
||||||
|
|
||||||
|
**Deviations / notes:** No defects found, zero code edits. `.agent/PLAN.md` is absent from the repo (referenced by AGENTS.md; pre-existing — the phase overview/task files served as the binding spec). Worktree carries only uncommitted `.agent/` bookkeeping (task-05 file move + reports) managed by the harness. Next pending phase: `66_history_auto_save_copy`.
|
||||||
@@ -0,0 +1,72 @@
|
|||||||
|
........................................................................ [ 5%]
|
||||||
|
........................................................................ [ 11%]
|
||||||
|
........................................................................ [ 17%]
|
||||||
|
........................................................................ [ 23%]
|
||||||
|
........................................................................ [ 28%]
|
||||||
|
........................................................................ [ 34%]
|
||||||
|
........................................................................ [ 40%]
|
||||||
|
........................................................................ [ 46%]
|
||||||
|
........................................................................ [ 51%]
|
||||||
|
........................................................................ [ 57%]
|
||||||
|
........................................................................ [ 63%]
|
||||||
|
........................................................................ [ 69%]
|
||||||
|
........................................................................ [ 74%]
|
||||||
|
........................................................................ [ 80%]
|
||||||
|
........................................................................ [ 86%]
|
||||||
|
........................................................................ [ 92%]
|
||||||
|
........................................................................ [ 97%]
|
||||||
|
........................... [100%]
|
||||||
|
=============================== warnings summary ===============================
|
||||||
|
.venv/lib/python3.13/site-packages/fastapi/testclient.py:1
|
||||||
|
/var/home/ducoterra/Projects/Personal/brain_of_reese/.venv/lib/python3.13/site-packages/fastapi/testclient.py:1: StarletteDeprecationWarning: Using `httpx` with `starlette.testclient` is deprecated; install `httpx2` instead.
|
||||||
|
from starlette.testclient import TestClient as TestClient # noqa
|
||||||
|
|
||||||
|
-- Docs: https://docs.pytest.org/en/stable/how-to/capture-warnings.html
|
||||||
|
================================ tests coverage ================================
|
||||||
|
_______________ coverage: platform linux, python 3.13.13-final-0 _______________
|
||||||
|
|
||||||
|
Name Stmts Miss Cover
|
||||||
|
-----------------------------------------------
|
||||||
|
app/__init__.py 1 0 100%
|
||||||
|
app/api/__init__.py 0 0 100%
|
||||||
|
app/api/auth.py 22 0 100%
|
||||||
|
app/api/chat.py 131 0 100%
|
||||||
|
app/api/chats.py 110 0 100%
|
||||||
|
app/api/config.py 7 0 100%
|
||||||
|
app/api/doc_drafts.py 93 0 100%
|
||||||
|
app/api/docs.py 50 0 100%
|
||||||
|
app/api/git_sources.py 181 0 100%
|
||||||
|
app/api/health.py 10 0 100%
|
||||||
|
app/api/steering.py 42 0 100%
|
||||||
|
app/api/suggestions.py 8 0 100%
|
||||||
|
app/api/sync.py 101 0 100%
|
||||||
|
app/config.py 112 0 100%
|
||||||
|
app/core/__init__.py 0 0 100%
|
||||||
|
app/core/auth.py 20 0 100%
|
||||||
|
app/core/caching.py 108 0 100%
|
||||||
|
app/core/debugging.py 29 2 93%
|
||||||
|
app/core/docs_push.py 39 0 100%
|
||||||
|
app/core/logging.py 13 0 100%
|
||||||
|
app/db.py 21 0 100%
|
||||||
|
app/main.py 52 0 100%
|
||||||
|
app/models.py 86 0 100%
|
||||||
|
app/rag/__init__.py 0 0 100%
|
||||||
|
app/rag/agent.py 78 0 100%
|
||||||
|
app/rag/archive_upload.py 128 0 100%
|
||||||
|
app/rag/chunker.py 206 4 98%
|
||||||
|
app/rag/git_sources.py 14 0 100%
|
||||||
|
app/rag/importer.py 180 3 98%
|
||||||
|
app/rag/llm.py 189 0 100%
|
||||||
|
app/rag/overview.py 71 0 100%
|
||||||
|
app/rag/prompts.py 65 0 100%
|
||||||
|
app/rag/retriever.py 94 3 97%
|
||||||
|
app/rag/sources_meta.py 16 0 100%
|
||||||
|
app/rag/suggestions.py 27 0 100%
|
||||||
|
app/rag/summarizer.py 24 0 100%
|
||||||
|
app/schemas.py 201 0 100%
|
||||||
|
-----------------------------------------------
|
||||||
|
TOTAL 2529 12 99%
|
||||||
|
coverage gate: app/ 99% (>90%) OK
|
||||||
|
All checks passed!
|
||||||
|
0 errors, 0 warnings, 0 informations
|
||||||
|
validation OK
|
||||||
+16
@@ -0,0 +1,16 @@
|
|||||||
|
Task 05 complete — all green.
|
||||||
|
|
||||||
|
**Report — Phase 65, Task 05 (regressions + commit)**
|
||||||
|
- Regression E2E matrix, each green in isolation (DB up, in task order):
|
||||||
|
- `uv run pytest tests/e2e/test_pinned_composer.py -v --no-cov` → 4 passed
|
||||||
|
- `uv run pytest tests/e2e/test_save_share_ux.py -v --no-cov` → 5 passed
|
||||||
|
- `uv run pytest tests/e2e/test_chat_persistence.py -v --no-cov` → 4 passed
|
||||||
|
- `uv run pytest tests/e2e/test_share_chat.py -v --no-cov` → 4 passed
|
||||||
|
- `uv run pytest tests/e2e/test_chat_history.py -v --no-cov` → 5 passed
|
||||||
|
- `uv run pytest tests/e2e/test_smoke.py -v --no-cov` → 3 passed
|
||||||
|
- Dedicated suite final run: `uv run pytest tests/e2e/test_bottom_chat_actions.py -v --no-cov` → 4 passed
|
||||||
|
- Full gate: `bash .agent/validate.sh` → exit 0 (unit+integration pass, app/ coverage **99%** >90%, `ruff check .` clean, `pyright` 0 errors)
|
||||||
|
- One atomic commit on `main`: `8a1f99c` `feat(web): move the chat action cluster to the pinned bottom and align the button sets` — `--no-gpg-sign`, staged exactly `.agent/ frontend/ tests/`, body has one line per task (01 move, 02 sticky `.chat-bottom` A1, 03 right-edge alignment A2, 04 dedicated suite, 05 regression outcome)
|
||||||
|
- No defects found in prior tasks' work — tasks 01–04 changes committed as-is; working tree clean
|
||||||
|
- Phase-dir move to `complete/` is the pipeline step (harness) per task rules — not done by me
|
||||||
|
- Next pending task: `.agent/phases/todo/66_history_auto_save_copy/01_history_page_copy.md`
|
||||||
+72
@@ -0,0 +1,72 @@
|
|||||||
|
........................................................................ [ 5%]
|
||||||
|
........................................................................ [ 11%]
|
||||||
|
........................................................................ [ 17%]
|
||||||
|
........................................................................ [ 23%]
|
||||||
|
........................................................................ [ 28%]
|
||||||
|
........................................................................ [ 34%]
|
||||||
|
........................................................................ [ 40%]
|
||||||
|
........................................................................ [ 46%]
|
||||||
|
........................................................................ [ 51%]
|
||||||
|
........................................................................ [ 57%]
|
||||||
|
........................................................................ [ 63%]
|
||||||
|
........................................................................ [ 69%]
|
||||||
|
........................................................................ [ 74%]
|
||||||
|
........................................................................ [ 80%]
|
||||||
|
........................................................................ [ 86%]
|
||||||
|
........................................................................ [ 92%]
|
||||||
|
........................................................................ [ 97%]
|
||||||
|
........................... [100%]
|
||||||
|
=============================== warnings summary ===============================
|
||||||
|
.venv/lib/python3.13/site-packages/fastapi/testclient.py:1
|
||||||
|
/var/home/ducoterra/Projects/Personal/brain_of_reese/.venv/lib/python3.13/site-packages/fastapi/testclient.py:1: StarletteDeprecationWarning: Using `httpx` with `starlette.testclient` is deprecated; install `httpx2` instead.
|
||||||
|
from starlette.testclient import TestClient as TestClient # noqa
|
||||||
|
|
||||||
|
-- Docs: https://docs.pytest.org/en/stable/how-to/capture-warnings.html
|
||||||
|
================================ tests coverage ================================
|
||||||
|
_______________ coverage: platform linux, python 3.13.13-final-0 _______________
|
||||||
|
|
||||||
|
Name Stmts Miss Cover
|
||||||
|
-----------------------------------------------
|
||||||
|
app/__init__.py 1 0 100%
|
||||||
|
app/api/__init__.py 0 0 100%
|
||||||
|
app/api/auth.py 22 0 100%
|
||||||
|
app/api/chat.py 131 0 100%
|
||||||
|
app/api/chats.py 110 0 100%
|
||||||
|
app/api/config.py 7 0 100%
|
||||||
|
app/api/doc_drafts.py 93 0 100%
|
||||||
|
app/api/docs.py 50 0 100%
|
||||||
|
app/api/git_sources.py 181 0 100%
|
||||||
|
app/api/health.py 10 0 100%
|
||||||
|
app/api/steering.py 42 0 100%
|
||||||
|
app/api/suggestions.py 8 0 100%
|
||||||
|
app/api/sync.py 101 0 100%
|
||||||
|
app/config.py 112 0 100%
|
||||||
|
app/core/__init__.py 0 0 100%
|
||||||
|
app/core/auth.py 20 0 100%
|
||||||
|
app/core/caching.py 108 0 100%
|
||||||
|
app/core/debugging.py 29 2 93%
|
||||||
|
app/core/docs_push.py 39 0 100%
|
||||||
|
app/core/logging.py 13 0 100%
|
||||||
|
app/db.py 21 0 100%
|
||||||
|
app/main.py 52 0 100%
|
||||||
|
app/models.py 86 0 100%
|
||||||
|
app/rag/__init__.py 0 0 100%
|
||||||
|
app/rag/agent.py 78 0 100%
|
||||||
|
app/rag/archive_upload.py 128 0 100%
|
||||||
|
app/rag/chunker.py 206 4 98%
|
||||||
|
app/rag/git_sources.py 14 0 100%
|
||||||
|
app/rag/importer.py 180 3 98%
|
||||||
|
app/rag/llm.py 189 0 100%
|
||||||
|
app/rag/overview.py 71 0 100%
|
||||||
|
app/rag/prompts.py 65 0 100%
|
||||||
|
app/rag/retriever.py 94 3 97%
|
||||||
|
app/rag/sources_meta.py 16 0 100%
|
||||||
|
app/rag/suggestions.py 27 0 100%
|
||||||
|
app/rag/summarizer.py 24 0 100%
|
||||||
|
app/schemas.py 201 0 100%
|
||||||
|
-----------------------------------------------
|
||||||
|
TOTAL 2529 12 99%
|
||||||
|
coverage gate: app/ 99% (>90%) OK
|
||||||
|
All checks passed!
|
||||||
|
0 errors, 0 warnings, 0 informations
|
||||||
|
validation OK
|
||||||
+18
@@ -0,0 +1,18 @@
|
|||||||
|
Task 01 complete — all criteria verified, repo left green and functional (no commit; task 02 owns the atomic commit).
|
||||||
|
|
||||||
|
**Implemented**
|
||||||
|
- `frontend/history.html`: replaced the three Save-button strings with the locked A3 auto-save copy — meta description, `.page-sub`, and the `#history-empty-row` cell (element, indentation, `colspan="6"`, `hidden` all preserved; markup otherwise byte-identical).
|
||||||
|
- `tests/unit/test_history_page.py`: updated the phase-50 pin that asserted the retired empty-row copy to the locked A3 string (required to keep the suite green).
|
||||||
|
|
||||||
|
**Verification**
|
||||||
|
- `grep -c "pressed <strong>Save</strong>\|press <strong>Save</strong>\|every conversation you saved" frontend/history.html` → 0; each of the three A3 strings present exactly once.
|
||||||
|
- h1, gate section, table caption, `history.js` byte-identical (git diff shows only the 3 HTML strings + the test pin; history.js md5 unchanged).
|
||||||
|
- `uv run pytest --cov=app --cov-report=term-missing` → 1251 passed, TOTAL 99% (>90% gate).
|
||||||
|
- `uv run ruff check .` → all checks passed; `uv run pyright` → 0 errors/warnings.
|
||||||
|
- Remaining case-sensitive "Save" hits are only state strings ("Saved chats" h1/title/meta/caption/aria-label, "Saved conversations are admin-only"); no other page names a Save button (no follow-up material for the commit body).
|
||||||
|
|
||||||
|
**Notes**
|
||||||
|
- `.agent/PLAN.md` does not exist in this repo; the phase's `00_phase.md` carries the binding A3 copy, which was followed exactly.
|
||||||
|
- Working tree also contains harness-side phase-65 move/report artifacts (pre-existing, untouched).
|
||||||
|
|
||||||
|
**Next pending task:** `.agent/phases/todo/66_history_auto_save_copy/02_tests_and_commit.md` (unit pins + E2E `tests/e2e/test_history_copy.py` + regression + commit).
|
||||||
+72
@@ -0,0 +1,72 @@
|
|||||||
|
........................................................................ [ 5%]
|
||||||
|
........................................................................ [ 11%]
|
||||||
|
........................................................................ [ 17%]
|
||||||
|
........................................................................ [ 23%]
|
||||||
|
........................................................................ [ 28%]
|
||||||
|
........................................................................ [ 34%]
|
||||||
|
........................................................................ [ 40%]
|
||||||
|
........................................................................ [ 46%]
|
||||||
|
........................................................................ [ 51%]
|
||||||
|
........................................................................ [ 57%]
|
||||||
|
........................................................................ [ 63%]
|
||||||
|
........................................................................ [ 69%]
|
||||||
|
........................................................................ [ 74%]
|
||||||
|
........................................................................ [ 80%]
|
||||||
|
........................................................................ [ 86%]
|
||||||
|
........................................................................ [ 92%]
|
||||||
|
........................................................................ [ 97%]
|
||||||
|
........................... [100%]
|
||||||
|
=============================== warnings summary ===============================
|
||||||
|
.venv/lib/python3.13/site-packages/fastapi/testclient.py:1
|
||||||
|
/var/home/ducoterra/Projects/Personal/brain_of_reese/.venv/lib/python3.13/site-packages/fastapi/testclient.py:1: StarletteDeprecationWarning: Using `httpx` with `starlette.testclient` is deprecated; install `httpx2` instead.
|
||||||
|
from starlette.testclient import TestClient as TestClient # noqa
|
||||||
|
|
||||||
|
-- Docs: https://docs.pytest.org/en/stable/how-to/capture-warnings.html
|
||||||
|
================================ tests coverage ================================
|
||||||
|
_______________ coverage: platform linux, python 3.13.13-final-0 _______________
|
||||||
|
|
||||||
|
Name Stmts Miss Cover
|
||||||
|
-----------------------------------------------
|
||||||
|
app/__init__.py 1 0 100%
|
||||||
|
app/api/__init__.py 0 0 100%
|
||||||
|
app/api/auth.py 22 0 100%
|
||||||
|
app/api/chat.py 131 0 100%
|
||||||
|
app/api/chats.py 110 0 100%
|
||||||
|
app/api/config.py 7 0 100%
|
||||||
|
app/api/doc_drafts.py 93 0 100%
|
||||||
|
app/api/docs.py 50 0 100%
|
||||||
|
app/api/git_sources.py 181 0 100%
|
||||||
|
app/api/health.py 10 0 100%
|
||||||
|
app/api/steering.py 42 0 100%
|
||||||
|
app/api/suggestions.py 8 0 100%
|
||||||
|
app/api/sync.py 101 0 100%
|
||||||
|
app/config.py 112 0 100%
|
||||||
|
app/core/__init__.py 0 0 100%
|
||||||
|
app/core/auth.py 20 0 100%
|
||||||
|
app/core/caching.py 108 0 100%
|
||||||
|
app/core/debugging.py 29 2 93%
|
||||||
|
app/core/docs_push.py 39 0 100%
|
||||||
|
app/core/logging.py 13 0 100%
|
||||||
|
app/db.py 21 0 100%
|
||||||
|
app/main.py 52 0 100%
|
||||||
|
app/models.py 86 0 100%
|
||||||
|
app/rag/__init__.py 0 0 100%
|
||||||
|
app/rag/agent.py 78 0 100%
|
||||||
|
app/rag/archive_upload.py 128 0 100%
|
||||||
|
app/rag/chunker.py 206 4 98%
|
||||||
|
app/rag/git_sources.py 14 0 100%
|
||||||
|
app/rag/importer.py 180 3 98%
|
||||||
|
app/rag/llm.py 189 0 100%
|
||||||
|
app/rag/overview.py 71 0 100%
|
||||||
|
app/rag/prompts.py 65 0 100%
|
||||||
|
app/rag/retriever.py 94 3 97%
|
||||||
|
app/rag/sources_meta.py 16 0 100%
|
||||||
|
app/rag/suggestions.py 27 0 100%
|
||||||
|
app/rag/summarizer.py 24 0 100%
|
||||||
|
app/schemas.py 201 0 100%
|
||||||
|
-----------------------------------------------
|
||||||
|
TOTAL 2529 12 99%
|
||||||
|
coverage gate: app/ 99% (>90%) OK
|
||||||
|
All checks passed!
|
||||||
|
0 errors, 0 warnings, 0 informations
|
||||||
|
validation OK
|
||||||
@@ -3,7 +3,7 @@
|
|||||||
<head>
|
<head>
|
||||||
<meta charset="utf-8">
|
<meta charset="utf-8">
|
||||||
<meta name="viewport" content="width=device-width, initial-scale=1, viewport-fit=cover">
|
<meta name="viewport" content="width=device-width, initial-scale=1, viewport-fit=cover">
|
||||||
<meta name="description" content="Saved chats — every conversation you saved, one click back.">
|
<meta name="description" content="Saved chats — every conversation is saved automatically, one click back.">
|
||||||
<title>Saved chats · Brain of Reese</title>
|
<title>Saved chats · Brain of Reese</title>
|
||||||
<link rel="icon" href="data:image/svg+xml,%3Csvg%20xmlns=%22http://www.w3.org/2000/svg%22%20viewBox=%220%200%2064%2064%22%3E%3Cpath%20d=%22M32%204%2055%2018v28L32%2060%209%2046V18Z%22%20fill=%22%231a0f0f%22%20stroke=%22%23f43f5e%22%20stroke-width=%224%22%20stroke-linejoin=%22round%22/%3E%3Ccircle%20cx=%2232%22%20cy=%2232%22%20r=%226.5%22%20fill=%22%23f43f5e%22/%3E%3Cpath%20d=%22M32%2025.5V16M32%2048v-9.5M25.5%2032H16M48%2032h-9.5%22%20stroke=%22%23fca5a5%22%20stroke-width=%223%22%20stroke-linecap=%22round%22/%3E%3C/svg%3E">
|
<link rel="icon" href="data:image/svg+xml,%3Csvg%20xmlns=%22http://www.w3.org/2000/svg%22%20viewBox=%220%200%2064%2064%22%3E%3Cpath%20d=%22M32%204%2055%2018v28L32%2060%209%2046V18Z%22%20fill=%22%231a0f0f%22%20stroke=%22%23f43f5e%22%20stroke-width=%224%22%20stroke-linejoin=%22round%22/%3E%3Ccircle%20cx=%2232%22%20cy=%2232%22%20r=%226.5%22%20fill=%22%23f43f5e%22/%3E%3Cpath%20d=%22M32%2025.5V16M32%2048v-9.5M25.5%2032H16M48%2032h-9.5%22%20stroke=%22%23fca5a5%22%20stroke-width=%223%22%20stroke-linecap=%22round%22/%3E%3C/svg%3E">
|
||||||
<link rel="stylesheet" href="/assets/styles.css">
|
<link rel="stylesheet" href="/assets/styles.css">
|
||||||
@@ -104,8 +104,7 @@
|
|||||||
<div class="page-head">
|
<div class="page-head">
|
||||||
<h1>Saved chats</h1>
|
<h1>Saved chats</h1>
|
||||||
<p class="page-sub">
|
<p class="page-sub">
|
||||||
Every conversation you pressed <strong>Save</strong> on —
|
Every conversation is saved automatically — newest activity first. Click a title to return to that chat.
|
||||||
newest activity first. Click a title to return to that chat.
|
|
||||||
</p>
|
</p>
|
||||||
</div>
|
</div>
|
||||||
<!-- Phase 50 (owner permission 2026-08-29): anonymous sign-in
|
<!-- Phase 50 (owner permission 2026-08-29): anonymous sign-in
|
||||||
@@ -160,7 +159,7 @@
|
|||||||
</thead>
|
</thead>
|
||||||
<tbody id="history-tbody">
|
<tbody id="history-tbody">
|
||||||
<tr class="history-empty-row" id="history-empty-row" hidden>
|
<tr class="history-empty-row" id="history-empty-row" hidden>
|
||||||
<td colspan="6">No saved chats yet — finish a conversation and press <strong>Save</strong> in the chat.</td>
|
<td colspan="6">No saved chats yet — start a conversation and it will be saved automatically.</td>
|
||||||
</tr>
|
</tr>
|
||||||
</tbody>
|
</tbody>
|
||||||
</table>
|
</table>
|
||||||
|
|||||||
@@ -0,0 +1,114 @@
|
|||||||
|
"""Phase 66 E2E (Playwright): the History tab's auto-save copy.
|
||||||
|
|
||||||
|
TODO.md L4 (owner 2026-09-01): "Update the history tab — the text
|
||||||
|
still reads like there's a save button. There isn't anymore, every
|
||||||
|
chat is saved."
|
||||||
|
|
||||||
|
Run in isolation (DB must be up: ``podman compose up -d db``):
|
||||||
|
|
||||||
|
uv run pytest tests/e2e/test_history_copy.py -v --no-cov
|
||||||
|
|
||||||
|
One phase, one file (AGENTS.md rule 4). What is asserted: the SIGNED-IN
|
||||||
|
ADMIN sees the actual page (the anonymous gate hidden, the table
|
||||||
|
rendered) reading the locked (A3) auto-save copy — and the rendered
|
||||||
|
page text nowhere reads like a Save button exists (none has since the
|
||||||
|
phase-55 owner-lock A2: every conversation auto-saves via ``app.js``
|
||||||
|
``persistConversation``).
|
||||||
|
|
||||||
|
Determinism: every assertion is settled-state (static HTML + the one
|
||||||
|
0-row ``/api/chats`` fetch); Playwright ``expect`` retries ride out the
|
||||||
|
table load.
|
||||||
|
"""
|
||||||
|
from __future__ import annotations
|
||||||
|
|
||||||
|
import re
|
||||||
|
from pathlib import Path
|
||||||
|
|
||||||
|
from playwright.sync_api import Page, expect
|
||||||
|
from sqlalchemy import text
|
||||||
|
|
||||||
|
from app.db import SessionLocal
|
||||||
|
from e2e.auth_helpers import login
|
||||||
|
|
||||||
|
REPO = Path(__file__).resolve().parents[2] # noqa: F841 — house pattern
|
||||||
|
|
||||||
|
# --- the locked auto-save copy (owner-locked A3, phase 66 task 01) -----
|
||||||
|
|
||||||
|
META = "Saved chats — every conversation is saved automatically, one click back."
|
||||||
|
PAGE_SUB = (
|
||||||
|
"Every conversation is saved automatically — newest activity first. "
|
||||||
|
"Click a title to return to that chat."
|
||||||
|
)
|
||||||
|
EMPTY_ROW = "No saved chats yet — start a conversation and it will be saved automatically."
|
||||||
|
|
||||||
|
#: Rendered copy that would still read like a Save button exists
|
||||||
|
#: (retired, phase 55 A2). The scan runs alongside a pinned <h1> so it
|
||||||
|
#: cannot pass by deleting the heading.
|
||||||
|
SAVE_BUTTON_PATTERNS = (
|
||||||
|
re.compile(r"press(ed)?\s+save", re.IGNORECASE),
|
||||||
|
re.compile(r"save\s+button", re.IGNORECASE),
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
|
def _reset_db() -> None:
|
||||||
|
"""The house reset (TRUNCATE chunks, documents, query_log,
|
||||||
|
steering_notes) EXTENDED with ``saved_chats`` — so the History tab
|
||||||
|
renders a genuinely empty table and the empty-row copy is pinned in
|
||||||
|
the real 0-row state, not only in the template. No KB re-import:
|
||||||
|
this suite reads static copy and never asks the brain a question."""
|
||||||
|
with SessionLocal() as db:
|
||||||
|
db.execute(
|
||||||
|
text("TRUNCATE chunks, documents, query_log, steering_notes, saved_chats")
|
||||||
|
)
|
||||||
|
db.commit()
|
||||||
|
|
||||||
|
|
||||||
|
def test_history_tab_shows_auto_save_copy(
|
||||||
|
page: Page, app_url: str, db_ready: None
|
||||||
|
) -> None:
|
||||||
|
_reset_db()
|
||||||
|
page.set_default_timeout(30_000)
|
||||||
|
|
||||||
|
login(page, app_url, next="/history.html")
|
||||||
|
expect(page).to_have_url(app_url + "/history.html", timeout=30_000)
|
||||||
|
|
||||||
|
# The anonymous gate is hidden (the login worked — history.js hides
|
||||||
|
# it for the admin) and the table region is rendered.
|
||||||
|
expect(page.locator("#history-gate")).to_be_hidden(timeout=15_000)
|
||||||
|
expect(page.locator("#history-table-wrap")).to_be_visible()
|
||||||
|
|
||||||
|
# The 0-row fetch reveals #history-empty-row (history.js) and its
|
||||||
|
# text is exactly the locked (A3) empty-row string.
|
||||||
|
empty_row = page.locator("#history-empty-row")
|
||||||
|
expect(empty_row).to_be_visible(timeout=15_000)
|
||||||
|
raw = empty_row.text_content()
|
||||||
|
assert raw is not None and raw.strip() == EMPTY_ROW
|
||||||
|
|
||||||
|
# The .page-sub reads the locked (A3) page-sub string
|
||||||
|
# (whitespace-normalized — the template wraps the line).
|
||||||
|
page_sub = page.locator(".page-sub")
|
||||||
|
expect(page_sub).to_have_count(1)
|
||||||
|
assert re.sub(r"\s+", " ", page_sub.inner_text()).strip() == PAGE_SUB
|
||||||
|
|
||||||
|
# The meta description is the locked (A3) meta string.
|
||||||
|
meta = page.locator('meta[name="description"]')
|
||||||
|
expect(meta).to_have_count(1)
|
||||||
|
assert meta.get_attribute("content") == META
|
||||||
|
|
||||||
|
# The no-button contract: the WHOLE rendered page reads neither
|
||||||
|
# "press(ed) Save" nor "Save button" — while the <h1> still reads
|
||||||
|
# "Saved chats" (asserted present, so the scan cannot pass by
|
||||||
|
# deleting the heading).
|
||||||
|
h1 = page.locator("h1")
|
||||||
|
expect(h1).to_have_count(1)
|
||||||
|
expect(h1).to_have_text("Saved chats")
|
||||||
|
body_text = page.locator("body").inner_text()
|
||||||
|
for pattern in SAVE_BUTTON_PATTERNS:
|
||||||
|
assert not pattern.search(body_text), (
|
||||||
|
f"History tab copy still reads like a Save button exists: "
|
||||||
|
f"{pattern.pattern!r} in {body_text!r}"
|
||||||
|
)
|
||||||
|
|
||||||
|
# The control itself is gone from the app (phase 55 A2) — not just
|
||||||
|
# the copy: no #save-chat-btn anywhere on the page.
|
||||||
|
expect(page.locator("#save-chat-btn")).to_have_count(0)
|
||||||
@@ -0,0 +1,79 @@
|
|||||||
|
"""Unit: phase-66 text pins — the History tab describes the auto-save
|
||||||
|
model, not the retired Save button.
|
||||||
|
|
||||||
|
House pattern (``test_stale_ui_copy.py``): read ``frontend/history.html``
|
||||||
|
as text and assert substrings — no browser. The browser-visible layer is
|
||||||
|
gated by the dedicated story suite (``tests/e2e/test_history_copy.py``);
|
||||||
|
these pins catch a silent regression in the template without it.
|
||||||
|
|
||||||
|
Locked decision (owner-locked A3, 2026-09-01): every conversation saves
|
||||||
|
itself automatically — there is NO Save button (retired phase 55, owner-
|
||||||
|
locked A2, pinned by ``test_save_share_ux.py::test_anonymous_auto_save``),
|
||||||
|
so no user-visible History-tab string may name one.
|
||||||
|
"""
|
||||||
|
from __future__ import annotations
|
||||||
|
|
||||||
|
import re
|
||||||
|
from pathlib import Path
|
||||||
|
|
||||||
|
FRONTEND = Path(__file__).resolve().parents[2] / "frontend"
|
||||||
|
|
||||||
|
# --- the locked auto-save copy (owner-locked A3) -----------------------
|
||||||
|
|
||||||
|
META = "Saved chats — every conversation is saved automatically, one click back."
|
||||||
|
PAGE_SUB = (
|
||||||
|
"Every conversation is saved automatically — newest activity first. "
|
||||||
|
"Click a title to return to that chat."
|
||||||
|
)
|
||||||
|
EMPTY_ROW = "No saved chats yet — start a conversation and it will be saved automatically."
|
||||||
|
|
||||||
|
# --- the retired manual-save copy (must be nowhere) --------------------
|
||||||
|
|
||||||
|
OLD_META = "every conversation you saved"
|
||||||
|
OLD_PAGE_SUB = "you pressed <strong>Save</strong>"
|
||||||
|
OLD_EMPTY_ROW = "press <strong>Save</strong> in the chat"
|
||||||
|
|
||||||
|
# --- state-language survivors (must STAY — "saved" is a state, not a
|
||||||
|
# button; their absence would prove over-deletion) ------------------
|
||||||
|
|
||||||
|
STATE_STRINGS = (
|
||||||
|
"<h1>Saved chats</h1>",
|
||||||
|
"Sign in to view your saved chats",
|
||||||
|
"Saved conversations are admin-only",
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
|
def _text() -> str:
|
||||||
|
return (FRONTEND / "history.html").read_text(encoding="utf-8")
|
||||||
|
|
||||||
|
|
||||||
|
def _norm(text: str) -> str:
|
||||||
|
"""Collapse whitespace runs — the templates wrap long lines, so the
|
||||||
|
locked copy is pinned against the normalized text."""
|
||||||
|
return re.sub(r"\s+", " ", text).strip()
|
||||||
|
|
||||||
|
|
||||||
|
def test_manual_save_copy_is_gone() -> None:
|
||||||
|
"""history.html: the three retired manual-save strings are GONE —
|
||||||
|
the copy no longer tells the visitor to press a Save button."""
|
||||||
|
html = _text()
|
||||||
|
for frag in (OLD_META, OLD_PAGE_SUB, OLD_EMPTY_ROW):
|
||||||
|
assert frag not in html, f"retired manual-save copy still present: {frag!r}"
|
||||||
|
|
||||||
|
|
||||||
|
def test_locked_auto_save_copy_present_exactly_once() -> None:
|
||||||
|
"""The three locked (A3) auto-save strings, each exactly once in
|
||||||
|
history.html (a second copy could drift out of sync)."""
|
||||||
|
html = _norm(_text())
|
||||||
|
assert html.count(META) == 1, "the locked meta description"
|
||||||
|
assert html.count(PAGE_SUB) == 1, "the locked page-sub"
|
||||||
|
assert html.count(EMPTY_ROW) == 1, "the locked empty-row string"
|
||||||
|
|
||||||
|
|
||||||
|
def test_state_language_survivors_are_untouched() -> None:
|
||||||
|
"""Proof of NO over-deletion: the strings where "saved" is a state —
|
||||||
|
the <h1>, the anonymous gate title, and the gate sub — stay exactly
|
||||||
|
as phase 50 wrote them."""
|
||||||
|
html = _text()
|
||||||
|
for frag in STATE_STRINGS:
|
||||||
|
assert frag in html, f"state-language survivor deleted: {frag!r}"
|
||||||
@@ -216,9 +216,11 @@ def test_history_table_skeleton() -> None:
|
|||||||
assert "hidden" in row.group(0)
|
assert "hidden" in row.group(0)
|
||||||
assert 'id="history-empty-row"' in row.group(0)
|
assert 'id="history-empty-row"' in row.group(0)
|
||||||
assert "<td colspan=\"6\">" in html
|
assert "<td colspan=\"6\">" in html
|
||||||
|
# Phase 66 (owner-locked A3, 2026-09-01): the auto-save copy —
|
||||||
|
# the Save button is retired (phase 55), every conversation
|
||||||
|
# saves itself; the old "press Save" line is gone.
|
||||||
assert (
|
assert (
|
||||||
"No saved chats yet — finish a conversation and press"
|
"No saved chats yet — start a conversation and it will be saved automatically."
|
||||||
" <strong>Save</strong> in the chat."
|
|
||||||
) in html
|
) in html
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user