Conversation
Add dev/bend2/poll_flight_info, a checked Bend 2 model of the Arrow Flight long-running query protocol: PollFlightInfo and PollInfo, FlightEndpoint.expiration_time, RenewFlightEndpoint and CancelFlightInfo. - main.bend: the server model (queries with progress, poll-descriptor expiry and endpoints with expiry ticks; requests Start, Poll, Cancel, DoGet, Renew, Tick, Fail) with a runnable sample trace. - LAWS.bend: 22 laws, each quoting the Flight.proto or Flight.rst sentence it comes from (progress bounded and monotone, endpoints append-only, unknown and expired descriptors rejected, complete query reports full info with the descriptor unset, cancel semantics and idempotence, DoGet before and after expiry, renewal strictly extends, freshness invariant, anti-vacuity traces). Properties Bend cannot express (long-poll timing, double progress, timestamps) and the trace form of monotonicity are kept as comments with the reason. - PROOF.bend: proofs of all 22 laws; `bend PROOF.bend` prints "All terms check." in 0.3 s. - README.md: what is modelled, the decisions taken where the spec leaves room, how to run, and seven mutation tests, each rejected by the checker. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01BrToZSS2oYHyEoo8JvLJog
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/poll_flight_info/, a proof-of-concept that uses the Bend 2 language to specify and machine-check one area of Arrow Flight: thePollFlightInfolong-running query protocol,FlightEndpoint.expiration_time,RenewFlightEndpointandCancelFlightInfo. It follows the layout of the prepared-statement model from the research branch (dev/bend2/prepared_statement/). No Java code is touched.main.bend: the server model. Queries with progress (a Nat out of 100), a poll-descriptor expiry tick and endpoints with expiry ticks; requestsAStart,APoll,ACancel,ADoGet,ARenew,ATick,AFail; a runnable sample trace inmain.LAWS.bend: 22 laws, each quoting theFlight.protoorFlight.rstsentence it comes from.PROOF.bend: proofs of all 22 laws.bend PROOF.bendprintsAll terms check.in 0.3 s.README.md: what is modelled, the decisions taken where the spec leaves room, how to run, results and mutation tests.Laws proven (22)
inv_start,inv_kept(ids below the counter, progress at most 100, kept by every request).progress_bounded("must be in [0.0, 1.0]");poll_monotone(endpoints only appended, and this server's progress never decreases across a poll, any one request, and a poll again).unknown_descriptor_rejected,expired_descriptor_rejected(error, and the query is cancelled),done_poll_complete(progress 100, descriptor unset, all endpoints, state unchanged),fresh_query_polls(anti-vacuity).cancel_running(CANCELLED and the query is cancelled),cancelled_poll_rejected,cancelled_doget_rejected,cancel_idempotent,failed_not_cancellable,failed_poll_rejected.doget_before_expiry,doget_after_expiry,renew_extends(strictly later expiry),renew_expired_rejected,renewed_doget_ok.trace_doget_fresh(start, poll, tick, poll, DoGet before expiry streams),trace_doget_expired,trace_completes.Decisions where the spec leaves room (argued in the README): cancelling a complete
FlightInfoanswersCANCELLEDand its endpoints stop streaming (per Flight.rst andExpirationTimeCancelFlightInfoScenario); a failed query answersNOT_CANCELLABLE; re-sending the original descriptor starts a new query rather than erroring; an endpoint is valid whilenow < exp; renewal requires a still-valid endpoint.Commented out in
LAWS.bend, with the reasonprogressas a double in [0.0, 1.0]. Bend has no F64 and F32 is axiomatic;progress_boundedis the Nat-out-of-100 form.expiration_timeas agoogle.protobuf.Timestampagainst a wall clock. No 64-bit integers, no clock; time is a Nat tick advanced byATick.poll_monotone_trace, the form with an arbitrary list of requests between the two polls. It follows from the one-step law once two more invariants (ids never forgotten; cancelled/failed absorbing) are proven; not done in this session.Mutation tests
Seven bugs were introduced one at a time; each is rejected by
bend PROOF.bend, and the file was restored (check green again) after each.Nat.subpoll_monotonedone_poll_completedoget_runalways answers datadoget_after_expiryexpired_descriptor_rejectedAStartdoes not advance the counterinv_keptcancel_st(QDone) = QDonecancelled_poll_rejected,cancelled_doget_rejectedrenewed(exp, now) = exprenew_extendsIn two rows the checker stops first at a proof or annotation that merely mentions the changed shape (proof brittleness, as noted in the research README); the README records where it stops and which law is actually false.
Build
bend main.bend -o out.js(32 KB, runs under node) andbend main.bend -o out(1.1 MB native via clang) both build and print the sample trace. Build outputs are not committed.🤖 Generated with Claude Code
https://claude.ai/code/session_015wBzfARVa1g7nkB1muT5Sj
Generated by Claude Code