refactor(session): finish sessionless runtime cutover#29
Conversation
There was a problem hiding this comment.
Pull request overview
Completes the cutover to the sessionless attribution runtime: the backend stops wiring/serving legacy session bootstrap and session-event/usage services, the git-hook queue and post-commit/post-rewrite paths derive a workspace_id (instead of requiring a session marker) and emit unbound checkpoints, and the dashboard/repo-detail copy is realigned to "Tracked Workflows" and ae-cli attribution sync. Docs (architecture, staged-cutover spec, plan) are updated to reflect the landed state.
Changes:
- Delete
sessionbootstrap,sessionusage,sessioneventservices/tests, theSessionUsageHandler, and the session bootstrap wiring + stale-session sweeper incmd/server/main.go; update router signature and all handler tests accordingly. - Replace dashboard
active_sessionswithtracked_workflows(distinct workspace_id overtool_usage_events) end-to-end (Go handler, Vue dashboard/types, unit/e2e tests). - Rework
ae-cli/internal/hooksqueue + handler to be workspace-keyed (NewWorkspaceQueue,PendingWorkspaceIDs, workspace-derivedbinding_source, workspace collector cache) while keeping a legacy session queue path.
Reviewed changes
Copilot reviewed 34 out of 34 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
| frontend/src/views/repos/RepoDetailView.vue | Update unbound-repo copy to reference ae-cli attribution sync. |
| frontend/src/views/DashboardView.vue | Show tracked_workflows metric instead of active_sessions. |
| frontend/src/types/index.ts | Rename DashboardData.active_sessions to tracked_workflows. |
| frontend/src/tests/repo-detail-view.test.ts | Assert new attribution-sync copy. |
| frontend/src/tests/dashboard-view.test.ts | Use tracked_workflows in mocked dashboard payload. |
| frontend/e2e_test.py | Update Playwright assertion to "Tracked Workflows". |
| docs/superpowers/specs/2026-05-14-legacy-session-staged-cutover-design.md | Rewrite to describe landed cutover and remaining footprint. |
| docs/superpowers/plans/2026-05-14-legacy-session-staged-cutover.md | Mark plan completed and refresh remaining gaps. |
| docs/architecture.md | Drop proxy/session bootstrap from diagrams and component table. |
| backend/internal/sessionusage/{service,service_test}.go | Delete legacy session-usage service. |
| backend/internal/sessionevent/{service,service_test}.go | Delete legacy session-event service. |
| backend/internal/sessionbootstrap/{service,service_test,key_selection,key_selection_test}.go | Delete legacy session bootstrap package. |
| backend/internal/handler/session_usage.go | Remove session-usage handler. |
| backend/internal/handler/router.go | Drop sessionBootstrapSvc parameter and import. |
| backend/internal/handler/efficiency.go | Compute tracked_workflows from distinct tool_usage_events.workspace_id. |
| backend/internal/handler/handler_*_test.go | Update SetupRouter arg counts and dashboard test data to tool-usage events / tracked_workflows. |
| backend/cmd/server/main.go | Remove session bootstrap construction, stale-session sweeper, and unused constants/import. |
| ae-cli/internal/hooks/queue.go | Add NewWorkspaceQueue/PendingWorkspaceIDs; reroute legacy queue under attributionlocal root. |
| ae-cli/internal/hooks/queue_test.go | Re-key queue tests to workspace IDs. |
| ae-cli/internal/hooks/handler.go | Derive workspace_id, emit unbound checkpoints when no marker, flush by workspace, persist workspace collector cache. |
| ae-cli/internal/hooks/handler_test.go | Switch tests to workspace markers, add unbound checkpoint test, update cache path assertions. |
| ae-cli/internal/collector/collector.go | Add WriteWorkspaceCache. |
| ae-cli/cmd/{test_helpers_test,hook_test}.go | Configure origin remote and derive workspace_id in cmd hook tests. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| workspaceIDs, _ := h.entClient.ToolUsageEvent.Query(). | ||
| Unique(true). | ||
| Select("workspace_id"). | ||
| Strings(ctx) | ||
| trackedWorkflows := len(workspaceIDs) |
There was a problem hiding this comment.
I did not change this in the current PR. The metric rename here is intentional and the value is currently defined as accumulated distinct workflow identities, not a recency-window activity gauge. Changing it to a time-windowed count-distinct would alter the product metric semantics and should be handled as a separate follow-up rather than folded into this runtime-cutover slice.
Summary
Test Plan
cd ae-cli && go test ./... -count=1cd backend && AE_TEST_POSTGRES_DSN='postgres://postgres:postgres@127.0.0.1:15432/postgres?sslmode=disable' go test ./internal/toolusage ./internal/checkpoint ./internal/handler ./cmd/server -count=1cd frontend && pnpm test