feat(history): add per-task version history#37
Conversation
|
Heads-up: #33 is also open against the same You and @cszhouwei may want to compare scope so the focused bugfix and the larger feature work do not step on each other. The maintainer team will decide which path lands. |
|
Adding one update now that the public harness PR has landed on Please keep the earlier review guidance, but map the files like this:
Recommended validation after rebase:
I am not pushing directly here because this is a larger feature branch and the existing review asks for scope cleanup before another code pass. |
Resolve conflicts after the workspace move into next/:
- Move src/components/history-pane.tsx -> next/src/components/history-pane.tsx
- Move src/lib/history/{db,db.test}.ts -> next/src/lib/history/
- Keep both HistoryToggle and CommunityLinks in toolbar.tsx
- Merge history.* and community.* strings in both i18n locales
- Add `diff`, `idb`, and `fake-indexeddb` to next/package.json
- Drop top-level vitest.config.mts (next has its own)
- Regenerate pnpm-lock.yaml
|
Resolved conflicts with Conflict resolution
Verification
|
Why this branch
This branch is ready to pick because the risky parts were exercised in-browser against the real app shell and are now covered by repeatable unit tests: IndexedDB writes, per-task GC, task deletion cleanup, restore commits, visual iframe compare, and source diff rendering. It also fixes the React update loop found during smoke QA after Convert.
What changed
html-anything-history/runswith a 20-version cap.historyPaneOpenacross refreshes.DeployControl's empty deployments selector so Convert does not trigger a React maximum-update-depth crash.Screenshots
v1 -> v2 visual compare
Empty state, English
Empty state, zh-CN
Large HTML visual compare, 250KB+ input
Automated coverage
pnpm testnow coverssrc/lib/history/db.tswithfake-indexeddb:listRunsreturns newest first.deleteTaskRunsremoves only the selected task's rows.deleteRunremoves a historical version without disturbing newer rows.putRun, reads, deletes, andclearAlldegrade without throwing.Browser QA evidence
runshad 1 row, versions[1],currentVersion=1, pane showedv1 currentand刚刚.runshad 2 rows, versions[2, 1],currentVersion=2, v1 no longer had the current marker.[3, 2, 1],currentVersion=3, preview returned to v1 content.v5throughv24; earlier rows were trimmed.remainingRowsForDeleted=0in IndexedDB.historyPaneOpen=trueand the active task's history remained visible.status=done, generated HTML, and no red error logs when IDB was unavailable.enandzh-CN; captured above.+and-rows and the scroll container remained responsive.Verification
pnpm test— 5 tests passed.pnpm build— passed.pnpm dev, with Application -> IndexedDB inspection forhtml-anything-history.Note: build still emits the existing Turbopack NFT tracing warning for
next.config.ts -> src/app/api/draft/route.ts; no new build failure was introduced.