Skip to content

Conversation

Copy link
Contributor

Copilot AI commented Dec 2, 2025

Closes #219

Implements a recurring transactions system that generates virtual transactions projected 15 months into the future, with lifecycle management through Create → Schedule → Complete actions.

Data Model

  • RecurringTransaction: Rule definition with frequency (daily/weekly/bi-weekly/monthly/yearly), start date, optional end date
  • RecurringOccurrence: Links recurringTransactionId + originalDate → realizedTransactionId for deduplication

Store

  • recurringTransactions slice: CRUD for recurring rules
  • recurringOccurrences slice: Tracks realized occurrences to prevent duplicate virtual transactions

UI Components

  • RecurringTransactionsPanel: Sidebar with Add/Edit/Delete for rules
  • RecurringTransactionModal: Form with frequency settings and optional end date
  • ActionCell: Context-aware button column
    • Virtual → Create (creates Planned transaction)
    • Planned → Schedule
    • Scheduled/Pending → Complete

Ledger Integration

  • Virtual transactions merged with real transactions, sorted by date
  • Running balance includes virtual transactions
  • Visual distinction: purple background, italic text, "Recurring" chip
  • Deduplication via occurrence tracking map

Screenshots

Recurring Panel in Sidebar
Recurring Panel

Virtual Transactions in Ledger
Virtual Transactions

Realized Transaction with Schedule Button
Realized Transaction

Original prompt

This section details on the original issue you should resolve

<issue_title>Recurring Transactions</issue_title>
<issue_description>Overview
Implement a "Recurring Transactions" system that allows users to define schedules for future income and expenses. These rules generate "virtual" transactions in the Ledger view, projecting the account status up to 15 months into the future. Users can interact with these virtual items to instantiate them into real transactions and move them through the standard lifecycle.

Functional Requirements

  1. Recurring Transactions Management (Sidebar)
    Location: Add a new sidebar to the Accounts view (similar to the existing Statements sidebar).
    Functionality:
    List all active recurring transaction rules for the currently selected account.
    Provide an interface to Add, Edit, and Delete recurring rules.
    Add/Edit Modal: Fields should mirror the existing transaction fields but include frequency settings (Daily, Weekly, Bi-Weekly, Monthly, Yearly) and an optional End Date.
  2. Ledger View Integration ("Virtual" Transactions)
    Projection Logic:
    The Ledger must calculate and display "virtual" transactions based on active recurring rules.
    Forecast Range: Project transactions from Today up to 15 months into the future.
    Future Only: Do not generate virtual transactions for dates in the past.
    Display & Calculations:
    Virtual transactions must be visually integrated into the Ledger table.
    Balance: They must be included in the running balance calculations.
    Statements: They must be included in statement groupings and dividers.
    Deduplication:
    A virtual transaction should not be displayed if it has already been "realized" (created) as a real transaction. This check must be performed using the Occurrence Tracking map (see Data Model below).
  3. Ledger Action Column
    New UI Element: Add a new column to the LedgerTable, positioned to the right of the Status column.
    Button Logic:
    Status: Recurring (Virtual): Display button "Create".
    Action: Creates a real transaction in the store with status Planned and records the occurrence.
    Status: Planned: Display button "Schedule".
    Action: Updates transaction status to Scheduled.
    Status: Scheduled or Pending: Display button "Complete".
    Action: Updates transaction status to Complete.
    Status: Complete: Button should be Hidden (or replaced with a static indicator).
    Technical Implementation Details
    Data Model
    RecurringTransaction Schema (New Store Slice)

Stores the rule definition.
Fields: id, accountId, description, amount, categoryId, frequency, startDate, endDate (optional).
RecurringTransactionOccurrence Schema (New Store Slice)

Purpose: Tracks which specific scheduled occurrences have been turned into real transactions. This allows the real transaction to be modified (e.g., date changed by a few days) without the system "forgetting" that the schedule for that month was already met.
Structure: Map or Table linking recurringTransactionId + originalDate → realizedTransactionId.
Cleanup: Implement logic to prune occurrence records for dates that have passed, as virtual transactions are only generated for the future.
Logic Flow
Render Ledger:

Fetch real transactions.
Fetch recurring rules.
Generate list of potential occurrence dates for the next 15 months.
Filter out any dates found in the RecurringTransactionOccurrence store.
Merge remaining "virtual" transactions with real transactions.
Sort by date and calculate running balance.
"Create" Action:

User clicks "Create" on a virtual row (e.g., Rent for Jan 1st).
System creates a new Transaction (Status: Planned).
System creates a RecurringTransactionOccurrence entry: [{ ruleId: 'rent-rule', originalDate: '2025-01-01', realizedId: 'new-tx-uuid' }](vscode-file://vscode-app/Applications/Visual%20Studio%20Code.app/Contents/Resources/app/out/vs/code/electron-browser/workben...


💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.

Copilot AI and others added 2 commits December 2, 2025 03:47
…n projection

- Add recurringTransactions and recurringOccurrences store slices
- Add validation schemas for recurring transactions and occurrences
- Create RecurringTransactionsPanel sidebar component
- Create RecurringTransactionModal for add/edit
- Add ActionCell component with Create/Schedule/Complete buttons
- Integrate virtual transactions into LedgerTable with 15-month forecast
- Implement deduplication via occurrence tracking
- Update LedgerHeader to include Action column
- Bump version to 2.1.0-rc.1

Co-authored-by: jwaspin <6432180+jwaspin@users.noreply.github.com>
…ove code duplication

- Replace HTML td element with MUI TableCell in LedgerRow
- Import generateOccurrenceDates from store generators instead of duplicating

Co-authored-by: jwaspin <6432180+jwaspin@users.noreply.github.com>
Copilot AI changed the title [WIP] Implement recurring transactions management system feat: implement recurring transactions system with virtual transaction projection Dec 2, 2025
Copilot AI requested a review from jwaspin December 2, 2025 03:55
@jwaspin jwaspin changed the base branch from main to release/2-1-0 December 7, 2025 23:47
@jwaspin jwaspin marked this pull request as ready for review December 7, 2025 23:47
@jwaspin jwaspin added this to the Version 2.1.0 milestone Dec 8, 2025
@jwaspin jwaspin added the enhancement New feature or request label Dec 8, 2025
@cloudflare-workers-and-pages
Copy link

cloudflare-workers-and-pages bot commented Dec 20, 2025

Deploying lucaledger with  Cloudflare Pages  Cloudflare Pages

Latest commit: b129402
Status: ✅  Deploy successful!
Preview URL: https://766084d2.lucaledger.pages.dev
Branch Preview URL: https://copilot-add-recurring-transa.lucaledger.pages.dev

View logs

@cloudflare-workers-and-pages
Copy link

cloudflare-workers-and-pages bot commented Dec 20, 2025

Deploying beta-lucaledger with  Cloudflare Pages  Cloudflare Pages

Latest commit: b129402
Status: ✅  Deploy successful!
Preview URL: https://2ebd3717.beta-lucaledger.pages.dev
Branch Preview URL: https://copilot-add-recurring-transa.beta-lucaledger.pages.dev

View logs

@jwaspin jwaspin merged commit 9500bb6 into release/2-1-0 Dec 20, 2025
2 checks passed
@jwaspin jwaspin deleted the copilot/add-recurring-transactions-system branch December 20, 2025 03:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Feature: Recurring Transactions

2 participants