Skip to content

fix: open detail page when clicking edit for time-off policies#1690

Open
jeffredodd wants to merge 1 commit intomainfrom
fix/non-holiday-policy-guard
Open

fix: open detail page when clicking edit for time-off policies#1690
jeffredodd wants to merge 1 commit intomainfrom
fix/non-holiday-policy-guard

Conversation

@jeffredodd
Copy link
Copy Markdown
Contributor

Summary

  • The state machine's TIME_OFF_VIEW_POLICY transition guarded on policyType === 'sick' || 'vacation'. The API's PolicyType union also includes bereavement, custom, floating_holiday, jury_duty, learning_and_development, parental_leave, personal_day, volunteer, and weather (companies migrated from Gusto.com may have any of these).
  • For any non-sick/vacation/holiday type the event matched no guard, the state machine swallowed it, and clicking "Edit policy" in the kabob menu appeared to do nothing.
  • Renames the guard to isNonHolidayView (returns policyType !== 'holiday') so any non-holiday policy routes to viewTimeOffPolicyDetail.
  • Broadens TimeOffPolicyType to PolicyType | 'holiday' so the context can hold the broader values; narrows back at the create-policy selector site (which only renders sick/vacation/holiday).

This is PR 11 in the time-off bug-fix slate captured in ~/.claude/plans/ok-i-want-to-partitioned-balloon.md.

Test plan

  • npm run test -- --run src/components/UNSTABLE_TimeOff/TimeOffFlow/ — 43/43 passing (added 5 parameterized tests for custom, bereavement, parental_leave, jury_duty, volunteer)
  • npx tsc --noEmit — clean
  • npm run test -- --run src/components/UNSTABLE_TimeOff/ — 302/302 passing
  • Manual: in dev app, attach a non-sick/vacation policy (e.g. custom or bereavement) via gws-flows fixtures or directly in ZenPayroll, then click Edit Policy from the policy list kabob — should open the detail screen

🤖 Generated with Claude Code

The TIME_OFF_VIEW_POLICY transition guarded on
policyType === 'sick' || 'vacation', but the API's PolicyType union
includes bereavement, custom, floating_holiday, jury_duty,
learning_and_development, parental_leave, personal_day, volunteer, and
weather. Companies migrated from Gusto.com may have any of these
attached to their account. For any non-sick/vacation/holiday type the
event matched no guard, the state machine swallowed it, and clicking
"Edit policy" in the kabob menu appeared to do nothing.

Rename the guard to isNonHolidayView (returns policyType !== 'holiday')
so any non-holiday policy routes to viewTimeOffPolicyDetail. Broaden
TimeOffPolicyType to PolicyType | 'holiday' so the context can hold the
broader values, and narrow back at the create-policy selector site.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@jeffredodd jeffredodd force-pushed the fix/non-holiday-policy-guard branch from 5a332f0 to 4f26526 Compare May 6, 2026 02:36
@jeffredodd jeffredodd marked this pull request as ready for review May 6, 2026 02:45
Copilot AI review requested due to automatic review settings May 6, 2026 02:45
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Fixes TimeOffFlow navigation so TIME_OFF_VIEW_POLICY correctly opens the policy detail screen for any non-holiday time-off policy type (e.g., custom, bereavement, parental_leave, etc.), instead of being silently ignored due to overly narrow guards/types.

Changes:

  • Updated the TIME_OFF_VIEW_POLICY guard to route all non-holiday policy types to viewTimeOffPolicyDetail.
  • Broadened TimeOffPolicyType to accept the full API PolicyType union (plus 'holiday') so flow context/payloads can represent migrated policy types.
  • Added parameterized state-machine tests covering several non-holiday policy types and updated the policy-type selector defaulting to only preselect sick/vacation/holiday.

Reviewed changes

Copilot reviewed 4 out of 4 changed files in this pull request and generated no comments.

File Description
src/components/UNSTABLE_TimeOff/TimeOffFlow/timeOffStateMachine.ts Broadens view-policy payload typing and updates the view-policy guard to route all non-holiday policies to the standard detail state.
src/components/UNSTABLE_TimeOff/TimeOffFlow/timeOffStateMachine.test.ts Adds coverage to ensure non-holiday (non sick/vacation) policy types transition to viewTimeOffPolicyDetail.
src/components/UNSTABLE_TimeOff/TimeOffFlow/timeOffPolicyTypes.ts Expands TimeOffPolicyType to include all API policy types, enabling flow context to hold migrated values.
src/components/UNSTABLE_TimeOff/TimeOffFlow/TimeOffFlowComponents.tsx Prevents invalid defaults in the create-policy selector by only defaulting when policyType is one of sick/vacation/holiday.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@jeffredodd jeffredodd changed the title fix: open detail page for non-sick/vacation time-off policies fix: open detail page when clicking edit for time-off policies May 6, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants