Conversation
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.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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.