Skip to content

feat: add store-contract package - #26

Merged
Mearman merged 4 commits into
mainfrom
feat/store
Oct 10, 2026
Merged

Mearman merged 4 commits into
mainfrom
feat/store

Conversation

@Mearman

@Mearman Mearman commented Oct 10, 2026

Copy link
Copy Markdown
Member

Adds @exadev/process-graph-store-contract, the persistence port from phase 3 of the plan, as a versioned oRPC contract (graphStoreContract.v1, @orpc/contract 2.0.0-beta.41) with Zod inputs and outputs taken from graph-schema's modelSchema and overlaySchema.

Procedures: models.list|save|load|delete, overlay.set, items.upsert (participants, bound activities and transitions merged by id, plus overlay entries), query.ready|blockedChain|impact, and changes as an event iterator with a since revision that yields missed when the subscriber fell behind. Every write is validated with validate and validateOverlay and takes the next store-wide revision; failures are NOT_FOUND and UNPROCESSABLE_CONTENT with data.

The queries are structural on purpose: transitions and run state only, decision loop edges (graph-domain's loopTransitions) excluded, decisions and pseudo-states passed through. That is what lets the SQLite store answer them with WITH RECURSIVE in the next PR. A unit test checks ready agrees with graph-domain's readySet on models without conditions or artefacts.

Adapters implement a plain GraphStore and get the router from createGraphStoreRouter, which owns abort handling, error mapping and subscribing before the change iterator is returned. The in-memory fake passes the conformance kit (./conformance, optional vitest peer) both in process and over a MessageChannel with oRPC's message-port adapter.

One thing the v2 beta taught: an oRPC client is a proxy over a function, so a procedure named apply is shadowed by Function.prototype.apply and the call goes to the parent path. The overlay procedure is overlay.set for that reason.

Stacked PRs follow for graph-store-sqlite and the node and wasm drivers. The browser driver choice is recorded in #22.

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

@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-10T18:54:00.994288Z 4ff1ed9 Manual request

Security findings

Advisory findings (1)

ℹ️ 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.

@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: 5e2f9048ac

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.

The persistence port for process models and their run overlays as a
versioned oRPC contract (v1): save, load, list and delete models, set run
state, upsert items read from a source, structural ready, blocked-chain
and impact queries, and a change feed as an event iterator.

Inputs and outputs reuse graph-schema's model and overlay schemas, so the
port carries the model as it is. createGraphStoreRouter builds the router
on a plain GraphStore implementation and owns abort handling, error
mapping and eager subscription, so a caller holding the change iterator
cannot miss its own next write. Every write is checked with validate and
validateOverlay and takes the next store-wide revision.

The queries are structural (transitions and run state only, decision
loop edges excluded, control elements passed through), so a SQL store
can answer them without evaluating conditions; on models without
conditions or artefacts ready agrees with graph-domain's readySet.

An in-memory fake and a conformance kit (separate ./conformance entry,
optional vitest peer) ship with it; the fake passes the kit in process
and over a MessageChannel.
… without a decision

The model fixtures move into the ./conformance entry so adapters can reuse
everyFieldModel and queryModel in their own tests, for example to check a
database file round-trips every field.

A new conformance case saves a model whose transitions cycle without a
decision: the queries must still terminate and never report the element
asked about. It caught a SQL walk that reported the start element when a
cycle led back to it.
@Mearman

Mearman commented Oct 10, 2026

Copy link
Copy Markdown
Member Author

@codex security review

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🛡️ Codex Security Review

Here are some automated security review suggestions for this pull request.

Reviewed commit: e1985e7eb6

ℹ️ 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.

Comment thread packages/core/graph/store-contract/src/feed.ts Outdated
A subscriber that stopped reading made every later change pile up in its
subscription without limit. A subscription now holds at most its
capacity of undelivered changes; when another arrives, the held changes
are replaced by one missed event, so memory stays bounded and the
subscriber knows to load the model again. A subscriber that keeps
reading receives every change directly and misses nothing.

The capacity is a ChangeFeed option, overridable per subscription. The
default, defaultSubscriptionCapacity, holds one change: the only thing a
change asks of a subscriber is to read the model again, and the model
read after one pending change already reflects every later one.

A conformance case checks that a subscriber that stops reading under
sustained writes is never left unaware of a change it lost, and the
kit's helpers move to their own module.
@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: 4ff1ed9d04

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 22abe27 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