feat: add note_type, status, parent_note_id, position columns to notes table #60

Closed
opened 2026-03-02 05:50:17 +00:00 by forgejo_admin · 0 comments

Plan

plan-2026-03-01-note-decomposition — Phase 2 (Schema)

Repo

pal-e-docs — Forgejo

User Story

As an AI agent managing plans, I need notes to have structured type, status, parent, and position columns so I can query phases across plans, update statuses without rewriting content, and compose parent-child note hierarchies.

Acceptance Criteria

  • Alembic migration adds 4 nullable columns: note_type, status, parent_note_id (FK, RESTRICT), position
  • Index on (parent_note_id, position)
  • SQLAlchemy model + Pydantic schemas updated
  • note_type validated against 11-value Literal enum
  • status validated per note_type
  • Self-parent check (parent_note_id != id)
  • Parent-type map: {"phase": ["plan"]}
  • list_notes accepts note_type, status, parent_slug query params
  • create_note / update_note accept and validate new fields
  • All existing 172 tests pass, new tests cover all validation paths

Additional Information

Core schema change for note decomposition. All columns nullable for backward compatibility. No data backfill — existing notes stay NULL. See note-conventions for the enum values and status-per-type spec. See doc-pal-e-docs-schema for the ERD.

Checklist

  • PR opened
  • Tests cover acceptance criteria
  • Docs updated if needed
  • plan-2026-03-01-note-decomposition — Phase 2
  • issue-pal-e-docs-note-decomposition-schema — pal-e-docs issue note
  • note-conventions — the spec
  • doc-pal-e-docs-schema — the ERD
### Plan `plan-2026-03-01-note-decomposition` — Phase 2 (Schema) ### Repo `pal-e-docs` — Forgejo ### User Story As an AI agent managing plans, I need notes to have structured type, status, parent, and position columns so I can query phases across plans, update statuses without rewriting content, and compose parent-child note hierarchies. ### Acceptance Criteria - Alembic migration adds 4 nullable columns: `note_type`, `status`, `parent_note_id` (FK, RESTRICT), `position` - Index on `(parent_note_id, position)` - SQLAlchemy model + Pydantic schemas updated - `note_type` validated against 11-value Literal enum - `status` validated per note_type - Self-parent check (`parent_note_id != id`) - Parent-type map: `{"phase": ["plan"]}` - `list_notes` accepts `note_type`, `status`, `parent_slug` query params - `create_note` / `update_note` accept and validate new fields - All existing 172 tests pass, new tests cover all validation paths ### Additional Information Core schema change for note decomposition. All columns nullable for backward compatibility. No data backfill — existing notes stay NULL. See `note-conventions` for the enum values and status-per-type spec. See `doc-pal-e-docs-schema` for the ERD. ### Checklist - [ ] PR opened - [ ] Tests cover acceptance criteria - [ ] Docs updated if needed ### Related - `plan-2026-03-01-note-decomposition` — Phase 2 - `issue-pal-e-docs-note-decomposition-schema` — pal-e-docs issue note - `note-conventions` — the spec - `doc-pal-e-docs-schema` — the ERD
Sign in to join this conversation.
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
forgejo_admin/pal-e-api#60
No description provided.