Repository navigation
feat(research): export the selected record comparison - #9486
huangruiteng merged 1 commit into
Conversation
Signed-off-by: Yuchao Wang <stevenkid404@gmail.com>
loopx-agent
left a comment
There was a problem hiding this comment.
Reviewer: model_agent · gpt-6.2-sol · OpenAI · runtime_reported · xhigh
动机 / Motivation
在 Research 里追溯被推翻结论的读者,需要把正在比较的两个原始版本交给同伴。 原比较视图能并排查看记录,搜索报告只导出匹配过滤器的记录。 手工拼接容易选错原始版本,丢失未测量和数值为零的区别,也让重新核验成本增加。
读者只搜到旧的负向记录,另一个版本仍可在比较里看到。以前下载搜索报告只能带走旧记录,需要手工找并配对另一个版本。现在可以在当前比较直接下载这一对。 同一批 79 条历史记录中,候选 JSON 保留所选的负向原文、搜索范围外的版本、计量值 0 与未测量。切换版本后两种文件都随之改变,保留来源和读回覆盖字段。 验证的是从基线与候选源码构建的 packaged Chat、synthetic 记录和真实分页 HTTP/SQLite 读回。安装及升级、真实研究数据和评估质量未验证。
改动思路 / Approach
在已有比较视图中导出恰好使用用户已选的同一对记录。复用原事件列表、字段差异和 Markdown 报告中的原文字面量转义。 新行为限于 Research 面板中展开原始版本比较后主动下载。一个搜索结果仍能对应已有多版本,原搜索 JSON 与 Markdown、只读历史和资料来源继续走原入口。 数据加载完成后点原比较中的下载按钮。下载失败影响当前比较的提示,保留选择;历史刷新失败时按已读有效范围标明陈旧。
具体改动 / Changes
核对精确提交 7582a2347f6c875ac7c6f9b4a62ea51fc7ee530b 相比分叉基线 c82e96141a039d1ab83c0693e8aa274e550d51ff 的 9 个文件,+216/−22。采用候选前的公开规范判断适用范围。 规范
关键代码讲解
-
ResearchRecordSearch。用当前 Goal 的原始事件查找版本,把完整度、刷新失败和 busy 传给比较组件。 源码 -
ResearchRecordComparison。以两个真实事件作为可见与可导出的选择,重试不会重选版本。 源码 -
researchComparisonSnapshot。同时交付两个原始事件、差异字段和可核对的覆盖状态。 源码 -
exportResearchComparison。以同一快照生成 JSON 与 Markdown,明确比较是两个历史记录。 源码 -
S5。Workspace 即刻呈现可验证的任务证据,保留可读的回放、失败和重试边界。 验证入口
-
S11。保留历史原始、负向与未知结果及其来源,让读者可在既有 Research 入口检查证据。 验证入口
对主干的风险 / Risks
两个记录可能来自不同评价条件。两个输出保留原版本与证据,Markdown 和 UI 对范围有明确说明。保留失效读回的陈旧标记,刷新忙时不能导出中间状态。 模拟无法创建下载时提示重试;再次下载保留同一选择。历史刷新失败时保留两个原始版本并标注陈旧,加载中禁用导出,真实刷新后恢复。
语义与 CI 对齐
用同一组 79 条 HTTP 分页原始记录,基线与候选导出的全量和过滤 JSON,以及旧的单结果 Markdown,除导出时间外相同。 两端均成功构建 packaged Chat;候选 34 项 Research 测试和标准预合并(含风险 smoke 与公共边界)通过。 本轮按项目策略跳过远端 CI 查询。目标主干在检查时可无冲突合并,合入资格仍由独立门禁决定。
我的整体评价 / Verdict
APPROVE。 同头检查未发现阻断问题。可携带旧的负向、未知与当前版本的完整来源,支持同伴复核,文件本身没有写入研究或决定下一步。 展开现有比较后可直接导出,无须重输记录身份或重复搜索。错误后仍从当前比较重试,不额外增加确认轮次。 检查 1440×900 和 390×844 packaged Research:首屏保留记录上下文,桌面展开后对照字段左右并排,窄屏按钮独立换行、字段纵向排列,底部保留测量范围、来源和返回入口。只有展开后出现新操作。 使用合成历史阅读实界面,包括长文本、重复记录和三种研究状态。未验证其他操作系统、安装态及更小 viewport。
English verdict: APPROVE at 7582a23. The packaged Research view exports the exact original versions on screen, including a version hidden by the search filter. The existing search exports match the baseline. Both recovery and narrow layouts were verified with the same synthetic event history.
Research readers can compare a negative record with a later version that is excluded by their current search, but the existing download only saves search matches. The saved report can therefore omit half of the comparison the reader is looking at. Add JSON and Markdown downloads inside the existing Compare recorded versions disclosure, saving exactly the displayed pair and its original evidence.
This completes an offline review step in the roadmap's S5/S11 results → report → research-history reading journey. It reuses the existing version grouping, field-difference owner and labels, canonical records, Markdown escaping, and download mechanism. It introduces no domain state, mutation, extra backend request or evaluation claim. Both records retain their identities, provenance, original text and measurements, including zero versus unknown. The snapshot records full loaded-history coverage and refresh failure. Missing/ambiguous identities, mixed Goals, identical IDs and different result kinds are rejected; source references are not followed.
The new controls appear only after opening a comparison. A failed download is retryable, downloads are disabled during refresh, and stale retained evidence is explicitly labeled in the export. Existing search-result downloads remain unchanged. The getting-started guide explains the distinction.
Validation against the branch creation base
c82e96141a039d1ab83c0693e8aa274e550d51ff:node --experimental-strip-types --test apps/presentation/dashboard/src/features/personal-workspace/research-comparison-export.test.mjs apps/presentation/dashboard/src/features/personal-workspace/research-record-*.test.mjs: 29 passed. Covers identity/Goal guards, identical versions, selected alternatives, complete/partial/stale coverage, original field differences, literal source markup, and existing report/export/search behavior.npm run build:chat:viteandpython scripts/chat_bundle.py build: passed (TypeScript and production Chat assets).research-record-searchbrowser scenario: passed, using a disposable real paged history HTTP owner with 79 synthetic records. The generic report still excludes the filtered-out revision while comparison downloads include both exact records. Changing the comparison to a third revision changes both downloaded formats; zero/unknown measurements, interrupted download/retry and failed-refresh readback pass. Final backend readback confirms unchanged source and zero mutation attempts.loopx canary premerge --from-git-diff --git-diff-base c82e96141a039d1ab83c0693e8aa274e550d51ff: passed, direct checks 4/4, catalog 4/4, risk smokes 8/8, public-boundary scan 1/1. Subsequent guide-only relocation avoids the documentation insertion point used by pending feat(cli): discover registered Goals with scoped search and paging #9431; final documentation scan has zero errors (local-registry absence warnings), and staged diff checks pass.Reproduce the browser scenario after building Chat with
LOOPX_PERSONAL_WORKSPACE_PACKAGED=1 LOOPX_PERSONAL_WORKSPACE_SCENARIO=research-record-search LOOPX_TEST_PYTHON=<test-venv-python> LOOPX_PLAYWRIGHT_PACKAGE=<dashboard-node_modules/playwright> LOOPX_CHROME_HEADLESS_SHELL=<qualified-browser> node examples/personal-workspace-browser-smoke.mjs.This validates source-built packaged Chat and the real history owner on Linux, not a newly installed release wheel, other platforms, or the full browser catalog. Record differences are not matched evaluations, acceptance receipts or proof of improved research quality. #9216's verification-evidence packet and pending #9431/#9432 are independent and not prerequisites.