feat(framework): P4 — upgrade-safe Constitution migration (both installers) #590

Merged
jason.woltje merged 2 commits from feat/p4-upgrade-safe-migration into main 2026-06-21 23:03:49 +00:00
Owner

Closes #589 · umbrella #542 · the phase that gates the alpha tag.

Makes CONSTITUTION/AGENTS/STANDARDS framework-owned (overwritten on upgrade) without losing user data — mirrored across both installers:

  • install.sh + file-adapter.ts: (overwrite, backup-once → ) vs (seed-if-absent); append-friendly lists (your ask); anchored rsync preserve excludes; never delete backups; never touched.
  • Crash safety: snapshot → sync → restore-on-failure (install.sh); + v2→v3 advisory.
  • mosaic-init: fail-closed persona — required in (no silent Assistant).
  • gate: self-test now proves coverage.

Verification:

  • install.sh fixture suite () 14/14 green — fresh / legacy-edited-AGENTS (overwrite+backup, SOUL/creds survive, idempotent .bak) / tuned-STANDARDS / no-TTY / failure-path.
  • vitest 5 migration fixtures added to (CI-gating; I updated the prior preserve
Closes #589 · umbrella #542 · the phase that **gates the alpha tag**. Makes CONSTITUTION/AGENTS/STANDARDS **framework-owned** (overwritten on upgrade) without losing user data — mirrored across **both** installers: - **install.sh + file-adapter.ts**: (overwrite, backup-once → ) vs (seed-if-absent); append-friendly lists (your ask); anchored rsync preserve excludes; never delete backups; never touched. - **Crash safety**: snapshot → sync → restore-on-failure (install.sh); + v2→v3 advisory. - **mosaic-init**: fail-closed persona — required in (no silent Assistant). - **gate**: self-test now proves coverage. **Verification:** - install.sh fixture suite () **14/14 green** — fresh / legacy-edited-AGENTS (overwrite+backup, SOUL/creds survive, idempotent .bak) / tuned-STANDARDS / no-TTY / failure-path. - vitest **5 migration fixtures** added to (CI-gating; I updated the prior preserve
jason.woltje added 2 commits 2026-06-21 22:56:23 +00:00
feat(framework): P4 (1/2) — install.sh upgrade-safe Constitution migration
All checks were successful
ci/woodpecker/push/ci Pipeline was successful
d2d0279e92
Make CONSTITUTION/AGENTS/STANDARDS framework-owned (overwritten on upgrade) while
never losing user data:
- FRAMEWORK_OWNED vs USER_SEEDED lists (append-friendly per Lead's ask)
- reconcile_framework_files: overwrite framework-owned from defaults/, backing up a
  divergent copy ONCE to <file>.pre-constitution.bak (advisory); seed-if-absent for
  USER_SEEDED (TOOLS.md)
- anchor rsync preserve excludes to top-level (/<file>) so defaults/<file> still syncs
- never delete *.pre-constitution.bak across upgrades (rsync + cp-fallback)
- snapshot -> sync -> restore-on-failure (ERR/INT/TERM trap) for crash safety
- FRAMEWORK_VERSION 2 -> 3 + v2->v3 migration advisory
- MOSAIC_SYNC_ONLY hook for testability (file phase only, no env side effects)

Fixture suite (test-install-migration.sh) green 7/7: fresh, legacy-edited AGENTS
(overwrite + backup + SOUL/creds survive + idempotent .bak), tuned STANDARDS,
no-TTY, failure-path data integrity. Two real bugs caught + fixed by the fixtures
(unanchored exclude blocking the overwrite; backup deletion on re-upgrade).

file-adapter.ts TS parity + the vitest fixture matrix land in P4 (2/2).

Refs #542

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
feat(framework): P4 (2/2) — TS installer parity + fixtures + fail-closed init
Some checks failed
ci/woodpecker/pr/ci Pipeline failed
ci/woodpecker/push/ci Pipeline was successful
1064427c6d
Mirror install.sh's upgrade-safe migration in the npm/TS install path and lock it
with CI-gating fixtures:
- file-adapter.ts: FRAMEWORK_OWNED_FILES (overwrite, backup-once to
  .pre-constitution.bak) vs USER_SEEDED_FILES (seed-if-absent); CONSTITUTION.md
  added to preserve; reconcile mirrors reconcile_framework_files() in install.sh
- file-adapter.test.ts: 5 migration fixtures (overwrite framework-owned + backup,
  idempotent backup-once, preserve SOUL/credentials, preserve user-seeded TOOLS);
  updated the prior "preserve AGENTS" test that P4 intentionally inverts
- mosaic-init: fail-closed persona — --name is REQUIRED in --non-interactive mode
  (no silent agent named "Assistant"); verified exit 1 + clear error
- verify-sanitized.sh self-test: prove the identity scan actually covers
  *.yaml/*.service config formats (Claude review ticket)

Both installers now behave identically. install.sh fixture suite 14/14 green;
gate green; mosaic-init fail-closed verified.

Refs #542

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
jason.woltje merged commit bb7d549080 into main 2026-06-21 23:03:49 +00:00
Sign in to join this conversation.
No Reviewers
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: mosaicstack/stack#590