Skip to content

fix(test): give the dispatcher suite a project root that exists - #70216

Open
drussell23 wants to merge 1 commit into
mainfrom
fix/dispatcher-fixture-root
Open

fix(test): give the dispatcher suite a project root that exists#70216
drussell23 wants to merge 1 commit into
mainfrom
fix/dispatcher-fixture-root

Conversation

@drussell23

@drussell23 drussell23 commented Jul 28, 2026

Copy link
Copy Markdown
Owner

project_root was hardcoded to Path("/tmp/test-project-6b")a directory nothing creates. Every op failed GENERATE with target_file_missing: backend/core/utils.py and never reached the GATE / APPROVE / APPLY terminals these tests assert on.

It went unnoticed because the CancelToken fake (fixed in #70215) short-circuited each op to POSTMORTEM before GENERATE ran. One dead fake concealing another — repairing the first is what made this visible.

The fix

Materialised per-test from tmp_path, with the target file actually written:

  • Real parseable content, since VALIDATE runs an AST pass — an empty placeholder would only trade target_file_missing for a SyntaxError.
  • tmp_path rather than a fixed directory, because a shared /tmp path is order-dependent state between sessions, and this repo's node policy makes /tmp unwritable outright.
  • One constant instead of two literals that had to agree with a third value (the root) for the suite to work at all. A disagreement between them is not diagnosable by reading any one of them.

Status — still 9 red

test_artifact_generation_threads_classify_to_validate now passes and the failure set shifted, which is the signal that this was a real cause rather than a reshuffle.

The next one down is the same defect class again: test_gate_can_write_denied_terminal now reaches COMPLETE instead of CANCELLED, with dispatcher-off/on parity intact. Both paths agree, so the gate is not consulting stack.can_write at all — that fake is likely modelling a seam production no longer reads. canary_not_promoted is produced in governance/integration.py:480, which is where the next trace should start.

🤖 Generated with Claude Code


Summary by cubic

Fix dispatcher tests by using a real, per-test project root and target file instead of a hardcoded /tmp path. This lets ops pass GENERATE and reach the expected GATE/APPROVE/APPLY terminals.

  • Bug Fixes
    • Added an autouse fixture that sets _FIXTURE_ROOT to tmp_path and creates backend/core/utils.py with parseable content.
    • Replaced duplicated path literals with a _TARGET_REL constant and updated the generator, target_files, and config to use it.
    • Config now reads project_root from _FIXTURE_ROOT (not Path('/tmp/test-project-6b')), removing /tmp state and unwritable-node issues; failure set shifted and at least one test now passes.

Written for commit 5bea6cb. Summary will update on new commits.

Review in cubic

`project_root` was hardcoded to Path('/tmp/test-project-6b') — a directory
nothing creates. Every op failed GENERATE with `target_file_missing:
backend/core/utils.py` and never reached the GATE / APPROVE / APPLY terminals
these tests assert on.

It went unnoticed because the CancelToken fake (fixed in #70215) short-circuited
each op to POSTMORTEM before GENERATE ran. One dead fake concealing another;
repairing the first is what made this one visible.

Now materialised per-test from `tmp_path`, with the target file actually
written — real parseable content, since VALIDATE runs an AST pass and an empty
placeholder would only trade target_file_missing for a SyntaxError. `tmp_path`
rather than a fixed directory because a shared /tmp path is order-dependent
state between sessions, and this repo's node policy makes /tmp unwritable
outright.

The target path is now ONE constant instead of two literals that had to agree
with a third value (the root) for the suite to work at all — a disagreement
between them is not diagnosable by reading any one of them.

Progress: test_artifact_generation_threads_classify_to_validate now passes and
the failure SET shifted. Still 9 red. The next one down is a different defect
of the same class — test_gate_can_write_denied_terminal now reaches COMPLETE
rather than CANCELLED with dispatcher-off/on parity intact, i.e. the gate is
not consulting `stack.can_write` at all, so that fake is likely modelling a
seam production no longer reads.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>

[integrity-verified: ee2c4d48eddb]
@github-actions

Copy link
Copy Markdown

💡 PR Description Suggestions

Consider improving your PR description:
- Add a summary section
  • Add a testing section

    Template:

    ## Summary
    Brief description of changes
    
    ## Changes Made
    - Change 1
    - Change 2
    
    ## Test Plan
    How to verify these changes
    
    ## Related Issues
    Closes #123
    

@github-actions

Copy link
Copy Markdown

📊 PR Size Analysis

Size: XS
Files Changed: 1
Lines Added: +45
Lines Deleted: -3
Total Changes: 48

Review Checklist

  • All tests passing
  • Code follows project style guidelines
  • Documentation updated if needed
  • No sensitive data exposed
  • Breaking changes documented

@github-actions

Copy link
Copy Markdown

💡 PR Description Suggestions

Consider improving your PR description:
- Add a testing section

**Template:**
```
## Summary
Brief description of changes

## Changes Made
- Change 1
- Change 2

## Test Plan
How to verify these changes

## Related Issues
Closes #123
```

@github-actions

Copy link
Copy Markdown

🤖 CI/CD Pipeline Results

Status: success
Branch: 70216/merge
Commit: 7dd2c80f63c72a6cfdde93483131c088e4798291

Pipeline Stages

  • Code Quality: ❌
  • Build & Test: ❌
  • Architecture: ❌
  • Security Scan: ❌

View full workflow run

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant