Skip to content

4245 change request process and factory#4331

Open
Steph375 wants to merge 8 commits into
developfrom
4245-generate-change-requests
Open

4245 change request process and factory#4331
Steph375 wants to merge 8 commits into
developfrom
4245-generate-change-requests

Conversation

@Steph375

@Steph375 Steph375 commented Jul 15, 2026

Copy link
Copy Markdown
Contributor

Changes

Added generation process for change requests. Specifically:

  • Change_Request
  • Stage_Gate_CR
  • Activation_CR
  • Budget_CR
  • Leadership_CR
  • Change

Checklist

It can be helpful to check the Checks and Files changed tabs.
Please review the contributor guide and reach out to your Tech Lead if anything is unclear.
Please request reviewers and ping on slack only after you've gone through this whole checklist.

  • All commits are tagged with the ticket number
  • No linting errors / newline at end of file warnings
  • All code follows repository-configured prettier formatting
  • No merge conflicts
  • All checks passing
  • Screenshots of UI changes (see Screenshots section)
  • Remove any non-applicable sections of this template
  • Assign the PR to yourself
  • No yarn.lock changes (unless dependencies have changed)
  • Request reviewers & ping on Slack
  • PR is linked to the ticket (fill in the closes line below)

Closes #4245

@Steph375 Steph375 self-assigned this Jul 15, 2026

@Santiordon Santiordon left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Just one thing.

organizationId,
this.faker.helpers.arrayElement(submitterPool).userId,
this.faker.helpers.arrayElement(reviewerPool).userId,
budgetReasonId()

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

I'd name this better. something like generateBudgetReasonId.

Santiordon
Santiordon previously approved these changes Jul 16, 2026

@Santiordon Santiordon left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

lgtm

@wavehassman wavehassman left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

A couple of general things:

  1. You can't have multiple simultaneous pending CRs on the same WBS element/category/account code/etc
  2. When a change request is accepted, it should apply their changes, so if a cr status is marked accepted, make sure the wbs reflects that
  3. Budget CRs are really only made on account codes for the finance team

@wavehassman
wavehassman self-requested a review July 20, 2026 22:47

@wavehassman wavehassman left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Two things I forgot to mention:

  1. Leadership, stage gate and activation crs are automatically accepted and implemented, so there status should always be approved
  2. Activation moves the work package's start and stage gate moves its duration

const outcomesForOrderedCrs = (faker: Faker, count: number): ReviewOutcome[] =>
Array.from({ length: count }, (_, index) => (index === count - 1 ? latestOutcome(faker) : resolvedOutcome(faker)));

const orderedSubmissionDates = (faker: Faker, timeline: DateRange, count: number): Date[] =>

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Dates here are bounded only by timeline, never capped at now
Since project/work-package timelines can extend into the future, this can produce a CR dateSubmitted/dateReviewed that's ahead of now


const wbsChangeRequestInputs: Prisma.Change_RequestCreateInput[] = [];

for (const { project, timeline } of projects) {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

No filter for future-dated projects/work packages and combined with cappedWindow, this collapses their CRs to dateSubmitted = now, before the WBS element's own start
Should prob skip not yet started ones here, like ReimbursementRequestProcess does

@wavehassman wavehassman left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

This isn't your doing, but it creates a bug with the merge:

Line: src/backend/src/prisma/factories/description-bullet.factory.ts:52
Never sets dateTimeChecked/userCheckedId, so every bullet is permanently unchecked. Since reviewStageGateChangeRequest throws if a work package has any unchecked bullet, and every work package now gets at least one, this makes every accepted STAGE_GATE CR an unreachable state. Some bullets need to get checked before a work package's STAGE_GATE CR is generated/accepted

}
};

const changesCreateInput = (

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

never sets dateImplemented

case CR_Type.LEADERSHIP:
return {
leadershipChangeRequest: {
create: {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

aren't they just changing them to the same ones? same for activation

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.

[Seed Data] - Generate Change Request Data

3 participants