Skip to content

feat: add portable archive export and restore - #1561

Open
larry-zy wants to merge 2 commits into
oceanbase:masterfrom
larry-zy:feat/1421-portable-export-backup-restore
Open

feat: add portable archive export and restore#1561
larry-zy wants to merge 2 commits into
oceanbase:masterfrom
larry-zy:feat/1421-portable-export-backup-restore

Conversation

@larry-zy

@larry-zy larry-zy commented Sep 10, 2026

Copy link
Copy Markdown
Contributor

Closes #1421

Rationale for this change

PowerContext needs a backend-neutral logical archive for disaster recovery, offline transfer, customer-controlled backup, and SQLite/OceanBase migration without losing immutable history, lineage, review decisions, or Handoff evidence. Database-native backup remains a separate operational recovery mechanism.

What changes are included in this PR?

  • Adds a versioned .pcb contract with deterministic manifests, producer/schema versions, per-record SHA-256 digests, an aggregate checksum, deterministic ZIP output, and optional compression.
  • Streams scope-selective export, inspect, target-aware dry-run validation, and transactional/idempotent restore with content-free progress.
  • Preserves Scope relationships, Sources and journal positions, immutable Artifact Revisions, lineage and cross-Scope publication provenance, Memory versions/heads, Candidate decisions, Work Sources, Handoffs, and receipts.
  • Requires export authorization before database enumeration, rejects credentials/provider secrets/absolute host paths, and excludes access bindings, audit/usage/evaluation data, host-local state, cursors, and projections.
  • Adds immutable conflict detection, rollback-safe restore, durable readiness receipts, and Memory/Experience/Skill projection rebuilds.
  • Supports configured SQLite, SeekDB, and OceanBase deployments through the local CLI; includes an opt-in live SQLite-to-OceanBase acceptance test.
  • Documents format compatibility, recovery workflow, exclusions, and distinct SQLite/OceanBase native backup guidance.

Are there any user-facing changes?

Adds powercontext archive export, powercontext archive inspect, and powercontext archive restore. Restore writes require --yes; --dry-run performs target compatibility and conflict checks without domain writes. This introduces portable bundle format version 1 and the pc_portable_restore_receipts table. No existing API or bundle format is changed.

How was this change tested?

  • prek run -a
  • ty check
  • Focused archive/schema/CLI/E2E suite: 22 passed
  • make docs-test: 792 public pages and internal links verified
  • Full macOS suite: 2471 passed and 101 skipped; the remaining three tests are Linux systemd-only platform guards

AI usage statement

Codex (GPT-5) was used to assist implementation, tests, documentation, and review; all changes were reviewed and validated locally.

@Teingi

Teingi commented Sep 10, 2026

Copy link
Copy Markdown
Member

resolve conflicts

@larry-zy
larry-zy force-pushed the feat/1421-portable-export-backup-restore branch from ea1688e to fc1521a Compare September 11, 2026 13:26
@larry-zy
larry-zy force-pushed the feat/1421-portable-export-backup-restore branch from fc1521a to 3c0e6fb Compare September 11, 2026 19:27
@larry-zy
larry-zy marked this pull request as ready for review September 11, 2026 19:28
@larry-zy larry-zy changed the title feat: add local portable archive CLI feat: add portable archive export and restore Sep 11, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

feat: add portable export, backup, and restore

2 participants