Skip to content

feat(compat): add forward-upgrade shield, time-capsule harness, and doc updates - #7152

Merged
M4n5ter merged 6 commits into
rust-previewfrom
feat/upgrade-compat-shield
Nov 22, 2026
Merged

M4n5ter merged 6 commits into
rust-previewfrom
feat/upgrade-compat-shield

Conversation

@M4n5ter

@M4n5ter M4n5ter commented Nov 22, 2026

Copy link
Copy Markdown
Member

Summary

Prepares rust-preview for the upcoming main switch and first nightly release by establishing forward in-place upgrade compatibility guarantees and cleaning up contributor/release docs:

1. Forward In-Place Data Migration & Immutable Ledger Lock

  • Atomic Rust data migration hook (platform/event-log/src/migration.rs): added Migration::with_data(fn(&Connection) -> Result<(), StoreError>) executed inside the same SAVEPOINT maka_schema_migrations right after migration.sql, so schema and JSON payload rewrites upgrade old SQLite databases directly to the current shape instead of accumulating legacy read branches or relying on external scripts.
  • Immutable migration lock (scripts/rust/migration-lock.mjs, scripts/rust/migrations.lock.json): seals SHA-384 digests of all 55 baseline migrations across the 4 ledgers (root shared by event-log + agent/state, checkpoint-repository, settings, deployment), rejecting edits, deletions, duplicate versions, and backdated versions. Wired into just migrations, just check, and always-run PR tooling CI.

2. Full-Scenario Time Capsule Harness & CI/Release Gates

  • products/maka/cli/tests/upgrade_compat.rs: drives the real maka binary end-to-end across Settings, encrypted Vault credential decryption (verified on the wire via Authorization: Bearer), Assistant Preferences, primary Session + Attachment + Code Mode exec/Shell/store, Fork, Room, Subagent Preset, Personal Memory/Recall, and Workspace Checkpoint publish + portable archive export/open.
    • Supports self-roundtrip (default), MAKA_COMPAT_PRODUCE_CAPSULE, and MAKA_COMPAT_VERIFY_CAPSULE (cold startup + migrations -> exhaustive read/deserialization sweep -> live continuation + maka inspect + SQLite PRAGMA integrity_check + monotonic migration ledger check).
  • scripts/rust/compat-capsule.mjs: produce, verify, verify-release, and publish (permanently pinning capsule-first-nightly.tar.gz and keeping a rolling window of the newest capsule-nightly-*.tar.gz assets on the compat-capsules pre-release).
  • .github/workflows/compat-post-merge.yml: runs after commits merge to main (not on ordinary PRs) to verify the migration lock, run the current-HEAD self-roundtrip, and replay every published historical capsule.
  • .github/workflows/nightly.yml: adds a hard compat-gate job (blocks publish-npm and release) running the real built linux-x64-gnu maka binary against self-roundtrip and all historical capsules, plus seal-capsule after release succeeds.

3. Docs & Review Cleanup

  • AGENTS.md: kept @.agents/AGENTS.md local override hook; added concise persisted-state & forward-upgrade rules pointing agents to upgrade_compat.rs.
  • CONTRIBUTING.md & CONTRIBUTING.zh-CN.md: replaced outdated SQLx migration wording with forward maka_event_log::migration::Migration + upgrade_compat.rs rules.
  • README.md & README.zh-CN.md: added Apache 0.2.2 (incubating) official source release & download page note.
  • Removed redundant .github/skills/code-review/SKILL.md, updated .github/copilot-instructions.md, and added a breaking-change / persisted-data migration check in .github/pull_request_template.md.

Verification

  • node scripts/ci.mjs check format — pass (552 files, 0 issues)
  • node scripts/ci.mjs check licenses — pass (2607 covered, 3433 excluded)
  • node scripts/ci.mjs check migrations — pass (55 locked, 0 pending)
  • node scripts/ci.mjs check tooling-tests — pass (351/351)
  • cargo test --locked -p maka-event-log --lib migration — pass (6/6)
  • cargo nextest run --locked -p maka-cli --test upgrade_compat — pass (self-roundtrip)
  • End-to-end tarball replay via compat-capsule.mjs produce (9.7 MiB) -> fresh mount verify — pass
  • Workflow YAML syntax validated via Ruby YAML.load_file

AI-Assisted Contribution

  • AI-assisted (authored and verified with Maka / Gemini)

Checklist

  • Changes are focused and concise
  • Tests cover the change and fail without it
  • Format, typecheck and the affected suites pass locally

Does this PR entail a breaking change or persisted-data migration?

  • Yes
  • No

Does this PR entail a change in behavior?

  • Yes — adds forward data-migration hook, immutable migration lock check in CI, and upgrade compatibility gates for post-merge/nightly workflows
  • No

@github-actions github-actions Bot added the effort/XXL Over 2500 readable lines label Nov 22, 2026
…oc updates

Establish forward in-place upgrade guarantees ahead of the first nightly on main:

- Add atomic Rust data-migration hook (`Migration::with_data`) inside
  `maka_event_log::migration` so schema and persisted JSON payloads evolve
  in place within the migration `SAVEPOINT` without legacy read-time branches
  or external migration scripts.
