Skip to content

feat: add reopen trigger and guard role changes in manage_items#59

Merged
jpicklyk merged 3 commits intomainfrom
feat/reopen-trigger-role-guard
Mar 7, 2026
Merged

feat: add reopen trigger and guard role changes in manage_items#59
jpicklyk merged 3 commits intomainfrom
feat/reopen-trigger-role-guard

Conversation

@jpicklyk
Copy link
Owner

@jpicklyk jpicklyk commented Mar 7, 2026

Summary

  • Reopen trigger: advance_item(trigger="reopen") moves TERMINAL items back to QUEUE, clearing statusLabel and bypassing gate enforcement. Cascades parent from TERMINAL → WORK when a child reopens.
  • Role guard: manage_items(update) now rejects the role field with a clear error directing users to advance_item. This closes the last backdoor around the workflow engine.
  • Docs & tests: Updated api-reference.md, workflow-guide.md, and added unit + integration tests covering reopen lifecycle, cascade behavior, and role guard rejection.

Test plan

  • All 732 tests pass (./gradlew :current:test)
  • reopen from TERMINAL resolves to QUEUE
  • reopen from non-terminal returns error
  • reopen clears statusLabel (cancelled items)
  • Reopen cascade fires parent TERMINAL → WORK
  • manage_items(update, role=...) rejected with clear error
  • manage_items(create, role=...) still works (regression)
  • Full lifecycle integration: create → start → complete → reopen → start again

🤖 Generated with Claude Code

jpicklyk and others added 3 commits March 6, 2026 20:43
Close the last workflow bypass: manage_items(update) can no longer set
role directly — all role changes must go through advance_item triggers.

Add reopen trigger (TERMINAL → QUEUE) with cascade support: when a child
reopens under a terminal parent, the parent auto-cascades to WORK.

Changes:
- RoleTransitionHandler: add resolveReopen + validation bypass for
  backward TERMINAL→QUEUE transition
- CascadeDetector: add detectReopenCascades (immediate parent only)
- AdvanceItemTool: wire reopen cascade, update description/triggers
- ManageItemsTool: reject role field in update with clear error message
- GetNextStatusTool: terminal message now mentions reopen option
- Docs: api-reference.md and workflow-guide.md updated
- Tests: reopen lifecycle, cascade, role guard, integration tests

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
- Extract applyCascadeEvents() helper in AdvanceItemTool to deduplicate
  Phase 4b (start cascade) and Phase 4c (reopen cascade) blocks
- Remove dead newRole variable and redundant extractItemString call in
  ManageItemsTool role guard — use containsKey check instead

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Both test sections are additive: HEAD adds reopen trigger tests,
origin/main adds guidancePointer + noteProgress tests. Keep both.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@jpicklyk jpicklyk merged commit 0839e4f into main Mar 7, 2026
2 checks passed
@jpicklyk jpicklyk deleted the feat/reopen-trigger-role-guard branch March 7, 2026 20:58
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.

1 participant