boardx / boardx/workspacex

[F03] 虚拟来源隔离门:标强/进决策依据在接口层拒绝

Open Beginner friendly
#1,648 0 comments 0 reactions 0 assignees View on GitHub
area:itv sprint:11-02 status:in-progress
Dominant language
TypeScript
Stars
0
Forks
0
Avg merge
1h 7m
Merged PRs (30d)
969

Description

## 交付契约(user_visible_behavior)

研究员对已入库洞察调 markStrongInsight / referenceForDecision 时,系统在接口层校验来源是否为真人(sourceKind):真人来源放行,虚拟来源(数字人/画像推演)一律返回 VIRTUAL_SOURCE_FORBIDDEN。这是接口层门不是前端按钮置灰——直接调 API 绕过前端仍被拒。混合来源候选(任一引述来自虚拟)整条按虚拟处理,同样被拒。

## Story

[requirements/01-insight-library-backend.md](https://github.com/boardx/workspacex/blob/main/phases/phase-11-research-insight-backend/requirements/01-insight-library-backend.md) — 章节 `R7`

## 验证(完成的唯一标准:每条命令退出码 0)

- [ ] `pnpm --filter api exec vitest run tests/itv/virtual-source-interface-gate.test.ts`

证据落盘:`phases/phase-11-research-insight-backend/sprints/sprint-02/evidence/F03.verify.log`

## 实现指引(notes)

算子出处:markStrongInsight / referenceForDecision(两者共享同一道门)。复用 apps/api/src/domain/interview/insight-source-gate.ts 的 checkSourceAllowsStrongUse(真人放行/虚拟 VIRTUAL_SOURCE_FORBIDDEN,两个接口调同一函数),本 feature 只把这道纯函数接到两个 controller 上并验证『绕过前端直接调 API 仍被拒』,不重写门逻辑;混合来源的 virtual 传播由 F01 的 candidate-insight.ts buildCandidateInsight 落定,本门只消费既成 sourceKind。对应 coverage.md uc-6-5 R12:V3(虚拟来源标强/进决策依据均被接口拒绝,统计返回真人/虚拟两个独立字段)。规则出处 R7『虚拟来源永远不能被标强或引为决策依据——这是接口层门』。依据等级:phase-01 已 confirmed 契约(I-28)。has_ui:false。估点 2。

## 设计参照

(无 UI 或沿用现有界面)

## 前置依赖

- `F01` — 已就绪

## 元数据

| phase | sprint | 能力平面 | 优先级 | wave | area |
|---|---|---|---|---|---|
| 11 | 02 | CAP-API | P2 | - | itv |

## 开工流程(agent 必读)

> 本 issue 是仓库的**只读投影**;权威是 [`phases/phase-11-research-insight-backend/feature_list.json`](https://github.com/boardx/workspacex/blob/main/phases/phase-11-research-insight-backend/feature_list.json)。若两者不一致,以仓库为准。

1. 环境:`./init.sh`(验证失败先修基础状态,别在坏地基上开工)。
2. 认领:`pnpm harness claim --phase 11 --feature F03 --owner <你的-agent-id>`(同一 owner 同时最多一个 in_progress)。
3. 读上下文:[`requirements/`](https://github.com/boardx/workspacex/blob/main/phases/phase-11-research-insight-backend/requirements)(原始需求)、[`contracts/`](https://github.com/boardx/workspacex/blob/main/phases/phase-11-research-insight-backend/contracts)(本 feature 所属契约束:`ui.md` 给组件落点与 data-testid,`usecases.md` 给失败模式,`design-signoff.md` 给签核状态)、[`sprints/sprint-02/session-handoff.md`](https://github.com/boardx/workspacex/blob/main/phases/phase-11-research-insight-backend/sprints/sprint-02/session-handoff.md)(上一轮交接)。
4. 实现:只做本 feature 的最小实现,不顺手重构无关区域;不碰 `active-features.json`(脚本派生只读)。
5. 验证:逐条跑上方 verification,输出留到 `phases/phase-11-research-insight-backend/sprints/sprint-02/evidence/F03.verify.log`;然后 `pnpm harness verify --sprint 11/02 --feature F03` 门控转 passing——**不允许手改 status**。
6. 提交:分支 `worker/-11-f03-`,PR 关联本 issue(`Closes #<本 issue 号>`),收尾更新 progress.md 与 session-handoff.md。

完整硬约束见 [`AGENTS.md`](https://github.com/boardx/workspacex/blob/main/AGENTS.md);多 agent 协作规则见 [`.harness/instructions/multi-agent-coordination.md`](https://github.com/boardx/workspacex/blob/main/.harness/instructions/multi-agent-coordination.md)。

Contributor guide

No contributing guide indexed for this repository

Research direction

Start with requirements/01-insight-library-backend.md section R7 and apps/api/src/domain/interview/insight-source-gate.ts, then locate the controllers for markStrongInsight and referenceForDecision. Run pnpm --filter api exec vitest run tests/itv/virtual-source-interface-gate.test.ts; done means both API paths reject virtual and mixed sources while allowing human sources, with evidence written to the specified log.

Written by the indexing model from the issue text.

Assessment

Tech stack
typescript
Domain
api, backend
Issue type
Feature
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Active
Clarity
Clearly specified
Newbie friendliness
78/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.