Repository navigation
fix(dashboard): Distribution saves one half alone, show cwd-less sessions, refresh stale pages - #11
hsuchifeng wants to merge 1 commit into
Conversation
…essions, refresh stale pages - Distribution sent primaryRole and projects on every preview and save, so a team with no manifest/projects.yaml (or no roles.yaml) got a 409 and a workspace with no primary role got a 400, even for a change to the other half. The page now sends only the halves the team defines and the draft changed, and asks for a primary role when only additional roles are picked. - The Unassigned bucket was listed only for an unowned event with a cwd, so a Copilot session (no cwd) outside every project was in no workspace. The bucket now uses the same per-session rule workspaceEvents routes by. - A Distribution save left the Resources page's skills and rules stale until a workspace switch, and a skill exclusion left the Distribution counts stale. Each now reloads the other.
Code Erosion ReportInformational — never blocks the merge.
Scanned 386 files / 86114 SLOC · high-CC functions 662/7247 * On TypeScript, Rule hits (TS verbosity layer)Standalone
58 distinct lines flagged across |
|
Generated by Claude Code |
Summary
Fixes three Dashboard bugs. I found all three by running the real dashboard against a sandbox team repo and driving the page in Chromium.
primaryRoleandprojectson every preview and save. A team with nomanifest/projects.yamlgot a 409 (This team repo defines no projects). A team with noroles.yamlgot the same error for roles. A workspace with no primary role got a 400 (Expected { primaryRole: string … }), even when only the projects changed. Because Save needs a preview first, these workspaces could change nothing. The page now sends only the halves the team defines and the draft changed. When only additional roles are picked, it asks for a primary role first.workspaceEventssends a session that matches no project tounassigned. ButdashboardWorkspaceslisted the Unassigned bucket only when an unowned event had acwd. Copilot events record nocwd, so such a session never appeared under any option in the picker. The bucket now uses the same per-session rule.Type of Change
Test Plan
npx tsc --noEmitpassesnpm run lintpassesnpx vitest run src/__tests__/dashboard*passes (298 tests)npm run test:e2e -- dashboard-distribution-ui dashboard-distribution dashboard-unifiedpasses (5 tests)dashboardWorkspaceslists the Unassigned bucket for a cwd-less Copilot session. It fails before the fix and passes after.Real-CLI record (after
npm run build). The sandbox team repo hadskills/{frontend,backend}/*, root and namespaced rules,manifest/roles.yamlandmanifest/projects.yaml. Setup ranteamai init https://github.com/your-org/your-repo.git --provider git --agent claude --role frontend, thenteamai pull, thenteamai dashboard --port 4791. I drove the page with headless Chromium:POST /api/distribution/preview {"primaryRole":null,…,"projects":["pay"]}returned 400. Withprojects.yamlremoved, a role-only preview returned 409.paygave a preview ofskills: +backend. Save showed "Saved". The config on disk then heldprojects: [pay]. The Resources page showed the new delivery right away (api-kit Delivered).projects.yamlremoved: picking thefrontendprimary role, previewing and saving all worked. The config on disk heldprimaryRole: frontend.cwd: "") inevents.jsonl:/api/workspacesnow listsunassigned, and/api/sessions?workspace=unassignedreturns the session.POST /api/resources/skills/exclusions) writesexcludedSkillsto the workspace's own config, and the effective Distribution then drops the skill.I covered only the Claude agent and the
gitprovider. I did not run the other agents or providers locally and am leaving them to CI.Notes for Reviewers
src/dashboard/client.ts). The server's validation is unchanged.Generated by Claude Code