@seanyao/roll 4.708.2 → 4.710.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/docs/INDEX.md CHANGED
@@ -6,6 +6,7 @@
6
6
 
7
7
  | Path | Title | Category | Description |
8
8
  |------|-------|----------|-------------|
9
+ | `docs/acceptance-contract.md` | 验收契约权属 / Acceptance Contract Ownership | process | 契约是设计层拥有的冻结产物(cycle 起始快照+漂移检测)、证据分类(web/cmd/roll-capture/named-tests)、能力天花板(存在性/绑定/权属 vs evaluator 判内容) |
9
10
  | `docs/architecture.md` | 系统设计 / System Architecture | architecture | 产品定位、设计原则、系统架构、领域模型、行为合同、事实来源 (US-TRUTH)、结构化交付真相、唯一查询入口、存储裁定、消费者契约 |
10
11
  | `docs/difftest-freeze-paradigm.md` | 快照冻结测试范式 | testing | CLI 命令输出用 Vitest 快照冻结的行为契约测试范式与可移植性陷阱 |
11
12
  | `docs/live-console.md` | 实时控制台指南 / Live Console Guide | guide | CLI-first 实时可观测指南:`roll loop cycle watch` 用法、三流契约、静态导出 vs 实时服务、证据按构造 |
@@ -15,8 +16,8 @@
15
16
 
16
17
  ## Coverage Summary
17
18
 
18
- - Total docs indexed: 6
19
- - By category: architecture (1) / guide (1) / migration (1) / testing (1) / product (1) / process (1)
19
+ - Total docs indexed: 7
20
+ - By category: architecture (1) / guide (1) / migration (1) / testing (1) / product (1) / process (2)
20
21
 
21
22
  ## Key Architecture Chapters (US-TRUTH epic)
22
23
 
