Add attribution test writing guidelines to AGENTS.md#1033
Conversation
|
Warning This pull request is not mergeable via GitHub because a downstack PR is open. Once all requirements are satisfied, merge this PR as a stack on Graphite.
This stack of pull requests is managed by Graphite. Learn more about stacking. |
ed02bb9 to
9e18ac5
Compare
45f5332 to
dda561b
Compare
9e18ac5 to
98654e8
Compare
dda561b to
644932e
Compare
98654e8 to
68438da
Compare
644932e to
bd1f665
Compare
68438da to
99815bc
Compare
99815bc to
b1dbda4
Compare
bd1f665 to
570a9a0
Compare
b1dbda4 to
c51217f
Compare
570a9a0 to
51f3b40
Compare
c51217f to
a0ba1b3
Compare
9d2b7d0 to
f5e6530
Compare
6a82d28 to
b99641f
Compare
7d62af7 to
fd7b5db
Compare
b99641f to
3d146e5
Compare
| file.assert_lines_and_blame(lines![ | ||
| "fn main() {".human(), | ||
| " // human code".human(), | ||
| " println!(\"AI\");".ai(), | ||
| "}".human(), | ||
| ]); |
There was a problem hiding this comment.
🟡 Documentation example uses .human() assertions for lines captured by an untracked (checkpoint --) checkpoint
The new code example at lines 270-285 uses checkpoint -- code.rs (which creates a legacy/untracked CheckpointKind::Human checkpoint per src/commands/git_ai_handlers.rs:1155) but then asserts .human() (known human) attribution for those lines. According to the conventions established earlier in this same file (AGENTS.md:52), checkpoint -- corresponds to untracked/unattributed changes, while .human() represents known-human attribution (which requires checkpoint mock_known_human). The correct assertions should use .unattributed_human() instead of .human(), or the checkpoint call should be changed to mock_known_human. The existing example at AGENTS.md:108-197 correctly uses checkpoint mock_known_human → .human() and checkpoint human → .unattributed_human(). This won't cause test failures since assert_lines_and_blame at tests/integration/repos/test_file.rs:316 treats Human and UnattributedHuman identically, but it will mislead agents/developers into writing tests with incorrect semantic expectations.
Prompt for agents
The documentation example at AGENTS.md lines 266-286 has an inconsistency between the checkpoint type used and the attribution assertions. The example uses `checkpoint -- code.rs` (which creates a legacy/untracked Human checkpoint) but then asserts `.human()` for those lines. There are two valid fixes:
1. Change the checkpoint in step 1 (line 271) from `checkpoint -- code.rs` to `checkpoint mock_known_human -- code.rs` so that lines are truly attributed as known human, matching the `.human()` assertions.
2. Alternatively, keep the `checkpoint --` call but change the assertions at lines 281-284 from `.human()` to `.unattributed_human()` for the non-AI lines.
Option 1 is preferable because the section title says "Write human content" and the intent is clearly to show known-human attribution. This would also be consistent with the existing example at AGENTS.md lines 108-197 which correctly uses `mock_known_human` for human-attributed content.
Was this helpful? React with 👍 or 👎 to provide feedback.
3d146e5 to
dda323b
Compare
fd7b5db to
9822853
Compare
Document patterns and conventions for writing integration tests that exercise the attribution system, including test harness setup, daemon interaction, and assertion helpers. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
9822853 to
f971342
Compare
dda323b to
f7384f2
Compare
|
Sorry I'm so late to reviewing this. I ended up writing up a lot re tests in agentsmd that's on main already |

Document patterns and conventions for writing integration tests
that exercise the attribution system, including test harness setup,
daemon interaction, and assertion helpers.
Co-Authored-By: Claude Opus 4.6 noreply@anthropic.com