Repository navigation
Conversation
…e replies
A result now lists every fact statement its program committed in
`statements: [{index, kind, inserted, deleted}]`, with effective counts,
so a client reads whether a write (such as a guarded update's token)
landed from data instead of parsing message text. The list rides on the
reply even when the program ends with a query, whose rows used to replace
the count messages.
Contributor
Author
|
Heavy checks deferred to the release checkpoint on the dedicated benchmark machine: the perf gate ( |
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-4: structured per-statement counts (E-1) — why: the gateway reads whether a guard token landed from data, not message text)
EN-4 / E-1 in substance: a write program's reply reports each statement's outcome structurally in the result, as
statements: [{index, kind, inserted, deleted}], instead of only in per-statement message text (Inserted N fact(s) into '<rel>'.,Update: N deleted, M inserted., ...). Today those counts exist only in message text and are lost when a program ends with a query. With structured counts the gateway and SDKs stop parsing message text to know whether a guarded write's token landed (a guarded insert compiles to the update form, and its inserted count decides whether it applied).What Changed
statementslist of{index, kind, inserted, deleted}for each committed fact statement, in program order.kindisinsert,deleteorupdate, and the counts are the tuples each statement actually changed. The list is still sent when the program ends with a query. It is left out when the program committed no fact statements, for example a read, a program that rolled back, or one that only changed schema or rules. A guarded update that matched nothing appears with zero counts, so itsinsertedvalue shows whether the write landed.commit_write_run, which now returns them alongside the existing message rows. They travel onQueryResultand the ws-protocolResultFrame, including streamed results, andStatementCountsandStatementKindare exported from both crates.statementsfield and theStatementCountsschema. New tests intests/statement_counts_tests.rs, the ws-protocol server tests and the stream tests cover the field.Risk Assessment
✅ Low: The change adds an optional field that is skipped when empty, so existing clients are unaffected; it is filled only from the single commit path, and every return after the commit (messages-only, failed query, query success) passes the counts through, including the WS streaming header; behavior tests cover rollback, a trailing query and guarded updates.
Testing
I built the real inputlayer-server and ran it with a disposable data dir. A Node WebSocket client then drove six scenarios over /ws: mixed insert/delete/update/rule programs, a write ending in a query, a guarded claim that lands and then is refused, a pure query, a rules-only program, a failing program that rolls back, and a write ending in a query larger than 1 MiB, which streams. Every reply's
statementsmatched the documented contract, including on the streamedresult_startheader. I also ran the change's own statement_counts integration tests and the ws-protocol serde tests, and both passed. All temporary server, data and build state was removed afterwards.statementskeystatements; follow-up ?item(100) returns 0 rowsEvidence: Live WebSocket transcript of all scenarios
Evidence: Guarded claim: token landed vs refused, read from data
Pipeline
Updates from git push no-mistakes
✅ **intent** - passed
✅ No issues found.
✅ **Rebase** - passed
✅ No issues found.
packages/inputlayer-py/src/inputlayer/program.py:469- The SDKs still work out guarded-write outcomes by parsing message text:packages/inputlayer-py/src/inputlayer/program.py:469uses_UPDATEDregex andpackages/inputlayer-js/src/program.ts:422usesUPDATEDregex. The engine now returns structuredstatementscounts, but neither SDK reads them yet. Moving the SDKs over is the follow-up the intent describes as a consequence of E-1, not something EN-4 itself requires. Nothing is broken today, because the message rows are unchanged.✅ **Test** - passed
✅ No issues found.
statementskeystatements; follow-up ?item(100) returns 0 rowsCARGO_TARGET_DIR=/tmp/nm-en4-target cargo build --bin inputlayer-serverthen ran it on 127.0.0.1:18431 with a throwaway --data-dir and a bootstrap API keyNode 22 WebSocket driver (drive.mjs) authenticated with the API key and sent execute frames for scenarios S1–S6 against the live server; transcript saved as evidencecargo test --test statement_counts_tests(6 passed)cargo testin ws-protocol (includes server::tests::statement_counts_are_listed_only_when_a_fact_statement_committed; all passed)✅ **Document** - passed
✅ No issues found.
✅ **Lint** - passed
✅ No issues found.
✅ **Push** - passed
✅ No issues found.