Add v2 typed materialization API - #31
Conversation
|
You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard. |
|
@codex ptal |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: e7a4e097dc
ℹ️ 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".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 53bb445a62
ℹ️ 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".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
|
@codex review |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 474719c235
ℹ️ 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".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
|
@codex review |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: b797adcfea
ℹ️ 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".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
|
@codex review |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 24bfde0321
ℹ️ 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".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
5f9fe1a to
aede8ef
Compare
918ebe9 to
13d1579
Compare
|
@codex review |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: db702db22b
ℹ️ 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".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
|
@codex review |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 3d0aceb335
ℹ️ 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".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
|
@codex review |
|
Codex Review: Didn't find any major issues. Breezy! Reviewed commit: ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
If Codex has suggestions, it will comment; otherwise it will react with 👍. Codex can also answer questions or update the PR. Try commenting "@codex address that feedback". |
|
@codex ptal |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 358367cdcd
ℹ️ 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".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
|
@codex PTAL |
|
Codex Review: Didn't find any major issues. Nice work! Reviewed commit: ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
If Codex has suggestions, it will comment; otherwise it will react with 👍. Codex can also answer questions or update the PR. Try commenting "@codex address that feedback". |
Summary
This is a breaking v2 ledger construction rewrite, not a bolt-on projection module.
defineLedgerModel/registerLedgerModel/bindLedgerModelpath withdefineLedgerShape(...),defineMaterializationSchema(...),defineMaterializationHistory(...),defineMaterializations(...),withMaterializations(...), and.register(...).relationsruns as a second phase over inferred tables.defineMaterializationHistory(currentSchema, ...), a typed migration DSL that records ordered create-table, add-column, create-index, create-unique-index, add-foreign-key, and data migration operations as data.s.data(description, async ({ db }) => ...)migration steps with a Sledge-owned typed migration database facade forselectFrom,insertInto,updateTable, anddeleteFrom; no raw SQL or storage handle is exposed.from/tomigration callback metadata with a single canonical current schema plus explicit migration history.defineMaterializations(...); implementations are supplied later as matching plain maps in.register(...).p.indexer(...)/p.query(...)handle pattern and the prior.withProjections(...)shape method.t.eventRef("event.name"); handlers writeevent.refrather than touching the internal events table.modelinstead ofboundModel.This is still not a Postgres driver and does not implement materialization migration execution. It is the v2 public API slice that makes typed materialization schema, ordered migration history, and facade-only materialization access the center of ledger construction before runtime/storage execution is added.
Diff Shape
3 files changed, 246 insertions(+), 1 deletion(-).4 files changed, 275 insertions(+), 36 deletions(-).5 files changed, 869 insertions(+), 250 deletions(-).15 files changed, 5384 insertions(+), 866 deletions(-).Validation
node --run lintpassed.node --run typecheckpassed.node --run buildpassed.node --test src/ledger/ledger-projections.test.ts src/ledger/projections.test.ts src/ledger/turso-ledger.contract.test.tspassed: 21 tests.npm pack --dry-runpassed after build: 43 files. I used a temp npm cache because the default~/.npmcache has root-owned files.node --run testattempted locally: 28 tests passed, including Turso contract and materialization/projection coverage; the remaining 47 failures are the known localbetter-sqlite3native binding lookup (Could not locate the bindings file). I did not rebuild or install native modules locally.Verify (Node 24)passed on head474719c2353ddfa6eb0c93c77d501b585f149c02.