From 064116565de9c965238590b59f91edba858cc399 Mon Sep 17 00:00:00 2001 From: Dinesh Pandiyan Date: Mon, 19 Oct 2026 15:45:03 +1100 Subject: [PATCH] feat: sort current reviews by code activity --- DESIGN.md | 12 +- apps/web/src/Header.tsx | 3 +- apps/web/src/ProjectsNav.tsx | 63 +++---- apps/web/src/context-activity.ts | 23 +++ apps/web/src/project-nav.ts | 46 +++-- apps/web/src/session-context.tsx | 47 ++++- apps/web/src/use-seen-streams.ts | 40 ++++ apps/web/test/browser/local-workspace.spec.ts | 175 +++++++++++++++++- apps/web/test/project-nav.test.ts | 160 ++++++++++++++++ docs/architecture.md | 9 + docs/development.md | 16 +- docs/release.md | 5 +- docs/system.md | 34 +++- internal/collector/activity_test.go | 125 +++++++++++++ internal/collector/changed_test.go | 101 ++++++++++ internal/collector/collector.go | 9 +- internal/contextservice/activity.go | 34 ++++ internal/contextservice/activity_test.go | 23 +++ internal/contextservice/catalog_test.go | 4 +- internal/contextservice/service.go | 2 +- internal/contextservice/service_test.go | 2 +- internal/diffsource/git.go | 12 +- internal/diffsource/git_test.go | 26 +++ internal/diffsource/identity.go | 22 +++ internal/diffsource/worktrees.go | 52 ++++-- internal/ingestion/model.go | 1 + internal/ingestion/validate.go | 3 + internal/ingestion/validate_test.go | 1 + internal/reviewdata/model.go | 3 + internal/reviewstore/activity_test.go | 143 ++++++++++++++ internal/reviewstore/catalog.go | 9 +- internal/reviewstore/queue_test.go | 3 +- internal/serverapp/capabilities_test.go | 12 +- internal/serverapp/collection.go | 29 ++- internal/serverapp/collection_test.go | 123 ++++++++++++ packages/api/openapi.yaml | 7 +- packages/api/src/schema.d.ts | 7 +- 37 files changed, 1280 insertions(+), 106 deletions(-) create mode 100644 apps/web/src/context-activity.ts create mode 100644 apps/web/src/use-seen-streams.ts create mode 100644 internal/collector/activity_test.go create mode 100644 internal/contextservice/activity.go create mode 100644 internal/contextservice/activity_test.go create mode 100644 internal/reviewstore/activity_test.go create mode 100644 internal/serverapp/collection_test.go diff --git a/DESIGN.md b/DESIGN.md index 12013048..69dd8f8e 100644 --- a/DESIGN.md +++ b/DESIGN.md @@ -240,8 +240,10 @@ such detail into a token. New layout spacing must use the scale. ghost “Browse all reviews” icon action that opens the review picker, and a close action in the modal drawer only. Below it: a “Search projects” field styled like the file filter that filters current streams in place (Escape - clears it; matching repositories expand), then repositories ordered by latest - arrival. + clears it; matching repositories expand), then repositories ordered by their + most active visible stream. Streams sort by estimated code activity, with + captured collection time as the fallback and stable identity ties. Repository + and stream ages describe this activity; snapshot history retains its chronology. Repository rows match tree-row height with a chevron, repository icon, medium name and muted monospace age. Stream rows indent under them: branch icon, name, trailing monospace changed-file count, and a muted metadata line (worktree, @@ -253,6 +255,12 @@ such detail into a token. New layout spacing must use the scale. Collapse state persists per browser. - A newer head for the viewed stream shows a one-line `--accent-bg` notice below the header with an outline-muted “View latest” action. Never swap the open review. +- A compact header action counts unopened changed heads across projects and + opens the most recently active one. Share the drawer's per-browser seen state, + baseline existing heads on first visit, and clear a head's mark when opened. + Keep the same-stream notice available. Unchanged submissions must not create + unread prompts. Use existing ghost-button typography, icons and accessible + labels; preserve the header's review identity and compact-layout controls. - Status bar: `--statusbar-height` (28), with shortcuts shed before server metrics. - The diff display toolbar uses `--panel`, matching the header and status bar. - Desktop sidebar: `--sidebar-width` defaults to 330px. `use-sidebar.ts` owns diff --git a/apps/web/src/Header.tsx b/apps/web/src/Header.tsx index 6a7e288f..2f8b3546 100644 --- a/apps/web/src/Header.tsx +++ b/apps/web/src/Header.tsx @@ -2,7 +2,7 @@ import { FolderSyncIcon, ListTreeIcon, RefreshCwIcon } from "lucide-react"; import { Button } from "@/components/ui/button"; import { ShellActions } from "./ActivityBar.tsx"; import { DeleteContextButton } from "./DeleteContextButton.tsx"; -import { ProjectsToggle } from "./ProjectsNav.tsx"; +import { NewChangesButton, ProjectsToggle } from "./ProjectsNav.tsx"; import { useDiffSource } from "./app-state.tsx"; import { useSidebarState } from "./sidebar-context.tsx"; import { CurrentContext, useCatalog, useSession } from "./session-context.tsx"; @@ -58,6 +58,7 @@ export function Header() {

+ {collect ? ( + ); +} + /** Announces a newer head for the viewed stream without replacing the review. */ export function NewerSnapshotNotice() { const session = useSession(); @@ -375,7 +368,7 @@ export function NewerSnapshotNotice() {