Skip to content

feat: add store-sqlite package - #27

Merged
Mearman merged 3 commits into
mainfrom
feat/store-sqlite
Oct 10, 2026
Merged

Mearman merged 3 commits into
mainfrom
feat/store-sqlite

Conversation

@Mearman

@Mearman Mearman commented Oct 10, 2026

Copy link
Copy Markdown
Member

Adds @exadev/process-graph-store-sqlite, the GraphStore port on SQLite through drizzle-orm 1.0.0-rc.4, stacked on #26.

It is written against Drizzle's async SQLite database type (SQLiteAsyncDatabase<"sync" | "async">), so node-sqlite and sqlite-proxy both plug in; the driver packages come in the next PRs. src/tables.ts is the single table definition, with enumerated columns taken from graph-schema's vocabulary (exported from graph-schema in its own commit here). src/rows.ts is the mapping layer: it flattens a model into rows and parses rows back with modelSchema, so storage layout never reaches the contract. A unit test derives the row schemas with drizzle-orm/zod (no drizzle-zod) and asserts they agree with the model schema on every shared scalar field.

The drizzle-kit migration under drizzle/ is committed. Drizzle's own migrators cannot run in the browser worker (drizzle-orm/migrator imports node:fs, and migrateAsync needs object-mode reads the proxy session refuses; details in #22), so the build embeds the folder using drizzle's own readMigrationFiles and migrate applies it through values and run into the same __drizzle_migrations journal. A test checks it produces the same schema and journal as drizzle's node-sqlite migrator on the committed folder, and that each finds nothing left after the other. The embedded module is build output and gitignored.

query.ready, query.blockedChain and query.impact are single WITH RECURSIVE queries through the sql template, reading a loop flag written from graph-domain's loopTransitions. Transactions use plain BEGIN IMMEDIATE/COMMIT/ROLLBACK because Drizzle's transaction callback has to be sync on a sync driver and async on an async one; every operation runs under an injectable exclusive, which the wasm driver will use for its cross-tab Web Lock.

The conformance kit passes over node:sqlite in memory; a file database also round-trips across a reopen. The contract commit on the base branch adds a conformance case for a cycle without a decision, which caught the SQL walk reporting the start element.

npm name to reserve before the first release: npm-reserve @exadev/process-graph-store-sqlite --trust ExaDev/process-graph --workflow ci.yml.

@Mearman
Mearman marked this pull request as ready for review October 10, 2026 16:36
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Oct 10, 2026 •

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
🔒 Security Review ✅ Completed 2026-10-10T19:43:02.412763Z 86d713a Manual request
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

The participant kinds, pseudo roles, message modes, fragment operators,
overlay statuses and notations were already const tuples but only their
types were exported. A storage adapter needs the values to declare
enumerated columns from the model's own vocabulary rather than a copy,
and elementKinds names the Element variants, pinned by a type test.
The GraphStore port on SQLite through drizzle-orm 1.0.0-rc.4, written
against Drizzle's async SQLite database type so any driver plugs in.

One table definition in src/tables.ts, with enumerated columns taken from
graph-schema's vocabulary; a mapping layer flattens a model into rows and
parses rows back with modelSchema; a unit test derives the row schemas
with drizzle-orm/zod and asserts they agree with the model schema.

The drizzle-kit SQL migrations are committed. The build embeds them via
drizzle's own readMigrationFiles and migrate applies the missing ones
through values and run, so a Node process and a browser worker apply the
same statements; drizzle's migrators read node:fs or need object-mode
reads the sqlite-proxy session refuses. A test checks migrate and
drizzle's node-sqlite migrator build the same schema and journal.

ready, blockedChain and impact are single WITH RECURSIVE queries through
the sql template, reading a stored loop flag from graph-domain's
loopTransitions. The store passes the conformance kit over node:sqlite.

The adapters layer gets its knip workspace entry with this first package.
@Mearman
Mearman changed the base branch from feat/store to main October 10, 2026 19:05
@Mearman

Mearman commented Oct 10, 2026

Copy link
Copy Markdown
Member Author

@codex security review

@chatgpt-codex-connector

Copy link
Copy Markdown

🛡️ Codex Security Review

Security review completed. No security issues were found in this pull request.

Reviewed commit: 86d713a6e7

View security finding report

Only the user who started this review can view the report in Codex.

ℹ️ About Codex security reviews in GitHub

This is an experimental Codex feature. Security reviews are triggered when:

  • You comment "@codex security review"
  • A regular code review gets triggered (for example, "@codex review" or when a PR is opened), and you’re opted in so security review runs alongside code review

Once complete, Codex will leave suggestions, or a comment if no findings are found.

@Mearman Mearman closed this Oct 10, 2026
@Mearman Mearman reopened this Oct 10, 2026
@Mearman

Mearman commented Oct 10, 2026

Copy link
Copy Markdown
Member Author

@codex security review

@chatgpt-codex-connector

Copy link
Copy Markdown

🛡️ Codex Security Review

Security review completed. No security issues were found in this pull request.

Reviewed commit: 86d713a6e7

View security finding report

Only the user who started this review can view the report in Codex.

ℹ️ About Codex security reviews in GitHub

This is an experimental Codex feature. Security reviews are triggered when:

  • You comment "@codex security review"
  • A regular code review gets triggered (for example, "@codex review" or when a PR is opened), and you’re opted in so security review runs alongside code review

Once complete, Codex will leave suggestions, or a comment if no findings are found.

@Mearman
Mearman merged commit 34c763b into main Oct 10, 2026
14 checks passed
@github-actions

Copy link
Copy Markdown

🎉 This PR is included in version 1.0.0 🎉

The release is available on:

Your semantic-release bot 📦🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant