Skip to content

PM-5378: Allow Design shortening across phases#124

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

PM-5378: Allow Design shortening across phases#124
jmgasper merged 1 commit into
developfrom
PM-5378-1

Conversation

@jmgasper

Copy link
Copy Markdown
Contributor

What was broken
The previous implementation only allowed Design-track shortening on the currently open phase. QA clarified that Design challenges should allow any incomplete phase to be shortened, and active non-Design updates could still fail when Work sent a stale duration even though the saved scheduled end date did not move earlier.

Root cause
The PM-5378 validation guard was tied to phase.isOpen instead of the active challenge schedule as a whole. The challenge update helper also had a row-id-aware matcher but still used phase definition ids in the main update path, so row-specific timeline edits could be matched incorrectly.

What was changed
Design challenges can now shorten any incomplete phase as long as the requested end date is not before the current date/time. Active non-Design challenges guard every incomplete phase against shortening, while pre-launch non-Design reductions remain allowed. Full challenge updates and direct phase PATCHes both pass the active-challenge guard options, and phase update matching now prefers challenge phase row id before phase definition id.

Any added/updated tests
Bootstrapped the phase helper unit test and added regressions for Design future-phase shortening, active non-Design future-phase rejection, pre-launch non-Design shortening, and stale duration payloads that keep the persisted end date.

Validation:

  • pnpm exec mocha test/unit/phase-helper.test.js --exit passed.
  • pnpm lint passed.
  • pnpm test is blocked in this checkout because DATABASE_URL is not set for Prisma-backed tests.
  • pnpm build is unavailable because this package has no build script.

What was broken
The previous fix only allowed Design-track shortening for the currently open phase. Active non-Design schedule validation could also reject unchanged saved end dates when a stale duration from the Work app implied shortening, and phase update matching did not use challenge phase row ids.

Root cause
The PM-5378 guard was keyed to phase.isOpen instead of the active challenge schedule as a whole. The update helper also had a row-id-aware matcher but still used phase definition ids in the main update path.

What was changed
Design challenges can now shorten any incomplete phase, provided the requested end date is not before the current date/time. Active non-Design challenges now guard every incomplete phase against shortening, while pre-launch non-Design reductions remain allowed. Full challenge updates and direct phase PATCHes both pass the active-challenge guard options, and challenge phase updates now prefer row id matching before phase definition id matching.

Any added/updated tests
Bootstrapped the phase helper test and added regressions for Design future-phase shortening, active non-Design future-phase rejection, pre-launch non-Design shortening, and stale duration payloads that keep the persisted end date. Focused phase-helper tests and pnpm lint passed. Full pnpm test is blocked without DATABASE_URL, and pnpm build is unavailable because the package has no build script.
@jmgasper jmgasper merged commit 76eefbc into develop Jun 18, 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