Add explicit PRD delivery order and fix epic sort ordering - #81
Merged
Conversation
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.
Uh oh!
There was an error while loading. Please reload this page.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for freeto join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
order:PRD frontmatter field (falls back to the epic README's## PRD Indextable position, then filename) so a PRD's shown delivery order no longer depends on alphabetical filename luck.PrdReorderDialog.tsx), backed by two explicit backend commands:migrate_prd_order(backfill missing values, idempotent) andset_prd_order(full permutation-validated rewrite). Deliberately kept off the read path — an earlier version auto-backfilled on everyread_prdscall and corrupted this repo's owndocs/epics/**/*.mdthe momentcargo test's dogfood test parsed real epics; reverted and redesigned as explicit, user-triggered writes only.EpicsView.tsx's cross-project milestone grouping claimed to already be sorted (only true per-project — merging projects preserved first-seen insertion order), andEpicsPanel.tsx's per-project epic list had no sort at all. Both now share onesortEpicshelper (lib/utils.ts): status-primary (in_progress→proposed→abandoned→completed), milestone ascending (numeric, not lexicographic) secondary.pointerdown/pointermove/pointerup+ pointer capture) instead of HTML5draggable/dragover/drop— Tauri's native window-level drag-drop handling (already relied on byChat.tsxattachments andImportFlow.tsxrepo 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 inepic.rs, including newset_prd_order/migrate_prd_order/read-only-guard tests), 0 failedcargo clippy --lib -- -D warningscleannpx tsc --noEmitclean