feat(tasks): add scope lifecycle task commands for vBRIEF model (#324)#339
Conversation
Greptile SummaryThis PR implements 7 deterministic vBRIEF scope lifecycle transition commands ( Confidence Score: 5/5Safe to merge — all three prior P0/P1 findings are resolved; only a minor test-docstring gap remains. The wrong-label bug, the Windows Path.rename incompatibility, and the premature timestamp write are all fixed correctly in the current HEAD. The remaining finding is a P2 test-quality nit (missing assertion to back a docstring claim) that does not affect runtime correctness. tests/cli/test_scope_lifecycle.py — minor assertion gap in test_cancel_already_cancelled_is_noop. Important Files Changed
Flowchart%%{init: {'theme': 'neutral'}}%%
flowchart TD
PROPOSED["proposed/\nstatus: proposed"]
PENDING["pending/\nstatus: pending"]
ACTIVE_R["active/\nstatus: running"]
ACTIVE_B["active/\nstatus: blocked"]
COMPLETED["completed/\nstatus: completed"]
CANCELLED["cancelled/\nstatus: cancelled"]
PROPOSED -->|"scope:promote"| PENDING
PENDING -->|"scope:activate"| ACTIVE_R
ACTIVE_R -->|"scope:block"| ACTIVE_B
ACTIVE_B -->|"scope:unblock"| ACTIVE_R
ACTIVE_R -->|"scope:complete"| COMPLETED
ACTIVE_B -->|"scope:complete"| COMPLETED
PROPOSED -->|"scope:cancel"| CANCELLED
PENDING -->|"scope:cancel"| CANCELLED
ACTIVE_R -->|"scope:cancel"| CANCELLED
ACTIVE_B -->|"scope:cancel"| CANCELLED
COMPLETED -->|"scope:cancel"| CANCELLED
CANCELLED -->|"scope:restore"| PROPOSED
Prompt To Fix All With AIThis is a comment left during a code review.
Path: tests/cli/test_scope_lifecycle.py
Line: 179-185
Comment:
**Docstring claims "no timestamp mutation" but assertion is absent**
The docstring says `no timestamp mutation`, yet the test only checks `ok`, the `"No-op"` prefix, and file existence. It never reads the file back to confirm `"updated"` was not added. Since `make_vbrief` omits the `updated` field, a single extra assert would close this gap:
```suggestion
def test_cancel_already_cancelled_is_noop(self, tmp_path):
"""Cancel from cancelled/ is idempotent — no-op, no timestamp mutation."""
f = make_vbrief(tmp_path, "cancelled", "cancelled")
ok, msg = run_transition("cancel", f)
assert ok
assert "No-op" in msg
assert f.exists()
assert "updated" not in read_vbrief(f)["plan"]
```
How can I resolve this? If you propose a fix, please make it concise.Reviews (3): Last reviewed commit: "fix: address Greptile review findings (b..." | Re-trigger Greptile |
- Create scripts/scope_lifecycle.py with 7 deterministic lifecycle transitions (promote, activate, complete, cancel, restore, block, unblock) - Each command validates legal transitions, updates plan.status and plan.updated, moves file to target lifecycle folder (or stays in place for block/unblock) - Invalid transitions rejected with descriptive error messages - Block/unblock are idempotent (no-op if already in target state) - Target folders created automatically if missing - Create tasks/scope.yml with all 7 task definitions - Add scope include to Taskfile.yml - Create tests/cli/test_scope_lifecycle.py with 38 tests covering all transitions, invalid transitions, idempotent behavior, validation edge cases, full lifecycle round-trips, and CLI subprocess integration - Add CHANGELOG.md entry under [Unreleased] Part of #309. Closes #324. Tracking: #338.
- Fix E501 line-too-long in scope_lifecycle.py error message formatting - Fix UP017 use datetime.UTC alias instead of timezone.utc - Fix RET505 remove unnecessary else after return in main() - Remove unused os import from test_scope_lifecycle.py - Remove unused TRANSITIONS import from test_scope_lifecycle.py - Fix I001 import sorting in test_scope_lifecycle.py
- P1: cancel-from-cancelled now returns No-op instead of wrong 'Unblocked' label; added idempotency early-return for same-folder moves before file write - P2: Timestamp no longer mutated for idempotent same-folder transitions - P2: Use Path.replace() instead of Path.rename() for Windows portability (Path.rename raises FileExistsError on Windows if destination exists) - Updated test_cancel_already_cancelled to assert on No-op message
afc2324 to
0c1b76b
Compare
Summary
Add deterministic task commands for all vBRIEF scope lifecycle transitions per RFC #309 decision D16.
Changes
Transition Matrix
Testing
task checkpasses (1055 tests, 0 failures)Checklist
task checkpassesPart of #309. Closes #324. Tracking: #338.