Chapter 42 · Workflow Patterns
Subchapter 42.1
references/details.mdMarkdown12 KBView on GitHub
Follow these 11 steps for each task:
Read plan.md and identify the next pending [ ] task. Select tasks in order within the current phase. Do not skip ahead to later phases.
Update plan.md to mark the task as [~]:
- [~] **Task 2.1**: Implement user validationCommit this status change separately from implementation.
Write tests that define the expected behavior before writing implementation:
Example:
def test_validate_user_email_valid():
user = User(email="test@example.com")
assert user.validate_email() is True
def test_validate_user_email_invalid():
user = User(email="invalid")
assert user.validate_email() is FalseWrite the minimum code necessary to make tests pass:
With green tests, improve the code:
Check test coverage meets the 80% target:
pytest --cov=module --cov-report=term-missingIf coverage is below 80%:
If implementation deviated from plan or introduced new dependencies:
Create a focused commit for the task:
git add -A
git commit -m "feat(user): implement email validation
- Add validate_email method to User class
- Handle empty and malformed emails
- Add comprehensive test coverage
Task: 2.1
Track: user-auth_20250115"Commit message format:
Add rich task summary as git note:
git notes add -m "Task 2.1: Implement user validation
Summary:
- Added email validation using regex pattern
- Handles edge cases: empty, no @, no domain
- Coverage: 94% on validation module
Files changed:
- src/models/user.py (modified)
- tests/test_user.py (modified)
Decisions:
- Used simple regex over email-validator library
- Reason: No external dependency for basic validation"Update plan.md to mark task complete with commit SHA:
- [x] **Task 2.1**: Implement user validation `abc1234`Commit the plan status update:
git add conductor/tracks/*/plan.md
git commit -m "docs: update plan - task 2.1 complete
Track: user-auth_20250115"When all tasks in a phase are complete, execute the verification protocol:
List all files modified since the last checkpoint:
git diff --name-only <last-checkpoint-sha>..HEADFor each modified file:
Execute complete test suite:
pytest -v --tb=shortAll tests must pass before proceeding.
Create checklist of manual verifications:
## Phase 1 Verification Checklist
- [ ] User can register with valid email
- [ ] Invalid email shows appropriate error
- [ ] Database stores user correctly
- [ ] API returns expected response codesPresent verification checklist to user:
Phase 1 complete. Please verify:
1. [ ] Test suite passes (automated)
2. [ ] Coverage meets target (automated)
3. [ ] Manual verification items (requires human)
Respond with 'approved' to continue, or note issues.Do NOT proceed without explicit approval.
After approval, create checkpoint commit:
git add -A
git commit -m "checkpoint: phase 1 complete - user-auth_20250115
Verified:
- All tests passing
- Coverage: 87%
- Manual verification approved
Phase 1 tasks:
- [x] Task 1.1: Setup database schema
- [x] Task 1.2: Implement user model
- [x] Task 1.3: Add validation logic"Update plan.md checkpoints table:
## Checkpoints
| Phase | Checkpoint SHA | Date | Status |
| ------- | -------------- | ---------- | -------- |
| Phase 1 | def5678 | 2025-01-15 | verified |
| Phase 2 | | | pending |Before marking any task complete, verify these gates:
If applicable:
<type>(<scope>): <subject>
<body>
<footer>Types:
feat: New featurefix: Bug fixrefactor: Code change without feature/fixtest: Adding testsdocs: Documentationchore: MaintenanceAttach detailed notes to commits:
git notes add -m "<detailed summary>"View notes:
git log --show-notesBenefits:
Always record the commit SHA when completing tasks:
- [x] **Task 1.1**: Setup schema `abc1234`
- [x] **Task 1.2**: Add model `def5678`This enables:
Checkpoints create restore points for semantic reversion:
Create checkpoint after:
Include in checkpoint commit:
For reverting:
# Revert to end of Phase 1
git revert --no-commit <phase-2-commits>...
git commit -m "revert: rollback to phase 1 checkpoint"For review:
# See what changed in Phase 2
git diff <phase-1-sha>..<phase-2-sha>During implementation, deviations from the plan may occur. Handle them systematically:
Scope Addition Discovered requirement not in original spec.
Scope Reduction Feature deemed unnecessary during implementation.
[-] (skipped) with reasonTechnical Deviation Different implementation approach than planned.
Requirement Change Understanding of requirement changes during work.
When completing a task with deviation:
- [x] **Task 2.1**: Implement validation `abc1234`
- DEVIATION: Used library instead of custom code
- Reason: Better edge case handling
- Impact: Added email-validator to dependenciesIf tests fail after reaching GREEN:
If user rejects a checkpoint:
If task cannot proceed:
[!] with blocker descriptionRED: Write test for model creation and validation
GREEN: Implement model class with fields
REFACTOR: Add computed properties, improve typesRED: Write test for request/response contract
GREEN: Implement endpoint handler
REFACTOR: Extract validation, improve error handlingRED: Write test for component interaction
GREEN: Wire components together
REFACTOR: Improve error propagation, add loggingRED: Add characterization tests for current behavior
GREEN: Apply refactoring (tests should stay green)
REFACTOR: Clean up any introduced complexityWhen modifying code with existing tests:
When refactoring changes test structure:
After any change:
Run before requesting approval:
# Test suite
pytest -v --tb=short
# Coverage
pytest --cov=src --cov-report=term-missing
# Linting
ruff check src/ tests/
# Type checking (if applicable)
mypy src/For manual items, provide specific instructions:
## Manual Verification Steps
### User Registration
1. Navigate to /register
2. Enter valid email: test@example.com
3. Enter password meeting requirements
4. Click Submit
5. Verify success message appears
6. Verify user appears in database
### Error Handling
1. Enter invalid email: "notanemail"
2. Verify error message shows
3. Verify form retains other entered dataKeep test suite fast:
Keep commits atomic:
This file