Skip to content

fix(research): restore grouped record reading after reload - #8973

Open
loopx-agent wants to merge 3 commits into
mainfrom
codex/research-frontier-followthrough-20261118t0012
Open

loopx-agent wants to merge 3 commits into
mainfrom
codex/research-frontier-followthrough-20261118t0012

Conversation

@loopx-agent

@loopx-agent loopx-agent commented Nov 18, 2026 •

Copy link
Copy Markdown
Collaborator

Reading fixes after independent review

Two reproduced failures affected the record reader at 6177f669. Returning to an expanded record after filtering it out could make the first click collapse its details and hide comparison. Opening the drawer or expanding a record could also add a browser history entry, leaving the reader on the same source after one Back.

Filter changes now clear the expansion along with the visible page. The drawer and expanded rows save their reading bookmark in the current entry. Navigating to another research source creates the entry used by Back and Forward. Reload restores the selected rows within their original Goal and source.

Validation

Check Result
Packaged comparison against fdee8adc0fea Reproduced both review findings on the previous implementation and passed the same two scenarios on 3f063ed4048b
Packaged browser smoke groups 1/3 and 3/3 All 58 scenarios passed, including keyboard expansion, one Back to the previous source, and exact row restoration with Forward
Reader regression suite All 19 tests passed. The adjacent packaged evidence-version and analysis-reader scenarios passed.
Production Chat build TypeScript, Vite and source bundle verification passed
Read-only history replay Previously captured source data still projects 113 records into 59 entries across all three pages. Exact replay, conflicting replay, source/Goal binding and the three known original relationships were checked.
Premerge 4 direct and 13 executed checks passed. The change-quality receipt is cqr_6272d1896ba01381f2b8.

The exact candidate is 3f063ed4048bf7d3a0bb6ee8b3191a7fa6ae374e. The paired browser runs used the same main revision f8ef1a63f12f and the same fixtures. Premerge checks used current target 108377179474. Its newer commit touches a separate set of paths and the merge preview is clean. The updated PR is ready for independent review and CI on this revision. Merge and installed App adoption remain pending.

Frontend evidence

These captures use two public, read-only Grid research fixtures in the packaged Chat browser. Both desktop views are 1200×854. The 390×844 capture shows the selected record restored by Forward, with its original text and comparison action.

Before. One Back leaves the reader on the second source with 11 records and closes the drawer.

Before, Back leaves the second research source selected

After. One Back returns to the previous source with 33 records.

After, Back restores the previous research source

390px. Forward restores the record and keyboard focus to its summary. The original title and body wrap within the viewport.

After, the original expanded record and comparison on a narrow viewport

Scope

The seven changed paths are in the Research reader, its existing browser regression coverage, and frontend delivery documentation. The reader reuses the existing URL decoder, source binding and evidence grouping. The bounded simplification removes the separate push path for drawer state.

Original proposal and validation at 6177f66

Goal And Delivered Outcome

Reloading the research record list discarded the search, status filter, expanded entry and later display page. This fixes that reading interruption using the existing Research URL: reload and Back/Forward restore the same original entries only within the same Goal/source. Missing group identities remain visibly unavailable.

The existing grouping owner is preserved. A read-only full-history check found 113 original records in 59 entries; the observed duplicate-looking pairs are a lifecycle record and its explicitly linked finding. Confirmation, refutation, revisions and original text remain separate evidence inside the entry. Counts do not establish independent research outcomes.

Author Declaration

  • Written by: OpenAI Codex model agent.
  • Specification: this reproduced reading defect; docs/development/design.md Research Workspace and docs/development/frontend-delivery.md Task-first delivery at base 684400582063e16d6c460b005598714f03ae380b.
Criterion Disposition Owner / evidence
Restore original reading selection on reload and Back/Forward implemented Existing Research URL, record reader; packaged browser readback
Fence bookmarks to their original Goal/source implemented Local bookmark codec; different-source and malformed bookmark tests
Retain original states, revisions, evidence and counts implemented Existing Explore projection/grouping and export/report regression tests
Preserve narrow and keyboard reading implemented 390px, Escape, restored summary focus; full original text remains readable
Native App window reopen / installation out_of_scope Existing native preference and installed qualification remain separate

