Skip to content

PM-5378: Allow unchanged-duration active schedule shifts#126

Merged
jmgasper merged 1 commit into
developfrom
PM-5378-3
Jun 23, 2026
Merged

PM-5378: Allow unchanged-duration active schedule shifts#126
jmgasper merged 1 commit into
developfrom
PM-5378-3

Conversation

@jmgasper

Copy link
Copy Markdown
Contributor

What was broken
Active Development challenge edits could still be rejected with the Design-only shortening error when a user moved a phase start earlier, or switched the challenge start to Immediately, while keeping the phase duration unchanged.

Root cause
The active phase schedule guard compared the requested scheduled end date only against the persisted end date. When the start date also moved earlier, an unchanged-duration phase had an earlier end date and was incorrectly classified as a shortened phase.

What was changed
The phase helper now resolves the requested scheduled start date before validation and treats a non-Design active update as shortening only when the requested phase duration is actually reduced. The direct phase PATCH path now passes the same requested start-date context to the shared validation.

Any added/updated tests
Added phase-helper regression coverage for allowing active non-Design phase start shifts when duration is unchanged, and for still rejecting active non-Design updates that reduce duration after moving the start earlier.

Validation
pnpm exec mocha --exit test/unit/phase-helper.test.js passed.
pnpm lint passed.
pnpm build is unavailable because challenge-api-v6 has no build command.
pnpm test is blocked locally by missing DATABASE_URL for Prisma-backed unit suites; the new phase-helper tests pass within that run before the command exits on the environment issue.

What was broken
Active Development challenge edits could still be rejected with the Design-only shortening error when a user moved a phase start earlier, or switched the challenge start to Immediately, while keeping the phase duration unchanged.

Root cause
The active phase schedule guard compared the requested scheduled end date only against the persisted end date. When the start date also moved earlier, an unchanged-duration phase had an earlier end date and was incorrectly classified as a shortened phase.

What was changed
The phase helper now resolves the requested scheduled start date before validation and treats a non-Design active update as shortening only when the requested phase duration is actually reduced. The direct phase PATCH path now passes the same requested start-date context to the shared validation.

Any added/updated tests
Added phase-helper regression coverage for allowing active non-Design phase start shifts when duration is unchanged, and for still rejecting active non-Design updates that reduce duration after moving the start earlier.
@jmgasper jmgasper merged commit b66979d into develop Jun 23, 2026
5 checks passed
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.

1 participant