Skip to content

Add explicit PRD delivery order and fix epic sort ordering - #81

Merged
suprie merged 2 commits into
mainfrom
claude/debug-vite-components-a36688
Aug 6, 2026
Merged

Add explicit PRD delivery order and fix epic sort ordering#81
suprie merged 2 commits into
mainfrom
claude/debug-vite-components-a36688

Conversation

@suprie

Copy link
Copy Markdown
Owner

Summary

  • Adds an optional order: PRD frontmatter field (falls back to the epic README's ## PRD Index table position, then filename) so a PRD's shown delivery order no longer depends on alphabetical filename luck.
  • New drag-to-reorder dialog in the per-project Epics tab (PrdReorderDialog.tsx), backed by two explicit backend commands: migrate_prd_order (backfill missing values, idempotent) and set_prd_order (full permutation-validated rewrite). Deliberately kept off the read path — an earlier version auto-backfilled on every read_prds call and corrupted this repo's own docs/epics/**/*.md the moment cargo test's dogfood test parsed real epics; reverted and redesigned as explicit, user-triggered writes only.
  • Fixes two real epic-ordering bugs found along the way: EpicsView.tsx's cross-project milestone grouping claimed to already be sorted (only true per-project — merging projects preserved first-seen insertion order), and EpicsPanel.tsx's per-project epic list had no sort at all. Both now share one sortEpics helper (lib/utils.ts): status-primary (in_progressproposedabandonedcompleted), milestone ascending (numeric, not lexicographic) secondary.
  • The reorder dialog uses pointer events (pointerdown/pointermove/pointerup + pointer capture) instead of HTML5 draggable/dragover/drop — Tauri's native window-level drag-drop handling (already relied on by Chat.tsx attachments and ImportFlow.tsx repo import) intercepts real OS drag gestures before the webview's JS sees them, so the native-DnD version dragged visually but never persisted an order.

Why

User-reported: PRDs were rendering in the wrong delivery order (alphabetical filename, ignoring the epic's actual planned sequence), and epics themselves weren't consistently sorted by status/milestone across the two views that list them.

Test plan

  • cargo test — 596 passed (61 in epic.rs, including new set_prd_order/migrate_prd_order/read-only-guard tests), 0 failed
  • cargo clippy --lib -- -D warnings clean
  • npx tsc --noEmit clean
  • Isolated Node runs of the extracted sort logic against representative/screenshot-derived data, confirming both ordering fixes
  • Live click-through in the running Tauri app — not verified this session (dev-server port held by another session throughout; the drag-to-reorder fix specifically needs the real webview since the bug it fixes only reproduces inside Tauri's native window, not a plain browser preview)

Adds an optional `order:` PRD frontmatter field (falling back to the
README's PRD Index table, then filename) so a PRD's delivery position no
longer depends on alphabetical filename luck. Ships with a drag-to-reorder
dialog in the per-project Epics tab, backed by two explicit backend
commands (migrate_prd_order for backfill, set_prd_order for a full
permutation-validated rewrite) — kept off the read path after an earlier
version's auto-backfill-on-read corrupted this repo's own docs/epics
files via cargo test's dogfood test.
Also fixes two real epic-ordering bugs found in the process: the
cross-project Epics view's milestone grouping wasn't actually sorted
across projects despite a comment claiming it was, and the per-project
Epics tab had no epic sort at all. Both now share one sortEpics helper
(status-primary, milestone-ascending secondary).
The reorder dialog uses pointer events instead of HTML5 drag-and-drop,
since Tauri's native window drag-drop handling (relied on elsewhere for
file attachments/import) swallows dragover/drop before the page sees them.
CI caught an unformatted line I missed locally.
@suprie
suprie merged commit de0d7f3 into mainAug 6, 2026
2 checks passed
Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant

@suprie