fix(capacity): stabilize PTO flows and calendar consistency
Make PTO creation immediately approved, add PTO deletion, and ensure cache invalidation updates individual/team/revenue capacity consistently. Harden holiday duplicate handling (422), support PTO-day availability overrides without disabling edits, and align tests plus OpenSpec artifacts with the new behavior.
This commit is contained in:
@@ -87,13 +87,23 @@ The system SHALL allow team members to request PTO which reduces their individua
|
||||
|
||||
#### Scenario: Submit PTO request
|
||||
- **WHEN** a team member submits PTO for February 10-12, 2026
|
||||
- **THEN** the system creates a PTO record with start date, end date, and status "pending"
|
||||
- **THEN** the system creates a PTO record with start date, end date, and status "approved"
|
||||
|
||||
#### Scenario: Approve PTO request
|
||||
- **WHEN** a manager approves a PTO request
|
||||
- **THEN** the system updates the PTO status to "approved"
|
||||
- **AND** the system automatically reduces the team member's capacity for those dates to 0
|
||||
|
||||
#### Scenario: Delete PTO request
|
||||
- **WHEN** a manager deletes an existing PTO request
|
||||
- **THEN** the PTO record is removed
|
||||
- **AND** individual, team, and revenue capacity caches for affected months are refreshed
|
||||
|
||||
#### Scenario: PTO affects capacity calculation
|
||||
- **WHEN** calculating capacity for a team member with approved PTO for 3 days
|
||||
- **THEN** the system excludes those 3 days from the capacity calculation
|
||||
|
||||
#### Scenario: Override PTO day availability
|
||||
- **WHEN** a PTO day is manually set to half day availability (0.5)
|
||||
- **THEN** the system keeps the PTO marker for that date
|
||||
- **AND** the capacity calculation uses the explicit availability override instead of forcing 0
|
||||
|
||||
@@ -526,6 +526,18 @@
|
||||
|
||||
**Commit**: `docs(capacity): Update API documentation`
|
||||
|
||||
### Phase 5: Stabilization Fixes
|
||||
|
||||
- [x] 4.5.1 Handle duplicate holiday creation gracefully with 422 response
|
||||
- [x] 4.5.2 Fix capacity cache invalidation for PTO and holiday mutations
|
||||
- [x] 4.5.3 Default PTO creation status to approved (no manual approval required)
|
||||
- [x] 4.5.4 Add PTO delete endpoint and UI action
|
||||
- [x] 4.5.5 Allow PTO-day availability overrides (keep PTO label, editable dropdown)
|
||||
- [x] 4.5.6 Fix calendar stale state after save/tab navigation
|
||||
- [x] 4.5.7 Expand regression coverage for capacity edge cases and cache behavior
|
||||
|
||||
**Commit**: `fix(capacity): stabilize PTO flows, cache invalidation, and calendar UX`
|
||||
|
||||
---
|
||||
|
||||
## Capability 5: Resource Allocation
|
||||
|
||||
Reference in New Issue
Block a user