DeepTutor: Lifelong Personalized Tutoring. https://deeptutor.info/.
Python ai-agentsai-tutorclawbotcli-tooldeepresearchinteractive-learninglearningmulti-agent-systemsrag
chore(tests): remove internal frontend audit artifacts
Bingxi Zhao (Frank)b993ac82d836
diff --git a/evidence/pr/AGEN-123.md b/evidence/pr/AGEN-123.mddeleted file mode 100644index 75ab61eaa..000000000--- a/evidence/pr/AGEN-123.md+++ /dev/null@@ -1,38 +0,0 @@-# PR: test(web): smoke ChatWorkspace empty home, streaming turn, failure banner--`web/features/chat/components/ChatWorkspace.tsx` — the >3000-line main chat workspace — had no component-level tests (0% coverage: 0/1074 statements, 0/947 lines; gap #2 of the coverage audit's Top 15). This PR adds `web/tests/chat/ChatWorkspace.smoke.spec.tsx` with 4 Vitest component smoke tests covering the empty-session home, the send path, the full streaming turn lifecycle, and failure banners. No product code is changed.--## Summary--- Add `web/tests/chat/ChatWorkspace.smoke.spec.tsx` (+462 lines): 4 component smoke tests for `ChatWorkspace.tsx`:- 1. **Empty-session home**: greeting hero + starter suggestions + idle composer render; mount boots `newSession({ workspaceId: null })`; export/save controls start disabled; `setActiveSessionId` is reported to the shell.- 2. **Send path**: submitting from the composer assembles the expected `sendMessage("Explain photosynthesis", [], { _course_id: "", ... }, ...)` call.- 3. **Streaming turn lifecycle** (mock `ChatStateAdapter` injecting events): `sent` → `streaming` (message list and composer both flag streaming; incremental content lands on the assistant row's events) → `done` (flags reset, no error banner).- 4. **Failure banners**: `submissionFailed` → `role="alert"` banner ("Couldn't reach the server...") with a Resend action that calls `resendLastMessage`; the `submissionNeedsReview` variant renders different copy and no Resend; a URL session load failure ends in a retryable terminal state where Retry re-calls `loadSession`.--## Root cause--No product defect. A coverage audit identified `ChatWorkspace.tsx` as the Top-15 gap #2 with 0% coverage (1074 missing statements): the chat core's empty-state rendering, `newSession` bootstrapping, send parameter assembly, and the sent→streaming→done turn lifecycle had no regression protection, so a refactor that broke any of these contracts would pass the existing suite unnoticed. This PR closes that gap with isolated component smoke tests only (assertions target semantic roles, names, testids, and spy calls — no brittle class matching).--## Changes--- New file `web/tests/chat/ChatWorkspace.smoke.spec.tsx` (+462 lines).-- Zero product-code changes (`web/features/`, `web/app/`, and all other product paths untouched).-- Full isolation: `ChatStateAdapter` is mocked at the component boundary; heavy children (composer, message list, dynamic pickers) are capture-style stubs — no network access, no backend, no LLM calls.--## Tests--All commands run on a branch based on the current `dev` tip (`ef2d9e5c3`, v1.6.12):--- `npm --prefix web run test:unit -- tests/chat/ChatWorkspace.smoke.spec.tsx` → **4/4 passed** (1 file)-- `npm --prefix web run test:unit` → **475/475 passed** (114 files; baseline 113 files / 471 tests + 1 file / 4 tests)-- `npm --prefix web run typecheck` → clean, 0 errors-- `npm --prefix web run lint` → 0 errors (the new test file has 0 warnings)-- `npm --prefix web run architecture:check` → no dependency violations (888 modules)-- `npm --prefix web run test:node` → **1234/1234 passed**-- `npm --prefix web run i18n:check` → parity + audit OK-- `ChatWorkspace.tsx` coverage: **0% → 47.39% statements (509/1074), 50.26% lines (476/947)** (v8 coverage measured in the originating audit run)--## Related issue--Related to the ChatWorkspace component coverage gap identified in an internal coverage audit. No upstream issue exists yet; this PR is standalone test hardening with no behavior change.diff --git a/evidence/quiz-viewer-tests-2026-10-03/README.md b/evidence/quiz-viewer-tests-2026-10-03/README.mddeleted file mode 100644index 5c3065019..000000000--- a/evidence/quiz-viewer-tests-2026-10-03/README.md+++ /dev/null@@ -1,63 +0,0 @@-# QuizViewer 冒烟与判分交互补测(AGEN-285 / 覆盖备选 16)--基线:`origin/main` @ `ef2d9e5c3`(release: v1.6.12)。-分支:`myfork/test/quiz-viewer-smoke-20261003`(独立 worktree,未触碰主工作区)。--## 产物--- `web/tests/quiz/QuizViewer.smoke.spec.tsx` — 11 个用例,全部通过。-- 无任何产品代码改动(`git status` 仅新增上述测试文件与本证据目录)。--### 命名说明--任务卡写的 `QuizViewer.smoke.test.tsx` 在本仓库不可运行:`web/vitest.config.mts`-的 include 只有 `tests/**/*.spec.ts|tsx`(`.test.ts` 走 node 测试线,无 jsdom/React)。-因此按仓库既有组件测试惯例命名为 `QuizViewer.smoke.spec.tsx`,目录 `tests/quiz/`-与任务卡一致。--## 覆盖点 ↔ 验收映射--| 验收 | 用例 |-| --- | --- |-| 渲染冒烟 | 空列表渲染 null;卡片渲染题干/三个选项/进度 0/2;首题 Previous 与 Check Answer 禁用 |-| 选项作答→提交→判分反馈 | 选对→"Correct"+解析区;选错→"Incorrect",正确项绿框、错选项红框;选项提交后锁定;T/F(concept) 走 `resolveConceptAnswer` 判定 |-| 重做路径 | Retry 清空选中与反馈 → 可重新作答并重新判分(对→错重判) |-| 进度与导航 | 提交后计数 1/2;已完成且判对的题号 chip 变绿;Next/Previous/chip 均可切题 |-| mock API:notebook | 提交即 `upsertNotebookEntry`(session_id/turn_id/question_id/user_answer/is_correct);挂载时按 (session, q_x, turn) 逐题 `lookupNotebookEntry`(#487/#677 turn 作用域) |-| mock API:成绩上报 | 全部作答后 `recordQuizResults` 恰好调用 1 次,payload 含逐题 question_id/user_answer/is_correct |-| mock API:无 turnId 本地态 | 不发生 lookup/upsert/record 任何调用(本地判分,无跨 quiz 状态泄漏) |-| AI 判分流(mock WS) | `startQuizJudge` payload 含题干/题型/答案/language;onDone 后判词渲染、Judging... 消失、参考答案区切走 |-| 资源清理 | 卸载时关闭在途 judge handle(close 被调用) |--## Mock 清单(均 `vi.hoisted` + `vi.mock`)--- `@/lib/notebook-api`(lookup/update/upsert/listCategories/addEntry/createCategory)-- `@/lib/session-api`(recordQuizResults)-- `@/lib/quiz-judge`(startQuizJudge / readFileAsBase64)-- `@/context/QuizFollowupContext`(controller stub + 空线程表)-- `@/components/common/MarkdownRenderer`(文本透传,避免 react-markdown/KaTeX 入 jsdom)--真实保留:Tooltip、CategoryMenu、i18n(en)、quiz-question-type 判定逻辑。--## 运行与数字--```bash-cd web-./node_modules/.bin/vitest run tests/quiz/QuizViewer.smoke.spec.tsx-# Test Files 1 passed (1)-# Tests 11 passed (11) (~1.4s)--./node_modules/.bin/vitest run-# Test Files 114 passed (114)-# Tests 482 passed (482) (含本文件 11 例,无回归)-```--- ESLint:`eslint tests/quiz/QuizViewer.smoke.spec.tsx` 通过。-- `node ./scripts/typecheck.mjs` 通过。-- 运行环境:worktree 内 `web/node_modules` 软链到主检出(本地 main 仅多一个- `qrcode.react` 依赖,其余与 `ef2d9e5c3` lockfile 一致;未改动主检出任何文件)。--## 备注--- 全程未向上游开 PR;分支已推 `myfork`。-- 与既有失败无关:本套件不触碰 evidence 中列出的已知后端失败用例。diff --git a/evidence/quiz-viewer-tests-2026-10-03/run-log.txt b/evidence/quiz-viewer-tests-2026-10-03/run-log.txtdeleted file mode 100644index 34963d1a5..000000000--- a/evidence/quiz-viewer-tests-2026-10-03/run-log.txt+++ /dev/null@@ -1,6 +0,0 @@-- Test Files 1 failed (1)- Tests no tests- Start at 15:22:52- Duration 199ms (transform 32ms, setup 0ms, import 0ms, tests 0ms, environment 0ms)-diff --git a/evidence/test-standalone-composer-20261003/summary.md b/evidence/test-standalone-composer-20261003/summary.mddeleted file mode 100644index 96aee7d75..000000000--- a/evidence/test-standalone-composer-20261003/summary.md+++ /dev/null@@ -1,41 +0,0 @@-# StandaloneComposer smoke coverage — 2026-10-03--Closes the 0% statement-coverage gap on `web/components/chat/home/StandaloneComposer.tsx`-(395/395 statements missed, Top-3 entry in `evidence/coverage-2026-10-02/frontend/summary.md`-on branch `audit/coverage-gaps-20261003`).--## What was added--- `web/tests/chat/StandaloneComposer.smoke.spec.tsx` — 4 vitest tests driving the- composer's own state pool through the `onSend` prop it hands to `ChatComposer`- (shell stubbed, pickers and network modules mocked):--| # | Behavior pinned | Guard under test |-|---|---|---|-| 1 | Empty / whitespace-only input never submits | `!content.trim() && !hasReferences` early return |-| 2 | Text submits once with the full payload; a follow-up empty send stays refused | submission shape + one-shot state consumption |-| 3 | Send locked while `isStreaming` | `isStreaming && !awaitingUserReply` early return |-| 4 | ask_user answer passes the lock | `awaitingUserReply` exception |--## Numbers--| Run | Command (from `web/`) | Result |-|---|---|---|-| New file | `npx vitest run tests/chat/StandaloneComposer.smoke.spec.tsx` | 1 file / **4 passed** (0.6s) |-| Full unit suite | `npx vitest run` | 114 files / **475 passed** (18.9s), 0 failed |--Other checks: `eslint tests/chat/StandaloneComposer.smoke.spec.tsx` clean;-`npm run typecheck` clean. No product code changed — the diff adds the test file-and this evidence only.--## Deviation from the card--The card named `StandaloneComposer.smoke.test.tsx`; the web vitest config only-collects `tests/**/*.spec.ts(x)`, so a `.test.tsx` file would never run-(verified: `vitest run` reports "No test files found"). The file is therefore-`StandaloneComposer.smoke.spec.tsx`, matching repo convention.--## Files--- `vitest-smoke-run.txt` — targeted run output-- `vitest-full-run.txt` — full suite outputdiff --git a/evidence/test-standalone-composer-20261003/vitest-full-run.txt b/evidence/test-standalone-composer-20261003/vitest-full-run.txtdeleted file mode 100644index bcd4e5b48..000000000--- a/evidence/test-standalone-composer-20261003/vitest-full-run.txt+++ /dev/null@@ -1,9 +0,0 @@-- RUN v4.1.11 /Users/xzh/services/ai-development/multica-pilot/workspaces/agents-plan-5fede2af789a/agen-444-776ec44ad184/workdir/dt-agen444-wt/web--- Test Files 114 passed (114)- Tests 475 passed (475)- Start at 23:26:02- Duration 18.91s (transform 12.78s, setup 27.34s, import 31.09s, tests 29.14s, environment 101.33s)-diff --git a/evidence/test-standalone-composer-20261003/vitest-smoke-run.txt b/evidence/test-standalone-composer-20261003/vitest-smoke-run.txtdeleted file mode 100644index cf5beac34..000000000--- a/evidence/test-standalone-composer-20261003/vitest-smoke-run.txt+++ /dev/null@@ -1,9 +0,0 @@-- RUN v4.1.11 /Users/xzh/services/ai-development/multica-pilot/workspaces/agents-plan-5fede2af789a/agen-444-776ec44ad184/workdir/dt-agen444-wt/web--- Test Files 1 passed (1)- Tests 4 passed (4)- Start at 23:25:32- Duration 644ms (transform 152ms, setup 78ms, import 211ms, tests 21ms, environment 271ms)-diff --git a/evidence/test-visualization-viewer-20261003/coverage-after.txt b/evidence/test-visualization-viewer-20261003/coverage-after.txtdeleted file mode 100644index 796bcbec2..000000000--- a/evidence/test-visualization-viewer-20261003/coverage-after.txt+++ /dev/null@@ -1,9 +0,0 @@- % Coverage report from v8--------------------|---------|----------|---------|---------|--------------------File | % Stmts | % Branch | % Funcs | % Lines | Uncovered Line #s--------------------|---------|----------|---------|---------|--------------------All files | 58.86 | 50.86 | 45.23 | 61.56 |- ...tionViewer.tsx | 74.57 | 60.3 | 71.69 | 78.57 | ...99-402,641-663- ...onfigPanel.tsx | 0 | 0 | 0 | 0 | 1-277--------------------|---------|----------|---------|---------|--------------------diff --git a/evidence/test-visualization-viewer-20261003/coverage-before.txt b/evidence/test-visualization-viewer-20261003/coverage-before.txtdeleted file mode 100644index 7392a2a91..000000000--- a/evidence/test-visualization-viewer-20261003/coverage-before.txt+++ /dev/null@@ -1,9 +0,0 @@--------------------|---------|----------|---------|---------|--------------------File | % Stmts | % Branch | % Funcs | % Lines | Uncovered Line #s--------------------|---------|----------|---------|---------|-------------------- ...tionViewer.tsx | 1.69 | 0 | 0 | 1.9 | 18,27-250,275-663--------------------|---------|----------|---------|---------|--------------------Statements : 1.69% ( 4/299 )-Branches : 0% ( 0/230 )-Functions : 0% ( 0/84 )-Lines : 1.49% ( 4/268 )diff --git a/evidence/test-visualization-viewer-20261003/summary.md b/evidence/test-visualization-viewer-20261003/summary.mddeleted file mode 100644index afecdd609..000000000--- a/evidence/test-visualization-viewer-20261003/summary.md+++ /dev/null@@ -1,54 +0,0 @@-# test: VisualizationViewer 渲染分支补测 — 证据(2026-10-03)--基线:`origin/main` @ `ef2d9e5c3`(release: v1.6.12)-分支:`test/visualization-viewer-20261004`-新增测试:`web/tests/visualize/VisualizationViewer.spec.tsx`(22 个用例,vitest + testing-library/jsdom)--## 命令--```bash-cd web-npm ci-npm install --no-save @vitest/[email protected] # 仓库未内置 coverage provider,仅装进 node_modules-# 基线(新分支上先不跑新测试)-npx vitest run --coverage --coverage.include='components/visualize/**' --coverage.reporter=text-# 加入新测试后(同命令)-npx vitest run --coverage --coverage.include='components/visualize/**' --coverage.reporter=text-```--注:仓库 vitest include 规则为 `tests/**/*.spec.ts(x)`,故文件名用 `.spec.tsx`(任务卡中写的-`.test.tsx` 不会被 vitest 收集,且 `.test.ts` 归 `test:node` 管线,不适用 jsdom 组件测试)。--## 覆盖率前后(web/components/visualize/VisualizationViewer.tsx)--| 指标 | 前 | 后 |-|---|---:|---:|-| Statements | 1.69% (4/299) | **74.57% (176/299)** |-| Branches | 0% (0/230) | **50.86% (117/230)** |-| Functions | 0% (0/84) | **71.69% (38/84)** |-| Lines | 1.49% (4/268) | **61.56% (165/268)** |--与 audit/coverage-gaps-20261003 报告一致:改前 232 条语句缺失 / 1.7%。--## 测试结果--- 基线全套件:113 files / 471 tests 全通过(新分支 origin/main 本身绿)-- 加新测试后全套件:**114 files / 493 tests 全通过**(+22)-- `npm run typecheck` 通过;`npx eslint tests/visualize/VisualizationViewer.spec.tsx` 通过--## 用例覆盖的三态与分支--1. 合法 mermaid:loading 占位("Rendering diagram...")→ 渲染成功注入 svg,`mermaid.render` 收到正确内容-2. 非法语法错误态:`mermaid.render` reject → "Diagram rendering error" 卡片 + 错误信息 + 源码可查-3. 空内容态:不触发 `mermaid.render`、无 loading、无错误卡片(不白屏)-4. 其余渲染分支:svg 清洗(去 script)与非法 svg 错误卡、多 svg 拆分、chartjs 解析成功/围栏剥离/解析失败错误卡/卸载 destroy、html iframe + "Open in new tab" + 高度桥接消息、插件 iframe(有/无 entry_url)、geogebra、未知 renderer 错误、manim 委托、Show code / Copy code / 全屏 portal + Escape 关闭、review 备注--## 已知环境限制--- jsdom 对 `image/svg+xml` 文档不支持 `[id]` 属性选择器,`sanitizeSvg` 的 id 重排分支在该环境下不可观测,- 测试只断言 script 剥离(安全相关行为),未断言 id 前缀。--## 未覆盖(残余)--剩余未覆盖语句集中在:全屏 portal 内层交互的部分分支、Geogebra/MathAnimator 真实子组件内部(已 mock)、-少量 chartjs/iframe 边界分支(详见 coverage-after.txt 的 Uncovered Line #s)。