feat(history): add project workflow history - #105
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
There was a problem hiding this comment.
Review findings:
frontend/src/app/app.tsx: The new history page is not imported or registered in the app router. The README documents/projects/:projectId/history, but the current route table still only has/projects/:projectIdand/projects/:projectId/assets, so that URL falls through toNotFoundPageand the page cannot be reached in the actual app.
Verification: attempted npm test -- src/pages/history -- --run, npm run typecheck, and npm run lint; all failed before running because the frontend command binaries (vitest, tsc, oxlint) were not executable/available in this checkout.
| <p className="mt-2 text-sm text-slate-600">查看任务进度、重做版本与每一步结果。</p> | ||
| </div> | ||
| <Link | ||
| to={`/workflow-editor?projectId=${encodeURIComponent(projectId)}`} |
There was a problem hiding this comment.
This link builds /workflow-editor?projectId=..., but the app router only defines /workflow-editor/:runId and /workflow-editor/:runId/:stage. Clicking 新建创作任务 from the history page will therefore fall through to NotFoundPage instead of opening the editor. Please either add the matching creation route or point this button at an existing creation flow.
| 3. 页面通过 `controller.subscribeAll()` 接收全局变化,并再次按 `projectId` 过滤。 | ||
| 4. 页面卸载时调用 Controller 返回的取消订阅函数。 | ||
|
|
||
| 页面不接触 `WorkflowRunStore`、localStorage 或后端传输。History 在页面入口声明只包含 `listWorkflows` 与 `subscribeAll` 的只读接口;正式 WorkflowController 只要满足这两个方法就能注入。将来持久化方式改变时,History 无需跟着改写。 |
There was a problem hiding this comment.
This says the formal WorkflowController can be injected if it provides listWorkflows/subscribeAll, but the current exported WorkflowController interface has neither method. As written, the documented integration path cannot compile against the actual controller; please add an adapter/interface that exists in the codebase or correct the README.
|
|
||
| 每张 Run 卡片展示任务目的、最近 Revision 时间、当前版本、步骤进度和版本数量。展开后显示每个 Revision 的来源、重开步骤和步骤状态。当前 WorkflowRun 没有独立的 `updatedAt` 字段,因此页面以最新 Revision 的 `createdAt` 作为最近活动时间,不伪造 Entity 数据。 | ||
|
|
||
| History 只选择恢复目标并传递 `runId`。真正的状态恢复由 Quick Start 或 Workflow Editor 调用 `WorkflowController.resume(runId)` 完成,History 不复制恢复逻辑。 |
There was a problem hiding this comment.
The README assigns resume behavior to WorkflowController.resume(runId), but the current controller interface does not define a resume method. That makes the documented handoff from History to Quick Start/Workflow Editor unimplementable as written; please document the real resume API or add it before relying on this contract.
What changed
listWorkflowsandsubscribeAll.Why
Users need one place to inspect creation tasks and their retry history without treating History as an asset library or Playtest record. The page must remain read-only and return an active task to the interface where it was created.
Scope
This PR targets
maindirectly and contains only:frontend/src/pages/history/index.tsxfrontend/src/pages/history/index.test.tsxfrontend/src/pages/history/README.mdAppShell routing, backend code, WorkflowRun persistence, local preview files, screenshots, dependencies, and build output are intentionally excluded.
Verification
npm test: 3 files, 9 tests passednpm test -- src/pages/history: 7 History tests passednpm run typecheck: passednpm run lint: passednpm run build: passedoxfmt --checkCloses #100