M0: Implement provisioning pass — create museion profile & seed writing skills (S2.1) #47

Closed
opened 2026-09-03 18:35:22 +02:00 by AlexKucera · 1 comment
Owner

Parent

#13 (wayfinder map — read its Decisions so far, then each linked ticket's resolution comment)

What to build

The success path of S2.1 provisioning, fully specified by map #13 — no decisions remain. After the gate passes, provisioning creates the dedicated museion profile via the Hermes CLI as a subprocess, then seeds the bundled writing skills into the profile's skills folder. Seeding is additive only; the whole pass is idempotent and runs on every gate pass. Fires from the existing onEnginePass seam, in parallel on pass.

Spec sources:

• #43 — profile create: hermes profile create museion, non-interactive, prompt-free; re-run on an existing profile exits 1 with "already exists" on stdout — treated as success, nothing clobbered; errors go to stdout; Museion never hand-scaffolds the profile
• #46 — payload ships as a plain Resources directory (copy phase, no zip, no compiled manifest); seed-manifest.txt at the payload root (one skill-dir name per line, blank/# lines ignored; inclusion list — only listed dirs copy); per-skill atomic copy (temp name, rename into place); per-skill metadata.version frontmatter is the version stamp, bumped on meaningful content change; .DS_Store excluded
• Map Notes — 11 mentor skills ship; ste-writing and writing-for-agents stay in ref/ as authoring tools, never seeded; dir-check first, spawn only when something's missing — no has-run flag

Acceptance criteria

  • Profile created if missing; an existing profile is left intact ("already exists" exit 1 = success)
  • Bundled skills seeded additively — missing copied, existing never overwritten — verified by running provisioning twice with a modified skill in place
  • Provisioning is idempotent; later app versions add new skills without touching old ones
  • Skills content matches the bundled payload (G3a set) — unit test asserts manifest ↔ payload correspondence
  • One os_log line per seed pass (per-skill shipped versions, copied/present counts; never opens present skills)
  • Tests inject the profile base dir (fake-HOME pattern) and fake hermes binaries

Blocked by

None — can start immediately.

[Generated by AI]

## Parent #13 (wayfinder map — read its Decisions so far, then each linked ticket's resolution comment) ## What to build The success path of S2.1 provisioning, fully specified by map #13 — no decisions remain. After the gate passes, provisioning creates the dedicated museion profile via the Hermes CLI as a subprocess, then seeds the bundled writing skills into the profile's skills folder. Seeding is additive only; the whole pass is idempotent and runs on every gate pass. Fires from the existing onEnginePass seam, in parallel on pass. Spec sources: • #43 — profile create: hermes profile create museion, non-interactive, prompt-free; re-run on an existing profile exits 1 with "already exists" on stdout — treated as success, nothing clobbered; errors go to stdout; Museion never hand-scaffolds the profile • #46 — payload ships as a plain Resources directory (copy phase, no zip, no compiled manifest); seed-manifest.txt at the payload root (one skill-dir name per line, blank/# lines ignored; inclusion list — only listed dirs copy); per-skill atomic copy (temp name, rename into place); per-skill metadata.version frontmatter is the version stamp, bumped on meaningful content change; .DS_Store excluded • Map Notes — 11 mentor skills ship; ste-writing and writing-for-agents stay in ref/ as authoring tools, never seeded; dir-check first, spawn only when something's missing — no has-run flag ## Acceptance criteria - [ ] Profile created if missing; an existing profile is left intact ("already exists" exit 1 = success) - [ ] Bundled skills seeded additively — missing copied, existing never overwritten — verified by running provisioning twice with a modified skill in place - [ ] Provisioning is idempotent; later app versions add new skills without touching old ones - [ ] Skills content matches the bundled payload (G3a set) — unit test asserts manifest ↔ payload correspondence - [ ] One os_log line per seed pass (per-skill shipped versions, copied/present counts; never opens present skills) - [ ] Tests inject the profile base dir (fake-HOME pattern) and fake hermes binaries ## Blocked by None — can start immediately. [Generated by AI]
AlexKucera added the ready-for-agent label 2026-09-03 18:35:22 +02:00
AlexKucera added a new dependency 2026-09-03 18:35:35 +02:00
AlexKucera self-assigned this 2026-09-05 12:15:18 +02:00
Author
Owner

Resolution

Success path of S2.1 provisioning landed. Build + full test suite green: 23/23 test cases, xcodebuild test exit 0 (12 gate + 10 provisioning + 1 UI), SwiftFormat/SwiftLint clean on all touched files.

What was built

  • Museion/ProfileProvisioner.swift — ProfileProvisioner.perform (nonisolated, one idempotent pass): dir-check first, spawn hermes profile create museion --no-alias --no-skills only when missing (--no-alias/--no-skills per the #43 research — no shell wrapper; the mentor's profile carries only the curated set, G3); exit 1 + "already exists" on stdout = success, errors read from stdout (#43). Seed phase: seed-manifest.txt inclusion list (blank/# lines ignored), per-skill dir-check, atomic copy (temp name → rename), present skills never opened/overwritten, .DS_Store purged. One os_log line per pass with per-skill shipped versions + copied/present counts, read from the bundled payload only (#46). ProvisioningModel (@MainActor @Observable) runs it off-main, absorbs re-fires while in flight, records lastFailure (phase-named copy + excerpt) for #48.
  • Museion/EngineGate.swift — execute/ProcessOutput made internal (shared child-process machinery); EngineGateModel.currentBinaryPath recorded on pass so provisioning spawns the exact binary the gate health-checked.
  • Museion/ContentView.swift / MuseionApp.swift — onEnginePass seam wired: fires ProvisioningModel.runPass in parallel on pass; AppGateState owns the model.
  • Museion.xcodeproj — payload ships as a folder reference (ref/writing skills → plain Resources/writing skills/, no zip, no compiled manifest) via a PBXBuildFile entry in the app's Resources phase.
  • ref/writing skills/seed-manifest.txt — new: the 11 mentor skills; sync contract added to ref/writing skills/AGENTS.md (#46).
  • Frontmatter repair: serif-writing and fiction-craft were missing license + metadata (their own AGENTS.md contract, and #46 made metadata.version the version stamp) — both now carry version: "1.0".
  • MuseionTests/EngineGateTests.swift — timeout test margin 1 s → 3 s (ponytail comment); a zsh fake's startup can exceed 1 s under parallel-suite load, which killed the good candidate and made the test flake. Root cause is test margin, not probe code (verified in isolation).

Acceptance criteria

  • Profile created if missing; existing left intact ("already exists" exit 1 = success) — fresh pass… + already-exists exit 1 is success… tests
  • Additive seeding, existing never overwritten, verified by second pass with a modified skill in place — already-exists… test asserts the mentor's edit survives byte-identical
  • Idempotent; later app versions add new skills without touching old ones — later app version adds new skill… test
  • Manifest ↔ payload correspondence — bundled manifest matches bundled payload test runs against the real bundled Resources payload (11 listed dirs exist; authoring tools present but never listed; ste-writing/writing-for-agents asserted absent from the manifest)
  • One os_log line per seed pass, shipped versions only — single Logger.info per completed pass; frontmatterVersion reads the bundled copy, present skills never opened
  • Tests inject profile base dir + fake hermes binaries — fake-binary Process harness (<binaryDir>/profiles/<name> convention, race-free under parallel Swift Testing)

Verification: xcodebuild -project Museion.xcodeproj -scheme Museion -destination 'platform=macOS' test → TEST SUCCEEDED, 23 passed / 0 failed. Payload verified present in the built .app (Contents/Resources/writing skills/, 0 .DS_Store). DOX updated: Museion/AGENTS.md, MuseionTests/AGENTS.md, ref/writing skills/AGENTS.md. GitNexus re-indexed (719 nodes).

Follow-up for #48: the failure-path alert renders ProvisioningModel.lastFailure — phase rawValue is the alert title, excerpt goes behind Technical details.

[Generated by AI]

## Resolution Success path of S2.1 provisioning landed. Build + full test suite green: **23/23 test cases, `xcodebuild test` exit 0** (12 gate + 10 provisioning + 1 UI), SwiftFormat/SwiftLint clean on all touched files. ### What was built - `Museion/ProfileProvisioner.swift` — `ProfileProvisioner.perform` (nonisolated, one idempotent pass): dir-check first, spawn `hermes profile create museion --no-alias --no-skills` only when missing (`--no-alias`/`--no-skills` per the #43 research — no shell wrapper; the mentor's profile carries only the curated set, G3); exit 1 + "already exists" on stdout = success, errors read from stdout (#43). Seed phase: `seed-manifest.txt` inclusion list (blank/`#` lines ignored), per-skill dir-check, atomic copy (temp name → rename), present skills never opened/overwritten, `.DS_Store` purged. One os_log line per pass with per-skill shipped versions + copied/present counts, read from the bundled payload only (#46). `ProvisioningModel` (@MainActor @Observable) runs it off-main, absorbs re-fires while in flight, records `lastFailure` (phase-named copy + excerpt) for #48. - `Museion/EngineGate.swift` — `execute`/`ProcessOutput` made internal (shared child-process machinery); `EngineGateModel.currentBinaryPath` recorded on pass so provisioning spawns the exact binary the gate health-checked. - `Museion/ContentView.swift` / `MuseionApp.swift` — `onEnginePass` seam wired: fires `ProvisioningModel.runPass` in parallel on pass; `AppGateState` owns the model. - `Museion.xcodeproj` — payload ships as a **folder reference** (`ref/writing skills` → plain `Resources/writing skills/`, no zip, no compiled manifest) via a PBXBuildFile entry in the app's Resources phase. - `ref/writing skills/seed-manifest.txt` — new: the 11 mentor skills; sync contract added to `ref/writing skills/AGENTS.md` (#46). - Frontmatter repair: `serif-writing` and `fiction-craft` were missing `license` + `metadata` (their own AGENTS.md contract, and #46 made `metadata.version` the version stamp) — both now carry `version: "1.0"`. - `MuseionTests/EngineGateTests.swift` — timeout test margin 1 s → 3 s (ponytail comment); a zsh fake's startup can exceed 1 s under parallel-suite load, which killed the good candidate and made the test flake. Root cause is test margin, not probe code (verified in isolation). ### Acceptance criteria - [x] Profile created if missing; existing left intact ("already exists" exit 1 = success) — `fresh pass…` + `already-exists exit 1 is success…` tests - [x] Additive seeding, existing never overwritten, verified by second pass with a modified skill in place — `already-exists…` test asserts the mentor's edit survives byte-identical - [x] Idempotent; later app versions add new skills without touching old ones — `later app version adds new skill…` test - [x] Manifest ↔ payload correspondence — `bundled manifest matches bundled payload` test runs against the real bundled Resources payload (11 listed dirs exist; authoring tools present but never listed; `ste-writing`/`writing-for-agents` asserted absent from the manifest) - [x] One os_log line per seed pass, shipped versions only — single `Logger.info` per completed pass; `frontmatterVersion` reads the bundled copy, present skills never opened - [x] Tests inject profile base dir + fake hermes binaries — fake-binary Process harness (`<binaryDir>/profiles/<name>` convention, race-free under parallel Swift Testing) Verification: `xcodebuild -project Museion.xcodeproj -scheme Museion -destination 'platform=macOS' test` → TEST SUCCEEDED, 23 passed / 0 failed. Payload verified present in the built .app (`Contents/Resources/writing skills/`, 0 `.DS_Store`). DOX updated: `Museion/AGENTS.md`, `MuseionTests/AGENTS.md`, `ref/writing skills/AGENTS.md`. GitNexus re-indexed (719 nodes). Follow-up for #48: the failure-path alert renders `ProvisioningModel.lastFailure` — phase rawValue is the alert title, excerpt goes behind Technical details. [Generated by AI]
Sign in to join this conversation.