pg: one-time import from SQLite and PocketBase files #107

Closed
opened 2026-10-27 13:34:58 +00:00 by sam · 0 comments
Owner

An archied command that imports an existing archie.db (State Store), the event store's PocketBase database and the Gateway conversation file into Postgres; refuses a non-empty target; preserves task ids, event order, binding secrets (still encrypted) and identity ids; verifies row counts after import.

Notes

2ic rulings (approved): (D1) Cutover must fail closed until an import-completion record is committed only after a successful all-source import and row-count/ordering verification. An empty target with non-empty legacy inputs must never serve as an apparently empty installation. A fresh install with no non-empty legacy inputs may initialize normally; any explicit fresh-install override in the presence of legacy data must be an explicit operator attestation, never a default. (D3) Host offline import as a subcommand of archie-state-store, not archied. Use dedicated read-only readers for all legacy sources; do not call openers that migrate/backfill/mutate. Acceptance: prove legacy sources are byte-for-byte unchanged (hash before/after) and require sources not to change during import. (D4 binding duplicates) Before adding uniqueness constraints/importing, detect duplicates for both one-per-source and one-armed-per-source rules. Refuse atomically and report the offending source/binding IDs; no automatic disarming or other repair. Operator resolves and retries.
2ic clarification: the importer must write the durable completion marker only after the single-transaction all-domain import commits and counts/order checks pass. Begin the host-independent read-only source-reader/verification work before the ports land, isolated from port-lane files; no command host or Postgres writes in this early lane. Timestamp decision: preserve (at,id), do not renumber or alter schema; compare ordered source/target IDs and stop with collision rows on any mismatch.

Close reason

Closed


Imported from beads archie-core-7r0x.7 · GitHub #1014 · type task · priority P1 · created 2026-09-23 · closed 2026-09-28

An archied command that imports an existing archie.db (State Store), the event store's PocketBase database and the Gateway conversation file into Postgres; refuses a non-empty target; preserves task ids, event order, binding secrets (still encrypted) and identity ids; verifies row counts after import. ### Notes 2ic rulings (approved): (D1) Cutover must fail closed until an import-completion record is committed only after a successful all-source import and row-count/ordering verification. An empty target with non-empty legacy inputs must never serve as an apparently empty installation. A fresh install with no non-empty legacy inputs may initialize normally; any explicit fresh-install override in the presence of legacy data must be an explicit operator attestation, never a default. (D3) Host offline import as a subcommand of archie-state-store, not archied. Use dedicated read-only readers for all legacy sources; do not call openers that migrate/backfill/mutate. Acceptance: prove legacy sources are byte-for-byte unchanged (hash before/after) and require sources not to change during import. (D4 binding duplicates) Before adding uniqueness constraints/importing, detect duplicates for both one-per-source and one-armed-per-source rules. Refuse atomically and report the offending source/binding IDs; no automatic disarming or other repair. Operator resolves and retries. 2ic clarification: the importer must write the durable completion marker only after the single-transaction all-domain import commits and counts/order checks pass. Begin the host-independent read-only source-reader/verification work before the ports land, isolated from port-lane files; no command host or Postgres writes in this early lane. Timestamp decision: preserve (at,id), do not renumber or alter schema; compare ordered source/target IDs and stop with collision rows on any mismatch. ### Close reason Closed --- _Imported from beads `archie-core-7r0x.7` · GitHub #1014 · type task · priority P1 · created 2026-09-23 · closed 2026-09-28_
sam added the hightask labels 2026-10-27 13:34:58 +00:00
sam self-assigned this 2026-10-27 13:34:58 +00:00
sam closed this issue 2026-10-27 13:34:58 +00:00
sam added a new dependency 2026-10-27 13:41:43 +00:00
sam added a new dependency 2026-10-27 13:41:43 +00:00
sam added a new dependency 2026-10-27 13:41:43 +00:00
sam added a new dependency 2026-10-27 13:41:43 +00:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Reference: sam/archie#107