Skip to content

Add human-owned acceptance tests - #24

Merged
adityaramkumar merged 1 commit into
mainfrom
claude/acceptance-tests
Oct 22, 2026
Merged

adityaramkumar merged 1 commit into
mainfrom
claude/acceptance-tests

Conversation

@adityaramkumar

Copy link
Copy Markdown
Owner

Summary

The same model writes the code and the generated tests, so passing them only shows the model agrees with itself. The example audit (docs/example-audit.md) found many failures came from details the spec left open. Acceptance tests let the spec's author pin those details down.

acceptance:
  - tests/acceptance/test_login.py
  • Contract. Every prompt includes the acceptance test contents under "Acceptance tests for this spec".
  • Write-protected. Agents can never change these files. No new mechanism was needed: they live outside output_dir (path-escape check) or are untracked existing files (ownership check). A test covers this.
  • Gate. They run after the generated tests as acceptance_command (new; defaults to test_command) with their paths appended. A failure goes to repair labelled "Hand-written acceptance tests failed (fix the code)". The repair and test skills explain how to treat them.
  • Staleness. Their file contents are part of the node fingerprint, so editing one shows "tests/acceptance/test_login.py changed" in status.
  • Safety. build refuses when a listed file is missing or no test command is configured. validate reports missing files.

Writing acceptance tests before building makes specdiff build test-driven.

Testing

  • pytest tests/: 206 passed. New tests cover the parser, fingerprinting, the runner (a real pytest run where a failing acceptance test drives repair until it passes, write protection, and missing-file refusal), and validate.
  • ruff check / ruff format --check: clean

Generated by Claude Code

Generated tests come from the same model as the code, so passing them
only shows the model agrees with itself. A spec can now list hand-written
test files under `acceptance:`; they are the contract.

- Agents see them in every prompt and can never write them (they sit
  outside output_dir or are untracked files, both already off limits).
- They run after the generated tests as acceptance_command (default
  test_command) with their paths appended; a failure goes to repair with
  the instruction to fix the code.
- Their contents are part of the node fingerprint, so editing one marks
  the spec stale.
- build refuses when a listed file is missing; validate reports it.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01FAykpfqqWA2GFjcC1p6FRy
@adityaramkumar
adityaramkumar merged commit 9adef43 into main Oct 22, 2026
2 checks passed
@adityaramkumar
adityaramkumar deleted the claude/acceptance-tests branch October 22, 2026 02:08
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.

2 participants