fix: align board sync test fixtures with project-based phase discovery #234
No reviewers
Labels
No labels
domain:backend
domain:devops
domain:frontend
status:approved
status:in-progress
status:needs-fix
status:qa
type:bug
type:devops
type:feature
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
forgejo_admin/pal-e-api!234
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "233-fix-board-sync-test-fixtures"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Summary
The sync_board refactor (PR #210) changed phase discovery from board-item-based to project-note-based (Note.project_id == board.project_id), but test fixtures created plan notes without project_slug, leaving them with project_id=NULL and invisible to sync. This caused all 12 sync-dependent tests to fail.
Changes
tests/test_board_sync.py: Addedproject_slugparameter to_create_notehelper so notes can be associated with projectstests/test_board_sync.py: Passproject_slug="proj-sync"when creating plan note inTestBoardSync._setuptests/test_board_sync.py: Passproject_slug="proj-hook"when creating plan note inTestUpdateNotePhaseHook._setupTest Plan
test_board_sync.pypass (12 previously failing, 4 already passing)Review Checklist
Related Notes
pal-e-api— the project this work belongs toPR #234 Review
DOMAIN REVIEW
Stack: Python / FastAPI / SQLAlchemy / pytest
Root cause analysis verified. PR #210 changed
sync_boardto discover plan notes viaNote.project_id == board.project_id(line 336 ofroutes/boards.py). The old test fixtures created plan notes withoutproject_slug, soproject_idwas NULL. The queryNote.project_id == board.project_idwould never match these orphaned plan notes, causing sync to return 0 phases across all dependent tests.Fix correctness verified. The
NoteCreatePydantic schema (schemas.py:108) acceptsproject_slug: str | None = None. Thecreate_noteendpoint (routes/notes.py:721-726) resolvesproject_slugtoproject_idvia a Project lookup. Addingproject_slugto the test fixture helper and passing it in both_setupmethods correctly wires plan notes to their projects sosync_boarddiscovers them.12-test failure count verified. I manually traced which tests depend on sync discovering phases:
test_sync_board_not_foundwhich tests 404, andtest_sync_no_plan_itemswhich creates its own empty project)test_update_phase_without_board_item_is_noopwhich tests the no-board-item path, andtest_update_non_phase_note_does_not_touch_boardwhich only checks the plan board item added directly via POST)No side effects. The
_create_notehelper's newproject_slugparameter defaults toNone, so all existing callers that do not pass it are unaffected. The two_setupmethods are the only call sites that changed. Phase note creation (child notes under the plan) correctly does NOT passproject_slug-- phases inherit their project association through parent_note_id, not through direct project_id assignment, and sync discovers them viaNote.parent_note_id == plan_note.id.BLOCKERS
None.
NITS
None. The diff is minimal, correctly formatted, and the comment on line 54 (
# must belong to project so sync_board discovers it) documents the "why" clearly.SOP COMPLIANCE
233-fix-board-sync-test-fixturesreferences #233)Closes #233PROCESS OBSERVATIONS
_create_notecallers in the test suite.VERDICT: APPROVED