fix(ui): enforce future-only planned start date + widen Configure Purchase Term field#1258
fix(ui): enforce future-only planned start date + widen Configure Purchase Term field#1258cristim wants to merge 3 commits into
Conversation
|
Warning Review limit reached
More reviews will be available in 4 minutes and 53 seconds. Learn how PR review limits work. Your organization has used up its prepaid credits, and credit purchases are no longer available. Enable the review add-on in the billing tab to keep reviews running — you're only billed for reviews past your plan's rate limits ($0.25/file). ⌛ How to resolve this issue?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 credits. 🚦 How do rate 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 see our Fair Usage Limits Policy for further information. ℹ️ Review info⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (3)
📝 WalkthroughWalkthroughTwo independent bug fixes: ChangesAdd Purchases start-date min constraint (QA 5.6)
Configure Purchase term field width (QA 5.3)
Estimated code review effort🎯 1 (Trivial) | ⏱️ ~4 minutes Suggested labels
Poem
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
Comment |
|
@coderabbitai review |
✅ Action performedReview finished.
|
|
@coderabbitai full review |
✅ Action performedFull review finished. |
#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).
…pping (closes #1250) The Term select carries class `.purchase-row-term` but no CSS rule existed for it, so the browser rendered it at content width and clipped the selected value and dropdown arrow. Add `min-width: 5rem` alongside the other `.purchase-modal-*` rules in modals.css. CSS-only change; visual verification required (not unit-testable in jsdom).
308f47c to
80df799
Compare
|
@coderabbitai review |
Rate Limit Exceeded
|
|
@coderabbitai full review |
✅ Action performedFull review finished. |
… 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.
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. |
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