Files
model-platform/frontend
tao.chen cee080b7df fix(scripts): AuthContext binding + load() cache invalidation (Codex review)
Codex (deepseek-v4-flash) review of feat(scripts) parent_path filter
surfaced four problems:

1. Critical — AuthContext listScripts binding silently dropped parentPath
   - frontend/app/context/AuthContext.tsx:224 had:
       listScripts: () => rawApi.listScripts(workspaceId)
     so loadScripts("foo/bar") hit GET /api/v1/scripts with no query and
     always received root-level scripts. Typecheck passed because
     `() => ...` is assignable to `(parentPath?: string) => ...`.
   - Fix: forward the parentPath argument.

2. High — load() cache invalidation gap on toolbar refresh / create / delete
   - load() replaced `scripts` with root-only items but never invalidated
     `loadedScriptPaths` for subfolders, so previously-expanded folders
     rendered empty (cached no-op on re-expand) and open tabs pointing
     into subfolders were dropped by the validIds filter.
   - Fix: load() now re-fetches every path currently in
     loadedScriptPaths (and loadedChildPaths for directories), then
     dedups by id/path. On initial mount the cache is empty so this
     degrades to a single root fetch.

3. Low — test docstring overclaimed coverage
   - The "actual ORM roundtrip is covered by the existing integration
     tests" line is false (no other list_scripts test exists).
   - Fix: honest docstring noting the repo has no endpoint integration
     test layer; SQL assertions are brittle to SQLAlchemy/dialect
     formatting.

4. Low — backend docstring overclaimed index role
   - Claimed `idx_storage_workspace_relative_path` "avoided全表扫", but
     the index isn't declared in the ORM model, only exists via the
     baseline migration's upgrade path, and EXPLAIN doesn't drive
     through it (scripts-first plan via idx_scripts_workspace).
   - Fix: accurate description — MySQL drives via idx_scripts_workspace,
     storage_objects PK lookup applies LIKE per row. Notes where to
     optimize if 10万-scale perf becomes a real problem.

Skipped findings (out of scope):
- Medium LIKE escape for `_` / `%` (pre-existing in
  list_workspace_directories; not introduced here).
- Low dashboard `scripts.length` count underreport (separate UI bug,
  pre-existing assumption that broke under the new semantics).

Verified: pytest 50 passed, pnpm typecheck clean.
2026-08-21 10:42:38 +08:00
..
2026-08-20 20:11:06 +08:00
2026-08-20 20:11:06 +08:00
2026-08-11 16:19:34 +08:00
2026-08-20 19:23:42 +08:00
2026-08-11 21:26:55 +08:00

Frontend

React Router SPA,已将原前端按功能拆分到 app/

app/components/          通用图标组件
app/features/platform/   主框架、脚本工作区和 Jupyter 编辑
app/features/schedules/  DAG 调度页面
app/features/admin/      工作台与系统管理
app/routes/              React Router 路由入口
app/services/            API 请求、DTO 和演示上下文
app/styles/              分功能样式

本地开发:

pnpm install
pnpm dev

生产构建由根目录 nginx/Dockerfile 完成,构建结果复制到 Nginx 静态目录。