fix(orchestrator): persist spec_path on spec-phase pass (ADR-004) #30

Merged
kaykayyali merged 1 commits from feat/S1-spec-path-persist into main 2026-06-27 16:38:25 +00:00
Owner

Summary

Fixes ADR-004: persist spec_path on spec-phase pass so build/review/dashboard can read it from the row instead of hitting disk every time.

Background

Today the spec-refiner writes the spec file to data_dir/specs/<project>/<story>.spec.md and returns the path in verdict feedback. But cycle.py:set_phase() never copies that path onto the work_items.spec_path column.

Build phase works only because _find_spec_file() happens to use the same slug convention by luck — fragile, undocumented, and would silently break if the slug convention ever changes.

Changes

  • src/damascus/cycle.py: 3-line branch in Txn 3 verdict-write block. When verdict == "pass" and phase == "spec", copy verdict_feedback["spec_path"] into extra_fields.
  • tests/test_spec_path_persistence.py: two new tests covering both ACs:
    • test_pass_verdict_persists_spec_path: on pass, row's spec_path matches the verdict feedback.
    • test_non_pass_verdict_does_not_persist: on non-pass (e.g. spec_ambiguous), row's spec_path is unchanged.

No schema migration. _find_spec_file fallback remains as defense in depth.

References

  • ADR: wiki/decisions/ADR-004-persist-spec-path-on-pass.md
  • Research: wiki/decisions/research/adr-004-spec-path-research.md
  • Story: /root/damascus-bugfixes-q4-2026-prds/_bmad-output/planning-artifacts/stories/S1-persist-spec-path-on-spec-pass.md

Test plan

  • pytest tests/test_spec_path_persistence.py -v exits 0
  • pytest tests/ -q exits 0 (no regressions)
  • Verify in live orchestrator: after a spec-phase pass, SELECT spec_path FROM work_items WHERE id = <row> returns the on-disk path

Out of scope

  • Not migrating specs into the project repo (rejected in ADR-004).
  • Not changing _find_spec_file semantics.
  • Not adding an index on spec_path.
  • One-shot backfill script (scripts/backfill_spec_paths.py) — separate PR if needed.
## Summary Fixes ADR-004: persist `spec_path` on spec-phase pass so build/review/dashboard can read it from the row instead of hitting disk every time. ## Background Today the spec-refiner writes the spec file to `data_dir/specs/<project>/<story>.spec.md` and returns the path in verdict feedback. But `cycle.py:set_phase()` never copies that path onto the `work_items.spec_path` column. Build phase works **only** because `_find_spec_file()` happens to use the same slug convention by luck — fragile, undocumented, and would silently break if the slug convention ever changes. ## Changes - **`src/damascus/cycle.py`**: 3-line branch in Txn 3 verdict-write block. When `verdict == "pass"` and `phase == "spec"`, copy `verdict_feedback["spec_path"]` into `extra_fields`. - **`tests/test_spec_path_persistence.py`**: two new tests covering both ACs: - `test_pass_verdict_persists_spec_path`: on pass, row's `spec_path` matches the verdict feedback. - `test_non_pass_verdict_does_not_persist`: on non-pass (e.g. `spec_ambiguous`), row's `spec_path` is unchanged. No schema migration. `_find_spec_file` fallback remains as defense in depth. ## References - **ADR**: `wiki/decisions/ADR-004-persist-spec-path-on-pass.md` - **Research**: `wiki/decisions/research/adr-004-spec-path-research.md` - **Story**: `/root/damascus-bugfixes-q4-2026-prds/_bmad-output/planning-artifacts/stories/S1-persist-spec-path-on-spec-pass.md` ## Test plan - `pytest tests/test_spec_path_persistence.py -v` exits 0 - `pytest tests/ -q` exits 0 (no regressions) - Verify in live orchestrator: after a spec-phase pass, `SELECT spec_path FROM work_items WHERE id = <row>` returns the on-disk path ## Out of scope - Not migrating specs into the project repo (rejected in ADR-004). - Not changing `_find_spec_file` semantics. - Not adding an index on `spec_path`. - One-shot backfill script (`scripts/backfill_spec_paths.py`) — separate PR if needed.
kaykayyali added 1 commit 2026-06-27 02:26:07 +00:00
fix(orchestrator): persist spec_path on spec-phase pass (ADR-004)
Some checks failed
test / contract-and-unit (pull_request) Failing after 15s
66afc2f7d2
Spec-refiner writes data_dir/specs/<project>/<story>.spec.md and returns
the path in verdict feedback, but cycle.py:set_phase() never copied it
onto the row. Build phase worked only because _find_spec_file fallback
used the same slug convention by luck.

- Add 3-line branch in cycle.py Txn 3: when verdict=pass and phase=spec,
  copy verdict_feedback["spec_path"] into extra_fields.
- Add tests/test_spec_path_persistence.py with two AC tests:
  test_pass_verdict_persists_spec_path, test_non_pass_verdict_does_not_persist.
- Defense-in-depth fallback (_find_spec_file) remains unchanged.

Refs: wiki/decisions/ADR-004-persist-spec-path-on-pass.md
Refs: wiki/decisions/research/adr-004-spec-path-research.md
Story: S1-persist-spec-path-on-spec-pass
kaykayyali merged commit 339faf47a0 into main 2026-06-27 16:38:25 +00:00
Sign in to join this conversation.
No Reviewers
No Label
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: kaykayyali/damascus-orchestrator#30