Scope And Continuation

Six frontend/test/documentation paths. No new history authority, source connection, model invocation, benchmark execution, scorer or native-window preference. This independently reversible reader repair does not complete the broader long-horizon research program or establish causal benefit.

The bookmark is local presentation state. It preserves the existing multiple-entry expansion, raw-record filtering and original export behavior. Normal older links retain the closed-list default.

Validation

  • 19 record search/version/export/report tests passed, including malformed/ambiguous bookmarks, source/Goal isolation, later-page state and conflicting original revisions.
  • Complete dashboard tsc --noEmit and Chat Vite production build passed.
  • Packaged candidate + real read-only owning backend: all three pages (40/40/33), exact source relationships, unchanged original body across reload, Back/Forward, 390px and Escape. Wrong physical source refused with HTTP 409. Exact event replay preserves 113 records; conflicting replay is rejected.
  • Synthetic 120-record / 60-entry case: later-page restoration, missing-selection recovery, different-source refusal and narrow reading passed. These are presentation fixtures, not benchmark results.
  • Standard premerge: 4 direct and 11 executed checks passed; exact-scope change-quality receipt cqr_bb91fb2f63d81b37cee0 passes.
  • Initial aggregate premerge held for the missing quality receipt; it passed after the exact-head receipt was recorded. A fixture-construction error and a test typo were corrected before the successful runs.
  • Independent PR review, CI completion, merge and installed/native App adoption remain pending. No production switch or installation was performed.

Frontend / Visual Evidence

Tested candidate 6177f66924488fd42eead81f10069eb829645a73, packaged Chat browser. All attached images use synthetic data; private live-source captures are retained locally and are not uploaded. No layout redesign is claimed.

Before: packaged 2.4.0 baseline a92b123749e7d2ef0c80e33fa88e40a4c0f572aa, served against the same disposable fixture. Reload closes the list and loses its selected record/filter.

Baseline after reload loses the record reader

After / first viewport: same existing list composition, distinct entry/raw-record counts and mixed states. Reading selections now survive reload.

Candidate desktop record list with synthetic mixed states

After / 390px: restored later entry, complete selected title and both original lifecycle/finding records. No horizontal overflow; Escape returns focus to the summary.

Candidate narrow original evidence reading

Attention/craft review: retain one title and one compact state/time summary per entry; reveal original records and provenance on demand. Closed repeated titles remain compact, selected text wraps completely, negative/tentative states stay visible. The change adds recovery information only when an original selection is unavailable; it adds no routine explanatory banner or control row. The existing header/sidebar and composition are unchanged.

Engineering Review

  • Reuse: existing Explore grouping, Research URL/router and original evidence rendering.

  • Simplification: one narrow local reader controller, without a second store/provider or an App-specific configuration path. It preserves existing decision and evidence semantics.

  • Vocabulary: the bookmark shape and URL key are local presentation state, not a new shared lifecycle/status protocol. The semantic advisory has no supported candidate carriers in this diff; its stated analysis limits remain.

  • Public boundary: generated captures and raw histories stay ignored. Only the selected synthetic screenshots are attached; no private Goal state, local paths or raw benchmark logs are committed.

  • Bug fix

  • Documentation update

  • Test update

  • Presentation / dashboard

Signed-off-by: LoopX Agent <337587101+loopx-agent@users.noreply.github.com>

@loopx-agent loopx-agent left a comment

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewer: model_agent · Gemini · Google (self_reported)

Request changes conclusion (author-owned PR; GitHub blocks formal self-review)

动机 / Motivation

在 Research 工作台打开全部已读记录抽屉并使用搜索、状态筛选、分页加载及浏览器前进后退的个人用户与运维审阅者。

改前刷新页面会丢失 Research 记录列表的展开、筛选词、状态、页数与条目展开状态;改后这些本地阅读选择写入 research_records URL 参数,刷新可在同 Goal 与同物理来源下恢复,但筛选变化未清理失效展开项且打开搜索抽屉使用了 pushState,导致筛选后点击展开变为折叠并触发比对区超时、单次浏览器 Back 无法退回上一来源。

期望交付在同 Goal 与同物理来源范围内可刷新恢复、可隔离错误来源并保留原始证据与计数的研究记录阅读书签;实测 exact head 6177f66 上该局部刷新书签以回归现有筛选重挂载与浏览器回退主流程为代价,暂未安全达成可用交付。

不引入新的历史真相源、服务端存储、模型执行或评分逻辑,也不修改原生 App 的窗口重开偏好。

从用户任务与长程阅读连续性来看,该 PR 针对的是单轮/多轮研究回看中刷新丢失研究记录筛选位置的问题;复现确实存在,但修复方式引入了更频繁的日用交互阻塞。

改动思路 / Approach

将本地阅读器状态编码并绑定到现有 Research URL 是正确的本地边界,但当前实现把筛选状态与历史栈 pushState 耦合过紧:筛选条件变更与 reset 未清理 expanded,且开启抽屉与单条展开都使用 pushState,直接破坏同页后退与筛选后交互。

仅应作为展示层 research_records URL 状态修复交付,保留现有 explore_history 分组与导出主权,待修复筛选清理 expanded 与改用 replaceState 后再合入。

在代码归属上,作者复用了现有的 router.tsx researchSearchShape、explore_history 分组和 ResearchRecordComparison 渲染组件,将状态收口为 research-record-search.ts 里的 ResearchRecordsLocation 与 research-record-browser.tsx 中的 useResearchRecordsLocation hook。对比更小改动,将抽屉开合与条目的本地展开写入浏览器历史时,应当只对跨页面或显式主版本切换压栈,而抽屉开合和筛选切换属于局部视图状态,使用 replaceState(并按需在 onChange/reset 清理 expanded)即可兼顾刷新恢复与既有导航语义。

触发交互 基线 6844005820 行为 候选 6177f66924 实际表现 评价
打开搜索抽屉 -> page.goBack() 返回上一来源 captures[0] (33 / 33) 仅弹出 {open: true},url 仍停留在 captures[1] 回归 (research-source-recovery.ts:130)
展开条目 -> 切空筛选 -> 切回筛选 -> 点击摘要 切筛选重挂载后默认闭合,点击即展开并露出比对区 expanded 未清理,切回即已展开,点击反致闭合且比对区隐藏 回归 (research-record-search.mjs:183)
刷新恢复/来源隔离/损坏书签回退 刷新丢失抽屉与筛选 同 Goal/来源可恢复,跨来源或非法 JSON 退回默认闭合 单元测试通过 (7/7)

具体改动 / Changes