@@ -0,0 +1,105 @@
1
+ # 验收契约权属 / Acceptance Contract Ownership
2
+
3
+ > Category: process. The design-owned acceptance contract, the evidence taxonomy,
4
+ > and the honest ceiling of what the harness can guarantee. Companion to
5
+ > `docs/verification.md` (which specifies per-story AC + evidence shape).
6
+
7
+ ## 1. 契约是设计层拥有的冻结产物 / The contract is a design-owned, frozen artifact
8
+
9
+ A story's **acceptance contract** is the set of things its delivery is judged
10
+ against: its **AC criteria** and its **evidence surface** (`deliverable_url` /
11
+ `deliverable_cmd` / physical screenshot / `screenshot_exempt`). Ownership is
12
+ strict and one-directional:
13
+
14
+ - **Designer owns it.** The contract is authored with the story and does not
15
+ change during a build.
16
+ - **Builder only satisfies it.** The builder produces code + evidence to meet
17
+ the contract; it never authors or edits the contract.
18
+ - **Evaluator only reads and judges it.** Attest reads the contract and decides
19
+ Done; it never lets the builder's own edits redefine the bar.
20
+
21
+ **Enforced by topology, not per-agent tool permissions.** Roll runs a
22
+ heterogeneous agent fleet; there is no uniform per-agent write-lock. Instead the
23
+ contract is **frozen at cycle start** into a snapshot (a projection of the
24
+ evidence-surface frontmatter + the set of AC criteria texts, hashed), taken from
25
+ **design truth** — not the builder-writable worktree copy. The attest gate
26
+ judges against that frozen snapshot; a worktree spec whose contract projection
27
+ no longer matches the snapshot is **drift** and is surfaced as an alert. The
28
+ projection deliberately EXCLUDES completion claims (checkbox state, the `✅`
29
+ tick, the `**Status**` line, Delivery/narrative sections) so the ordinary
30
+ stale-claim reset is never mistaken for tampering.
31
+
32
+ **Ingest is shift-left and soft.** A story with an AC block must declare a
33
+ capture surface OR a `screenshot_exempt` reason. A card that declares neither is
34
+ recorded to a hold list and alerted at authoring time — never a hard block of
35
+ ingestion, and runtime `pick_story` is never blocked (a false positive must not
36
+ stall the loop).
37
+
38
+ **Exemptions are design-time and audited.** `screenshot_exempt` is part of the
39
+ frozen contract (a builder cannot introduce one that counts). "Exempt from
40
+ screenshot" is not "exempt from evidence": an exempt card still owes another
41
+ capturable evidence form (command output or named tests). The existing
42
+ exemption rate is an observability smell signal (surfaced overall + per epic);
43
+ legacy per-card exemptions and any policy epic-level blanket exempt
44
+ (`acceptance.screenshot_exempt_epics`) are auditable read-only for batch review,
45
+ forward-enforced and never retroactively blocked.
46
+
47
+ ## 2. 证据分类 / Evidence taxonomy
48
+
49
+ Every AC-bearing story binds **at least one real, gate-resolvable capturable
50
+ evidence**. There is no "give nothing" path. Screenshot is one kind, not the
51
+ only kind:
52
+
53
+ | Surface | Capture | Bound by |
54
+ |---|---|---|
55
+ | Web page (`deliverable_url`) | headless screenshot | harness |
56
+ | CLI/terminal (`deliverable_cmd`, read-only roll command) | captured terminal output | harness |
57
+ | Physical desktop / real terminal | **roll-capture** (real screen pixels) | harness |
58
+ | Library / pure backend | named test-pass references | builder (non-captured) |
59
+
60
+ For **captured** artifacts (the first three), the harness — which knows what it
61
+ captured — is the intended owner of the ac-map binding, so the builder does not
62
+ type or confirm those paths; the builder's ac-map covers only **non-captured**
63
+ evidence (named tests, manual verification notes). "No screenshot" therefore
64
+ still requires a declared `deliverable_cmd` or named tests — not silence.
65
+
66
+ ## 3. 能力天花板 / What this guarantees — and what it does not
67
+
68
+ These mechanisms guarantee, structurally:
69
+
70
+ - the contract cannot be silently tampered by the builder (frozen snapshot +
71
+ drift detection);
72
+ - an AC-bearing card cannot enter the backlog with no declared way to produce
73
+ evidence (shift-left ingest);
74
+ - captured evidence is bound to real on-disk artifacts, not invented paths.
75
+
76
+ They do **not** guarantee that the evidence CONTENT actually proves the AC. A
77
+ `deliverable_cmd: echo ok` or a vacuous test resolves as "evidence present" yet
78
+ demonstrates nothing. **Judging whether the evidence genuinely satisfies the
79
+ criterion is the Evaluator's semantic job** — read the content, score it — and
80
+ is out of scope for the existence/binding/ownership guarantees above. The
81
+ harness makes tampering hard and evidence necessarily present and correctly
82
+ bound; it does not replace the reviewer reading the proof.
83
+
84
+ ## 4. 现状 / Implementation status (honest, not target-washed)
85
+
86
+ This model is delivered incrementally; the doc describes the intended contract,
87
+ and this section states what is LIVE vs DESIGNED so nothing above is read as
88
+ more-enforced than it is.
89
+
90
+ - **Live** (US-EVID-020/021/022): the contract PROJECTION + cycle-start frozen
91
+ snapshot (`contract-projection.ts`, `contract-snapshot.ts`); the attest gate's
92
+ worktree-vs-snapshot **drift alert** (`attest-gate.ts`, alert-only); the
93
+ **shift-left ingest** surface check + hold list (`ingest-gate.ts`), phased and
94
+ **default observe-only** (`metric`) — `alert`/`block` are opt-in via policy.
95
+ - **Function delivered, surfacing pending** (US-EVID-026/027): the exemption-rate
96
+ computation (`exemption-stats.ts`) and read-only audit (`exemption-audit.ts`)
97
+ are implemented and unit-tested, but not yet wired into a board/`roll status`
98
+ line or a CLI command — they have no production caller yet.
99
+ - **Designed / in progress**: harness-owned binding of captured artifacts into
100
+ the ac-map (US-EVID-023 — the read primitive exists; the draft-generator
101
+ wiring + capture-failure surfacing are not yet wired); the confirmed-ac-map
102
+ dangling-evidence remediation trigger (US-EVID-024); design-time hetero-
103
+ consensus confirmation of exemptions + the enforced substitute-evidence
104
+ requirement (US-EVID-025). Until those land, "no give-nothing path" and
105
+ "harness owns the binding" are the DESIGN intent, not a runtime guarantee.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@seanyao/roll",
3
- "version": "4.708.2",
3
+ "version": "4.710.2",
4
4
  "description": "Roll — Roll out features with AI agents",
5
5
  "packageManager": "pnpm@11.1.3",
6
6
  "scripts": {
@@ -975,6 +975,62 @@ or the cap), not in it. A RESIZE is never emitted for a pure quality problem.
975
975
 
976
976
  ---
977
977
 
978
+ ## Construction-time independence & shift-left evidence (US-SKILL-031/032/033)
979
+
980
+ The Review Score (FIX-343) and Phase 6 Agent 4 add independence *downstream* of a
981
+ single builder that wrote BOTH the tests and the implementation. These three
982
+ gates add independence and evidence freshness *during* construction. They were
983
+ distilled from the US-EVID-026 delivery retro.
984
+
985
+ ### US-SKILL-031 — Adversarial pairing mode (verified / designed profiles)
986
+
987
+ Under the `verified` and `designed` execution profiles, the **test author and the
988
+ implementer are DIFFERENT, heterogeneous agents** — the agent that makes a test
989
+ pass is never the one that wrote it, so tests and implementation cannot be
990
+ co-shaped to be mutually flattering. The loop is:
991
+
992
+ 1. Test author writes a RED test for the next micro-step.
993
+ 2. Implementer (a different agent) writes ONLY production code to turn it green;
994
+ it must not edit the test.
995
+ 3. **Attack round** — once green, the test author writes ≥1 *breaking* test
996
+ targeting an untested failure mode; the implementer fixes; repeat until the
997
+ attacker is dry (N consecutive rounds surface no new hole).
998
+ 4. The attacker's breaking tests are added to the Phase 6 **Agent 4** test-audit
999
+ input, so "these failure modes are now pinned" is auditable.
1000
+
1001
+ Cost: this approximately 2–3× the agent calls, so it is **bound to `verified` /
1002
+ `designed`** (high-stakes cards). `standard` keeps the single-builder + downstream
1003
+ audit unchanged. The profile choice is recorded (which was picked, and why).
1004
+ Independence is by session/context, not vendor (same FIX-343 red line): the
1005
+ test-author session must not be the implementer's session or a sub-agent of it.
1006
+
1007
+ ### US-SKILL-032 — Independent heterogeneous code review
1008
+
1009
+ Phase 6's code review is performed by a **randomly-picked independent
1010
+ heterogeneous agent** (e.g. pi / kimi), NOT a sub-agent of the builder's session,
1011
+ and it emits a **structured verdict** — PASS/FAIL per AC plus a blocking-issue
1012
+ list — recorded with `reviewedBy` + session id so independence is verifiable (the
1013
+ same `scoredBy` contract as the Review Score). Independence is by session/context,
1014
+ not vendor. If no heterogeneous agent is available, fall back to `$roll-.review
1015
+ staged`, but **record the independence degradation explicitly** — never silently
1016
+ present a self-review as independent. This never becomes a hard block; its output
1017
+ feeds the existing fix-and-recheck loop.
1018
+
1019
+ ### US-SKILL-033 — Shift-left per-AC evidence
1020
+
1021
+ Each AC's evidence is captured **at the moment that AC's TCR turns green** — fresh
1022
+ and bound to the micro-step — not batched at Phase 11. Phase 11 therefore
1023
+ DOWNGRADES from "collect evidence" to "**summarize already-captured evidence +
1024
+ generate the ac-map + render the report**"; an AC that reaches Phase 11 with no
1025
+ captured evidence is a **red flag** (its TCR never captured), not an invitation to
1026
+ now-collect. This is fully consistent with FIX-329 ("attest is earned during
1027
+ delivery, never backfilled") — it only moves the earning point earlier, from
1028
+ Phase 11 to the per-AC micro-step. Captured-artifact binding stays harness-owned
1029
+ (US-EVID-023); this governs the *timing* of non-captured evidence (command output,
1030
+ named tests).
1031
+
1032
+ ---
1033
+
978
1034
  ## TCR Recovery Patterns
979
1035
 
980
1036
  ### Pattern 1: Red After Multiple Attempts