feat: propagate phase note title drift in sync_board #238
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!238
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "192-sync-board-title-drift"
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
sync_boardnow detects when a phase board item's title has drifted from its linked note title and propagates the update. Follows the same drift-detection pattern already used bysync_issues. Non-phase items with manually set titles are not touched.Changes
src/pal_e_docs/routes/boards.py: Added title drift detection to the existing phase item reconciliation loop insync_board. When an existing phase board item's title differs from its linked note's title, the title is updated and the item counts towardupdated. Achangedflag (matching thesync_issuespattern) prevents unnecessary writes and correctly separatesskippedvsupdated.tests/test_board_sync.py: Added 3 tests: (1) stale phase title is detected and updated, returning updated=1; (2) current phase title is skipped, returning skipped=3; (3) non-phase items with manual titles are not overwritten by sync.Test Plan
pytest tests/test_board_sync.py -v-- 19 passed)pytest tests/ -v-- 685 passed)ruff checkcleanReview Checklist
Related Notes
project-pal-e-docs-- the project this work belongs toQA Review -- PR #238
Diff Analysis
Production code (
src/pal_e_docs/routes/boards.py):changedflag to the existing phase reconciliation block, matching the exact pattern used bysync_issues(lines 458-478).existing.title != phase.title) is correct -- string comparison catches any title change.for phase in child_phasesloop are affected. Non-phase items (plan, issue, todo) are never entered into this code path, satisfying acceptance criterion 4.changedflag correctly gatesupdatedvsskippedcounters -- title-only drift incrementsupdated, no-change incrementsskipped.Tests (
tests/test_board_sync.py):test_sync_updates_stale_phase_title: Renames a phase note via PUT, re-syncs, asserts updated=1/skipped=2/created=0, then verifies the board item title matches the new note title. Covers the primary user story.test_sync_skips_phase_with_current_title: Double-sync with no changes, asserts all 3 skipped. Confirms idempotency still holds with the new code path.test_sync_does_not_overwrite_non_phase_titles: Manually renames a plan board item, syncs, verifies the plan item keeps its custom title. Confirms sync_board's phase-only scope.Checklist
sync_issuesdrift pattern (issue requirement)Nits
None.
VERDICT: APPROVED
PR #238 Review
DOMAIN REVIEW
Tech stack: Python / FastAPI / SQLAlchemy / pytest
Pattern alignment verified. The
changedflag pattern insync_board(lines 363-374 ofboards.py) now mirrors the identical pattern insync_issues(lines 466-488). Both use:changed = Falseat loop topchanged = Trueif changed: updated += 1/else: skipped += 1This is clean, consistent, and the right structural choice.
Logic correctness. The diff adds exactly 7 net lines of logic (introducing
changedflag, title comparison, and restructuring theupdated/skippedbranching). The behavior is correct:updatedupdatedupdated(not double-counted)skippedNo regressions. The restructuring of the
if existing:block preserves the original column-update behavior exactly while adding the new title-update path. Theelse(create) branch is not touched.BLOCKERS
None.
sync_issuesas a parallel structure, not duplicated auth/security logic.NITS
Docstring update (boards.py:325-330). The
sync_boarddocstring mentions syncing "phase notes from plan notes" and describes column mapping, but does not mention the new title propagation behavior. A one-line addition like "Also propagates title drift from phase notes to their board items." would keep the docstring accurate.Test docstring on
test_sync_skips_phase_with_current_title. This test (line 250) is functionally identical to what the existingtest_sync_column_idempotenttest (if one exists) would do -- it verifies a double-sync with no changes yields all skips. The docstring is clear, but worth noting this also implicitly tests column idempotency, not just title idempotency.SOP COMPLIANCE
192-sync-board-title-driftreferences issue #192project-pal-e-docs)Closes #192PROCESS OBSERVATIONS
changedflag pattern fromsync_issueswas correctly identified and replicated, reducing cognitive load for future readers.VERDICT: APPROVED