Test Completion and Approval Workflow Rules
๐ฏ Core Principleโ
Different types of work require different approval processes to ensure quality while maintaining development velocity.
๐ Test Completion Statesโ
1. TESTS_PASSING - All automated tests passโ
- Status: Ready for next phase
- Rule: Can proceed to approval phase automatically
- Action: Move to appropriate approval queue
2. NEEDS_MANUAL_APPROVAL - Requires human reviewโ
- Status: Waiting for manual verification
- Rule: Cannot proceed until manually approved
- Location:
docs/kanban/tasks/needs-approval/
3. APPROVED - Manual approval completedโ
- Status: Ready for completion
- Rule: Can be moved to DONE
- Action: Complete the task/requirement
4. REJECTED - Failed approvalโ
- Status: Needs rework
- Rule: Move back to DOING with feedback
- Action: Address approval feedback
๐ Test Completion Decision Treeโ
Automatic Approval (No Manual Review)โ
Triggers:
- Simple bug fixes
- Documentation updates
- Configuration changes
- Refactoring with full test coverage
- Tasks marked with
auto-approve: true
Process:
Tests Pass โ Automated Checks โ DONE
Manual Approval Requiredโ
Triggers:
- Security-related changes
- API changes
- Database schema changes
- Production configuration
- New user-facing features
- Tasks marked with
requires-approval: true
Process:
Tests Pass โ NEEDS_MANUAL_APPROVAL โ Manual Review โ APPROVED/REJECTED
๐งช Test Evaluation Rulesโ
Unit Testsโ
- Requirement: Must pass for any code change
- Blocking: Cannot proceed without passing
- Coverage: Minimum 80% for new code
- Process: Automatic evaluation
Integration Testsโ
- Requirement: Must pass for API/service changes
- Blocking: Cannot proceed without passing
- Coverage: All integration points tested
- Process: Automatic evaluation
E2E Testsโ
- Requirement: Must pass for user-facing changes
- Blocking: Cannot proceed without passing
- Coverage: Critical user journeys
- Process: Automatic evaluation with manual verification
Manual Testsโ
- Requirement: Required for complex features
- Blocking: Cannot proceed without completion
- Coverage: Scenarios that can't be automated
- Process: Manual execution and approval
๐ Approval Categoriesโ
๐ข Auto-Approve Categoriesโ
- Documentation: README updates, code comments
- Styling: CSS changes, formatting
- Bug Fixes: Simple fixes with tests
- Dependencies: Minor version updates
- Configuration: Non-production config changes
# Task metadata example
auto-approve: true
approval-category: documentation
๐ก Standard Approval Categoriesโ
- Features: New functionality
- Refactoring: Code restructuring
- Performance: Optimization changes
- Testing: New test implementations
# Task metadata example
requires-approval: true
approval-category: feature
approval-type: standard
๐ด High-Risk Approval Categoriesโ
- Security: Authentication, authorization
- Data: Database changes, migrations
- Infrastructure: Deployment, scaling
- API: Breaking changes, new endpoints
# Task metadata example
requires-approval: true
approval-category: security
approval-type: high-risk
approval-reviewers: ['security-team', 'lead-dev']
๐ Approval Workflow Statesโ
State: NEEDS_MANUAL_APPROVALโ
Actions:
- Move task: From
DOINGtoneeds-approval/ - Add metadata: Approval type, reviewers, deadline
- Notify: Appropriate reviewers
- Document: What needs approval and why
File Structure:
docs/kanban/tasks/needs-approval/
โโโ [task-name]-feature.md
โโโ [task-name]-security.md
โโโ [task-name]-api-change.md
State: UNDER_REVIEWโ
Actions:
- Assign reviewer: Based on approval category
- Set deadline: Based on priority and complexity
- Track progress: Review status and feedback
- Escalate: If deadline approaches
State: APPROVEDโ
Actions:
- Document approval: Who approved, when, conditions
- Move to DONE: Complete the task
- Update records: Mark as completed
- Archive: Move to completed tasks
State: REJECTEDโ
Actions:
- Document feedback: Specific issues to address
- Move to DOING: Return to development
- Update requirements: If needed based on feedback
- Reassign: If necessary
๐จ Approval Escalation Rulesโ
Standard Escalation Timelineโ
- P0 (Critical): 4 hours โ Escalate to management
- P1 (High): 24 hours โ Escalate to senior team
- P2 (Medium): 3 days โ Escalate to team lead
- P3 (Low): 1 week โ Escalate to backlog review
- P4 (Future): 2 weeks โ Archive or defer
Escalation Actionsโ
- Notify: Next level of approval authority
- Document: Reason for escalation
- Update: Priority or requirements if needed
- Expedite: If blocking critical work
๐ง Automation Functionsโ
Check Approval Statusโ
# Function to check items needing approval
check_approval_queue() {
local needs_approval_count=$(find docs/kanban/tasks/needs-approval/ -name "*.md" | wc -l)
local overdue_count=$(find docs/kanban/tasks/needs-approval/ -name "*.md" -mtime +3 | wc -l)
echo "Items needing approval: $needs_approval_count"
echo "Overdue approvals: $overdue_count"
if [ $overdue_count -gt 0 ]; then
echo "โ ๏ธ Overdue approvals detected!"
find docs/kanban/tasks/needs-approval/ -name "*.md" -mtime +3 -exec basename {} \;
return 1
fi
if [ $needs_approval_count -gt 0 ]; then
echo "๐ Pending approvals:"
ls docs/kanban/tasks/needs-approval/
fi
}
Move to Approvalโ
# Function to move task to approval queue
move_to_approval() {
local task_file="$1"
local approval_type="$2"
# Validate inputs
if [ ! -f "$task_file" ]; then
echo "Error: Task file not found: $task_file"
return 1
fi
# Extract task name
local task_name=$(basename "$task_file" .md)
local approval_file="docs/kanban/tasks/needs-approval/${task_name}.md"
# Move file
mv "$task_file" "$approval_file"
# Add approval metadata
echo -e "\n## ๐ Approval Information" >> "$approval_file"
echo -e "- **Approval Type**: $approval_type" >> "$approval_file"
echo -e "- **Submitted**: $(date)" >> "$approval_file"
echo -e "- **Status**: NEEDS_MANUAL_APPROVAL" >> "$approval_file"
echo "โ
Task moved to approval queue: $approval_file"
}
Approve Taskโ
# Function to approve a task
approve_task() {
local task_file="$1"
local approver="$2"
local comments="$3"
# Add approval record
echo -e "\n## โ
Approval Record" >> "$task_file"
echo -e "- **Approved by**: $approver" >> "$task_file"
echo -e "- **Approved on**: $(date)" >> "$task_file"
echo -e "- **Comments**: $comments" >> "$task_file"
# Move to done
local done_file="docs/kanban/tasks/done/$(basename "$task_file")"
mv "$task_file" "$done_file"
echo "โ
Task approved and completed: $done_file"
}
๐ Integration with Task Creationโ
Task Metadata Templatesโ
# In task creation templates
---
requires-approval: false # Default for simple tasks
approval-category: none # documentation, feature, security, etc.
approval-type: none # standard, high-risk
auto-approve: false # Only for safe changes
---
Approval Decision Logicโ
# Function to determine if approval is needed
needs_approval() {
local task_file="$1"
local category=$(grep "approval-category:" "$task_file" | cut -d' ' -f2)
local auto_approve=$(grep "auto-approve:" "$task_file" | cut -d' ' -f2)
if [ "$auto_approve" = "true" ]; then
return 1 # No approval needed
fi
case "$category" in
"security"|"data"|"infrastructure"|"api")
return 0 # Approval required
;;
"documentation"|"styling"|"bug-fix")
return 1 # No approval needed
;;
*)
return 0 # Default to requiring approval
;;
esac
}
๐ฏ Best Practicesโ
Setting Approval Requirementsโ
- Be explicit: Clear approval categories in task metadata
- Default secure: Require approval unless explicitly auto-approved
- Document rationale: Why approval is/isn't needed
- Set deadlines: Appropriate review timeframes
Review Processโ
- Focused reviews: Review specific to approval category
- Documented feedback: Clear, actionable comments
- Timely response: Respect escalation timelines
- Constructive approach: Help improve rather than block
Automationโ
- Auto-approve safe changes: Documentation, simple fixes
- Escalate overdue: Prevent bottlenecks
- Track metrics: Approval times, rejection rates
- Continuous improvement: Refine approval criteria
Test completion and approval workflows ensure quality while maintaining development velocity through appropriate automation and manual oversight.