Files
museion/docs/devlog/20261027-issue134-profiles-s1-registry-provisioning-x3_log.md
T
AlexKucera 610f8789bd
CI / ci (push) Canceled after 0s
feat(profiles): registry + provisioning ×3
Profiles S1 (#134, ADR-0014): one gate pass provisions all three
surface profiles — museion adopted in place (never reconfigured; its
glm-5.3-max stays the user's), museion-pass1/-pass2 created fresh with
the #132 sonnet defaults + 24k budget via the hermes 'config set' CLI
rail, marker-gated so a re-pass is a no-op and Settings changes
survive; a failed provision names the profile on the #48 card.

Skills move to ONE master copy under Application Support, symlinked
per profile per the #133 allocation (P1 9 · P2 8 · Chat 10); copy-era
dirs migrate on byte-match (.DS_Store-tolerant, symlink-refusing),
diverged dirs stay copies, user skills untouched (G3a). Backup widens
to one three-subdir stamp, any-live-skip-all; RESTORE.md names the
three folders.

Two review rounds (standards+spec, then finish-audit ponytail/
security/general) caught and fixed: the dead .DS_Store leniency in
treesByteMatch, exit-code-only config-set trust, the swallowed marker
write (defaults-stomp re-arm), symlink-following in the untrusted
tree, and a fixture-skewed count pin. Suite: 412 passed / 414 (fork
flake green in isolation 16/16; UI launch = pre-existing testmanagerd
flake, failed identically pre-change). DOX: Museion/AGENTS.md,
MuseionTests/AGENTS.md, ref/writing skills/AGENTS.md rewritten.

Closes #134
2026-10-27 09:23:56 +01:00

75 lines
9.4 KiB
Markdown
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
# Profiles S1 — Profile registry + provisioning ×3 (#134)
> **Date:** 2026-10-27
> **Type:** issue
> **Reference:** https://git.babylondreams.de/AlexKucera/museion/issues/134
## Goal
Implement ticket #134 (Profiles S1, ADR-0014): the static surface→profile map, the ×3 provisioner at the unchanged binary-gate onPass seam, the #133 skills master+symlink architecture with copy-era migration, the #129 three-profile backup widening, and the profile-named #48 failure card. Grounding: #126/#128/#129/#132/#133 all closed with recorded decisions; this is the build slice.
## Verification
- **Full suite (post-reboot, runner recovered): 412 passed / 414 total.** The two failures decompose honestly: `SessionLifecycleTests/fork activates a fresh transcript and refuses unknown honestly` passes in isolation (whole suite 16/16 green — the fake-ACP load-flake pattern of project learning #30), and `MuseionUITests.testAppLaunches` died at 0.000 s with "Lost connection to testmanagerd" — the same automation-infrastructure flake that failed identically in the pre-change baseline (2026-10-26 13:09, 396 passed / 1 UI-runner failure). Unit suite effectively 412/412.
- `xcodebuild build` and `build-for-testing` SUCCEEDED at every stage including all review fixes.
- `treesByteMatch` (the migration's pure logic) verified by direct execution — standalone Swift check, 6/6 cases including the .DS_Store-browsed and symlinked-entry refusals.
## What Was Done
- `Museion/ProfileProvisioner.swift` — new `ProfileSurface` registry (chat/pass1/pass2 → museion adopted / museion-pass1 / museion-pass2; #133 allocation table 9·8·10 with the persona pair never co-occurring; #132 defaults as constants: anthropic / claude-sonnet-5-5 / 24000 budget, reasoning_effort never written; `init?(passKind:)` seam). `perform` reworked: phase 0 seeds the ONE master copy at `~/Library/Application Support/Museion/skills/` (`masterRoot` injectable), then per surface — create/adopt (`museion` never re-created), marker-gated configure via `hermes -p <profile> config set` (provider→model→budget `--force`, live-probed wire), per-allocation skill symlinks + copy-era→symlink migration on `treesByteMatch` against the master, museion-tools registration per profile. `provisionSurface` extracted (complexity/length ceilings); pure FS helpers moved to a `nonisolated extension`. `Outcome.failed(profile:phase:excerpt:)` names the profile.
- `Museion/ProfileBackup.swift` — one stamp, three subdirs from `ProfileSurface.allCases`; any-live-skip-all (single hoisted ps scan + per-dir pid checks via extracted `idleProfileDir`); missing profiles absent from the stamp, never the profiles root; RESTORE.md documents three folders.
- `Museion/EngineGateView.swift` — the #48 failure card renders the failing profile name in mono under the phase title.
- Tests — `ProfileProvisionerTests.swift` reworked (fake hermes speaks `-p <any-profile> mcp` + `config set`, per-profile marker/invocation logs, create log); `ProfileSurfaceTests.swift` + `ProfileSkillMigrationTests.swift` (new files, scenario headers); `ProfileProvisionerFailureTests.swift` and `ProfileBackupTests.swift` updated (+3 new backup tests). 16 new tests total.
- DOX — `Museion/AGENTS.md` (provisioning + backup sections rewritten for ×3, the #44 config.yaml byte-identity sentence scoped to adopted configs), `MuseionTests/AGENTS.md`, `ref/writing skills/AGENTS.md` (master+symlink seeding contract).
## Decisions & Rationale
| Decision | Rationale |
|----------|-----------|
| Configure phase marker-gated by `.museion-provisioned`, not fresh-create-only | Fresh-only leaves a hole: configure fails → Retry sees the existing dir → config never re-written → profile silently stranded on inherited glm config. The marker makes re-pass a true no-op, heals interrupted provisions, and never stomps a user's later Settings change. The adopted museion is exempt (existing without marker = pre-S1 profile, never configured). |
| Migration byte-match compares against the MASTER, not the payload | The swap must be invisible through the link; on first seed master==payload so behavior matches #133's letter, and after an app update a lagging master keeps the copy rather than silently changing skill content. |
| Provision order chat → pass1 → pass2 | The resident surface gets every chance to be healthy before a pass-profile failure stops the loop (first failure wins). |
| `.seeded(copied:present:)` aggregates master copies + links | Kept the existing outcome shape; the log line says "linked/copied". Renaming labels across ~30 test sites buys nothing (declined in review). |
| `init?(passKind:)` kept though test-only today | It IS the registry-mapping acceptance criterion's seam — PassKind→profile is the mapping being pinned; the S2 engine-spawn slice consumes it next. |
| `ConfigWrite` struct over a labeled tuple | The 3-member tuple trips SwiftLint's enforced `large_tuple`; tooling overrides the ponytail smell baseline (declined in review). |
| Migration applies to all manifest-tracked dirs regardless of allocation | Migration is storage conversion (copy→link), not curation; curation only governs NEW links on fresh profiles (G3a additive-only keeps existing extras). |
| Two security Info findings deferred | `.public` logging of CLI-authored excerpts and the ×3 credentials fan-out in backup stamps are both documented #15/log posture on a single-user unsandboxed host — parked visibly, not silently dropped. |
## Gotchas & Fixes
| Problem | Root Cause | Fix |
|---------|------------|-----|
| Test runner wedged mid-session ("Timed out while preparing IDE session" / "control session with daemon") | Machine-level Xcode test infrastructure degradation, pre-existing (baseline UI-runner failure was the first symptom); every reset short of reboot failed | User rebooted overnight — post-reboot full suite ran. Baseline-vs-after comparison kept honest by the pre-change 13:09 run |
| `treesByteMatch`'s `.DS_Store` leniency was dead code — a Finder-browsed copy-era dir would NEVER migrate and the pinning test shipped red | Strict entry-name equality ran BEFORE the filter; the master side is purged at seed so name lists differ | Filter `.DS_Store` from BOTH listings before equality (spec reviewer catch; verified by direct execution 6/6) |
| mcp-rail test's third perform pinned `(0,8)` but re-derives to `(2,6)` — guaranteed red | Each perform inlined a FRESH `masterRoot` (provTempDir per call) — my fixture sloppiness | Hoisted ONE shared master; second pin corrected to `(6,2)` (the failed pass pre-seeds it), third `(0,8)` now holds (general-reviewer catch, hand-re-derived) |
| `config set` trusted exit code alone; marker write swallowed failures | Both could silently mis-mark a profile configured (exit-0-writes-nothing CLI; disk-full marker) → defaults stomp on every later pass | Wire-verify `✓ Set <key>` on stdout (matches `mcp add`'s posture); `markConfigured` failure surfaces as a configure-phase failure — both pinned |
| `treesByteMatch` followed symlinks in the untrusted copy-era tree (FIFO hang / unbounded read) | fileExists/Data(contentsOf:) follow links | Symlinked entry on either side refuses the match before any open — pinned |
| Swift 6 default-MainActor: extension members became MainActor-isolated vs the nonisolated enum | Extensions don't inherit the enum's `nonisolated` | `nonisolated extension ProfileProvisioner` |
| Vacuous single-test `-only-testing` runs (exit 0, zero tests executed) | Swift Testing identifiers with spaces/backticks don't match the filter form | Learning #31 discipline: verify by the xcresult executed count; ran the whole suite instead |
## Files Changed
| File | Change Summary |
|------|---------------|
| `Museion/ProfileProvisioner.swift` | ProfileSurface registry + ×3 provisioner, master+symlinks+migration, marker-gated config set, nonisolated extension split |
| `Museion/ProfileBackup.swift` | Three-subdir stamps, any-live-skip-all (hoisted scan), RESTORE.md ×3 |
| `Museion/EngineGateView.swift` | Failure card names the failing profile |
| `MuseionTests/ProfileProvisionerTests.swift` | Fake hermes ×3-capable (config set, per-profile mcp), suites updated |
| `MuseionTests/ProfileSurfaceTests.swift` | NEW — registry, ×3 provisioning, config-set lines, symlinks, no-op, adoption, marker, failures |
| `MuseionTests/ProfileSkillMigrationTests.swift` | NEW — byte-match migration, diverged/untracked/symlink refusals |
| `MuseionTests/ProfileProvisionerFailureTests.swift` | ×3 expectations, shared master, fresh-profile case split out |
| `MuseionTests/ProfileBackupTests.swift` | Fixture name param + three-profile/any-live/partial tests |
| `Museion/AGENTS.md`, `MuseionTests/AGENTS.md`, `ref/writing skills/AGENTS.md` | DOX pass for the ×3 world |
| `.swiftlint.yml` | (reverted — an invalid `allowed_terms` key for this SwiftLint version) |
## Open Items & Next Steps
- [ ] Settings build slice (#130) — reads/writes the per-surface model blocks via the same `config set` rail; the registry and marker are its seam.
- [ ] Profiles S2 — pass engines spawn `hermes acp -p museion-passN` (consumes `ProfileSurface(passKind:)`); Chat auto-restart on model change per #129.
- [ ] Deferred security notes: `.public` CLI-excerpt logging; credentials fan-out ×3 in backup stamps (documented posture, revisit if multi-user context appears).
- [ ] `MuseionUITests.testAppLaunches` testmanagerd flake — environment-level, pre-dates this slice; consider `git retry`-style tolerance or a CI marker if it recurs.
---
*Log written by write-log skill*