Conversation
rajohnson90
left a comment
There was a problem hiding this comment.
What I've seen here all makes sense. Just respond to my one question and I'll be ready to approve.
rajohnson90
left a comment
There was a problem hiding this comment.
Given that Wei has dynamic fixes for the things I'm concerned with, I am fine with approving this name.
There was a problem hiding this comment.
Pull request overview
This PR decouples agreement and budget line item (BLI) validation, postponing validation until budget lines are selected for status changes. Previously, validation was triggered on page render for all items; now it only runs when BLIs are selected, validating only those selected items.
Key changes:
- Split validation logic into separate agreement and BLI suites with new exported utility functions
- Updated validation timing to occur on BLI selection rather than page load
- Fixed rendering issue in AgreementTableRow where loading state rendered a div as direct child of table
Reviewed changes
Copilot reviewed 9 out of 9 changed files in this pull request and generated 7 comments.
Show a summary per file
| File | Description |
|---|---|
| frontend/src/pages/agreements/review/suite.js | Refactored validation suite into separate agreement and BLI validators; added validateBudgetLineItem and validateBudgetLineItems utility functions |
| frontend/src/pages/agreements/review/ReviewAgreement.hooks.js | Updated validation timing to trigger on BLI selection; refactored error aggregation logic; replaced res with agreementValidationResults |
| frontend/src/pages/agreements/review/ReviewAgreement.jsx | Updated to use agreementValidationResults prop; removed validation-based disabling of action options |
| frontend/src/components/BudgetLineItems/BLIReviewTable/BLIReviewRow.jsx | Modified date error classes to only apply when budget line is selected |
| frontend/src/components/Agreements/AgreementsTable/AgreementTableRow.jsx | Fixed loading state to render table row with td instead of bare div |
| frontend/src/components/Agreements/AgreementMetaAccordion/AgreementMetaAccordion.jsx | Updated prop name from res to agreementValidationResults |
| frontend/test_validation.js | Updated date and formatting (quote style changes) |
| frontend/cypress/e2e/createAgreementWithValidations.cy.js | Enhanced test robustness with unique suffixes, better error handling, and removed validation checks that no longer apply |
| frontend/cypress/e2e/agreementList.cy.js | Improved test stability with better selectors and retry logic |
Comments suppressed due to low confidence (1)
frontend/src/components/BudgetLineItems/BLIReviewTable/BLIReviewRow.jsx:144
- Inconsistent error display logic: The dateNeeded field only shows errors when the budget line is selected (line 139), but the canNumber and amount fields (lines 142, 144) show errors based on isReviewMode regardless of selection status. This inconsistency may confuse users - either all fields should respect the selection status, or none should. Consider updating these lines to match the pattern:
budgetLine.selected ? addErrorClassIfNotFound(...) : ''
const canNumberClasses = `${addErrorClassIfNotFound(canNumber, isReviewMode)} ${borderExpandedStyles}`;
const amount = budgetLine?.amount ?? 0;
const amountClasses = `${addErrorClassIfNotFound(amount, isReviewMode)} ${borderExpandedStyles}`;
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| export const validateBudgetLineItem = (budgetLine, fieldName) => { | ||
| budgetLineSuite.reset(); | ||
| budgetLineSuite(budgetLine, fieldName); | ||
| const result = budgetLineSuite.get(); | ||
| return { | ||
| isValid: result.isValid(), | ||
| errors: cloneErrors(result.getErrors()) | ||
| }; | ||
| }; | ||
|
|
||
| /** | ||
| * Validate one or more budget line items independently from the agreement. | ||
| * @param {import("../../../types/BudgetLineTypes").BudgetLine | import("../../../types/BudgetLineTypes").BudgetLine[]} budgetLines | ||
| * @returns {{ id: number | null, isValid: boolean, errors: Record<string, string[]> }[]} - Collection of budget line validation results | ||
| */ | ||
| export const validateBudgetLineItems = (budgetLines = []) => { | ||
| const items = Array.isArray(budgetLines) ? budgetLines : [budgetLines]; | ||
| return items.map((budgetLine) => ({ | ||
| id: budgetLine?.id ?? null, | ||
| ...validateBudgetLineItem(budgetLine) | ||
| })); | ||
| }; |
There was a problem hiding this comment.
The newly exported functions validateBudgetLineItem and validateBudgetLineItems lack unit test coverage. Given that the repository has comprehensive test coverage for helper functions (as seen in the helpers directory), these validation utility functions should have corresponding unit tests to verify their behavior with valid and invalid budget line data, edge cases like null/undefined values, and array handling.
There was a problem hiding this comment.
I added specs. Not sure why this comment is not being flagged as outdated. See suite.test.js
|
🤖 Claude's review PR Review: #4809 - Status Change Validation TimingOverviewThis PR improves the user experience for budget line item status changes by deferring validation until BLIs are selected, rather than showing validation errors immediately on page load. All CI checks are passing ✅ Strengths1. Better UX PatternThe change from eager validation (on render) to lazy validation (on selection) is a solid UX improvement. Users aren't confronted with errors until they've actually indicated intent to make changes. 2. Performance OptimizationOnly validating selected BLIs rather than all BLIs is more efficient, especially for agreements with many budget lines. 3. Cleaner ArchitectureThe separation of agreement and BLI validation suites ( 4. Comprehensive TestingThe E2E test updates show attention to test stability, particularly around flakiness in CI environments (using Issues & Concerns1. Potential Validation Bypass
|
|
found a bug with manually testing a minimal agreement with a minimal BLI and trying to send to review. Screen.Recording.2026-01-08.at.10.25.11.AM.mov |
Bug resolved |
…in useReviewAgreement hook
|
@fpigeonjr For Claude concerns
|
|
🎉 This PR is included in version 1.262.0 🎉 The release is available on GitHub release Your semantic-release bot 📦🚀 |
What changed
When requesting a bli status change, now the validation of the agreement/blis will be postponed until user selects the blis that need to change. Furthermore, instead of validating all blis, only the selected blis will be validated.
Described what changes in this PR, at a high level
Previously the agreement/blis were validated using vest as a whole suite and done on page rendering. This change decouples the agreement and blis suites. They are not triggered not on page rendering but on bli selection.
Additionally there is also an unrelated fix to a warning emerging from Agreement table row where a div ended up being rendered as a direct child of a table when loading.
Issue
4720
Add link to issue here
#4720
How to test
Write out steps for how someone could test this PR against the acceptance criteria
Screenshots
If relevant, e.g. for a front-end feature
Definition of Done Checklist
Links
If relevant, e.g. for a link to a piece of markdown documentation