boardx / boardx/workspacex

fix(harness): verify --sprint 会覆写他人 feature 的 evidence(含失败输出)—— 默认只写本 owner,写别人需 --all

Open
#1,025 1 comment 0 reactions 0 assignees View on GitHub
backlog
Dominant language
TypeScript
Stars
0
Forks
0
Avg merge
1h 7m
Merged PRs (30d)
969

Description

## 现象

`pnpm harness verify --sprint <阶段>/` 会给它处理的**每一个** feature 落 evidence 日志——**包括不属于当前 owner 的 feature**,**且失败的运行也照写**。

`.harness/scripts/verify.ts:135-138`:

```ts
// 3) 证据落盘到 sprint evidence
if (sprintId) {
const ev = join(sprintDir(phaseId, sprintId), "evidence", `${f.id}.verify.log`);
writeFileSync(ev, appendFingerprint(logs.join("\n\n")), "utf8");
}
```

这段在 `if (ok)` **之外**——即验证失败时同样覆写。

## 实际发生了什么(2026-08-12,dev-project)

我为收口 **F158**(我自己的 feature)跑了多次 `harness verify --sprint 01/02`。sprint-02 里同时存在别人的 in_progress feature:

- **F34** owner=`w2-files2`
- **F50** owner=`w2-model`

每一次运行都把 `F34.verify.log` 与 `F50.verify.log` **覆写成了我这次运行的失败输出**。`git status` 每次都能看到:

```
M phases/phase-01-run-a-project/sprints/sprint-02/evidence/F34.verify.log
M phases/phase-01-run-a-project/sprints/sprint-02/evidence/F50.verify.log
```

我每次都 `git checkout --` 还原了,**没有带进任何 commit**。但这靠的是我碰巧在 `git merge --ff-only` 被挡时注意到了——**它没有任何机械防护**。

## 为什么这是地雷

1. **证据是审计链的根**。ADR-012 与完成定义第 3 条把 evidence 当作 passing 的凭据;一个 agent 的失败运行覆写另一个 agent 的证据,等于污染别人的审计材料。
2. **静默**。verify 不会提示「你刚改了 2 个不属于你的文件」。
3. **容易被顺手提交**。如果我当时执行的是 `git add -A && git commit`,这两个文件就跟着进 PR 了,而 PR 标题写的是「F158 收口」——review 很难注意到里面夹带了别人 feature 的证据回退。
4. **多 owner 共存是常态**,不是例外:本 sprint 同时有 4 个 owner(w2-files2 / w2-model / dev-project / dev-org-admin)。

## 建议修法(coord-main 2026-08-12 批)

`verify --sprint` **默认只写**「`--feature` 指定的」或「本 owner 名下的」feature 的 evidence;要写别人的需**显式 `--all`**。

补充建议(供 harness 线取舍):

- 跳过别人的 feature 时**打一行日志**说明「已跳过 N 个非本 owner 的 feature(如需全量用 `--all`)」——静默跳过会造成新的「以为验过了」的错觉;
- 若保留 `--all`,在写入前对**非本 owner 且失败**的写入额外告警。

## 不建议的做法

不要简单改成「失败就不落盘」——`verify.ts:107-116` 的 backfill 模式明确要求失败也如实记录(「若重跑发现命令实际失败,如实记录,绝不悄悄抹平」)。**问题不在于「失败也写」,而在于「写了不属于自己的 feature」。**

## 复现

在一个含多个 owner 的 sprint 上,以其中一个 owner 的身份跑:

```bash
pnpm harness verify --sprint 01/02
git status --porcelain # 会看到别人 feature 的 evidence 被改
```

---

发现来源:dev-project 收口 F158 期间(连续多轮),见 #1010。

/cc @coord-main

Contributor guide

No contributing guide indexed for this repository

Research direction

Start in .harness/scripts/verify.ts, especially the backfill logic around lines 107-116 and evidence writing at lines 135-138. Reproduce with pnpm harness verify --sprint 01/02 and inspect git status. Done means the default mode writes only the selected or current-owner features, --all permits other features, and failed runs still record evidence with a skip message for excluded features.

Written by the indexing model from the issue text.

Assessment

Tech stack
typescript
Domain
cli, tooling
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Quiet
Clarity
Mostly clear
Newbie friendliness
72/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.