Repository navigation
feat(protocol): return the commit revision on write replies - #293
Merged
Merged
Conversation
A program whose writes commit now replies with `revision`: the revision of the snapshot its commit published, the one standing-query pushes carry. A write that changes nothing names the current revision. Queries, rolled back programs and session-scoped writes carry none.
…e for session schemas
…s nothing durable
This was referenced Oct 5, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Intent
please continue developing the input layer engine so we make sure that the symbolic engine is ready to go live and completely production ready while we develop the GoTM uh, market.
(Context: the captain approved the neurosymbolic decision engine plan; its milestone "Engine readiness" makes the symbolic engine production-ready for the hosted decision API. This task is item EN-3: commit revision on write replies (E-3): a program whose writes commit returns the revision it committed at (
result.revisionfor committed programs) — why: every API write returnsrevision; decision records carryrevision_commitwithout a second query)What Changed
revisionfield, onQueryResultand on the WebSocketResultFrame/ResultStartFrame. It holds the knowledge graph revision the program's committed writes become visible at, which is the same revision standing-query pushes carry. It is set for committed fact, schema and rule writes, and for the meta-commands.rel drop,.clear prefix,.index create|drop|rebuild,.kg createand.ontology install|remove|upgrade. When a program makes several such writes, the field holds the last one's revision. Session-only schemas, facts and rules, plain queries, and rolled-back writes leave it unset.ProgramCommitnow records the revision it published. The storage calls behind those meta-commands now return the revision of the snapshot they published:create_knowledge_graph_at,drop_relation_in,clear_relations_by_prefix_in, andcreate_index_in/drop_index_in/rebuild_index_in.Risk Assessment
✅ Low: The change adds an optional
revisionfield to replies. The field is serialized only when a write ran and is read under the KG write lock right after each publish. Every early return inrun_program(unpinned proof, pinned proof, messages-only return, failed query) carries it, and the ontology and index paths propagate it consistently, so I found no wrong-value or breaking-change path.Testing
I built the server from this branch and ran it on a local port with a throwaway data directory and admin password. A Node script logged in as admin over WebSocket with two connections, one writing and one subscribed, and checked 20 things: - Fact inserts, persistent rules,.clear prefix,.rel drop,.index create/rebuild/drop,.kg create, and a write followed by.whyall return arevision. - For each write a subscriber was watching, the reply's revision equals the revision on the nextsubscription_delta. - A write that changed nothing returns the current revision. - Query-only programs, a rolled-back program (no fact persisted and no delta pushed), session rules and schemas,.reland.kg usecarry no revision. The first two attempts had failures caused by bugs in my driver: it countedpersistent_updatenotifications as deltas, and a timed-out wait swallowed the next delta. I fixed the driver, restarted the server on a clean data directory, and all 20 checks passed. I also ran the targeted tests this branch adds or changes; all passed. They cover.ontology install/remove, which I did not drive live, so that scenario is marked untested. I didn't run the full suite. The server and temp directory were removed afterwards, and the worktree is clean. This is an API change with no UI, so there is no screenshot; the evidence is a WebSocket transcript.cargo test --test atomic_program_tests(failed_pack_installation_applies_nothing), not over WebSocket against the running…Evidence: Live WebSocket transcript: requests, replies with revision, subscription deltas, and check results
Evidence: Node WebSocket driver used for the live run
Evidence: Key excerpt
Pipeline
Updates from git push no-mistakes
✅ **intent** - passed
✅ No issues found.
🔧 **Rebase** - 1 issue found → auto-fixed ✅
src/protocol/handler.rs- merge conflict rebasing onto origin/main🔧 Fix applied.
✅ Re-checked - no issues remain.
✅ **Review** - passed
✅ No issues found.
✅ **Test** - passed
✅ No issues found.
cargo test --test atomic_program_tests(failed_pack_installation_applies_nothing), not over WebSocket against the running…cargo build --bin inputlayer-server, then started it with--port 18791 --data-dir <tmp>/dataandINPUTLAYER_ADMIN_PASSWORDin a temp dirnode drive.mjs: a Node WebSocket driver with a writer and a subscriber connection that ran 20 live checks against the servercargo test --test standing_query_tests test_write_reply_names_the_revision_its_push_carriescargo test --test standing_query_tests test_relation_commands_name_the_revision_their_push_carriescargo test --test atomic_program_tests(includes ontology install/remove revision assertions in failed_pack_installation_applies_nothing)cargo test --test hnsw_index_tests revisioncargo test --lib pinned_proof_tests::the_reply_names_the_revision_the_writes_committed_atcargo test -p inputlayer-ws-protocol revision✅ **Document** - passed
✅ No issues found.
✅ **Lint** - passed
✅ No issues found.
✅ **Push** - passed
✅ No issues found.