Skip to content

feat(plans): preview draft purchase schedules - #880

Merged
cristim merged 1 commit into
mainfrom
feat/plan-graph-preview-ship
Oct 15, 2026
Merged

cristim merged 1 commit into
mainfrom
feat/plan-graph-preview-ship

Conversation

@cristim

@cristim cristim commented Oct 15, 2026 •

Copy link
Copy Markdown
Member

Add Preview schedule to the Create/Edit Purchase Plan form. It opens a wide target staircase with point selection, UTC dates, a compact summary and collapsed advanced settings. The dialog preserves form values and restores focus when closed.

The preview clearly labels its dates as hypothetical and shows unavailable amounts honestly. Existing Save and Add Purchases actions continue to serve scheduling while the atomic graph editor is developed. This leaf makes no API mutation and does not display saved purchase history.

Validation: 223 affected Jest tests, typecheck, changed-source ESLint and production webpack build. Production-bundle Chromium checks cover Create/Edit at 1440, 1280, 390 and 320 pixels, keyboard/focus behavior, 100 points and zero mutation requests. Browser APIs/auth are fixtures. Exact-head independent review and verification evidence is recorded separately on this PR.

Refs #631

Summary by CodeRabbit

  • New Features
    • Added a “Preview schedule” option when creating or editing a plan. Review hypothetical purchase dates and cumulative targets, with a chart and plan details, before saving.
    • Select schedule steps by clicking or using the keyboard. The preview supports preset and custom schedules and adapts to smaller screens.
    • Closing the preview returns you to the plan form with its values intact.

Show a wide, keyboard-accessible target staircase without saving or
scheduling purchases. Preserve the existing form and purchase actions.

Refs #631
@cristim

cristim commented Oct 15, 2026

Copy link
Copy Markdown
Member Author

Independent exact-head review and verification covers d6ab03735698ce0d526872a3f5e9bc167bdef5dc, tree b3514bf06c989b8965be7335eccf3d105903d392, based on merged date fix 149544fe7d57f1b7b0b4cf651d8fb9f8ba3c7920.

Two retained adversarial source/staged passes and two fresh committed-head cold verification passes found no actionable findings. The original reviewed G1 patch and this transplant are byte-identical; the original branch and artifacts are preserved. Normal commit hooks passed.

The cold verifier independently reproduced 223 affected Jest tests, typecheck, changed-source ESLint, an isolated production build, and Chromium scenarios at 1440, 1280, 390 and 320 pixels. The tests use the actual Create/Edit form, inspect keyboard/focus/inert/Escape behavior, exercise 100 points, and assert zero mutation requests or captured errors. Desktop and phone screenshots were inspected. The build has one existing entrypoint-size warning.

Prior scratch probes each failed an assertion when the disclosure, keyboard behavior or no-write boundary was broken. Their transfer is supported by complete frontend/source and rebuilt-bundle byte identity; no unnecessary broad backend test rerun is claimed.

Browser API/auth responses are fixtures. This leaf previews hypothetical dates and target shares, with unavailable amounts labeled honestly. It does not save schedules or display saved history or approval states. Existing purchase actions remain available while the atomic editor is developed. Owner-authorized independent gpt-6.1-sol medium reviews and realistic local UI proof apply; no live purchase was required or performed. Required CI and normal protections remain separate merge gates.

@cristim cristim added effort/xl Multi-week / refactor impact/many Affects most users priority/p1 Next up; this sprint severity/high Significant harm triaged Item has been triaged type/feat New capability urgency/this-sprint Within the current sprint labels Oct 15, 2026
@coderabbitai

coderabbitai Bot commented Oct 15, 2026 •

Copy link
Copy Markdown
Contributor

Review in Change Stack →

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration
  • Configuration used: Repository: LeanerCloud/cloud-commitments-platform/.coderabbit.yaml
  • Review profile: CHILL
  • Plan: Essentials
  • Run ID: c499b569-db83-4db5-a9b4-7c2cf4f34a3b
📥 Commits

Reviewing files that changed from the base of the PR and between 149544f and d6ab037.

📒 Files selected for processing: 8
  • frontend/src/__tests__/plan-schedule-preview.test.ts
  • frontend/src/__tests__/plans.test.ts
  • frontend/src/index.html
  • frontend/src/lib/calendar-date.ts
  • frontend/src/plan-schedule-preview.ts
  • frontend/src/plans.ts
  • frontend/src/styles/plans.css
  • frontend/tests-e2e/plan-schedule-preview.spec.ts

Included review availability: This review used your included allowance. 0 included reviews remain after this review. Your included PR review attempts over the past 7 days set your current allowance at 1 review per hour.

📝 Walkthrough

The plan modal now opens a hypothetical schedule preview with validated schedule settings, cumulative targets, UTC dates, and interactive step selection. The preview preserves the parent form state. Tests cover unit behavior and Create and Edit flows across viewport sizes.

Changes: Plan schedule preview

