Repository navigation
spike: W-010 session-type endpoint generation (#184) - #760
Open
tuyentn23-dot wants to merge 3 commits into
Open
tuyentn23-dot wants to merge 3 commits into
tuyentn23-dot wants to merge 3 commits into
Conversation
2 tasks done
Contributor
|
Shepherd W2 could not update this branch automatically (behind main by 76). Labeled |
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.
Spike for W-010 (#184): session-type endpoint generation
Standalone, dependency-free feasibility spike for the W-010 ledger slot
(slot 10, review window 2026-11-01). Pre-registered at
spikes/spike15-w010-session-projection/PREREG.mdbefore the firsttest run; results at
RESULTS.md.Hypothesis (preregistered)
For a closed subset (finite labelled message sequence + binary choice; no
recursion, no delegation, no dynamic spawn), if a global type
Gprojectsto every role under Honda-Yoshida-Carbone projection with the standard
uninvolved-role merge condition, then the projected locals are
communication-deadlock-free (conditional on terminating local computation
and fair scheduling). Its contrapositive — the A/B ping-pong
A: send p; recv q/B: send q; recv p— cannot be synthesized into anyglobal type.
What is in the spike
model/is a ~570-LOC Rust crate with zero dependencies:Global/Localtypes,project,synthesize(inverse)simulate_locals: exhaustive interleaving explorer that enumeratesevery schedule of enabled endpoints up to a bounded state count and
distinguishes
TerminatesfromDeadlock(with witness trace + stuckrole set)
codegen_go: emits a hub-mediated Go skeleton (not run — see limits)Results (actual, from
RESULTS.md)cargo test --release --offline, 4.87 s.synthesizereturnsErr(NoMatchingReceiver); thesimulator reports
Deadlockwith both roles stuck. Prereg bar 2 met.synthesizereturnsA -> B : p . B -> A : q . End, both projections round-trip, simulatorreports
Terminates. Prereg bars 3 and 4 met.branch is rejected with
UninvolvedBranchMerge.No kill criterion fired.
Honest limits (stated in PREREG.md up-front, not retrofitted)
No Go toolchain on the author machine. I cannot run
go buildorgo runhere, so the codegen was validated by reading its actual outputplus a protocol-level reasoning check against the projection. A reviewer
with Go installed can now actually run it — see the
model/work/{main.go,go.mod}that this PR commits:Expected:
PROTOCOL OK. (First revision of this PR had a broken codegen— the hub goroutine forwarded into its own channel; that is fixed in
commit
6f183cb: per-role inbox channels, plussync.Oncearoundclose(done)to avoid a double-close race between the timeout goroutineand the
wg.Wait()goroutine.cargo test --release --offlineis still8/8 after the fix. The correctness claim is the simulator, not the
codegen; the codegen is a concrete, now-runnable illustration.)
No recursion, no delegation, no
select-on-multiple-channels, nocancellation. All excluded by design.
Bounded state space (
MAX_STATES = 20_000); beyond that the simulatorreturns
DepthExceeded, never a safety verdict.Relation to #184
The proposal's own "Bounded model evidence" section says its Python model
covers "the supplied finite acyclic graphs only" and does not parse
Go-Hybrid source, generate Go, or establish a future projection's
correctness. This spike closes part of that gap by mechanizing
synthesize <-> projectround-trip and an exhaustive scheduler. It doesnot claim to be a Go-Hybrid compiler change; it is a model of the
claim, in the same form as #370 and #381.
Files
PREREG.md— registered 2026-10-19, before first runRESULTS.md— actual output, actual test countsmodel/— the crate (Cargo.toml,src/,tests/)Refs #184 (W-010, MOONSHOT slot 10).