fix(write-tests): use reference_branches for source repo; fix spec path

AR-27b filters clone pre_actions when agent-repo is active, so the source
repo was never cloned and the spec was unreachable. Use reference_branches
instead: the source repo is cloned read-only to /workspace/reference/main/
by agent-repo/v1/init.sh.

Both write_tests and review_coverage nodes now declare:
  reference_branches:
    - repo_url: "{{ repo_url }}"
      branch: main
      name: main

Prompts updated to read from /workspace/reference/main/{{ spec_file }}
and write output to /workspace/project/{{ test_output_dir }}.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
Paul O'Reilly
2026-04-30 15:21:30 +12:00
parent 21bdeb0c0e
commit e7225960ec

View File

@@ -48,12 +48,16 @@ params:
nodes: nodes:
write_tests: write_tests:
name: "Write tests from spec" name: "Write tests from spec"
reference_branches:
- repo_url: "{{ repo_url }}"
branch: main
name: main
prompt: | prompt: |
You are writing a test suite from a spec file. Tests are the contract — they will You are writing a test suite from a spec file. Tests are the contract — they will
be run against an agent's implementation. Write them now, before the implementation exists. be run against an agent's implementation. Write them now, before the implementation exists.
## Spec file ## Spec file
Read the spec at `{{ spec_file }}` in the cloned repo at `/workspace/project/`. Read the spec at `/workspace/reference/main/{{ spec_file }}`.
{% if task_description %} {% if task_description %}
## Additional context ## Additional context
@@ -65,7 +69,7 @@ nodes:
2. For each requirement, write at least one test function named `test_<req_id>_<short_description>`. 2. For each requirement, write at least one test function named `test_<req_id>_<short_description>`.
3. Cover edge cases explicitly — empty inputs, boundary values, error paths. 3. Cover edge cases explicitly — empty inputs, boundary values, error paths.
4. Add property-based tests (Hypothesis) where the requirement involves ranges or invariants. 4. Add property-based tests (Hypothesis) where the requirement involves ranges or invariants.
5. Write tests to `{{ test_output_dir }}` — one file per logical group (mirrors spec sections). 5. Write tests to `/workspace/project/{{ test_output_dir }}` — one file per logical group (mirrors spec sections).
6. Use `{{ test_framework }}` conventions. Tests should fail immediately (no implementation exists). 6. Use `{{ test_framework }}` conventions. Tests should fail immediately (no implementation exists).
7. Do NOT write any implementation code. Only test files. 7. Do NOT write any implementation code. Only test files.
@@ -82,11 +86,15 @@ nodes:
review_coverage: review_coverage:
name: "Review test coverage" name: "Review test coverage"
depends_on: [write_tests] depends_on: [write_tests]
reference_branches:
- repo_url: "{{ repo_url }}"
branch: main
name: main
prompt: | prompt: |
You are reviewing the coverage of a freshly written test suite against its spec. You are reviewing the coverage of a freshly written test suite against its spec.
## Spec file ## Spec file
Read the spec at `{{ spec_file }}` in the cloned repo at `/workspace/project/`. Read the spec at `/workspace/reference/main/{{ spec_file }}`.
## Test summary written by the previous agent ## Test summary written by the previous agent
<<ARTIFACT:write_tests:output>> <<ARTIFACT:write_tests:output>>