Review: Add board_note_id FK to board_items + data migration

review-315-2026-03-24 Review

review ready

Verdict: READY

Re-review after NEEDS_REFINEMENT. Both issues from the first review have been addressed in refinement comment #6581.

Template Completeness

  • [x] Type
  • [x] Lineage
  • [x] Repo
  • [x] User Story
  • [x] Context
  • [x] File Targets
  • [x] Acceptance Criteria
  • [x] Test Expectations
  • [x] Constraints
  • [x] Checklist
  • [x] Related

File Targets

  • [x] src/pal_e_docs/models.py — verified: BoardItem model at line 252, board_id FK at line 256. No board_note_id column exists yet. Board model at line 234.
  • [x] alembic/versions/ — verified: directory exists with 19 migrations. Last migration is p6k7l8m9n0o1_add_project_updated_at.py.
  • [x] scripts/migrate_boards_to_notes.py — verified: scripts directory exists with 2 existing scripts. New script filename explicitly specified in refinement comment.
  • [x] src/pal_e_docs/routes/boards.py — verified: correctly excluded from scope. Has 16 references to board_id that will need updating in follow-up ticket (#197).

Repo Placement

OK. Forgejo issue filed on forgejo_admin/pal-e-docs, which is the correct repo for model and migration changes.

Dependencies

  • Upstream (satisfied): Board item #314 / Forgejo issue #195 ("Add board to NoteType") — closed and merged. NoteType Literal in schemas.py line 23 includes "board". VALID_STATUSES in routes/notes.py line 62 includes board: ["active", "archived"].
  • Downstream: Board items #316 (#197, "Update board API"), #317 (#198, "Update MCP + SDK + hooks"), #318 (#199, "Drop legacy boards table") — all in backlog, correctly sequenced after this ticket.
  • No conflicts with in_progress items.

Acceptance Criteria

All 5 criteria are testable by an agent:
  • board_note_id column + FK — verifiable via alembic migration + model inspection
  • Board notes created — verifiable via SQL or API query after migration
  • board_note_id populated — verifiable via SQL query
  • Dual FK — verifiable by checking both columns exist and are populated
  • Slug/name/project_id match — verifiable via SQL join or API comparison
Test command pytest tests/test_boards.py -v is valid — file exists at tests/test_boards.py.

Blast Radius

  • board_id is referenced 16 times in routes/boards.py — correctly deferred to issue #197.
  • schemas.py line 245 has board_id: int in BoardItemResponse — will need a new board_note_id field eventually, but that is #197 scope.
  • SDK and MCP repos do not reference board_id directly — no blast radius there.
  • Note slug uniqueness: boards table has its own unique slug constraint (models.py line 238), notes table has its own (line 98). No existing notes have board-prefixed slugs (verified via search). Migration will create them without conflict.
  • Existing test file tests/test_boards.py does not reference board_id directly — no test breakage expected from adding the new column.

Refinement Verification

Both issues from the first review (NEEDS_REFINEMENT) have been addressed in comment #6581:
  • Board count: Corrected from "6 active boards" to "13 existing boards". Verified: list_boards returns exactly 13 boards (IDs 1-14, no ID 9).
  • Script filename: Explicitly specified as scripts/migrate_boards_to_notes.py.

Note for Agent

The issue body was NOT updated — refinements exist only in comment #6581. The executing agent must read the issue comments to get the corrected board count (13, not 6) and the explicit script filename (scripts/migrate_boards_to_notes.py).

Recommendation

No further action needed. Ticket is READY for execution. The agent should read both the issue body and comment #6581 for the corrected values.