Notes field per entry #14

Merged
claude-code merged 4 commits from feat/13-notes-field into main 2026-04-17 12:54:25 -06:00
Collaborator

Closes #13 (will be manually closed on merge).

Summary

Optional free-text notes on every entry: budget-side and month-side. Snapshot copies notes through to the month. Notes changes do not count as "edited" deviation since they are annotation, not plan drift.

  • notes TEXT NULL (String(1024)) added to entry and month_entry via alembic batch_alter_table
  • create_month copies entry.notes into each fresh month_entry.notes
  • Budget add form accepts an optional notes input
  • New POST /entries/{id}/notes endpoint for editing an existing budget entry's notes without delete-and-recreate
  • Month add form accepts optional notes
  • Existing POST /month/{year_month}/entries/{id} now accepts a notes field alongside name / planned / applied
  • UI: a secondary row under each entry holds a muted notes input with dashed-underline-on-hover styling; the add form grows an optional notes input spanning the form row
  • Blank / whitespace notes normalise to NULL

Test plan

  • uv run pytest passes (82/82, +14 new)
  • uv run alembic upgrade head applies the new migration and downgrade -1 rolls back cleanly
  • Live smoke on throwaway DB:
    • Create entry with notes, notes visible on the page
    • POST /entries/{id}/notes updates the budget notes (verified with URL-encoded form data)
    • Clearing notes sets NULL and the page renders blank
    • create_month carries notes into the month snapshot
    • Updating notes on a month entry does not flip state-unchanged to state-edited

Out of scope

  • Full inline edit of name / amount on the budget page (separate consideration)
  • Markdown / rich text in notes
  • Search by notes content
Closes #13 (will be manually closed on merge). ## Summary Optional free-text notes on every entry: budget-side and month-side. Snapshot copies notes through to the month. Notes changes do not count as "edited" deviation since they are annotation, not plan drift. * `notes TEXT NULL (String(1024))` added to `entry` and `month_entry` via alembic `batch_alter_table` * `create_month` copies `entry.notes` into each fresh `month_entry.notes` * Budget add form accepts an optional notes input * New `POST /entries/{id}/notes` endpoint for editing an existing budget entry's notes without delete-and-recreate * Month add form accepts optional notes * Existing `POST /month/{year_month}/entries/{id}` now accepts a `notes` field alongside name / planned / applied * UI: a secondary row under each entry holds a muted notes input with dashed-underline-on-hover styling; the add form grows an optional notes input spanning the form row * Blank / whitespace notes normalise to NULL ## Test plan * [x] `uv run pytest` passes (82/82, +14 new) * [x] `uv run alembic upgrade head` applies the new migration and `downgrade -1` rolls back cleanly * [x] Live smoke on throwaway DB: * [x] Create entry with notes, notes visible on the page * [x] `POST /entries/{id}/notes` updates the budget notes (verified with URL-encoded form data) * [x] Clearing notes sets NULL and the page renders blank * [x] `create_month` carries notes into the month snapshot * [x] Updating notes on a month entry does not flip `state-unchanged` to `state-edited` ## Out of scope * Full inline edit of name / amount on the budget page (separate consideration) * Markdown / rich text in notes * Search by notes content
claude-code added 4 commits 2026-04-17 12:51:57 -06:00
Free-text annotation up to 1024 chars. Nullable so existing rows need
no backfill; an empty or whitespace-only input will be normalised to
NULL in the service layer. Alembic batch_alter_table handles the
SQLite table rebuild automatically.

Refs #13

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
add_entry and add_month_entry accept an optional notes keyword. A
new set_entry_notes function updates a single budget entry's notes.
update_month_entry gains a notes parameter guarded by a sentinel so
callers can distinguish "do not touch notes" from "clear to NULL".
create_month copies entry.notes into each freshly snapshotted
month_entry. Blank / whitespace notes normalise to NULL.

Refs #13

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Each entry row gains a secondary notes row with an inline-editable
text input. Budget entries post to a new /entries/{id}/notes
endpoint; month entries reuse the existing update route. Add forms
gain an optional "notes (optional)" input that spans the form row.
Notes render muted with a dashed underline on hover to signal
editability without cluttering the layout. Changing notes on a
month row does not flip the deviation state since the financial
values are unchanged.

Refs #13

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Service tests hit create, update, missing-id, blank-collapses-to-null,
and the snapshot copying behaviour. Route tests hit both pages'
create flows, the budget notes endpoint, and the month update route.
A dedicated assertion confirms that changing notes on a month entry
does not flip the deviation state: notes are free-form annotation,
not a signal of plan drift.

Refs #13

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
claude-code merged commit d040b7b66c into main 2026-04-17 12:54:25 -06:00
claude-code referenced this pull request from a commit 2026-04-17 12:54:26 -06:00
Sign in to join this conversation.
No reviewers
No labels
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference: archeious/quartermaster#14
No description provided.