Cloud-back the knowledge catalog + cutover runbook (PURE REMOTE) - #14
Cloud-back the knowledge catalog + cutover runbook (PURE REMOTE)#14andrei-hasna wants to merge 3 commits into
Conversation
Add a knowledge_items Postgres table and a cloud-catalog access layer so the CLI catalog (add/list/get) round-trips to the cloud DB in cloud storage mode, instead of the local JSON store. Reads/writes go through the vendored storage kit (createKnowledgeCloudClient). Remaining catalog mutators are explicitly guarded in cloud mode so they never silently touch the local JSON store. - src/db/pg-migrations.ts: knowledge_items table + indexes (additive) - src/db/cloud-catalog.ts: list/get/count/upsert/add via storage kit - src/cli.ts: route add/list/get to cloud when HASNA_KNOWLEDGE_STORAGE_MODE=cloud; guard update/archive/restore/untag/delete/upsert/prune/dedupe/export/stats/inventory - rebuilt bin/ + dist/
Idempotent upsert-by-id importer for KnowledgeItem JSONL exports into the cloud knowledge_items table, mirroring apply-cloud-migrations.mjs (owner DSN, no echo).
Documents schema apply, catalog import, real-code-path + S3 verification, local store backup, and the default-mode flip (env/fleet-config, reversible, no code release). Records the tunnel sslmode=require->uselibpqcompat gotcha.
|
OpenLoops worker review: blocked, not safe to merge yet. Evidence gathered on 2026-07-06:
Adversarial review also flagged non-blocking-but-important follow-ups before merge:
Required merge gate: rebase/merge current |
|
Closing as superseded / already-fixed-on-main. Since this PR was opened (2026-07-06),
The PR is also CONFLICTING/DIRTY against |
Follow-up to #12. Completes the knowledge cloud cutover: the CLI catalog now round-trips to the cloud Postgres in cloud mode, plus the data-cutover tooling and runbook.
What
knowledge_itemstable (additive migration + indexes) — the catalog's cloud home. Local mode still uses the JSON store.src/db/cloud-catalog.ts— list/get/count/upsert/add via the vendored storage kit (createKnowledgeCloudClient). PURE REMOTE (Amendment A1): every call round-trips, no cache/mirror.add/list/getroute to cloud whenHASNA_KNOWLEDGE_STORAGE_MODE=cloud. Remaining catalog mutators (update/archive/restore/untag/delete/upsert/prune/dedupe/export/stats/inventory) are guarded in cloud mode so they never silently operate on the local JSON store — follow-up to wire them.scripts/import-cloud-catalog.mjs— idempotent JSONL importer (upsert by id).docs/migration/local-to-cloud-cutover.md— full runbook incl. the default-mode flip step (env/fleet-config, reversible, no code release) and the tunnelsslmode=require→uselibpqcompat=truegotcha.Verified live (shared RDS via SSM tunnel, S3 prod)
apply-cloud-migrations.mjs; idempotent (64/64, 0 pending).knowledge_itemscount 0→48 (47 active + 1 archived, matches source).knowledge_app):knowledge list --include-archivedtotal=48,knowledge getround-trips.S3ArtifactStoreonhasna-oss-knowledge-prod-789877399345.bun run buildgreen (tsc);bun testcli+cloud-storage-kit+artifact-store = 59 pass / 0 fail.Not in scope
local; flipping default is an env/fleet-config action (documented), not a code change.