Refactor sync_board to discover plans from notes, not board items #208

Closed
opened 2026-03-24 18:08:35 +00:00 by forgejo_admin · 1 comment

Type

Feature

Lineage

Standalone — board-pal-e-docs kanban unification. Blocks: #203 (remove plan items from boards)

Repo

forgejo_admin/pal-e-docs

User Story

As the platform
I want sync_board to discover plan→phase relationships from notes hierarchy
So that plan items can be removed from boards without breaking phase sync

Context

POST /boards/{slug}/sync currently finds phases by: query plan-type board items → get note_slug → find child phase notes → create/update phase board items. If plan items are removed from boards (#203), sync returns 0/0/0 silently.

The fix: query plan notes directly from the project (notes where note_type="plan" and project_id=board.project_id) instead of from plan board items. Plan notes still exist in the database — they're just not on the board anymore.

File Targets

Files to modify:

  • src/pal_e_docs/routes/boards.py — refactor sync endpoint (~line 251) to query plan notes from project instead of plan board items

Files NOT to touch:

  • Board item CRUD endpoints — unchanged
  • sync-issues endpoint — unchanged (queries Forgejo, not plan items)

Acceptance Criteria

  • sync_board works correctly with zero plan items on the board
  • sync_board works correctly with plan items still on the board (backwards compatible)
  • Phase items are still created/updated correctly from plan child notes
  • /update-docs chain still works end-to-end after sync refactor

Test Expectations

  • Remove plan items from a test board → run sync → verify phases still sync
  • Run existing test suite: pytest tests/test_boards.py -v

Constraints

  • Must be backwards compatible — works with or without plan items on board
  • Query pattern: SELECT notes WHERE note_type='plan' AND project_id=board.project_id

Checklist

  • PR opened
  • Tests pass
  • No unrelated changes
  • #203 (blocked by this) — remove plan items from boards
  • convention-kanban-over-plans — the philosophy driving this change
### Type Feature ### Lineage Standalone — board-pal-e-docs kanban unification. Blocks: #203 (remove plan items from boards) ### Repo `forgejo_admin/pal-e-docs` ### User Story As the platform I want sync_board to discover plan→phase relationships from notes hierarchy So that plan items can be removed from boards without breaking phase sync ### Context `POST /boards/{slug}/sync` currently finds phases by: query plan-type board items → get note_slug → find child phase notes → create/update phase board items. If plan items are removed from boards (#203), sync returns 0/0/0 silently. The fix: query plan notes directly from the project (`notes where note_type="plan" and project_id=board.project_id`) instead of from plan board items. Plan notes still exist in the database — they're just not on the board anymore. ### File Targets Files to modify: - `src/pal_e_docs/routes/boards.py` — refactor sync endpoint (~line 251) to query plan notes from project instead of plan board items Files NOT to touch: - Board item CRUD endpoints — unchanged - sync-issues endpoint — unchanged (queries Forgejo, not plan items) ### Acceptance Criteria - [ ] sync_board works correctly with zero plan items on the board - [ ] sync_board works correctly with plan items still on the board (backwards compatible) - [ ] Phase items are still created/updated correctly from plan child notes - [ ] /update-docs chain still works end-to-end after sync refactor ### Test Expectations - [ ] Remove plan items from a test board → run sync → verify phases still sync - [ ] Run existing test suite: `pytest tests/test_boards.py -v` ### Constraints - Must be backwards compatible — works with or without plan items on board - Query pattern: `SELECT notes WHERE note_type='plan' AND project_id=board.project_id` ### Checklist - [ ] PR opened - [ ] Tests pass - [ ] No unrelated changes ### Related - #203 (blocked by this) — remove plan items from boards - `convention-kanban-over-plans` — the philosophy driving this change
Author
Owner

Ticket Review Verdict: READY

Reviewed by agent (review-327-2026-03-24). All 11 template sections present. File targets verified — sync_board function at line 323 (not ~251 as stated). Dependencies correct (#203 blocked by this). Existing test suite at tests/test_board_sync.py has 11 tests — new tests needed for "no plan board item" path.

One nit: line reference correction (323, not 251). Non-blocking.

Ready for next_up → dispatch.

## Ticket Review Verdict: READY Reviewed by agent (review-327-2026-03-24). All 11 template sections present. File targets verified — sync_board function at line 323 (not ~251 as stated). Dependencies correct (#203 blocked by this). Existing test suite at tests/test_board_sync.py has 11 tests — new tests needed for "no plan board item" path. One nit: line reference correction (323, not 251). Non-blocking. Ready for next_up → dispatch.
forgejo_admin 2026-03-24 20:30:38 +00:00
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#208
No description provided.