本评审以改动前基线规范 docs/development/frontend-delivery.md 及 docs/development/design.md(提交 684400582063e16d6c460b005598714f03ae380b)为独立验收基准,并核查本 PR 顺带新增的 docs/development/frontend-delivery.md#L155-L159 说明在当前头部的真实性:

  • SPEC-1(docs/development/frontend-delivery.md#L151-L154 at 684400582063e16d6c460b005598714f03ae380b):研究阅读器支持 reload 与 Back/Forward 且缺失版本不静默回退到最新项 -> not_met(GoalResearchHistory 调用 recordReading.update({open}, false) 压入 pushState,破坏同页来源切换后的浏览器 Back 返回链路)。
  • SPEC-2(docs/development/frontend-delivery.md#L150-L154 at 684400582063e16d6c460b005598714f03ae380b):保留原始记录、多状态与相同 Goal/物理来源作用域隔离 -> implemented(readResearchRecordsLocation 与 writeResearchRecordsLocation 在 research-record-search.test.mjs 7 项测试中通过)。
  • SPEC-3(docs/development/design.md#L138-L140 at 684400582063e16d6c460b005598714f03ae380b):核验已填充、空白及受阻/回退交互并确认可返回原上下文 -> not_met(ResearchRecordSearch 在 onChange / reset 中未清空 expanded,导致列表项重新挂载时以已展开状态覆盖用户预期点击语义)。

关键代码讲解

  1. useResearchRecordsLocation(apps/presentation/dashboard/src/features/personal-workspace/research-record-browser.tsx:53):负责读写 URL 查询参数 research_records 并监听 popstate 与递增 navigation 计数。当 replace = false 时通过 window.history.pushState 写入历史记录;但本组件未区分「需刷新恢复的 URL 同步」与「应形成后退步的历史压栈」。
  2. ResearchRecordSearch(apps/presentation/dashboard/src/features/personal-workspace/research-record-browser.tsx:78):将原本本地 useState 的 query/status/limit 改为受控于 reading.value,并在 onChange(第 132、135 行)与 reset(第 114 行)仅传 {query/status: ..., limit: 50} 而不重置 expanded。当某分组先前被展开并随后因零匹配筛选从 DOM 卸载、再因条件切回而重新挂载时,<details open={expanded.includes(group.id)}>(第 155 行)会直接处于开启态,随后用户的展开点击反而将其折叠。
  3. GroupedResearchRecord(apps/presentation/dashboard/src/features/personal-workspace/research-record-browser.tsx:166):受控 <details> 在第 179 行绑定 open={open} 与 onToggle={event => onOpen(event.currentTarget.open)};由于浏览器 <details> 在受控属性未先同步清理时,卸载重挂载后仍按 URL expanded 直接打开。
  4. GoalResearchHistory(apps/presentation/dashboard/src/features/personal-workspace/goal-research-history.tsx:125,21,574):第 21 行 setRecordsOpen 使用 recordReading.update({open}, false),replace 硬编码为 false。点击工具栏「搜索研究记录」按钮时强行新增浏览器历史条目,拦截了随后用户在双来源对比场景中的单次后退返回操作。
  5. readResearchRecordsLocation / writeResearchRecordsLocation(apps/presentation/dashboard/src/features/personal-workspace/research-record-search.ts:256,269):以严格白名单校验 scope、布尔/整数类型与去重 expanded,重复参数或多于一项均安全退回 defaultResearchRecordsLocation;本地状态词表局部可控,未污染控制面协议。

对主干的风险 / Risks

当前 HEAD 6177f66924 存在两项已直接复现的 P1 主干回归,均已在 CI (browser (1/3), browser (3/3), dashboard-browser (1/3), chat-bundle-browser (1/3)) 与本地打包浏览器 smoke 中确认失败,而相同命令在基线 684400582063e16d6c460b005598714f03ae380b 均稳定通过:

  1. P1 · 筛选切换未清理 expanded 导致详情条目重挂载反向折叠并使对比区不可达
    • 触发路径:在 ResearchRecordSearch(research-record-browser.tsx:114,132,135,155,179)展开任意条目使 group.id 进入 URL expanded,随后切换状态筛选至零匹配(条目卸载),再切回包含该条目的状态后点击条目摘要。
    • 实测证据:基线 6844005820 下 LOOPX_PERSONAL_WORKSPACE_SCENARIO=research-record-search 通过;候选头 6177f66924 本地运行与 CI browser (1/3) 均在 examples/personal-workspace-browser/research-record-search.mjs:183:70 报 TimeoutError(等待 Compare with 超时,因第 167 行点击把本应新展开的条目折叠,导致 .research-record-comparison 不可见)。
    • 最小修复与回归验证:在 query/status onChange 及 reset 时清空(或按匹配分组过滤)expanded;修复后需在 apps/presentation/dashboard 重新打包并用真实浏览器复跑 LOOPX_PERSONAL_WORKSPACE_SCENARIO=research-record-search node examples/personal-workspace-browser-smoke.mjs。
  2. P1 · 开启研究记录抽屉使用 pushState 劫持浏览器后退语义
    • 触发路径:GoalResearchHistory(goal-research-history.tsx:21,574)通过 recordReading.update({open}, false) 调用 window.history.pushState,同时 research-record-browser.tsx:117 的 toggle 同样传递 replace = false。
    • 实测证据:基线 6844005820 下 LOOPX_PERSONAL_WORKSPACE_SCENARIO=research-source-recovery 通过;候选头 6177f66924 本地运行与 CI browser (3/3) 均在 examples/personal-workspace-browser/research-source-recovery.ts:130:85 报 TimeoutError(page.goBack() 后未回到前序来源标题 Grid · context on · 2026-11-03)。
    • 最小修复与回归验证:setRecordsOpen 与单条 toggle(至少抽屉开合 setRecordsOpen)改用 replace = true 或在非目标来源导航切换时避免新增历史条目,并确认支持 reload 恢复与单次 goBack() 回退前序来源;需重跑 LOOPX_PERSONAL_WORKSPACE_SCENARIO=research-source-recovery node examples/personal-workspace-browser-smoke.mjs 与全量 browser (1/3)/browser (3/3)。

附注:scope_fit 检查确认新 URL 编解码在 GoalResearchHistory 与 router.tsx 均具备真实生产调用链;docs/development/frontend-delivery.md#L155-L159 新增的 Back/Forward 声明在修复上述两个 pushState 与筛选清理缺陷前与实际行为不符,应一并经真实浏览器回归验证后再按现状保留。本地已复跑:node --test .../research-record-search.test.mjs PASS (7/7),npm --prefix apps/presentation/dashboard run build:chat PASS (tsc --noEmit && vite build),canary premerge --tier quick PASS(4/4 直接检查与 3/3 目录/边界检查通过,未发现私有边界泄露)。

我的整体评价 / Verdict

综合 problem_context.outcome_impact 判定:long_horizon 为 preserved(保留原始记录、状态与 Goal/来源边界,未增设旁路真相),但 user_experience 为 regression、visual_review 为 regression。

已在 1716x995 桌面默认态、1716x995 展开全部已读记录态及 390x844 窄屏展开态下人工核验 PR 附图,静态排版层级清晰、条目与原始记录区分明确、窄屏卡片无横向溢出;但受限于交互回归,桌面真实浏览器中筛选切换重挂载后点击摘要无法打开比对区且 Back 被历史栈劫持,构成本次 UX 与可视化交互回归。

未验证范围:390x844 窄屏默认折叠态静态截图及原生桌面 App 独立窗口重开路径未单独截图验证。

词表与可观测语义结论:本次新增 ResearchRecordsLocation 仅属于展示层局部 URL 书签状态,未新增或修改跨层共享控制面词表;observable_semantics 判定为 unintended_drift,原因正是上述筛选状态残留与 pushState 对既有核心浏览与返回路径造成了非预期漂移。

English verdict: REQUEST_CHANGES — Fix stale expanded state on filter changes and pushState history hijacking on drawer open in research-record-browser.tsx / goal-research-history.tsx so research-record-search and research-source-recovery browser suites pass.

…search-frontier-followthrough-20261118t0012

Signed-off-by: LoopX Agent <337587101+loopx-agent@users.noreply.github.com>
Signed-off-by: LoopX Agent <337587101+loopx-agent@users.noreply.github.com>

@loopx-agent loopx-agent left a comment

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewer: model_agent · Gemini · Google (self_reported)

Approval conclusion (author-owned PR; GitHub blocks formal self-approval)

本次对 PR #8973 当前 exact head 3f063ed4048bf7d3a0bb6ee8b3191a7fa6ae374e 执行了完整复审。上一轮针对 6177f66924488fd42eead81f10069eb829645a73 提出的两个 P1 阻塞问题(筛选切换未清理 expanded 导致重挂载后反向折叠比对区、打开抽屉及展开条目误用 pushState 劫持单次 Back 返回上一来源)以及文档表述一致性问题,均已在本轮提交中修复并经打包构建与真实浏览器回归验证通过;未发现新的主干回归或边界泄露。

动机 / Motivation

在 Research 工作台使用「全部已读记录」抽屉进行关键词检索、状态筛选、分页加载及多来源对比浏览的个人用户与运维审阅者。

基线 f8ef1a6 下将 open、query、status、limit 存放在组件本地状态,浏览器刷新会丢失抽屉展开、筛选条件与后续分页,而在上一评审头 6177f66 虽写入 URL 却因筛选未清空 expanded 导致重挂载后反向折叠对比区,且抽屉与展开使用 pushState 拦截单次 Back 回退;当前头部 3f063ed 将 reading 状态以 replaceState 绑定到同 Goal 与同物理来源的 research_records 查询参数,并在筛选变更或清除时清空 expanded 且重置至第 1 页(limit 50),实现刷新与跨来源 Back/Forward 精确恢复而不劫持来源历史栈。

在同 Goal 与同物理来源下,刷新或通过浏览器前进后退返回该页时可恢复「全部已读记录」抽屉开关、搜索词、状态筛选、已加载页数及展开条目并聚焦恢复条目摘要;切换筛选或清除筛选后新结果从第 1 页折叠态开始;缺失分组标识显式提示不可用而不静默替换最新记录;跨 Goal 或跨物理来源以及损坏参数均安全退回默认折叠状态。

不新增历史真相源、服务端存储、模型分析调用或评分规则,不改变 explore_history 分组与原始导出语义,也不修改桌面端原生 App 的独立窗口重开偏好。

如果不修复该问题,用户在多页记录与多来源对比过程中每次刷新或从其他来源 Back 返回都会失去已筛选和展开的证据上下文;而在修复前 6177f669 的实现则会破坏日常高频使用的筛选点击与单次浏览器回退。本次切片自包含、可独立验证且可整包回退,构成了完整可用的展示层修复。

改动思路 / Approach

将 research_records 编解码与作用域隔离留在展示层纯函数模块 research-record-search.ts,由 useResearchRecordsLocation 以 replaceState 承接当前历史条目上的局部阅读书签,并在 router.tsx 注册只读传递字段,避免引入第二套前端状态 store 或污染控制面协议,同时在筛选变更时统一清空 expanded 与分页上限以保证受控 details 的幂等状态。

当前 PR 边界严格收敛于 Research 已读记录列表的 URL 书签持久化、同页筛选重置与现有打包浏览器回归覆盖(7 个文件 +156/-22),待后续独立合入后再由桌面端发行链路验证原生容器重开场景。

本 PR 复用既有 router.tsx 的 researchSearchShape、clearedResearchSearch、explore_history 原始分组与 ResearchRecordComparison 比对组件,没有另起平行缓存或后端路由。相比上一版在抽屉和单行展开时传入 replace = false 压栈的做法,当前版本删去 pushState 分支并统一使用 window.history.replaceState(window.history.state, "", url),使页面切换、Goal 切换与来源切换继续拥有浏览器历史栈,而抽屉内部阅读状态随当前历史条目一起保存与恢复。

交互路径 基线 f8ef1a63f1 前序候选 6177f669 当前头部 3f063ed404
打开抽屉、翻页并展开条目后刷新 丢失抽屉与筛选(重置为闭合) 恢复,但产生多余历史栈条目 原位置恢复抽屉、页数、展开项并聚焦摘要
展开条目 -> 切零匹配筛选 -> 切回筛选 重挂载闭合,点击展开比对区 expanded 残留,点击反致折叠超时 updateFilters 清空 expanded,点击正常展开
跨来源切换后打开抽屉展开条目 -> Back -> Forward 返回上一来源但丧失新来源阅读位置 需多次 Back 才离开当前来源 单次 Back 退回上一来源,Forward 精确恢复

具体改动 / Changes

本评审以改动前主干基线 f8ef1a63f12fb042c62b3f5b828a432da1b568b2 上的规范文档 docs/development/frontend-delivery.md(与同基线 docs/development/design.md 研究工作台章节)作为独立验收依据,并核查本 PR 在 docs/development/frontend-delivery.md 新增的行为说明是否与 3f063ed404 一致:

  • FD-1(docs/development/frontend-delivery.md 基线阅读连续性与 Back/Forward 语义,结合 design.md 研究工作台多源导航要求):阅读器应支持 reload 与 Back/Forward 且保持 Goal/来源隔离 -> implemented(useResearchRecordsLocation 与 researchSearchShape 在刷新、同页 Tab 切换与跨来源 Back/Forward 中精确恢复且跨 Goal/源保持隔离)。
  • FD-2(docs/development/frontend-delivery.md 缺失版本不静默回退与原始记录保真要求):找不到原展开条目时不得静默替换为最新条目,并保持原始记录与分组独立性 -> implemented(ResearchRecordSearch 在 complete 且缺失原分组时输出 role="status" 显式提示,3 项单元测试及浏览器对抗测试验证)。
  • FD-3(docs/development/design.md 填充/空白/受阻状态核验与返回原上下文要求):筛选变化及重挂载后点击交互与 Escape / Back 返回语义不得回归 -> implemented(updateFilters 在变更关键词、状态或清除筛选时重置 expanded: [] 与 limit: 50,research-record-search 与 research-source-recovery 打包浏览器套件全通过)。
  • FD-4(docs/development/frontend-delivery.md 本 PR 新增第 155–161 行文档与实现一致性核查):文档声明 replaceState 更新当前历史条目与筛选清空折叠态 -> implemented(与 3f063ed404 实际行为完全一致)。

关键代码讲解

  1. useResearchRecordsLocation(apps/presentation/dashboard/src/features/personal-workspace/research-record-browser.tsx:13-34):以 historySource(JSON.stringify([goalId, originalGoalId, readSourceUrl]))作为作用域键读取 URL 参数 research_records,监听 popstate 并递增 navigation 计数。update 仅在状态序列化变化时通过 window.history.replaceState(window.history.state, "", url) 写回当前历史条目,既保留 TanStack Router 的 history.state 又不再额外压栈;同时 navigation 在主动交互时不递增,避免抢占用户输入焦点。
  2. readResearchRecordsLocation / writeResearchRecordsLocation(apps/presentation/dashboard/src/features/personal-workspace/research-record-search.ts:16-33):对 research_records 执行单值校验、JSON 解析、scope 精确匹配、字段类型检查(open 布尔、query/status 字符串、expanded 非空字符串去重数组、limit >= 50 安全整数),任意重复参数、越界类型或作用域不匹配均回退到关闭的 defaultResearchRecordsLocation。
  3. ResearchRecordSearch(apps/presentation/dashboard/src/features/personal-workspace/research-record-browser.tsx:37-158):用受控 reading.value 取代本地 useState;updateFilters 在搜索框 onChange、状态 select onChange 与「清除筛选」按钮中统一写入 {...filters, limit: 50, expanded: []},彻底消除 6177f669 下筛选重挂载残留 expanded 的故障;useEffect 仅在 complete && !busy 且 focusNavigation.current !== reading.navigation 时把焦点移回恢复的展开条目 <summary>;当 complete && expanded 存在不在 allGroups 的 ID 时渲染 role="status" 不可用提示。
  4. GroupedResearchRecord(apps/presentation/dashboard/src/features/personal-workspace/research-record-browser.tsx:160-190):改为完全受控的 open 与 onOpen 属性,保留分组摘要的 Escape 折叠回焦与懒渲染逻辑,并由外层 toggle 去重后同步至 URL。
  5. GoalResearchHistory(apps/presentation/dashboard/src/features/personal-workspace/goal-research-history.tsx:125-127,729-736):接入 useResearchRecordsLocation(historySource) 管理外层「全部已读记录」抽屉开关 recordsOpen,并将 reading 传入带 key={JSON.stringify([goalId, readSourceUrl])} 的 ResearchRecordSearch,同时在 apps/presentation/dashboard/src/router.tsx:41 的 researchSearchShape 注册 research_records 以便在切换 Goal/来源时由 clearedResearchSearch 自动清理。

对主干的风险 / Risks

经对全量 diff 与上下游调用路径的复核及对抗性检验,上轮已复现的两项 P1 风险均已在 3f063ed404 消除:

  1. 筛选切换与重置状态安全性:无论是输入关键词导致零匹配再切回,还是当前展开条目在新状态筛选下仍然匹配(如从全部状态切到 refuted),updateFilters 都会同步清空 expanded 并重置 limit: 50,已由 research-record-search 打包浏览器烟测及实测对抗脚本证实。
  2. 浏览器导航与路由状态协同:useResearchRecordsLocation 在 replaceState 时传入 window.history.state,保留 TanStack Router 历史状态。实测在 Research 打开抽屉与展开条目后切换到 Overview Tab 再切回 Research,URL 参数、分页(62 条)与展开状态保持完整;跨来源切换后单次 Back 返回上一来源闭合态,Forward 准确还原新来源展开态,未引入额外栈帧。
  3. 公共边界与规范对齐:research_records 仅作为展示层局部 URL 书签存在,未新增或修改任何跨层控制面词表;loopx canary premerge --from-git-diff --git-diff-base origin/main(标准级 4 项直接检查 + 13 项精选与风险检查)及改动路径 loopx check 均无违规或私有边界泄露。

仅存一处低影响交互边界记录供后续参考:若用户展开某条目后手动折叠外层「全部已读记录」抽屉(此时 URL 中的 expanded 仍保留),再点击工具栏放大镜「搜索研究记录」按钮重新打开抽屉时,ResearchRecordSearch 首次挂载的 useEffect 会在 requestAnimationFrame 前把焦点移至先前展开条目的 <summary>,导致工具栏按钮里的聚焦搜索框保护条件 document.activeElement !== focused 提前退出,焦点落在已恢复的条目而非搜索输入框;该行为不影响键盘继续浏览与刷新/Back 恢复语义,不构成阻塞。

本地核心验证汇总:

  • 单元测试 research-record-search.test.mjs:PASS(7/7,对比基线 f8ef1a63f1 为 4/4)。
  • TypeScript 类型检查与打包产物构建(tsc --noEmit && vite build --config vite.chat.config.ts 及 build:chat):PASS;CSS Token 检查 check:css-custom-properties:PASS。
  • 打包与开发态浏览器烟测:research-record-search(packaged PASS / dev coverage PASS)、research-source-recovery(packaged PASS)、research-history(packaged PASS)、research-finding-reader(packaged PASS)、research-evidence-version-browser-smoke(PASS),以及跨 Goal/损坏参数/缺失分组/Tab 切换/匹配筛选重置对抗测试全部 PASS,控制台零 pageerror。
  • loopx canary premerge --from-git-diff --git-diff-base origin/main:PASS(4/4 直接检查与 13/13 执行检查通过;远端 GitHub Actions CI 按 Goal 配置 wait_for_ci=false 未轮询等待)。

我的整体评价 / Verdict

综合 problem_context.outcome_impact 判定:long_horizon 为 preserved(保留原始记录、多版本演化、时间顺序与 Goal/物理来源隔离,不引入旁路真相或自动执行),user_experience 为 improved(消除了刷新与跨来源往返丢失阅读筛选位置的中断,同时完整修复了 6177f669 的筛选折叠回归与 Back 历史栈劫持)。

visual_review 结论:已在打包 Chat 产物 3f063ed 上通过 Playwright 实测并人工逐帧审阅桌面端 1440x900 与窄屏 390x844 的默认折叠态、展开第 2 页长文本与版本比对态及缺失分组恢复态,包含长重复标题、多状态混合(Refuted/Tentative/Confirmed)与中英双语来源切换视图,整体排版层级与主次信息分离清晰,未见横向溢出或新增冗余横幅。 未验证范围:原生桌面 App 独立窗口重开偏好与真实远程 SSH/容器来源运行时未在本次无头浏览器烟测中覆盖。

代码体量与兼容性评估:7 个文件净增 +156/-22,ResearchRecordsLocation 严格限定为展示层局部书签而不引入兼容分支或第二状态管理层,observable_semantics 判定为 intentional_change_validated,repository_reuse 为 reused,scope_fit 与 change_proportionality 均为合理适度且 architecture_assessment 为 retain;未新增跨层共享词表(semantic_alignment 为 not_applicable)。

当前复核基于最新远端 exact head 3f063ed4048bf7d3a0bb6ee8b3191a7fa6ae374e;所有必需本地门禁、打包浏览器主链路与对抗验证均已通过,满足合入审查质量要求(具体合入操作与分支保护仍遵循独立 merge 授权流程)。

English verdict: APPROVE — Exact head 3f063ed resolves both prior P1 findings (clearing expanded on filter updates/reset and switching useResearchRecordsLocation to replaceState), passes unit/build/premerge and packaged browser suites (research-record-search, research-source-recovery, research-history, research-finding-reader, research-evidence-version), and preserves Goal/source isolation and original records.

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant