fix(ui): enforce future-only planned start date + widen Configure Purchase Term field - #1258
Conversation
|
Warning Review limit reachedYou’ve reached a temporary PR review limit under our Fair Usage Limits Policy. Next review available in: 13 minutes Enable usage-based reviews in Billing to review now. Otherwise, wait until the next included review is available. How can I continue?After more reviews become available, a review can be triggered using the To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews. How do review limits work?CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability. For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window. Please refer docs for additional details. Review details⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (2)
📝 WalkthroughWalkthroughThe Add Purchases modal now formats dates from local calendar components, defaults the start date to tomorrow, and prevents selecting dates before today. Tests cover the ChangesAdd Purchases start-date validation
Estimated code review effort: 2 (Simple) | ~10 minutes 🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✨ Finishing Touches🧪 Generate unit tests (beta)
Comment |
|
@coderabbitai review |
✅ Action performedReview finished.
|
|
@coderabbitai full review |
✅ Action performedFull review finished. |
308f47c to
80df799
Compare
|
@coderabbitai review |
Rate Limit Exceeded
|
|
@coderabbitai full review |
✅ Action performedFull review finished. |
Adversarial review pass — in-scope fix pushed, two follow-ups filedIn-scope fix (just pushed as Both lines added by this PR used The fix introduces a
Out-of-scope follow-ups (filed as separate issues per the playbook):
Kept those out of this PR to honour its CI UNSTABLE: the three failing checks on this PR (
@coderabbitai full review |
|
I’ll run a full review with the updated local-date helper/test coverage in mind. ✏️ Learnings added
✅ Action performedFull review finished. |
|
@coderabbitai review |
✅ Action performedReview finished.
|
43c3954 to
a864861
Compare
|
Rebased onto origin/main (27fdb06). The term-width commit (closes #1250) was superseded by the already-merged #1430; it was resolved as a no-op during rebase -- the CSS rule from #1430 (min-width: 5.5rem) is kept. The remaining two commits (future-only start-date picker, closes #1249) are unique and intact. Gates: go build/vet exit 0; npm test exit 0 (78 suites, 2628 tests). @coderabbitai review |
|
✅ Action performedReview finished.
|
a864861 to
9595958
Compare
#1249) Set `startDateInput.min` to today's ISO date after the default value (tomorrow) is assigned so the browser date-picker rejects past dates while still allowing today as a valid same-day start. Regression test added in plans-range-validation.test.ts: asserts `input.min === today ISO` after `openAddPurchasesModal` returns (FAIL pre-fix, PASS post-fix, 44 tests green).
… day
`new Date().toISOString().split('T')[0]` returns the UTC calendar date, not
the user's local one. For any user west of UTC after their local-evening
crossover, the prior `min = toISOString().split('T')[0]` would resolve to
tomorrow's UTC date and grey out today in the picker, directly contradicting
the PR's own claim that "today remains selectable (a same-day start is
legitimate)" (QA 5.6).
Extract a `toLocalDateInputValue(Date) -> YYYY-MM-DD` helper that builds the
ISO string from local year/month/day components (mirrors the local-midnight
pattern already used by `isPlanOverdue` above), and use it for both `value`
(default tomorrow) and `min` (today) in `openAddPurchasesModal`.
Regression test updated in `plans-range-validation.test.ts`: the prior
assertion used the same UTC function as production code, so it would have
gone green even with the bug present. The replacement asserts both `min` and
`value` against the local-component derivation, and adds an explicit
"local calendar day, not UTC" case that documents the failure shape.
9595958 to
d8e718e
Compare
Summary
Two small Purchase-flow UI polish fixes from the QA sheet, shipped together.
Bug 1 (QA 5.6) - Add Purchases start-date picker allowed past dates
Closes #1249
Root cause: the
<input type="date" id="add-purchases-start-date">in the existing-plan "Add Purchases" modal (frontend/src/plans.ts) had nominattribute, so the browser date-picker let users select dates in the past, which is contradictory for scheduling future purchases.Fix: after the default value (tomorrow) is assigned, set
startDateInput.minto today's ISO date. Past dates are now blocked in the picker while today remains selectable (a same-day start is legitimate). The default value stays tomorrow.Bug 2 (QA 5.3) - Configure Purchase modal Term field too narrow to read
Closes #1250
Root cause: the Term
<select>in the Configure Purchase modal carries class.purchase-row-term(set inrecommendations.ts), but no CSS rule existed for it anywhere, so the browser rendered it at content width and clipped both the selected value and the dropdown arrow.Fix: add
.purchase-row-term { min-width: 5rem; }tofrontend/src/styles/modals.css, next to the sibling.purchase-modal-*rules. CSS-only;recommendations.tsis untouched (owned by another PR).Testing
frontend/src/__tests__/plans-range-validation.test.ts(new describe block "Add Purchases modal: start-date picker enforces future-only dates (QA 5.6)"). Assertsinput.min === today's ISO dateafter the modal opens, plus that the default value stays tomorrow. Confirmed FAIL pre-fix (received""), PASS post-fix. Full file: 44 pass / 0 fail.npx tsc --noEmit: no errors.Note
Stacked on #1254 (pre-commit repair); retarget to main when #1254 merges.
Summary by CodeRabbit
New Features
Bug Fixes