Fix workflow: pass_auditβpending_approval, fail_auditβtodo
Description
Recent Comments
## Orchestrator Guidance for Worker The reviewer noted that the implementation is missing this acceptance criterion: > "Failing audit requires a comment explaining why" **Required fix:** Add validation to `app/models/ticket.rb` in the `fail_audit` event to ensure a comment exists before allowing transition. See the reviewer's code review comment for suggested implementation.
## Pre-Review Feedback **Note**: Ticket is in `todo` status but PR #12 exists. Please submit via proper workflow: `start_work` β `submit_review` β `pending_audit` ### Code Review (PR #12): **β Core fixes implemented correctly:** - `pass_audit`: `review` β `pending_approval` - `fail_audit`: `in_progress` β `todo` - Tests updated (37/37 passing) **β Missing acceptance criterion:** > "Failing audit requires a comment explaining why" **Suggested implementation** (add to `ticket.rb`): ```ruby event :fail_audit do transitions from: :pending_audit, to: :todo before do if comments.reviewer_feedback.none? errors.add(:base, "A comment explaining the rejection is required") throw :abort end end after do log_transition("fail_audit") end end ``` **Optional**: If you don't want the comment requirement enforced, update the acceptance criteria to remove it.
## Implementation Plan for Worker **Objective:** Fix two workflow transition bugs in the ticket state machine. ### Changes Required: 1. **Fix `pass_audit` transition:** - Change destination from `review` β `pending_approval` - Location: Ticket model (AASM state machine) 2. **Fix `fail_audit` transition:** - Change destination from `in_progress` β `todo` - Location: Ticket model (AASM state machine) 3. **Optional cleanup:** - Consider removing/aliasing the `review` status if it's no longer needed - Update any references to `review` status ### Files to Modify: - `app/models/ticket.rb` (primary - AASM configuration) - Check: `app/controllers/api/v1/tickets_controller.rb` (transition actions) - Check: Any tests referencing these transitions ### Validation: - After changes, verify both transitions work correctly - Test that tickets move to correct states - Ensure comments are preserved on fail_audit ### Reference: See ticket #45 which recently added the `todo` status and `plan` action.
Ticket Stats
Comments
3 commentsAdd a Comment
No Subtasks Yet
Break down this ticket into smaller, manageable subtasks