Layer / File(s) Summary
Schedule inputs and calculations
frontend/src/plan-schedule-preview.ts, frontend/src/lib/calendar-date.ts, frontend/src/__tests__/plan-schedule-preview.test.ts
The preview validates schedule values and calculates draft steps, cumulative targets, and UTC dates. The date helper calculates the suggested purchase start date. Unit tests cover validation and date calculation.
Preview dialog and step selection
frontend/src/plan-schedule-preview.ts, frontend/src/__tests__/plan-schedule-preview.test.ts
The dialog displays the draft schedule and read-only plan summary. Click and keyboard input select steps. Closing the dialog restores the parent’s prior inert state.
Plan modal integration and responsive validation
frontend/src/index.html, frontend/src/plans.ts, frontend/src/styles/plans.css, frontend/src/__tests__/plans.test.ts, frontend/tests-e2e/plan-schedule-preview.spec.ts
The plan modal includes a preview button, and its handler passes current form values to the preview. Styling adapts the dialog layout to smaller viewports. Tests cover Create and Edit flows and check that previewing does not invoke plan-write APIs.

Priority: ⬇️ Low

Estimated code review effort: 3 (Moderate) | ~25 minutes

Change: Feature

Sequence Diagram(s)

sequenceDiagram
  actor User
  participant PlanModal
  participant setupPlanHandlers
  participant openPlanSchedulePreview
  User->>PlanModal: Select Preview schedule
  PlanModal->>setupPlanHandlers: Dispatch button click
  setupPlanHandlers->>openPlanSchedulePreview: Pass plan fields and parent modal
  openPlanSchedulePreview->>PlanModal: Display preview and set parent inert
  User->>openPlanSchedulePreview: Select a step or close preview
  openPlanSchedulePreview->>PlanModal: Restore prior inert state on close
Loading
Merge Risk: ⚪ Minimal · up to d6ab0

The draft preview matches the existing scheduling behavior, and no issue requiring a fix before merge was identified.

Pre-merge checks: Passed 4 · Failed 1

Failed Failed checks: 1 warning

Check name Status Explanation Resolution
Docstring Coverage Warning Docstring coverage is 40.00% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 5 functions across 6 files. (2 skipped: 2… Write docstrings for the functions missing them to satisfy the coverage threshold.
Passed Passed checks: 4 passed
Check name Status Explanation
Description Check Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check Passed The title clearly and concisely describes the main change: adding a preview for draft purchase schedules.
Linked Issues check Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check Passed Check skipped because no linked issues were found for this pull request.
Full details: Docstring Coverage

Explanation

Docstring coverage is 40.00% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 5 functions across 6 files. (2 skipped: 2 unsupported.)

  • Fix all pre-merge checks with AI
✨ Finishing Touches: 💡 1
📝 Generate docstrings: 💡
  • Commit to this branch
  • Create a new PR
🧪 Generate unit tests (beta)
  • Commit to this branch
  • Create a new PR
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Comment @coderabbitai help to get the list of available commands.

@cristim

cristim commented Oct 15, 2026

Copy link
Copy Markdown
Member Author

Docstring coverage warning disposition: dismissed under the project’s comment conventions. The project uses descriptive names and types, with short comments for non-obvious reasons, and discourages docstrings that repeat a signature. The preset/custom-ramp policy mirror already identifies its cross-language source.

CodeRabbit’s completed exact-head comment metadata reports no actionable comments or specific missing behavioral contract documentation. The inline-comment endpoint is empty. Independent triage agreed in two passes; no source change is needed for this generic coverage warning.

@cristim
cristim merged commit 64ec8b3 into main Oct 15, 2026
28 checks passed
@cristim

cristim commented Oct 15, 2026 •

Copy link
Copy Markdown
Member Author

PR #880 normally squash merged as 64ec8b3fe12de04964837a3c68b1957a2c7dccf4, with parent 149544fe and the exact independently reviewed tree b3514bf0. All required checks were green at the reviewed PR head before merge.

All five post-merge workflows passed: full CI, automatic deployment, frontend E2E, frontend build sentinel and pre-commit. Every CI watcher and the completed PR merge watcher has been reaped.

Read-only deployed identity verification returned HTTP200 from /version, reporting git_sha: 64ec8b3 and build 20261015055918. The running Lambda and corresponding image digest matched the same build/source. This verifies deployed identity; no authenticated live plan or purchase was changed.

The actual Create/Edit form preview was independently verified locally from the production bundle at desktop and phone widths, including dense schedules, keyboard interaction, focus trapping and restoration, and zero API writes. The browser APIs/authentication were fixtures. This leaf adds the disclosed no-write preview; existing Save and Add Purchases actions remain. Atomic graph scheduling and saved history integration remain tracked in #631 and are not claimed complete by this PR.

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

Labels

effort/xl Multi-week / refactor impact/many Affects most users priority/p1 Next up; this sprint severity/high Significant harm triaged Item has been triaged type/feat New capability urgency/this-sprint Within the current sprint

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant