feat(followup): implement PLAN-FOLLOWUP.md gap fixes

Complete implementation of 7 slices addressing E2E testing gaps:

Slice 0+1: Wire Actions + ReasonPrompt
- FocusView now uses useActions hook instead of direct act() calls
- Added pendingAction state pattern for skip/defer/complete actions
- ReasonPrompt integration with proper confirm/cancel flow
- Tags support in DecisionEntry interface

Slice 2: Drag Reorder UI
- Installed @dnd-kit (core, sortable, utilities)
- QueueView with DndContext, SortableContext, verticalListSortingStrategy
- SortableQueueItem wrapper component using useSortable hook
- pendingReorder state with ReasonPrompt for reorder reasons
- Cmd+Up/Down keyboard shortcuts for accessibility
- Fixed: Store item ID in PendingReorder to avoid stale queue reference

Slice 3: System Tray Integration
- tray.rs with TrayState, setup_tray, toggle_window_visibility
- Menu with Show/Quit items
- Left-click toggles window visibility
- update_tray_badge command updates tooltip with item count
- Frontend wiring in AppShell

Slice 4: E2E Test Updates
- Fixed test selectors for InboxView, Queue badge
- Exposed inbox store for test seeding

Slice 5: Staleness Visualization
- Already implemented in computeStaleness() with tests

Slice 6: Quick Wiring
- onStartBatch callback wired to QueueView
- SyncStatus rendered in nav area
- SettingsView renders Settings component

Slice 7: State Persistence
- settings-store with hydrate/update methods
- Tauri backend integration via read_settings/write_settings
- AppShell hydrates settings on mount

Bug fixes from code review:
- close_bead now has error isolation (try/catch) so decision logging
  and queue advancement continue even if bead close fails
- PendingReorder stores item ID to avoid stale queue reference

E2E tests for all ACs (tests/e2e/followup-acs.spec.ts):
- AC-F1: Drag reorder (4 tests)
- AC-F2: ReasonPrompt integration (7 tests)
- AC-F5: Staleness visualization (3 tests)
- AC-F6: Batch mode (2 tests)
- AC-F7: SyncStatus (2 tests)
- ReasonPrompt behavior (3 tests)

Tests: 388 frontend + 119 Rust + 32 E2E all passing

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
teernisse
2026-02-26 11:26:42 -05:00
parent 5078cb506a
commit f5ce8a9091
44 changed files with 5268 additions and 625 deletions

View File

@@ -154,9 +154,10 @@ test.describe("Mission Control E2E", () => {
await expect(page.getByText("All Clear")).toBeVisible();
});
test("shows Inbox placeholder", async ({ page }) => {
test("shows Inbox view with zero state", async ({ page }) => {
await page.getByRole("button", { name: "Inbox" }).click();
await expect(page.getByText("Inbox view coming in Phase 4b")).toBeVisible();
await expect(page.getByText("Inbox Zero")).toBeVisible();
await expect(page.getByText("All caught up!")).toBeVisible();
});
test("Queue tab shows item count badge when store has data", async ({
@@ -171,7 +172,9 @@ test.describe("Mission Control E2E", () => {
}
// 1 current + 2 queue = 3
await expect(page.getByText("3")).toBeVisible();
const badge = page.getByTestId("queue-badge");
await expect(badge).toBeVisible();
await expect(badge).toHaveText("3");
});
});
@@ -234,4 +237,102 @@ test.describe("Mission Control E2E", () => {
await expect(html).toHaveClass(/dark/);
});
});
test.describe("Data Flow Smoke Test", () => {
test("lore items display correctly in Focus and Queue views", async ({
page,
}) => {
// This test validates the data path from transformed lore items to UI.
// Items are seeded with the exact shape returned by useLoreItems.
try {
await exposeStores(page);
} catch {
test.skip();
return;
}
// Seed with items matching the lore transformation output
await page.evaluate(() => {
const w = window as Record<string, unknown>;
const focusStore = w.__MC_FOCUS_STORE__ as {
setState: (state: Record<string, unknown>) => void;
};
if (!focusStore) return;
focusStore.setState({
current: {
// MR review item from lore
id: "mr_review:platform::core:200",
title: "Add user authentication middleware",
type: "mr_review",
project: "platform/core",
url: "https://gitlab.com/platform/core/-/merge_requests/200",
iid: 200,
updatedAt: new Date().toISOString(),
contextQuote: null,
requestedBy: "alice", // This is set by lore for reviews
snoozedUntil: null,
},
queue: [
{
// Issue from lore
id: "issue:platform::api:42",
title: "API timeout on large requests",
type: "issue",
project: "platform/api",
url: "https://gitlab.com/platform/api/-/issues/42",
iid: 42,
updatedAt: new Date(
Date.now() - 2 * 24 * 60 * 60 * 1000
).toISOString(),
contextQuote: null,
requestedBy: null, // Issues don't have requestedBy
snoozedUntil: null,
},
{
// Authored MR from lore
id: "mr_authored:platform::core:150",
title: "Refactor database connection pooling",
type: "mr_authored",
project: "platform/core",
url: "https://gitlab.com/platform/core/-/merge_requests/150",
iid: 150,
updatedAt: new Date(
Date.now() - 5 * 24 * 60 * 60 * 1000
).toISOString(),
contextQuote: null,
requestedBy: null,
snoozedUntil: null,
},
],
isLoading: false,
error: null,
});
});
// Verify Focus view displays the current item correctly
await expect(
page.getByText("Add user authentication middleware")
).toBeVisible();
await expect(page.getByText("MR REVIEW")).toBeVisible();
await expect(page.getByText("!200 in platform/core")).toBeVisible();
// Navigate to Queue to verify all items render
await page.getByRole("button", { name: "Queue" }).click();
// Check badge shows correct count (1 current + 2 queue = 3)
const badge = page.getByTestId("queue-badge");
await expect(badge).toHaveText("3");
// Verify issue renders with correct formatting
await expect(page.getByText("API timeout on large requests")).toBeVisible();
await expect(page.getByText("#42")).toBeVisible();
// Verify authored MR renders
await expect(
page.getByText("Refactor database connection pooling")
).toBeVisible();
await expect(page.getByText("!150")).toBeVisible();
});
});
});