[BUG] Capacity calculation shows incorrect values due to cache invalidation failure #29

Closed
opened 2026-02-20 02:56:08 +00:00 by santhoshj · 0 comments
Owner

Problem: Capacity summary shows incorrect person days when PTO and holidays are combined.\n\nObserved:\n- User with 2 PTO weekdays + 1 holiday shows 19 days instead of 17\n- Cache invalidation methods did not clear array store cache\n- Only Redis cache was being invalidated\n\nRoot Cause:\n- forgetCapacity() returned early when Redis unavailable\n- forgetCapacityCacheForTeamMember() and forgetCapacityCacheForMonth() only cleared Redis cache\n- Tests use array store, so cache was never invalidated\n\nFix Applied:\n- Always clear array store cache in invalidation methods\n- Added comprehensive tests for PTO + holiday scenarios\n- Tests cover: PTO spanning weekends, PTO on holidays, multiple PTOs, cache invalidation\n\nTests Added:\n- 4.1.25: PTO + holiday combined\n- 4.1.26: PTO spanning weekends\n- 4.1.27: PTO on holiday date\n- 4.1.28: Multiple PTO periods\n- 4.1.29: Half-day + PTO\n- 4.1.30: Pending PTO not counted\n- 4.1.31: PTO spanning month boundary\n- 4.1.32: Holiday on weekend\n- 4.1.33: Full month verification\n- 4.1.34-39: Cache invalidation tests

Problem: Capacity summary shows incorrect person days when PTO and holidays are combined.\n\nObserved:\n- User with 2 PTO weekdays + 1 holiday shows 19 days instead of 17\n- Cache invalidation methods did not clear array store cache\n- Only Redis cache was being invalidated\n\nRoot Cause:\n- forgetCapacity() returned early when Redis unavailable\n- forgetCapacityCacheForTeamMember() and forgetCapacityCacheForMonth() only cleared Redis cache\n- Tests use array store, so cache was never invalidated\n\nFix Applied:\n- Always clear array store cache in invalidation methods\n- Added comprehensive tests for PTO + holiday scenarios\n- Tests cover: PTO spanning weekends, PTO on holidays, multiple PTOs, cache invalidation\n\nTests Added:\n- 4.1.25: PTO + holiday combined\n- 4.1.26: PTO spanning weekends\n- 4.1.27: PTO on holiday date\n- 4.1.28: Multiple PTO periods\n- 4.1.29: Half-day + PTO\n- 4.1.30: Pending PTO not counted\n- 4.1.31: PTO spanning month boundary\n- 4.1.32: Holiday on weekend\n- 4.1.33: Full month verification\n- 4.1.34-39: Cache invalidation tests
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: santhoshj/headroom#29