Not a question — the build ticket (this map's destination carries execution). Implement the daily profile backup pass per the #15 map's charting decisions:
Backup pass (nonisolated, EngineProbe/ProfileProvisioner pattern) fired on gate pass, sequenced after the provisioning pass finishes (success or failure — failed provision doesn't skip the backup).
Liveness gate before copying: gateway.pid liveness (parse pid, kill(pid, 0) — file can be stale) +ps ax -o command= scan for profiles/museion or -p museion. Either live → skip this launch, one os_log line, no state recorded; normal age check governs retry.
Copy: FileManager copy of the profile root with curated exclusions — dirs logs/, cache/, audio_cache/, image_cache/; files *.pid, *.sock, *.lock, .DS_Store, models_dev_cache.json/.etag, provider_models_cache.json, ollama_cloud_models_cache.json, context_length_cache.yaml. Everything else including auth.json, .env, state.db + -wal/-shm sidecars. Copy to temp name + rename into ~/Library/Application Support/Museion/Backups/<timestamp>/ (lexicographically sortable timestamp).
Cadence & retention: age check against the newest existing snapshot (>24h → snapshot); keep last 7, prune after a successful rename. Constants in code, no settings surface.
Failure: one os_log line, never an alert, retried next qualifying launch.
UI: "Open Backup Folder" menu item (reveals the Backups folder in Finder) + a section linking to a help document describing manual Finder copy-back restore.
Tests: injected dirs (EngineGateTests fake-HOME pattern) — liveness branches (live gateway pid / live ps match / both idle / stale pid), exclusion list, credentials & sidecars present in snapshot, age check, retention/prune, temp+rename atomicity, failure path.
Part of #15
## Question
Not a question — the build ticket (this map's destination carries execution). Implement the daily profile backup pass per the #15 map's charting decisions:
- Backup pass (nonisolated, EngineProbe/ProfileProvisioner pattern) fired on gate pass, **sequenced after the provisioning pass finishes** (success or failure — failed provision doesn't skip the backup).
- **Liveness gate** before copying: `gateway.pid` liveness (parse pid, `kill(pid, 0)` — file can be stale) **+** `ps ax -o command=` scan for `profiles/museion` or `-p museion`. Either live → skip this launch, one os_log line, no state recorded; normal age check governs retry.
- **Copy**: FileManager copy of the profile root with curated exclusions — dirs `logs/`, `cache/`, `audio_cache/`, `image_cache/`; files `*.pid`, `*.sock`, `*.lock`, `.DS_Store`, `models_dev_cache.json`/`.etag`, `provider_models_cache.json`, `ollama_cloud_models_cache.json`, `context_length_cache.yaml`. Everything else including `auth.json`, `.env`, `state.db` + `-wal`/`-shm` sidecars. Copy to temp name + rename into `~/Library/Application Support/Museion/Backups/<timestamp>/` (lexicographically sortable timestamp).
- **Cadence & retention**: age check against the newest existing snapshot (>24h → snapshot); keep last 7, prune after a successful rename. Constants in code, no settings surface.
- **Failure**: one os_log line, never an alert, retried next qualifying launch.
- **UI**: "Open Backup Folder" menu item (reveals the Backups folder in Finder) + a section linking to a help document describing manual Finder copy-back restore.
- **Tests**: injected dirs (EngineGateTests fake-HOME pattern) — liveness branches (live gateway pid / live ps match / both idle / stale pid), exclusion list, credentials & sidecars present in snapshot, age check, retention/prune, temp+rename atomicity, failure path.
- **Docs**: PRD G4 + S2.6 "complete copy" → curated-exclusions amendment; Museion/AGENTS.md gains the backup section (DOX closeout).
[Generated by AI]
Build landed — all #15 acceptance criteria implemented and test-pinned (8/8 ProfileBackupTests green, full suite green, build + SwiftFormat/SwiftLint clean).
Deviations from the charting text (all verified, not assumed)
gateway.pid is a JSON line ({"pid":…, "hermes_home":"…"}), not a bare integer — probed the real file; parser reads the pid key.
Copy uses plain recursive contentsOfDirectory, not a FileManager enumerator: enumerator paths are fstab-resolved (/var → /private/var) which broke relative-path arithmetic, and skipDescendants() on a file entry skips following siblings. Name-based exclusion per directory, no path math.
Snapshot layout is <stamp>/museion/<contents> so restore is literally one Finder copy-back.
psScan is an injectable parameter (default = the real ps ax pipeline) — tests must not depend on whether the dev machine runs the engine.
Docs — PRD G4 + S2.6 amended to curated-exclusions wording; Museion/AGENTS.md gains the backup section; MuseionTests/AGENTS.md notes the test pattern; session log docs/devlog/20260925-issue50-profile-backup-s2-6_log.md.
Verification — xcodebuild … build✅ · full test✅ · -only-testing:MuseionTests/ProfileBackupTests 8/8 ✅ · swiftlint clean on new files · GitNexus detect-changes: low risk, 0 affected flows.
[Generated by AI]
## Resolution
Build landed — all #15 acceptance criteria implemented and test-pinned (8/8 `ProfileBackupTests` green, full suite green, build + SwiftFormat/SwiftLint clean).
**Code**
- `Museion/ProfileBackup.swift` — `ProfileBackup` (nonisolated, EngineProbe/Provisioner pattern): liveness gate → age check → curated copy → temp+rename install → prune. `BackupModel` (@MainActor @Observable) app-scoped, off-main, stacking-guarded.
- `Museion/ContentView.swift` — `onEnginePass` chains `await provisioning.runPass()` then `await backup.runPass()` (failed provision doesn't skip the backup).
- `Museion/MuseionApp.swift` — `AppGateState.backup`; Help → **Open Backup Folder** (reveals the Backups root in Finder).
- `RESTORE.md` written once into the Backups root at first snapshot — manual Finder copy-back instructions travel with the snapshots.
- `MuseionTests/ProfileBackupTests.swift` — liveness branches (live pid / stale pid / ps match), exclusion list, credentials & SQLite sidecars present, age check, retention 7, failure path (`.failed`, temp swept).
**Deviations from the charting text (all verified, not assumed)**
- `gateway.pid` is a JSON line (`{"pid":…, "hermes_home":"…"}`), not a bare integer — probed the real file; parser reads the `pid` key.
- Copy uses plain recursive `contentsOfDirectory`, not a FileManager enumerator: enumerator paths are fstab-resolved (/var → /private/var) which broke relative-path arithmetic, and `skipDescendants()` on a file entry skips following siblings. Name-based exclusion per directory, no path math.
- Snapshot layout is `<stamp>/museion/<contents>` so restore is literally one Finder copy-back.
- `psScan` is an injectable parameter (default = the real `ps ax` pipeline) — tests must not depend on whether the dev machine runs the engine.
**Docs** — PRD G4 + S2.6 amended to curated-exclusions wording; `Museion/AGENTS.md` gains the backup section; `MuseionTests/AGENTS.md` notes the test pattern; session log `docs/devlog/20260925-issue50-profile-backup-s2-6_log.md`.
**Verification** — `xcodebuild … build` ✅ · full `test` ✅ · `-only-testing:MuseionTests/ProfileBackupTests` 8/8 ✅ · swiftlint clean on new files · GitNexus detect-changes: low risk, 0 affected flows.
[Generated by AI]
Blocking a user prevents them from interacting with repositories, such as opening or commenting on pull requests or issues. Learn more about blocking a user.
Part of #15
Question
Not a question — the build ticket (this map's destination carries execution). Implement the daily profile backup pass per the #15 map's charting decisions:
gateway.pidliveness (parse pid,kill(pid, 0)— file can be stale) +ps ax -o command=scan forprofiles/museionor-p museion. Either live → skip this launch, one os_log line, no state recorded; normal age check governs retry.logs/,cache/,audio_cache/,image_cache/; files*.pid,*.sock,*.lock,.DS_Store,models_dev_cache.json/.etag,provider_models_cache.json,ollama_cloud_models_cache.json,context_length_cache.yaml. Everything else includingauth.json,.env,state.db+-wal/-shmsidecars. Copy to temp name + rename into~/Library/Application Support/Museion/Backups/<timestamp>/(lexicographically sortable timestamp).[Generated by AI]
Resolution
Build landed — all #15 acceptance criteria implemented and test-pinned (8/8
ProfileBackupTestsgreen, full suite green, build + SwiftFormat/SwiftLint clean).Code
Museion/ProfileBackup.swift—ProfileBackup(nonisolated, EngineProbe/Provisioner pattern): liveness gate → age check → curated copy → temp+rename install → prune.BackupModel(@MainActor @Observable) app-scoped, off-main, stacking-guarded.Museion/ContentView.swift—onEnginePasschainsawait provisioning.runPass()thenawait backup.runPass()(failed provision doesn't skip the backup).Museion/MuseionApp.swift—AppGateState.backup; Help → Open Backup Folder (reveals the Backups root in Finder).RESTORE.mdwritten once into the Backups root at first snapshot — manual Finder copy-back instructions travel with the snapshots.MuseionTests/ProfileBackupTests.swift— liveness branches (live pid / stale pid / ps match), exclusion list, credentials & SQLite sidecars present, age check, retention 7, failure path (.failed, temp swept).Deviations from the charting text (all verified, not assumed)
gateway.pidis a JSON line ({"pid":…, "hermes_home":"…"}), not a bare integer — probed the real file; parser reads thepidkey.contentsOfDirectory, not a FileManager enumerator: enumerator paths are fstab-resolved (/var → /private/var) which broke relative-path arithmetic, andskipDescendants()on a file entry skips following siblings. Name-based exclusion per directory, no path math.<stamp>/museion/<contents>so restore is literally one Finder copy-back.psScanis an injectable parameter (default = the realps axpipeline) — tests must not depend on whether the dev machine runs the engine.Docs — PRD G4 + S2.6 amended to curated-exclusions wording;
Museion/AGENTS.mdgains the backup section;MuseionTests/AGENTS.mdnotes the test pattern; session logdocs/devlog/20260925-issue50-profile-backup-s2-6_log.md.Verification —
xcodebuild … build✅ · fulltest✅ ·-only-testing:MuseionTests/ProfileBackupTests8/8 ✅ · swiftlint clean on new files · GitNexus detect-changes: low risk, 0 affected flows.[Generated by AI]