phase: 97_kb_tree_catalog
All completion criteria verified — everything is green, no defects found. Final report: ## Phase 97 final verification pass — ALL GREEN **Verified (no code changes needed):** - `GET /api/docs/tree` (admin), `build_kb_tree` pure builder, `PATCH /api/folders/summary`, migration 0018 (`manually_edited`, head confirmed), generator skip/keep + `kept_manual` stat, RAG tree UI + edit affordance in `sources.js`/`index.html`/`styles.css` - `tests/e2e/test_kb_tree.py`: 8 passed — top level, drill source/folder, edit round-trip, clear, manual-desc-survives-sync, reload fallback, anonymous gate - Integration: tree shape/order/403/empty/indexed-only + PATCH update/create/root/clear/404/403/no-LLM + stat-walk equivalence (in `test_docs_api.py`); 3-field `folder_summaries=` import token preserved **Gates (exact commands):** - `uv run pytest --cov=app --cov-report=term-missing` → **2053 passed**, TOTAL coverage **99%** (>90% ✓) - `uv run ruff check . && uv run pyright` → **All checks passed / 0 errors** - `uv run pytest tests/e2e/test_kb_tree.py -v --no-cov` → **8 passed** in isolation - 30 story/RAG-view E2E suites run **one per process**: all passed, incl. `test_ls_tree_drilldown` (agent `ls` byte-identical ✓), `test_import_documents`, `test_edit_summaries`, `test_admin_auth`, `test_kb_overview` **Completion criteria:** tree view ✓ · edit round-trip + clear ✓ · manual persists/clear resets ✓ · `ls` unchanged ✓ · pytest/coverage/lint ✓ · E2E isolation ✓ · commit — left to harness per protocol (working tree untouched, `git add/commit` not run) **Deviations:** none. **Next pending phase:** none — `todo/` contains only 97 (96 already committed).
This commit is contained in:
@@ -213,7 +213,10 @@ def test_no_horizontal_overflow_at_viewports(
|
||||
_assert_no_doc_overflow(page, f"chat @ {width}px")
|
||||
|
||||
page.goto(f"{app_url}/sources.html") # phase 16: admin-only
|
||||
page.locator("#docs-tbody tr").first.wait_for(state="visible", timeout=10_000)
|
||||
# Phase 97: the top level lists the sources (the file table
|
||||
# is per-level, always hidden at the top) — the source row
|
||||
# is the catalog-rendered signal.
|
||||
page.locator("#folders-tbody tr").first.wait_for(state="visible", timeout=10_000)
|
||||
_assert_no_doc_overflow(page, f"sources @ {width}px")
|
||||
finally:
|
||||
page.close()
|
||||
@@ -276,10 +279,14 @@ def test_sources_table_full_width(
|
||||
page = browser.new_page(viewport={"width": 1280, "height": 800})
|
||||
try:
|
||||
login(page, app_url, next="/sources.html") # phase 16: admin-only
|
||||
page.locator("#docs-tbody tr").first.wait_for(state="visible", timeout=10_000)
|
||||
# Phase 76 (task 02): the shell carries BOTH views' .table-wrap
|
||||
# (the git-sources one ships hidden) — scope to the RAG view.
|
||||
wrap_box = page.locator("#view-rag .table-wrap").bounding_box()
|
||||
# Phase 97: the top level lists the sources (the file table is
|
||||
# per-level, hidden at the top) — the source row is the
|
||||
# catalog-rendered signal, and the visible catalog card is
|
||||
# #folders-wrap (the ONE .table-wrap without an id in the RAG
|
||||
# view is no longer unique — the shell carries the git-sources
|
||||
# one too, so scope by the id).
|
||||
page.locator("#folders-tbody tr").first.wait_for(state="visible", timeout=10_000)
|
||||
wrap_box = page.locator("#folders-wrap").bounding_box()
|
||||
shell_box = page.locator(".sources-shell").bounding_box()
|
||||
assert wrap_box is not None and shell_box is not None
|
||||
assert wrap_box["width"] >= 0.80 * shell_box["width"], (
|
||||
@@ -292,9 +299,11 @@ def test_sources_table_full_width(
|
||||
mobile = browser.new_page(viewport={"width": 375, "height": 812})
|
||||
try:
|
||||
login(mobile, app_url, next="/sources.html") # phase 16: admin-only
|
||||
mobile.locator("#docs-tbody tr").first.wait_for(state="visible", timeout=10_000)
|
||||
# Phase 97: the top-level catalog card is #folders-wrap (the
|
||||
# .kb-folders-table keeps its min-width and scrolls in-card).
|
||||
mobile.locator("#folders-tbody tr").first.wait_for(state="visible", timeout=10_000)
|
||||
scroll, client = mobile.evaluate(
|
||||
"() => { const el = document.querySelector('#view-rag .table-wrap');"
|
||||
"() => { const el = document.querySelector('#folders-wrap');"
|
||||
" return [el.scrollWidth, el.clientWidth]; }"
|
||||
)
|
||||
assert scroll > client, (
|
||||
@@ -366,9 +375,14 @@ def test_a11y_landmarks_and_labels(
|
||||
page.wait_for_load_state("networkidle")
|
||||
expect(page.locator("#auth-gate")).to_be_hidden()
|
||||
|
||||
# Landmarks (PLAN §7.2).
|
||||
# Landmarks (PLAN §7.2). Phase 97: the shell carries a SECOND
|
||||
# nav in the RAG view (#kb-crumb, the catalog breadcrumb —
|
||||
# hidden at the top level, pinned in test_kb_tree), so the
|
||||
# primary-nav landmark is pinned by its label.
|
||||
assert page.locator("header.app-header").count() == 1, f"header missing on {path}"
|
||||
assert page.locator("nav[aria-label]").count() == 1, f"labeled nav missing on {path}"
|
||||
assert page.locator("nav[aria-label='Primary']").count() == 1, (
|
||||
f"labeled primary nav missing on {path}"
|
||||
)
|
||||
assert page.locator("main#main").count() == 1, f"main#main missing on {path}"
|
||||
assert page.locator("footer.app-footer").count() == 1, f"footer missing on {path}"
|
||||
|
||||
@@ -577,6 +591,11 @@ def test_long_content_wraps_without_overflow(
|
||||
phone = browser.new_page(viewport={"width": 360, "height": 740})
|
||||
try:
|
||||
login(phone, app_url, next="/sources.html") # phase 16: admin-only
|
||||
# Phase 97: the catalog is the drill-down tree — the row lives
|
||||
# at the deep level of the longkb source (the drill is the only
|
||||
# change).
|
||||
for name in ("longkb", "deep"):
|
||||
phone.click(f'#folders-tbody a.folder-link:text-is("{name}")')
|
||||
row = phone.locator("#docs-tbody tr", has_text="backup_rotation").first
|
||||
row.wait_for(state="visible", timeout=10_000)
|
||||
cell = row.get_by_role("cell").nth(1)
|
||||
|
||||
Reference in New Issue
Block a user