cloud-backed knowledge store: vendored storage kit + PURE REMOTE cloud mode - #12
Merged
Merged
Conversation
… in build Stamp the canonical PURE REMOTE Postgres storage kit into src/generated/storage-kit via 'contracts vendor-kit' (kitVersion 0.4.0): correct RDS TLS, pool factory, typed query wrapper with the restored get(), migration ledger with checksum drift/downgrade guards, and health probes. Externalize @hasna/contracts in the bun build (alongside pg/machines) so the package's own no-cloud guard pattern strings no longer leak into the bundled CLI artifacts and repo-conformance passes.
Rewrite PgAdapterAsync to build its pool/TLS via the kit (replacing the hand-rolled rejectUnauthorized:false shim) and restore the dropped single-row get() helper. Adopt the A1 PURE REMOTE mode contract: StorageMode is now local|cloud, deprecated aliases (remote/hybrid/self_hosted) normalize to cloud, and a DATABASE_URL alone no longer implies a hybrid runtime. Add createKnowledgeCloudClient plus scripts/apply-cloud-migrations.mjs, which applies the schema through the kit's MigrationLedger (proven idempotent against pg16).
Declare the cli-with-store service contract (v1, kitVersion 0.4.0, canonical HASNA_KNOWLEDGE_ env prefix and hasna/oss/knowledge/database-url secret ref); repo-conformance passes. Add a throwaway Postgres compose for exercising cloud mode locally, and ignore the scoped .hasna/ workspace.
andrei-hasna
force-pushed
the
oss-cloud-runtime/knowledge-cloud-storage-kit
branch
2 times, most recently
from
July 6, 2026 10:49
f514a9f to
3140cf8
Compare
andrei-hasna
force-pushed
the
oss-cloud-runtime/knowledge-cloud-storage-kit
branch
from
July 6, 2026 10:53
3140cf8 to
ae708d8
Compare
This was referenced Jul 6, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
First cloud tenant wiring for @hasna/knowledge (todos 4927ea2d, LANE knowledge-cloud).
What
src/generated/storage-kit/) viacontracts vendor-kit(kitVersion 0.4.0): correct RDS TLS, pool factory, typed query wrapper with the restoredget(), migration ledger (sha256 checksum + drift/downgrade guards), health probes.contracts vendor-kit --checkpasses.PgAdapterAsyncnow builds its pool/TLS via the kit (replacing the hand-rolledrejectUnauthorized:falseshim) and exposes the restored single-rowget().StorageModeis nowlocal|cloud; deprecated aliases (remote/hybrid/self_hosted) normalize tocloud; aDATABASE_URLalone no longer implies a hybrid runtime (cloud must be requested viaHASNA_KNOWLEDGE_STORAGE_MODE=cloud).scripts/apply-cloud-migrations.mjsapplies the schema through the kit'sMigrationLedger. Proven end-to-end against a throwaway Postgres 16: dry-run → apply (24 tables, 60 ledger rows) → idempotent re-apply (pending: []) →get()+checkHealthOK.hasna.contract.json(cli-with-store, v1) —repo-conformancepasses; devdocker-compose.yml. Externalized@hasna/contractsin the build so the guard-pattern strings no longer leak into artifacts.Tests / gates
bun test: 154/154 green (one machines-topology test is a shared-state flake; passes in isolation and on rerun).bun run build(prepublishOnly): exit 0.Out of scope / follow-ups
hasna/oss/knowledge/database-urlDSN secret exists yet. Runscripts/apply-cloud-migrations.mjsonce the router lands and the secret is created.~/.hasna/knowledge/migration-exports/; cloud load + local-sqlite.bakrename deferred until the cloud DB is reachable (renaming now would break local operation before cloud is populated).Depends on @hasna/contracts kit PRs (#2 contract-v1, #3 kit-codegen) reaching main/npm; kit is vendored so this repo has no runtime dep on it.