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:
2026-02-19 22:47:39 -05:00
parent 0a9fdd248b
commit b821713cc7
21 changed files with 1081 additions and 128 deletions

View File

@@ -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