feat(rag): harden post-LightRAG runtime

Retire legacy OCR/media/evidence fallbacks, add local-folder event bus and Page Aggregate guards, and archive completed design checklists.

Validation: cargo test -p mnote-web -- --test-threads=1; cargo test --workspace -- --test-threads=1; git diff --check; codegraph sync .; codegraph_status.
This commit is contained in:
lix-2026
2026-06-07 10:35:21 +08:00
parent 22a92edcda
commit 9551d4c1dc
59 changed files with 4053 additions and 5249 deletions
@@ -125,6 +125,7 @@ async function openKnowledgePanel(page) {
state: "visible",
timeout: UI_TIMEOUT_MS,
});
await page.locator('[data-knowledge-rag-action="filter-sources"][data-knowledge-rag-filter="all"]').click({ timeout: UI_TIMEOUT_MS });
}
async function waitForSourceRow(page, sourcePath) {
@@ -155,6 +156,8 @@ async function main() {
const scoped = await query(context, marker, [sourceA]);
const scopedReferences = Array.isArray(scoped.references) ? scoped.references : [];
assert.equal(scoped.sourceScopeMode, "post_filter_mapped_references", `sourcePaths scope mode 应明确为 post-filter: ${JSON.stringify(scoped, null, 2).slice(0, 3000)}`);
assert.equal(scoped.rawScopeFiltered, false, `rawScopeFiltered 应明确提示 provider raw 未被 sourcePaths 预过滤: ${JSON.stringify(scoped, null, 2).slice(0, 3000)}`);
assert(scopedReferences.length > 0, `sourcePaths scope 应至少返回 alpha: ${JSON.stringify(scoped, null, 2).slice(0, 3000)}`);
assert(
scopedReferences.every((reference) => reference.sourceRootRelativePath === sourceA),
@@ -170,7 +173,8 @@ async function main() {
await page.waitForFunction(
(expectedPath) => {
const row = document.querySelector(`[data-knowledge-rag-source-row="true"][data-knowledge-rag-source-path="${expectedPath}"]`);
return row && (row.textContent || "").includes("已删除");
const text = row ? row.textContent || "" : "";
return text.includes("已删除") || text.includes("删除已提交") || text.includes("LightRAG 已移除");
},
sourceA,
{ timeout: UI_TIMEOUT_MS },
@@ -191,6 +195,8 @@ async function main() {
sourceA,
sourceB,
sourceScope: scoped.sourceScope,
sourceScopeMode: scoped.sourceScopeMode,
rawScopeFiltered: scoped.rawScopeFiltered,
scopedReferenceCount: scopedReferences.length,
alphaDocId: entryFor(indexedStatus, sourceA)?.lightRagDocId || null,
betaDocId: entryFor(indexedStatus, sourceB)?.lightRagDocId || null,