# Build 91 hotfix — admin setup, cleanup, identity enrollment — 20260606-1200

## Identitet
| Felt | Værdi |
|------|-------|
| Produkt | Ninja Nexus |
| Build | 91 |
| Version | `0.1.0-installer3` |
| Kanal | poc |
| Branch | `integration/platform-sprint-before-phase1` |
| CDN | https://nexus.ninjakernen.info/downloads/latest.json |

## Release note
Fix admin setup, safe cleanup, Identity API startup, SQLite data path, onboarding persistence and installer progress UI.

## Root cause (Build 90 baseline ugyldig)
| Symptom | Årsag | Fix |
|---------|-------|-----|
| Identity API starter ikke | `NexusLaunchService` sat ikke `NEXUS_DB_CONNECTION`; DB i identity-mappe | Writable `data/identity/` + env var ved opstart |
| Bruger/enrollment gemmes ikke korrekt | Kun JSON seed uden API readiness | 19-trins bootstrap: API → health → orgs → roles → enrollment |
| PC-navn tom | Manglende fallback | `Environment.MachineName` → fallback `Nexus-PC` |
| Rolle vises ikke | Hardcoded OneWay "User" | `RoleCatalog` + ComboBox TwoWay + `/api/roles` |
| Org/indlæsning før API klar | Statisk katalog uden boot order | Load orgs/roles efter API health i install-trin |

## Admin / cleanup (Build 91 delta)
| Krav | Implementering |
|------|----------------|
| Admin detection | `AdminElevationHelper.IsRunningElevated()` |
| UAC relaunch | "Genstart som administrator" → `runas`, luk non-elevated |
| Repair clean | `NexusInstallCleanupService.RepairBinaries` — bevarer `data/identity/` |
| Fresh POC reset | Checkbox + bekræftelse → backup `backup/YYYYMMDD-HHMM/` |
| Process stop | `NexusProcessStopService` — kun NexusShell/Identity/Agent under POC-sti |
| Fil-lås | `CheckFileLocks` → Blocked status + retry |

## Install timeline (19 trin)
Admin → stop processer → fil-lås → clean → data → mapper → forudsætninger → udpak → SHA256 → SQLite sti → start API → health → migrationer → orgs → roles → PC navn → enrollment → valider → fuldført

## SQLite sti
- POC: `C:\NinjaNexusPOC\data\identity\nexus-identity.db`
- Fallback: `%LocalAppData%\NinjaNexus\identity\`

## Artifact
| Felt | Værdi |
|------|-------|
| packageUrl | https://nexus.ninjakernen.info/downloads/releases/0.1.0-installer3/nexus-shell-poc.zip |
| sha256 | `74cd86501094674eef80dd46deb23f41c671f44bb27cd33438ebe15d77c9d19e` |
| sizeBytes | 15352684 |
| installerSha256 | `3e18513b12420a8d60930787627000399e4563ccca9d49ce0ce50d3911699b1e` |

## Tests
| Suite | Resultat |
|-------|----------|
| NexusInstaller.Tests | 34/34 PASS |
| NexusShell.Tests | 33/33 PASS |

## Lokal POC-test (C:\NinjaNexusPOC)
| Check | Resultat |
|-------|----------|
| Repair bevarer data/identity | PASS |
| API health + orgs + roles efter NEXUS_DB_CONNECTION | PASS |
| Fresh reset backup + slet data | PASS |
| VERIFY-NEXUS-POC.ps1 | PASS (10/10 required) |
| Build 91 zip VERSION.txt | PASS — 0.1.0-installer3 |

## Ændrede filer (hovedområder)
- `source/nexus-installer/Services/AdminElevationHelper.cs`
- `source/nexus-installer/Services/NexusInstallCleanupService.cs`
- `source/nexus-installer/Services/NexusProcessStopService.cs`
- `source/nexus-installer/Services/NexusLaunchService.cs`
- `source/nexus-installer/Services/NexusIdentityDataPaths.cs`
- `source/nexus-installer/Services/NexusIdentityBootstrapService.cs`
- `source/nexus-installer/ViewModels/NexusSetupViewModel.cs`
- `source/nexus-installer/Views/NexusSetupWindow.xaml`
- `source/nexus-identity/.../RolesController.cs`
- `source/nexus-shell/Services/NexusIdentityDataPaths.cs`
- `scripts/nexus-laptop-poc/*.ps1`
