Skip to content

feat(evidence): Copilot 回答可从问题追溯到引用事实 - #357

Open
wannT-1 wants to merge 7 commits into
helsome:mainfrom
wannT-1:cursor/copilot-citation-trace-1c94
Open

wannT-1 wants to merge 7 commits into
helsome:mainfrom
wannT-1:cursor/copilot-citation-trace-1c94

Conversation

@wannT-1

@wannT-1 wannT-1 commented Oct 19, 2026 •

Copy link
Copy Markdown
Contributor

改动说明

What: resolveCopilotCitationTrace maps inline citations to persisted financialEvidence (provider, symbol, metric, currency, asOf, retrievedAt, delayed, fallback); material-conflict keeps both candidates; unmapped citations marked.

Why: one Copilot answer fully traceable from question to financial fact to citation.

关联 Issue

Related to #101

测试报告(正式审核前必填)

环境

  • Bun:1.4.3
  • OS:Linux

实际执行命令与结果

focused tests → 68 passed
typecheck core / i18n / shared / ui / electron → exit 0

已知失败 / Baseline(如有)

  • 无

  • 已提供实际测试命令与 pass/fail 结果

  • 已说明测试环境

  • 如果存在已知 baseline / 环境失败,已提供 main 对照或说明

  • 核心改动已有对应 focused test / smoke / integration 验证

UI 截图(仅可见 UI 变化时必填)

  • 本 PR 无可见 UI 变化(无需截图)
  • 本 PR 有可见 UI 变化,已提供修改后的 UI 截图
  • 已提供 Before / After 对比截图(适用时)

Scope / 后续

6 commits dated October 2026 (Oct 8–18), not June。本切片让一条 Copilot 回答可从问题追溯到已持久化的金融事实与行内引用;无可见 UI 变化。

引用溯源与渲染器必须共用同一套 folio-block 围栏规则,避免把代码块里的示例当成引用。UI 改为从 core 重导出,渲染行为不变。
将 ReconciliationResult 规范进金融证据信封。实质冲突保留双方候选与选中来源,不把价格平均成一个数。仅含 providers/method 的旧记录保持原样。
实质冲突或口径不可比时将 availability 标为 conflicted,并在提供者声明延迟时写入 freshness.delayed。provenance.envelopeId 保留 fe_ id。选中数值仍是规范化原值。
行内工具调用 id 与已闭合 folio-block 的 evidenceIds(工具调用 id 或 fe_)都加入同一条事实,带上提供者、标的、货币、asOf、retrievedAt、延迟、回退和冲突候选。无法解析的引用显式为 unmapped,重载后结果不变。
用 ProviderRouter 回退路径经 RunManager 落库并重载。延迟、fallback 与 material-conflict 仍能由引用解析,价格不是候选平均值。
写明 availability 何时为 conflicted、delayed 与 envelopeId 的含义,以及 resolveCopilotCitationTrace 只读取已持久化的回合数据。
@cursor
cursor Bot force-pushed the cursor/copilot-citation-trace-1c94 branch from 864b9b8 to e5be903 Compare October 19, 2026 12:23
@wannT-1

wannT-1 commented Nov 17, 2026

Copy link
Copy Markdown
Contributor Author

Friendly bump on this one — it has been open four weeks and is still conflict-free against main (mergeable_state: clean), so nothing is blocking it on the code side.

It adds traceability from a Copilot answer back to the persisted facts it cites (packages/core/src/answer-segments.ts, packages/shared/src/evidence/citation-trace.ts), with its own test coverage. Happy to rebase or split it if you would prefer a smaller slice to review first — the evidence-contract part can probably land independently of the UI wiring.

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