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:
@@ -60,7 +60,9 @@ Contract under test:
|
||||
control) and its folder exists on the host under ``BOR_UPLOAD_DIR``
|
||||
with all three files — but **zero documents are indexed**:
|
||||
``GET /api/docs`` is empty and the RAG catalog (``/sources.html``)
|
||||
settles on its empty state;
|
||||
settles on the source's 0-document row (phase 97: ``#sources-empty``
|
||||
is the zero-SOURCES state only — a registered 0-document source
|
||||
renders its ``0`` count instead);
|
||||
* **test 2 — ignore list, then Sync scans**: fresh state → upload →
|
||||
success line → the row's phase-89 "Ignore paths" editor: type
|
||||
``notes``, Save → the row shows the "1 ignored" count tag (the A5
|
||||
@@ -465,12 +467,17 @@ def test_upload_does_not_scan(
|
||||
assert _folder_files(folder) == {"alpha.md", "beta.md", "notes/skipme.md"}, (
|
||||
f"unexpected unpacked files: {_folder_files(folder)}"
|
||||
)
|
||||
# …and so is the RAG catalog: it settles on its empty state (the
|
||||
# visible #sources-empty is the deterministic "the load finished
|
||||
# with zero documents" signal — a count-0 check alone would race
|
||||
# the boot loadDocs fetch).
|
||||
# …and so is the RAG catalog: the registered source renders its
|
||||
# 0-document row (phase 97: the "zero documents" signal moved from
|
||||
# #sources-empty — the zero-SOURCES state only — to the source
|
||||
# row's own `0` count, which is ALSO the deterministic load-settled
|
||||
# signal; a count-0 check alone would race the boot loadTree
|
||||
# fetch).
|
||||
page.goto(app_url + SOURCES_URL)
|
||||
expect(page.locator("#sources-empty")).to_be_visible(timeout=30_000)
|
||||
row = page.locator("#folders-tbody tr", has_text=SOURCE_NAME)
|
||||
expect(row).to_have_count(1, timeout=30_000)
|
||||
expect(row.locator("td:nth-child(2)")).to_have_text("0")
|
||||
expect(page.locator("#sources-empty")).to_be_hidden()
|
||||
expect(page.locator("#docs-tbody tr")).to_have_count(0)
|
||||
expect(page.locator("#stat-docs")).to_have_text("0")
|
||||
|
||||
@@ -533,10 +540,13 @@ def test_ignore_list_then_sync_scans(
|
||||
("local", str(upload_dir / SOURCE_NAME), [IGNORE_ENTRY])
|
||||
]
|
||||
|
||||
# The RAG page — the catalog is still empty before the scan…
|
||||
# The RAG page — the catalog is still empty before the scan (the
|
||||
# source row reads 0 — phase 97's load-settled zero signal)…
|
||||
page.goto(app_url + SOURCES_URL)
|
||||
expect(page.locator("#sync-btn")).to_be_visible(timeout=30_000)
|
||||
expect(page.locator("#sources-empty")).to_be_visible(timeout=30_000)
|
||||
row = page.locator("#folders-tbody tr", has_text=SOURCE_NAME)
|
||||
expect(row).to_have_count(1, timeout=30_000)
|
||||
expect(row.locator("td:nth-child(2)")).to_have_text("0")
|
||||
expect(page.locator("#sync-label")).to_have_text("Sync sources")
|
||||
expect(page.locator("#sync-error-banner")).to_be_hidden()
|
||||
|
||||
@@ -566,7 +576,12 @@ def test_ignore_list_then_sync_scans(
|
||||
assert status["files_done"] == 2 and status["files_total"] == 2
|
||||
|
||||
# The catalog: exactly the two non-ignored docs, for the source —
|
||||
# and the ignored one is NOT there.
|
||||
# and the ignored one is NOT there. Phase 97: files are seen per
|
||||
# source — drill into the source row first (the two docs sit at
|
||||
# its root; the ignored notes/ folder is not even listed — the
|
||||
# existence rule runs over INDEXED paths).
|
||||
page.click(f'#folders-tbody a.folder-link:text-is("{SOURCE_NAME}")')
|
||||
expect(page.locator("#folders-wrap")).to_be_hidden() # no subfolders
|
||||
expect(page.locator("#docs-tbody tr")).to_have_count(2, timeout=30_000)
|
||||
expect(page.locator("#docs-tbody tr", has_text=SOURCE_NAME)).to_have_count(2)
|
||||
expect(page.locator("#docs-tbody tr", has_text="alpha.md")).to_have_count(1)
|
||||
|
||||
Reference in New Issue
Block a user