Repository navigation
Port the read-only Postgres store to TypeScript - #709
arrry-hydraDB merged 1 commit into
Conversation
|
@hydra-mira-review review |
Mira score 5/5 · 🟢 Good to merge
1 more
TypeScript applications can read PostgreSQL graphs through a new read-only store. The PR adds an optional Before this ships · 3 to confirm
How this PR works · 7 changes, 1 high risk, 5 medium risk, 1 low riskTypeScript applications can now read existing Postgres tables as a graph without copying their rows into another store. This PR ports the Python store using an optional Postgres driver, registered graph metadata, and bounded reads. It adds the TypeScript layer above the Python store branch. 1. Connect through an optional Postgres driver · 🟠 medium risk ·
|
There was a problem hiding this comment.
Mira Review Summary
Valid 19-digit bigint IDs can disappear from lookups and traversal, and some Unicode names cannot be found even by exact spelling (pgHydradb.ts). Concurrent initialization can expose an incomplete registry and leak competing pools, while an initial connection failure permanently disables the graph; large neighborhood reads also spend quadratic work grouping edge keys. CI skips every Postgres store integration test (pgHydradbStore.test.ts).
Key Issues
| Issue | Location | |
|---|---|---|
| 🔴 | Valid 19-digit bigint IDs are silently discarded from lookups and traversal. | typescript/src/stores/pgHydradb.ts:141 |
| 🔴 | Concurrent initialization can expose an incomplete registry and leak competing pools. | typescript/src/stores/pgHydradb.ts:270 |
| 🔴 | An initial connection outage permanently closes the store and prevents recovery. | typescript/src/stores/pgHydradb.ts:285 |
cda06bc to
a0d61b2
Compare
|
@hydra-mira-review review |
a0d61b2 to
81f5c0e
Compare
|
@hydra-mira-review review |
81f5c0e to
a65d0a2
Compare
|
@hydra-mira-review review |
a65d0a2 to
a681d71
Compare
|
@hydra-mira-review review |
a681d71 to
253216f
Compare
|
@hydra-mira-review review |
Signed-off-by: adityamishra-hydradb <[email protected]> Co-Authored-By: Claude Opus 5.5 <[email protected]>
253216f to
ce8fb6b
Compare
|
@hydra-mira-review review |
Summary
3/5 of #706. Ports
PgHydraDBStoreto TypeScript over thepgdriver (optional peer dependency), with the same ids, types, statements, and error text as Python.It has the same review fixes as 2/5: full bigint range, one-time initialize, retry after a failed connect, reserved types, exact names, URI credentials, and one namespace per store.
Implementation details
Door:
one-wayNew public TypeScript store class and an optional
pgpeer dependency.Cleanup:
noneWhat to delete:
Decisions
pg), the common pure JavaScript client. It is an optional peer dependency, loaded withloadOptional, so a missing install raisesmissing_packagewithnpm install pg. Theoptionsstartup parameter setsdefault_transaction_read_only=onandstatement_timeout; the pool runs no statement when it returns a client.bigintand the walk returns keys as text, so keys above 2^53 keep their value.graph,names,statementTimeout,seedLimit,poolSize. The error text names the Python primitive (upsert_node), so both SDKs give identical messages.read_only_store.postgres. It builds pg_hydradb from a pinned hydradb commit and runs these gated tests of both SDKs on Postgres 16 and 17. No image goes to a registry.tests/fixtures/pg_hydradb_work.sql.test/pgHydradbStore.test.tsraises each code from the store itself.Validation
test/pgHydradbStore.test.tsmirrors the Python tests (skipped unlessSG_PG_HYDRADB_URIis set): passes on Postgres 16, 17, and 18 with pg_hydradb.npm packof this branch, installed withpgin an empty folder, ran the TypeScript example of the docs as written against the docs' Docker setup: it printed the draft schema andAnn Lee -[WORKS_AT]-> Acme.SELFGRAPH_PY: A (main): lint, typecheck, and build pass; 1420 passed, 27 skipped. B (top of the stack): lint, typecheck, and build pass; 1427 passed, 36 skipped, 0 failed, conformance pair included; CI runs the same suites green on every PR. One earlier run of A timed out inconformanceGraphwhile Docker builds loaded the machine; the rerun passed.precheck,make probes, ruff:precheck --base2/5: all checks passed; the same conformance warning, answered in 5/5.make probes:plan_apply,secret_echo, andunmerge_orderpass;parity_tablefails the same way on main and on the branch (vitest cannot parse a.scmquery file in this environment).ruff checkandruff format --check: clean.Limits
Same as 2/5.
Linked issue
Closes #706
AI Assistance
Checklist
/approved.AGENTS.md).Breaking changes
None.
🤖 Generated with Claude Code