Conversation
|
resolve conflicts |
ea1688e to
fc1521a
Compare
fc1521a to
3c0e6fb
Compare
Teingi
left a comment
There was a problem hiding this comment.
Reviewed bffe534. The focused archive suite passed (16 tests; the large-bundle memory test was excluded). I reproduced the six issues below in isolated SQLite databases; vector coverage used a deterministic embedding model. I did not run live OceanBase validation.
| scope_field: str = "scope_id" | ||
|
|
||
|
|
||
| _SPECS: dict[RecordType, _RecordSpec] = { |
There was a problem hiding this comment.
[P1] Preserve managed Skill package contents
_SPECS omits pc_skill_packages. An approved two-file Skill passes archive validation, but restore commits the Artifact rows and then raises RepositoryNotFoundError while rebuilding projections. Reopening the target Runtime fails with the same error. Please include referenced package bytes and validate those dependencies before committing the restored rows.
| async def _establish_export_snapshot(connection: AsyncConnection, /) -> None: | ||
| """Pin all export reads to one database snapshot before enumeration.""" | ||
|
|
||
| if connection.dialect.name == "mysql": |
There was a problem hiding this comment.
[P1] Establish an explicit SQLite read snapshot
This only pins a snapshot for MySQL. With the configured SQLite driver, a separate writer can commit between the journal-head and Source reads. I reproduced an archive with journal head 1 and a Source at position 2; validation and restore succeeded, but the next capture failed the journal-position unique constraint. Please explicitly begin a SQLite read transaction and validate journal consistency.
| database, | ||
| projection_rebuilder=self.rebuild_portable_projections, | ||
| supported_source_types=tuple(definition.name for definition in self.source_registry.definitions), | ||
| supported_artifact_families=(Handoff.family, Memory.family, Experience.family, Skill.family), |
There was a problem hiding this comment.
[P2] Include the registered Artifact families in restore support
The repository below supports Profile, Prompt, and Topic Memory, but this list rejects all three. Creating a Prompt through the public Runtime produces an archive that the same version cannot restore. Please align export and restore support, including the CLI validation list and each family's durable dependencies.
| for scope_id in scope_ids: | ||
| services = self._services_for(scope_id) | ||
| _, catalog = services.sources() | ||
| await services.memory(catalog).rebuild_projections() |
There was a problem hiding this comment.
[P2] Rebuild vectors before reporting readiness
rebuild_projections() defaults its embedding model to None; it does not use the model configured on the Memory service. Restoring into a vector-enabled target therefore reports ready, while explicit vector search raises CapabilityNotSupportedError and auto falls back to FTS. Please pass the target embedding model and verify vector completeness before marking the restore ready.
|
|
||
| # Parent rows always precede their dependent rows. This matters for SQLite as | ||
| # well as for MySQL/OceanBase foreign-key enforcement. | ||
| _EXPORT_ORDER: tuple[RecordType, ...] = tuple(_SPECS) |
There was a problem hiding this comment.
[P2] Preserve tag assignments in the archive
The export list excludes pc_artifact_tags. A Memory entry tagged backup-critical restores with an empty tag set even though the receipt reports ready, silently losing metadata and changing tag-filtered retrieval. Please include tag assignments and validate their target references.
|
|
||
| def _emit_validation_result(source: Path, /, *, env_file: Path | None) -> None: | ||
| try: | ||
| _emit(asyncio.run(_validate_only(source, env_file=env_file))) |
There was a problem hiding this comment.
[P2] Return a failure exit code for an incompatible dry-run
_validate_only() can return compatible=False without raising, so this path prints the report and exits successfully. I reproduced compatible: false with exit code 0 for a Prompt bundle. Scripts checking the exit status will treat that validation as successful. Please inspect the result and return a nonzero exit code for incompatibility or conflicts.
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?
.pcbcontract with deterministic manifests, producer/schema versions, per-record SHA-256 digests, an aggregate checksum, deterministic ZIP output, and optional compression.Are there any user-facing changes?
Adds
powercontext archive export,powercontext archive inspect, andpowercontext archive restore. Restore writes require--yes;--dry-runperforms target compatibility and conflict checks without domain writes. This introduces portable bundle format version 1 and thepc_portable_restore_receiptstable. No existing API or bundle format is changed.How was this change tested?
prek run -aty checkmake docs-test: 792 public pages and internal links verifiedAI usage statement
Codex (GPT-5) was used to assist implementation, tests, documentation, and review; all changes were reviewed and validated locally.