azurenoops / azurenoops/spin_agent

[BUG] [Systems] - Register wizard creates orphan 'In Setup' system on Cancel — record persisted at Step 1→2, not rolled back

Open
#559 2 comments 0 reactions 1 assignee Claimed by @jrspinella View on GitHub
agent:oracle area:rmf bug priority:high
Dominant language
C#
Stars
3
Forks
1
Avg merge
18h 9m
Merged PRs (30d)
43

Description

## Bug Description
Clicking **"+ Add System"** on `/systems`, entering a System Name in Step 1, and clicking **Next** immediately creates a persistent system record in the database — visible in the systems list as **"[Name] In Setup"** with status columns showing blank/Not Configured.

Clicking **Cancel** on any subsequent step does NOT delete the partially-created system. The "In Setup" record remains indefinitely in the systems table as an orphan with no way to delete it from the UI.

## Steps to Reproduce
1. Navigate to `/systems`
2. Click **"+ Add System"**
3. Enter System Name: "QA Test System 2026-06-25T17:48:00Z", click **Next** (advances to Step 2: Security Capabilities)
4. Click **Cancel**
5. Observe: System list now shows 2 systems — original + new "QA Test System 2026-06-25T17:48:00Z In Setup" row

## Expected Behavior
Clicking **Cancel** in the wizard at any step should roll back / discard the partially-created system record. No orphan should remain.

Alternatively, the system should NOT be persisted to DB until the wizard reaches a final "Confirm" step.

## Actual Behavior
- System is written to DB immediately when Step 1 → Step 2 is clicked
- Cancel does not delete the partially-created record
- Orphaned "In Setup" systems accumulate in the database with each cancelled wizard session

## Impact
- **UI pollution**: Every cancelled wizard run leaves a row in the systems table
- **SYSTEM_REQUIRED worsening**: These orphan "In Setup" systems appear in the MCP agent's disambiguation list, making the SYSTEM_REQUIRED disambiguation loop (#542) worse with each cancelled registration
- **No deletion capability**: Combined with #557 (no delete endpoint), these accumulate forever
- **Confusing UX**: Users see their new system immediately appear in the table during Step 2+, before they've finished — creates false sense of completion

## Screenshot
Register New System wizard showing system already in the background table as "In Setup"

## Console Errors
None (no JS errors)

## Browser/Environment
Azure Container Apps Dashboard v2
URL: https://ca-ato-copilot-dashboard-v2.blackwater-9393aa1a.centralus.azurecontainerapps.io/systems
Browser: Chromium (Playwright/Hermes browser)
Date: 2026-06-25
Sweep: Automated 4-hour QA sweep

## Evidence
- New system `b4d0aca6-cdb1-4630-84ae-df93b2747178` ("QA Test System 2026-06-25T17:48:00Z") was created at Step 1→2 transition and persisted after Cancel
- System count went from 1 to 2 systems in the table while still in wizard Step 2
- After Cancel: systems list shows 2 systems — the wizard creates records at Next, not at Finish

## Playwright Test Code
```typescript
test('[systems] wizard cancel does not leave orphan system in DB', async ({ page }) => {
await page.goto('/systems');
await page.click('button:has-text("+ Add System")');
await page.fill('input[placeholder="e.g. ACME Portal"]', 'Cancel Test System');
await page.click('button:has-text("Next")');
// Now at step 2 — verify system count in background
const countBefore = await page.locator('table tbody tr').count();
await page.click('button:has-text("Cancel")');
await page.waitForTimeout(1000);
const countAfter = await page.locator('table tbody tr').count();
expect(countAfter).toBe(countBefore - 1); // Should be unchanged / rolled back
});
```

*Filed by Oracle — Automated 4-hour QA Sweep 2026-06-25T17:52:00Z*

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.