Repository navigation
fix(web): 项目续页的重试保留范围、大页合并提速 / keep a project page's scope on retry and merge large pages quickly - #1097
Conversation
…quickly Follow-up to BytePioneer-AI#1081. - A failed project page now records its Workspace ID in the list state, and the list error's Retry reads on for that project again instead of fetching a plain page. - mergeOrderedBaseline skips candidates that are not merged yet before scanning for an insertion anchor. A project page can bring about a thousand rows; merging 1,000 new rows before 20 known ones took about 1.1 s and now takes about 23 ms, with the same order. - The docs state that "Show more" disappears only at the end of the catalog, and that a click stopped by the 10-page bound needs another click. - archived-query.test.ts mocks the Gateway browser export like prompt-delivery.test.ts, so it loads in Node and runs in CI.
|
No actionable comments were generated in the recent review. Summary
Merge Risk:
|
|
感谢迅速跟进 |
摘要
#1081 的后续修复,处理 CodeRabbit 在 #1081 上提出、核对后成立的三条意见:
errorWorkspaceId/listErrorWorkspaceId),列表错误的「重试」带上它重新读取,仍会读到该项目的会话。原来会改成普通的 20 条续页:错误消失,但项目的会话仍不出现。「最近」和远程项目的重试不带工作区 ID。mergeOrderedBaseline为新行找插入位置时,对每个后续候选都执行一次merged.findIndex全表扫描。现在先用mergedKeys判断候选是否已合并,未合并的直接跳过,插入位置不变。另外:
archived-query.test.ts原本不在 vitest 的 include 列表中,在 Node 中加载时报window is not defined(Gateway 的浏览器导出是加载器包)。现在与prompt-delivery.test.ts一样 mock 该导出,并加入 include 列表,在 CI 中运行。workspaceId参数类型从string收紧为WorkspaceId,与该包其他接口一致。CodeRabbit 对
docs/product/standalone-web.md的两条 LanguageTool 用字提示(「不读」「不齐」)是误报,未改。关联 Issue
#1081 的后续(CodeRabbit 在该 PR 上的意见)。
测试
基于
main(33d36737),macOS 27.2.1(arm64),Node 26.0.0:npx vitest run --config tests/vitest.config.js apps/web-ui/packages/api/session-controller/test/:2 个文件,15 个通过。archived-query.test.ts原有 10 个用例在 Node 中全部通过。「keeps the page cursor on errors…」新增断言:项目续页失败时请求带workspaceId,快照的errorPage为more、errorWorkspaceId为该项目,下一次成功续页后清空。去掉manager.ts的改动后,这条用例失败。mergeOrderedBaseline,结果顺序相同。100 条新行加 20 条已加载行:7.7 ms → 1.6 ms;1000 条新行加 20 条已加载行:1149 ms → 23 ms。没有新增基于耗时的测试,合并顺序由已有用例覆盖。main后,npm run build:web:ui通过。改动文件prettier --check通过,tests/vitest.config.js的eslint没有错误。用apps/web-ui/tsconfig.base.json对改动的两个 Web UI 包运行tsc,错误列表与改动前相同。Summary
Follow-up to #1081 for the three CodeRabbit comments on #1081 that hold after checking:
errorWorkspaceId/listErrorWorkspaceId), and the list error's "Retry" sends it again, so the retry still reads on to the project's Threads. Before, Retry fetched a plain 20-row page: the error went away, but the project's Threads still did not appear. Retries for Recents and remote projects send no Workspace ID.mergeOrderedBaselineran a fullmerged.findIndexscan for every following candidate. It now checksmergedKeysfirst and skips candidates that are not merged yet; insertion positions do not change.Also:
archived-query.test.tswas not in the vitest include list and failed to load in Node withwindow is not defined(the Gateway browser export is a loader bundle). It now mocks that export likeprompt-delivery.test.ts, is in the include list, and runs in CI.workspaceIdparameter added in fix(web): 项目的「展开显示」读到本项目的会话为止 / let a project's "Show more" read on to its own Threads #1081 is typedWorkspaceIdinstead ofstring, like the package's other interfaces.The two LanguageTool wording hints CodeRabbit posted on
docs/product/standalone-web.md("不读", "不齐") are false positives and are left unchanged.Related issues
Follow-up to #1081 (CodeRabbit's comments on that PR).
Test plan
On
main(33d3673), macOS 27.2.1 (arm64), Node 26.0.0:npx vitest run --config tests/vitest.config.js apps/web-ui/packages/api/session-controller/test/: 2 files, 15 passed. All 10 existing cases inarchived-query.test.tspass in Node. "keeps the page cursor on errors…" gains assertions: a failed project page sendsworkspaceId, the snapshot haserrorPagemoreanderrorWorkspaceIdset to the project, and the next successful page clears it. The case fails without the change tomanager.ts.mergeOrderedBaselineon the same input on this machine give the same order. 100 new rows plus 20 loaded rows: 7.7 ms → 1.6 ms; 1,000 new rows plus 20 loaded rows: 1,149 ms → 23 ms. No timing-based test was added; the merge order is covered by existing cases.main,npm run build:web:uipasses.prettier --checkpasses on the changed files, andeslintreports no errors ontests/vitest.config.js. Runningtscwithapps/web-ui/tsconfig.base.jsonon the two changed Web UI packages gives the same error list as before the change.