- Add SHA-384 immutable migration ledger verification
  (`scripts/rust/migration-lock.mjs` + `scripts/rust/migrations.lock.json`),
  wired into `just migrations`, `just check`, and always-run PR `tooling` CI.
- Add full-scenario Time Capsule upgrade compatibility harness
  (`products/maka/cli/tests/upgrade_compat.rs` + `scripts/rust/compat-capsule.mjs`)
  exercising Settings, encrypted Vault, Preferences, Sessions/Attachments,
  Code Mode `SessionData`, Fork, Room, Subagent Presets, Personal Memory/Recall,
  and Workspace Checkpoints (including portable export/open).
- Add post-merge replay workflow (`.github/workflows/compat-post-merge.yml`)
  and wire hard `compat-gate` + post-release `seal-capsule` jobs into
  `.github/workflows/nightly.yml`.
- Align `AGENTS.md`, `CONTRIBUTING*.md`, `README*.md`, PR template, and
  Copilot review instructions; remove redundant `.github/skills/code-review/SKILL.md`.

Generated-by: Maka (Gemini)
Generated-by: Maka (Gemini)
…y, deployment upgrades, and verify assertions

- Enforce sealed migrations in `migration-lock.mjs check` (`pendingCount > 0`
  now fails until `seal` is committed) while keeping `seal` validating
  locked history before appending.
- Harden `compat-capsule.mjs`: validate archive `baseDir` matches
  `CANONICAL_CAPSULE_DIR` before touching any path (never pass archive-supplied
  paths to `rmSync`), create the `compat-capsules` release atomically with
  both rolling and `capsule-first-nightly.tar.gz` assets, and require the
  permanent baseline asset during `verify-release`.
- Fix `deployment/store.rs` pre-migration schema validation so writer opens
  accept a verified historical prefix before running `migrate()` and enforce
  the complete ledger afterward (with v1->v2 regression test).
- Tighten `upgrade_compat.rs`: deduplicate Host lifecycle via
  `tests/support/host.rs`, assert pre-upgrade conversation context strictly on
  the first post-upgrade request before emitting any tool call, verify exact
  `agent.memory` ID/body, `receipts.read` operation persistence, and online
  `maka checkpoint export` + `open` on the upgraded Root, and fix Vault wording.

Generated-by: Maka (Gemini)
@M4n5ter
M4n5ter force-pushed the feat/upgrade-compat-shield branch from e0fb6ff to 4d6712a Compare November 22, 2026 04:46
…r_version

- Advance PRAGMA user_version atomically inside store::migrate_with's savepoint
  and require PRAGMA user_version to match the latest applied _sqlx_migrations
  version in validate_schema_with so writers and strict readers share one rule.
- Route lease-held host update/reconcile reads through store::read_for_update
  and allow verified historical prefixes when opening the update writer, keeping
  schema migration and pending-intent insertion atomic in updates::prepare.
- Add an end-to-end v1 -> v2 deployment update regression test covering failed
  prepare rollback and strict post-migration reopen, and tighten upgrade_compat
  personal memory assertions to exact id/body equality.

Generated-by: Maka (Gemini)
…ated stores

- Add store::read_handoff so an older scheduled auto-update executable can still
  locate and validate the newer pending/active executor when updates::prepare has
  already migrated deployment.sqlite (e.g. after returning ActiveTasks), without
  ever writing to the newer schema.
- Validate the known historical migration prefix and package path bounds before
  handing off, and keep HandoffRecord tolerant of forward-added JSON fields.
- Pin both v1 -> v2 upgrade regression tests to an explicit v1 catalog so future
  production migrations do not break the baseline fixture, and extend coverage to
  v1 scheduler handoff recovery.

Generated-by: Maka (Gemini)
@M4n5ter
M4n5ter merged commit 4cb1415 into rust-preview Nov 22, 2026
16 checks passed
@M4n5ter
M4n5ter deleted the feat/upgrade-compat-shield branch November 22, 2026 05:42
M4n5ter added a commit that referenced this pull request Nov 22, 2026
#7127 merged onto rust-preview right before #7152, adding
plugins/agent/state/migrations/0052_room_overhaul.sql without the new
Migration::data field or migrations.lock.json entry introduced in #7152.

- Initialize data: None on migration 52 in plugins/agent/state/src/lib.rs.
- Seal 0052_room_overhaul.sql into scripts/rust/migrations.lock.json.

Generated-by: Maka (Gemini)
M4n5ter added a commit that referenced this pull request Nov 22, 2026
#7127 merged onto rust-preview right before #7152, adding
plugins/agent/state/migrations/0052_room_overhaul.sql without the new
Migration::data field or migrations.lock.json entry introduced in #7152.

- Initialize data: None on migration 52 in plugins/agent/state/src/lib.rs.
- Seal 0052_room_overhaul.sql into scripts/rust/migrations.lock.json.

Generated-by: Maka (Gemini)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

effort/XXL Over 2500 readable lines

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant