azurenoops / azurenoops/spin_agent
[BUG] [Dashboard/Portfolio] - 'Total Systems' KPI shows org-scoped count (19) — does not match MCP backend total (63)
- Dominant language
- C#
- Stars
- 3
- Forks
- 1
- Avg merge
- 11h 20m
- Merged PRs (30d)
- 70
Description
## Bug Description
The Portfolio dashboard's "TOTAL SYSTEMS" KPI shows **19** — the count for the PEO-790 organization only. The MCP API reports **63 total registered systems** across all tenants/orgs. This discrepancy means portfolio-level stakeholders see a materially incorrect picture of the total system footprint.
## Steps to Reproduce
1. Navigate to Portfolio page (`/`)
2. Observe "TOTAL SYSTEMS" metric — shows **19**
3. In parallel, query MCP API: `POST /mcp/chat {"message":"Show all registered systems"}`
4. API responds: "Showing 20 of **62** systems" (plus 1 added this sweep = 63 total)
5. Discrepancy: portfolio shows 19, backend has 63
## Expected Behavior
"TOTAL SYSTEMS" on the portfolio page should reflect the total across all organizations in the flankspeed portfolio, or be clearly labeled as "Systems in [Org Name]" if org-scoped.
## Actual Behavior
TOTAL SYSTEMS shows **19** — this appears to be the PEO-790 org count only, not the cross-org total.
Note: The 63 backend total includes ~43 orphaned QA test systems (from the ongoing issue #615 where systems cannot be deleted). The "true" production system count is much lower, but the KPI still doesn't match even the 19 displayed in the orgs table.
## Root Cause Hypothesis
The portfolio KPI card queries the currently-active org's system count rather than the global cross-org count. With 4 orgs and only PEO-790 having systems, the "Total Systems" metric for the portfolio should be the sum across all active orgs (currently 19 from PEO-790 + 0 from others = 19), but the backend MCP has 63. This implies the portfolio KPIs are scoped to the current org context rather than true portfolio-wide.
## Screenshot
[Captured: Portfolio page showing "TOTAL SYSTEMS: 19" alongside MCP response showing 63 systems in backend]
## Console Errors
None — KPI renders correctly for org-scoped count.
## Browser/Environment
Azure Container Apps Dashboard (v2)
Browser: Chromium (Playwright/Hermes browser)
Date: 2026-07-06
Sweep: Automated 4-hour QA sweep
## Playwright Test Code
```typescript
test('[portfolio] total systems KPI matches backend count', async ({ page }) => {
await page.goto('/');
const totalSystems = await page.locator('[data-testid="kpi-total-systems"]').textContent();
const apiCount = await fetch('/mcp/chat', {...}).then(r => r.json()); // returns 63
expect(parseInt(totalSystems)).toEqual(apiCount.totalSystems); // FAILS: 19 != 63
});
```
*Filed by Oracle — Automated 4-hour QA Sweep 2026-07-06T07:43:00Z*
Contributor guide
Assessment
This issue has not been assessed yet.