feat(provisioning): add S2.1 pass with failure alert & retry (fixes #47, #48)
CI / ci (push) Canceled after 0s

Idempotent per-gate pass: create the museion Hermes profile only when
missing (exit-1 "already exists" = success), then additively seed the
bundled writing skills from seed-manifest.txt — temp-copy+rename, present
skills never touched, orphaned temps swept, manifest entries validated
kebab-case at the trust boundary.

Failures surface a separate phase-named alert ("couldn't set up the
writing profile" / "couldn't copy the writing skills"), never re-raising
the gate: excerpt behind Technical details (stdout per #43, stderr
fallback), Retry re-runs the whole pass, Not Now defers to the next
launch's silent retry. The card presents only after the gate sheet's
dismissal completes and snapshots its failure so a successful Retry
doesn't blank it mid-animation.

Provisioning writes nothing to the profile config (no mcp_servers entry,
#44) and leaves state.json engine-gate-only. 30/30 tests green.

Co-Authored-By: Cipher <cipher@babylondreams.de>
This commit is contained in:
AlexKuceraandCipher committed 2026-09-05 15:03:01 +02:00
1 parent 67cf3d42e4
commit c0b2cb0b93
19 files changed
+912 -9

No files matched your search

@@ -0,0 +1,63 @@
# Provisioning failure alert & retry UX (#48)
> **Date:** 2026-09-05
> **Type:** issue
> **Reference:** https://git.babylondreams.de/AlexKucera/museion/issues/48
## Goal
Ship #48 — the failure path of S2.1 provisioning on top of #47's uncommitted success path: when a provisioning pass fails (profile-create error, copy error, missing manifest entry), Museion shows a separate phase-named alert; the gate never re-raises. Retry re-runs the whole idempotent pass; Not Now defers to the next launch's silent retry.
## What Was Done
- `ProvisioningModel` gained `hasFailure` + `deferFailure()` (Not Now) — ProfileProvisioner.swift.
- `ProvisioningFailureCard` (EngineGateView.swift) — separate sheet: phase rawValue as title, excerpt behind Technical details, Retry + Not Now, `interactiveDismissDisabled`.
- `ContentView.failurePresented` — second sheet bound to `hasFailure && gateDismissed`; `AppGateState.gateDismissed` set in the gate sheet's `onDismiss` so the failure sheet presents only after the gate sheet's dismissal *completes* (macOS can drop a sheet presented during another's dismissal animation).
- Card snapshots the failure into `@State`, refreshed only on new failures — a successful Retry nils `model.lastFailure` without blanking the card mid-dismiss.
- Tests (+7): stderr-fallback create excerpt, config.yaml byte-identity (pre-existing + fresh-profile), state.json engine-gate-only, copy-phase catch branch, Not-Now defer + re-fail, path-traversal rejection, orphaned-temp sweep. 30/30 green.
- Audit fixes: kebab-case guard on manifest entries at the trust boundary (`isKebabCaseDirectoryName`); orphaned `.name-UUID` temp dirs swept at pass start (`sweepOrphanedTemps`); deleted the unreachable `firstAvailableBinary()` fallback; `SeedSkill` memberwise init; test suite split at SwiftLint's file-length cap into `ProfileProvisionerFailureTests.swift` with shared internal helpers (`provTempDir` avoids EngineGateTests' `tempDir` collision).
- Docs: frontmatter `email` restored in fiction-craft + serif-writing; stale #13 ref fixed; pbxproj folder-reference exception documented in Museion/AGENTS.md; DOX contracts updated for the card, the guard, and the sweep.
## Decisions & Rationale
| Decision | Rationale |
|----------|-----------|
| Failure card keyed on `gateDismissed`, not `!gateRaised` | Sheet-level `onDismiss` fires at dismissal completion; `!gateRaised` flips at start and can race a second sheet into being dropped |
| Snapshot failure in card `@State` | Live read of `lastFailure` blanks the card during Retry's dismiss animation |
| Kebab-case guard vs. regex blocklist | One `allSatisfy` at the trust boundary enforces the documented payload contract and kills `/`, `..`, absolute escapes in one line |
| Declined: manifest → directory scan | Closed #46/#47 resolutions pin the manifest file; #48 AC5 names it |
| Declined: stderr-preference excerpt | #43 documents create errors print on stdout; current order is the spec |
| Declined: symlink hardening | ADR-0009 accepted same-user posture; no privilege boundary crossed |
## Gotchas & Fixes
| Problem | Root Cause | Fix |
|---------|------------|-----|
| mcp-servers test expected `copied: 2` on retry | Failed pass copies skills *before* hitting the missing entry — partial progress is the idempotence design | Expect `copied: 0, present: 2` |
| SwiftFormat/SwiftLint closure-parameter fight in ContentView | Inline `Binding(get:set:)` reflows differently per tool | Extract `failurePresented` computed property |
| `defaultSkills`/helpers invisible after test-file split | `private` file scope; EngineGateTests owns `tempDir` already | Internal + `provTempDir` rename |
| Subagent summaries truncated at ~400 chars in transcripts | Transcript line cap | Full outputs live in `subagent-summary-*.txt`; read those |
| One reviewer died at iteration cap (API timeout on final call) | 90 s non-streaming timeout | Re-dispatched with tight scope + word cap; recovered findings from live log |
## Files Changed
| File | Change Summary |
|------|---------------|
| `Museion/ProfileProvisioner.swift` | `hasFailure`/`deferFailure`; kebab guard; orphan sweep; fallback deleted |
| `Museion/EngineGateView.swift` | `ProvisioningFailureCard` + snapshot state |
| `Museion/ContentView.swift` | `failurePresented` binding + second sheet |
| `Museion/MuseionApp.swift` | `gateDismissed` flag |
| `MuseionTests/ProfileProvisionerTests.swift` | +5 tests; shared helpers; memberwise init |
| `MuseionTests/ProfileProvisionerFailureTests.swift` | New file — failure-path suite (5 tests) |
| `Museion/AGENTS.md`, `MuseionTests/AGENTS.md` | Contracts updated for #48 |
| `ref/writing skills/{fiction-craft,serif-writing}/SKILL.md` | `email` frontmatter restored |
## Open Items & Next Steps
- [ ] Verify the failure card by hand on a machine where `hermes profile create` errors (retry + Not Now paths)
- [ ] Empty-dir create edge (crashed create leaves `museion/` dir) — declined this session; revisit if hermes documents empty-dir healing
- [ ] `#23` registers museion-tools via `hermes mcp add` once the mode serves — never in provisioning (#44)
---
*Log written by write-log skill*
+1
View File
@@ -5,4 +5,5 @@ Complete history of session logs in this directory, newest first. One-line summa
<!-- write-log: full-index -->
| Date | Type | File | Summary |
|------|------|------|---------|
| 2026-09-05 | issue | [20260905-issue48-provisioning-failure-alert-retry-ux_log.md](20260905-issue48-provisioning-failure-alert-retry-ux_log.md) | #48 shipped: failure card with retry/Not-Now, traversal guard, temp sweep — 30 tests green |
| 2026-09-03 | issue | [20260903-issue42-engine-gate-s2-1_log.md](20260903-issue42-engine-gate-s2-1_log.md) | Engine gate S2.1 shipped: six-path probe, blocking sheet, state.json, About mirror — 12 tests green |