Repository navigation
Fix ledger append finalization and notes projections - #65928
Conversation
Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
There was a problem hiding this comment.
Note
Copilot could not run the full agentic suite for this review because it was automatically requested on a bot-authored pull request. Request a review from Copilot under Reviewers to retry with the full agentic suite. Improved support for bot-authored pull requests is coming soon.
Copilot review overview
Review effort: Lite
Findings: 1
Open (4)
Theelsebranch treats any non-'up'vote value as a downvote, which can silently corrupt… · New These new TypeErrors don’t include any details about what was received, which will make diagnosing… · New The default vote-state object literal is duplicated. Consider extracting a single factory/helper… · New The default vote-state object literal is duplicated. Consider extracting a single factory/helper… · New
What changed in this PR
This PR updates the notes ledger replay to materialize note_state as a physical table (instead of an SQLite view) and hardens ledger append ingestion by normalizing/removing a safe-output type discriminator before validation.
Changes:
- Replace
note_stateSQLite view generation with replay-timenote_statetable generation in the builtin notes reducer. - Simplify projection creation by removing post-processing that created the
note_stateview and metadata entry. - Normalize ledger append envelopes by stripping/validating the top-level
typefield before queueing requests; add tests for the behavior.
| File | Description |
|---|---|
| actions/setup/js/ledger_builtin.cjs | Removes NOTE_STATE_VIEW and computes/materializes note_state as a replay table. |
| actions/setup/js/create_ledger_projection.cjs | Drops special-case view creation; relies on replay output tables. |
| actions/setup/js/ledger_append.cjs | Validates append envelope shape and strips safe-output type discriminator. |
| actions/setup/js/ledger_builtin.test.cjs | Updates notes replay test to rely on table materialization (no manual view exec). |
| actions/setup/js/ledger_append.test.cjs | Adds test ensuring safe-output type is normalized before validation. |
| actions/setup/js/create_ledger_projection.test.cjs | Asserts note_state is a table and that empty projections materialize empty tables. |
💡 Add a code-review agent skill for context-aware, tailored reviews. Learn more in the docs.
Reject unexpected votes during aggregation, share the empty vote-state factory, and report append envelope kinds without exposing payloads. Add regression coverage for both validation paths. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
|
🎉 This pull request is included in a new release. Release: |


Ledger smoke runs failed when safe-output validation rejected the
ledger_appendmessage envelope, preventing transaction artifacts from being written. The notes projection also exposednote_stateas a view rather than a table.typediscriminator before validating append fields, allowing the transaction artifact to be finalized and pushed.note_statewith vote totals and timestamps as a replay table, including when the ledger is empty.work_queue_readandwork_queue_claim_finish.For example, a safe-output message like
{"type":"ledger_append","ledger":"events","operation":"append","value":{}}is normalized before validation.