Conversation
Adds dev/bend2/flightsql_transactions/, a proof-of-concept that states the transaction and savepoint lifecycle sentences of FlightSql.proto (BeginTransaction, BeginSavepoint, EndTransaction COMMIT/ROLLBACK, EndSavepoint RELEASE/ROLLBACK, optional transaction_id on statements) as Bend 2 laws over an executable server model, and proves them. - main.bend: the model, one id counter, live transactions and live savepoints tagged with their transaction, and a runnable trace. - LAWS.bend: 19 laws, each quoting the proto sentence it comes from, plus three properties kept as comments with the reason they cannot be expressed (timeouts, opaque byte handles, feature negotiation). - PROOF.bend: the proofs; `bend PROOF.bend` prints "All terms check." - README.md: what is modelled, the readings chosen where the proto is silent, how to run, results, and seven mutation tests that the checker rejects. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Fheww5W5WMBfe3EZeS4qtD
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.
What's Changed
Adds
dev/bend2/flightsql_transactions/, a proof of concept that uses the Bend 2 language to state and prove the transaction and savepoint lifecycle of Flight SQL, as written in the comments ofarrow-format/FlightSql.proto(ActionBeginTransaction,ActionBeginSavepoint,ActionEndTransactionCOMMIT/ROLLBACK,ActionEndSavepointRELEASE/ROLLBACK, and the optionaltransaction_idon statements). It follows the prepared-statement prototype onclaude/bend2-arrow-integration-pgexutand reuses its proof helpers; only this new directory is in the PR, no Java code is touched.main.bend: the server model. One id counter, live transaction ids, live savepoints tagged with their transaction (newest first), the five requests, and a runnable trace inmain.LAWS.bend: 19 laws, each quoting the proto sentence it comes from, plus three properties kept as comments with the reason they cannot be expressed.PROOF.bend: the proofs.bend PROOF.bendprintsAll terms check.in 0.32 s.README.md: what is modelled, the readings chosen where the proto is silent, how to run, results, mutation tests.Laws proven (19)
ended_tx_rejectedt, every request namingt(BeginSavepoint, EndTransaction, statement) is an error, from any stateended_tx_kills_savepointscommit_rollback_same_statesavepoint_needs_live_tx,savepoint_in_live_tx,savepoint_bound_to_txend_savepoint_keeps_txsrelease_kills_savepointrelease_keeps_other_savepointsrollback_keeps_savepointrollback_kills_later_savepointsrollback_keeps_earlier_savepointsstatement_needs_live_tx,statement_autocommit,statement_in_live_txfresh_tx_runs_statement,fresh_tx_takes_savepointinv_start,inv_keptKept as comments, not proven
NOT EXPRESSIBLEtimeout: "If the transaction times out, then it is automatically rolled back". The model has no clock; a timeout is an event between requests, not a request.NOT EXPRESSIBLEopaquebyteshandles: Bend has no byte or 64-bit integer type; ids areNats from one counter and only "never reissued" is stated.NOT EXPRESSIBLE"Only supported if FLIGHT_SQL_TRANSACTION is ... SUPPORT_SAVEPOINT": feature negotiation lives inGetSqlInfo, a separate RPC.Every law that was attempted was proven; there is no
NOT PROVENentry.Mutation tests
Seven bugs injected into
main.bendone at a time, each rejected bybend PROOF.bend, files restored afterwards:The README records, per mutation, the law that becomes false and where the checker first fails (often an earlier proof step that spelled out the old shape of the model rather than the violated law, the brittleness noted in the research notes).
Builds
bend main.bend -o out.js(21 KB, runs under node) andbend main.bend -o out(1.1 MB native via clang 18) both build and print the expected trace[Id(0), Id(1), Id(2), Done, Err, Done, Done, Err, Err, Done]. No build outputs are committed.Observation
While reading
FlightSqlClientfor the semantics:rollback(Savepoint)sendsEND_SAVEPOINT_RELEASE, the same action asrelease(Savepoint). Under the model that call performs the release transition, after which the savepoint is gone, rather than the rollback transition that keeps it. Not changed in this PR.🤖 Generated with Claude Code
https://claude.ai/code/session_015wBzfARVa1g7nkB1muT5Sj
Generated by Claude Code