Skip to content

Ops 1517/ Procurement Tracker Step 4#5198

Merged
josbell merged 34 commits intomainfrom
OPS-1517/procurment-tracker-step-4-container
Mar 5, 2026
Merged

Ops 1517/ Procurement Tracker Step 4#5198
josbell merged 34 commits intomainfrom
OPS-1517/procurment-tracker-step-4-container

Conversation

@josbell
Copy link
Copy Markdown
Contributor

@josbell josbell commented Mar 4, 2026

What changed

Implemented Procurement Tracker Step 4 (Evaluation) for tracking the evaluation phase where OPRE completes technical evaluations, conducts negotiations, and internally selects a vendor before submitting the Final Consensus Memo to the Procurement Shop.

Key Changes:

  • Added backend database schema with evaluation fields (evaluation_target_completion_date, evaluation_task_completed_by, evaluation_date_completed, evaluation_notes)
  • Implemented backend service layer field mapping for EVALUATION step type
  • Added backend validation rules for Step 4 completion requirements
  • Created frontend Step 4 component with PENDING and COMPLETED states
  • Implemented custom React hook for state management and API interactions
  • Added Vest validation suite for Step 4 form fields
  • Fixed Marshmallow schema serialization to properly include EVALUATION fields in API responses
  • Integrated Step 4 into parent procurement tracker component with feature flag

Issue

Closes #1517 - Step 4 of Procurement Tracker - Evaluation

#1517

How to test

Prerequisites

  1. Start the application: docker compose up --build
  2. Navigate to an agreement with an active procurement tracker at Step 4
  3. Example: http://localhost:3000/agreements/13/procurement-tracker

Test Scenarios

1. Save Target Completion Date (Optional)

  • Step 4 displays when feature flag is enabled (STEP_4: true in constants.js)
  • User can enter a target completion date (future dates only)
  • Clicking "Save" saves the date and displays it as a readonly TermTag
  • No success alert appears (follows Step 2 pattern)
  • Date validation shows errors for invalid formats or past dates

2. Complete Step 4

  • User checks "Evaluations are complete..." checkbox
  • Form fields become enabled (Task Completed By, Date Completed, Notes)
  • User can select a user from the combo box
  • User can enter a date completed (today or earlier only)
  • User can enter optional notes (max 750 characters)
  • "Complete Step 4" button is disabled until all required fields are filled
  • Clicking "Complete Step 4" saves all data and transitions to COMPLETED state
  • Step 5 automatically opens after completion

3. COMPLETED State Display

  • All saved data displays as readonly TermTags (Target Completion Date, Completed By, Date Completed)
  • Notes display in full-width section
  • "None" displays for empty optional fields (Target Completion Date, Notes)
  • Checkmark icon appears next to completion confirmation text
  • Description text changes to past tense

4. Cancel Functionality

  • Clicking "Cancel" opens confirmation modal
  • Modal warns that input will not be saved
  • Confirming cancellation resets all form fields
  • Continuing editing closes modal without resetting

5. Backend Validation

  • Cannot complete step without task_completed_by (returns 400)
  • Cannot complete step without date_completed (returns 400)
  • Date completed cannot be in the future (returns 400)
  • Target completion date cannot be in the past (returns 400)
  • All evaluation fields properly serialize in API responses

6. Integration Tests

  • Backend tests pass: cd backend/ops_api && pipenv run pytest tests/ops/procurement_tracker/ -k step
  • Frontend tests pass: cd frontend && bun run test ProcurementTrackerStepFour --watch=false
  • E2E tests pass: cd frontend && bun run test:e2e

A11y impact

  • No accessibility-impacting changes in this PR
  • Accessibility changes included and validated against WCAG 2.1 AA intent
  • Any temporary suppression includes A11Y-SUPPRESSION metadata (owner, expires, rationale)

Note: Step 4 follows the same patterns as Steps 1-3 which have already been validated for accessibility compliance (USWDS components, keyboard navigation, screen reader support).

Definition of Done Checklist

  • OESA: Code refactored for clarity
  • OESA: Dependency rules followed
  • Automated unit tests updated and passed
  • Automated integration tests updated and passed
  • Automated quality tests updated and passed
  • Automated load tests updated and passed (N/A - no performance-sensitive changes)
  • Automated a11y tests updated and passed (follows Step 1-3 patterns)
  • Automated security tests updated and passed (N/A - no security-sensitive changes)
  • 90%+ Code coverage achieved
  • Form validations updated

Links

josbell and others added 15 commits March 3, 2026 14:39
Add database fields for Step 4 (Evaluation) tracking in procurement workflow:
- evaluation_target_completion_date: optional target date for evaluations
- evaluation_task_completed_by: user who completed the step
- evaluation_date_completed: actual completion date
- evaluation_notes: optional notes about evaluation

Includes Alembic migration and comprehensive test coverage for evaluation step API endpoints.
Update DefaultProcurementTrackerStep.to_dict() to map evaluation fields:
- evaluation_target_completion_date → target_completion_date
- evaluation_task_completed_by → task_completed_by
- evaluation_date_completed → date_completed
- evaluation_notes → notes

Ensures evaluation fields are excluded from other step types and vice versa.
Adds test coverage for evaluation field mapping.
Update ProcurementTrackerStepsService to map API field names to database columns:
- target_completion_date → evaluation_target_completion_date
- task_completed_by → evaluation_task_completed_by
- date_completed → evaluation_date_completed
- notes → evaluation_notes

Enables Step 4 evaluation fields to be updated via PATCH API endpoint.
Add validation rules for Step 4 completion:
- EvaluationCompletionRequiredFieldsRule: validates task_completed_by
  and date_completed are present when completing evaluation step
- Register rule in ProcurementTrackerStepsValidator for EVALUATION type
- Update CompletionAuthorizationRule to handle evaluation_task_completed_by

Prevents invalid Step 4 completions and ensures proper authorization.
Create Vest validation suite for evaluation step form fields:
- targetCompletionDate: optional, must be MM/DD/YYYY and not in past
- dateCompleted: required, must be MM/DD/YYYY and not in future
- users: required task_completed_by field

Includes comprehensive test coverage with 30 test cases covering format,
range, required field, and edge case validations.
Create useProcurementTrackerStepFour hook to manage evaluation step:
- State management for all form fields (checkbox, user, dates, notes)
- API mutations for saving target date and completing step
- Validation integration with suite
- Error handling with alerts
- Cancel modal functionality

Includes comprehensive test coverage with 21 test cases covering state
initialization, updates, validation, API calls, and modal behavior.
Create ProcurementTrackerStepFour component with PENDING and COMPLETED states:
- PENDING: description, optional target date, checkbox, user selection,
  date completed, notes, cancel/complete buttons
- COMPLETED: description, checkmark, TermTags grid with all saved data

Includes comprehensive test coverage with 20 test cases covering both
states, form interactions, validation, and button behaviors.
Integrate ProcurementTrackerStepFour component into parent
AgreementProcurementTracker page. Add stepFourData extraction,
conditional rendering based on feature flag, and update test mocks
to include Step 4 component. Add dedicated test for Step 4 active
state rendering.
Enable Step 4 (Evaluation) feature flag in production.
Step 4 implementation is complete with full test coverage
and integrated into the procurement tracker workflow.
Add success alerts for target completion date save and step completion
to provide immediate user feedback. Update completed state to always
display Target Completion Date and Notes fields with "None" fallback
when not set, following Step 2 pattern for consistency.

Changes:
- Add success alert after saving target completion date
- Add success alert after completing step 4
- Always show Target Completion Date in completed state (with "None")
- Always show Notes section in completed state (with "None")
- Update tests to reflect new behavior
Remove success alerts after saving target completion date and
completing step 4. Follow Step 2 pattern where the UI updates
immediately via RTK Query cache invalidation without showing
alert notifications.

Changes:
- Remove success alert after target completion date save
- Remove success alert after step completion
- Clear local state after save to rely on server data
- Update tests to reflect new behavior
…p schemas

Added EVALUATION handling to both ProcurementTrackerStepResponseSchema and
ProcurementTrackerStepSchema to properly serialize evaluation_* fields
(target_completion_date, task_completed_by, date_completed, notes) in API responses.

The schemas were missing EVALUATION cases in pre_dump and post_dump methods,
causing evaluation fields to be stripped from the response.

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
1. Add NoPastTargetCompletionDateUpdateRule validation for EVALUATION steps
   - Updated rule to support both PRE_SOLICITATION and EVALUATION step types
   - Added rule to EVALUATION validators list to prevent past target dates

2. Add step ID guard to target completion date save button
   - Prevents undefined stepId from being passed to API mutation

3. Complete DefaultProcurementTracker docstring with EVALUATION fields
   - Documents evaluation_target_completion_date, evaluation_task_completed_by,
     evaluation_date_completed, evaluation_notes in class docstring

4. Update schema comment to include EVALUATION
   - ProcurementTrackerStepPatchRequestSchema now correctly lists EVALUATION
     as sharing task_completed_by, date_completed, and notes fields

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
@josbell josbell changed the title Ops 1517/procurment tracker step 4 container Ops 1517/ Procurement Tracker Step 4 Mar 4, 2026
josbell and others added 5 commits March 3, 2026 19:17
Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
Updated backend tests to expect EVALUATION step (step 4) to include
step-specific fields (task_completed_by, date_completed, notes,
target_completion_date) in API responses, matching the implementation.

Also fixed test_complete_evaluation_step to use task_completed_by: 503
(the authenticated test user) instead of 1 (user not associated with
the test agreement).

Fixes:
- test_get_procurement_tracker_all_step_fields now expects EVALUATION
  to have extra fields like steps 1-3
- test_step_to_dict_excludes_step_specific_fields_for_other_steps now
  expects EVALUATION to include mapped fields in to_dict()
- test_complete_evaluation_step now uses correct user ID (503) that's
  associated with the test agreement

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
…utton

Changed data-cy attribute from "target-completion-save-btn" to
"step-4-target-completion-save-btn" to avoid conflicts with step 2's
button that has the same attribute.

This fixes the E2E test failure where the Cypress selector was matching
BOTH step 2 and step 4 buttons, causing the test to fail when checking
if buttons are not disabled.

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
Remove Figma screenshot files (figma-step4*.png) that were accidentally
committed. These reference images should be linked in tickets/documentation
rather than stored in the git repository.

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
@josbell josbell marked this pull request as ready for review March 4, 2026 18:45
@fpigeonjr fpigeonjr requested a review from Copilot March 4, 2026 19:17
@josbell josbell self-assigned this Mar 4, 2026
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

Implements Procurement Tracker Step 4 (Evaluation) end-to-end, adding evaluation-specific fields to the backend model/schema/service/validation and wiring a new Step 4 UI (plus hook + Vest validation) into the agreement procurement tracker flow.

Changes:

  • Backend: add evaluation step columns + mapping/serialization + step-type-specific validation and API/service updates.
  • Frontend: add Step 4 component + hook + Vest validation suite and integrate into the procurement tracker UI behind the Step 4 readiness flag.
  • Tests: add frontend unit tests for Step 4 and extend backend procurement tracker tests for evaluation field mapping and API behavior.

Reviewed changes

Copilot reviewed 21 out of 22 changed files in this pull request and generated 6 comments.

Show a summary per file
File Description
frontend/src/types/ProcurementTrackerTypes.d.ts Adds ProcurementTrackerEvaluationStep to the response union type.
frontend/src/pages/agreements/details/AgreementProcurementTracker.test.jsx Updates agreement procurement tracker tests to account for Step 4 rendering.
frontend/src/pages/agreements/details/AgreementProcurementTracker.jsx Wires in ProcurementTrackerStepFour rendering under the Step 4 readiness flag.
frontend/src/constants.js Enables Step 4 readiness flag (STEP_4).
frontend/src/components/Agreements/ProcurementTracker/ProcurementTrackerStepFour/suite.test.js Adds Vest suite tests for Step 4 form validation.
frontend/src/components/Agreements/ProcurementTracker/ProcurementTrackerStepFour/suite.js Implements Step 4 Vest validation rules.
frontend/src/components/Agreements/ProcurementTracker/ProcurementTrackerStepFour/index.js Barrel export for Step 4 component.
frontend/src/components/Agreements/ProcurementTracker/ProcurementTrackerStepFour/ProcurementTrackerStepFour.test.jsx Adds component tests for PENDING/COMPLETED rendering and interactions.
frontend/src/components/Agreements/ProcurementTracker/ProcurementTrackerStepFour/ProcurementTrackerStepFour.jsx Implements the Step 4 UI (PENDING + COMPLETED states).
frontend/src/components/Agreements/ProcurementTracker/ProcurementTrackerStepFour/ProcurementTrackerStepFour.hooks.test.js Adds hook tests for payload creation, alerts, cancel modal, etc.
frontend/src/components/Agreements/ProcurementTracker/ProcurementTrackerStepFour/ProcurementTrackerStepFour.hooks.js Implements Step 4 state management + PATCH interactions.
backend/ops_api/tests/ops/procurement_tracker/test_procurement_tracker_steps_api.py Adds evaluation step API tests/fixture coverage.
backend/ops_api/tests/ops/procurement_tracker/test_procurement_tracker_model.py Adds model to_dict() mapping tests for evaluation fields.
backend/ops_api/tests/ops/procurement_tracker/test_procurement_tracker_api.py Updates “all step fields” API test expectations to include evaluation step fields.
backend/ops_api/ops/validation/rules/procurement_tracker_step.py Adds Evaluation completion required-fields rule; extends target completion date rule to evaluation.
backend/ops_api/ops/validation/procurement_tracker_steps_validator.py Registers evaluation-specific validator chain.
backend/ops_api/ops/services/procurement_tracker_steps.py Adds evaluation field mapping from API fields to prefixed model columns.
backend/ops_api/ops/schemas/procurement_tracker_steps.py Ensures evaluation fields are serialized/preserved appropriately for EVALUATION steps.
backend/models/procurement_tracker.py Adds evaluation columns/relationship and updates to_dict() mapping/exclusion logic.
backend/alembic/versions/2026_03_03_2212-5b98f5ea777e_add_evaluation_step_fields_to_.py Migration adding evaluation columns (step + step_version) and FK.
backend/Pipfile Adds a new (empty) Pipfile at backend/.
.vscode/mcp.json Adds VS Code MCP server config pointing at a localhost endpoint.

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

Comment thread .vscode/mcp.json Outdated
Comment thread backend/ops_api/ops/validation/rules/procurement_tracker_step.py
Comment thread backend/Pipfile Outdated
Comment thread frontend/src/constants.js
josbell and others added 4 commits March 4, 2026 11:48
Addresses Copilot PR review feedback by improving code consistency and
fixing validation bugs:

- Add reusable helper functions (isValidDateFormat, getDateOnly,
  compareDateToToday) matching Step 2 pattern
- Fix dual error message bug on empty required dateCompleted field by
  skipping format validation when empty
- Remove duplicate inline date comparison logic (70+ chars per validation)
- Remove personal VS Code MCP config (.vscode/mcp.json) and add to
  .gitignore
- Remove accidental empty backend/Pipfile at wrong location

All 72 Step 4 tests pass. Validation behavior unchanged, only code
organization improved.

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
Copy link
Copy Markdown
Contributor

@fpigeonjr fpigeonjr left a comment

Choose a reason for hiding this comment

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

manual tests look good

Image Image Image

Comment thread backend/models/procurement_tracker.py
Comment thread frontend/src/types/ProcurementTrackerTypes.d.ts
josbell and others added 5 commits March 4, 2026 15:03
…teps

- Add ProcurementTrackerEvaluationStep schema to OpenAPI spec
- Update request/response schemas to document EVALUATION step fields
- Add proper TypeScript types for all procurement tracker step components
- Fix TypeScript errors in ProcurementTrackerStepFour and UsersComboBox
- Update Steps 1-3 to use typed step data instead of generic Object

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
Updated test expectations to match the improved TypeScript type safety
where selectedUser is initialized as undefined instead of an empty object.

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
Copy link
Copy Markdown
Contributor

@johndeange johndeange left a comment

Choose a reason for hiding this comment

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

LGTM - I tested locally and it seems to work. Since @rajohnson90 worked on the procurement steps recently I would defer to him for final approval.

@josbell josbell merged commit db186d2 into main Mar 5, 2026
55 checks passed
@josbell josbell deleted the OPS-1517/procurment-tracker-step-4-container branch March 5, 2026 22:34
@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented Mar 5, 2026

🎉 This PR is included in version 1.319.0 🎉

The release is available on GitHub release

Your semantic-release bot 📦🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Step 4 of Procurement Tracker - Evaluation

5 participants