Repository navigation
Synchronization primitives, environments and region checks - #25
Open
Kristof Roomp (mcroomp) wants to merge 9 commits into
Open
Kristof Roomp (mcroomp) wants to merge 9 commits into
Kristof Roomp (mcroomp) wants to merge 9 commits into
Conversation
Replace reviewed method summaries with declared primitive kinds, per-primitive manifests, environment manifests and region completeness checks, with the Abacus multiplexer as the first consumer. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Ship a kind library (register, latch, once, admission gate, counting resource, channel, cancellation source) with harnesses, witnesses and negative controls. Add per-primitive manifests resolved with Roslyn and SANY, scope synchronization.primitives and stage primitive uses, with support and staleness carried over from reviewed method summaries, which are removed. Replace the method-summary example with a primitives example. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Declare a region of explicit C# sources with its lock objects, spawns and non-primitive waits, plus environment manifests for code outside it and library primitives. Region checks (SR100-SR106) flag raw synchronization, undeclared operations and waits, lock-region violations, undeclared spawns and stale declarations, and statically discharge signals-async and non-blocking guarantees. Checks run as a synchronization stage and in preflight for model stages over a region scope. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Add the instance annotation, Roslyn site detection over region fields and SANY reference extraction, with SR107-SR111 for undeclared instances, unbound sites, contract mismatches, stale instances and unresolved receivers. Also accept empty declaration lists, limit resume-under-lock to primitives with waits, make inline callbacks a per-operation flag and allow inherited members as environment and library operations. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
…ent host TlaLinkCancellationSource gains Dispose and CancelRejected (Cancel after Dispose throws), with harness history checks. Stage child commands now run on the muxer of the running runtime instead of the first dotnet on PATH, which could change the pinned reference set mid-run (WF900 'Input changed between parser invocations: tool:csharp-references'). Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Model stages now carry their region's environment obligations, and temporal stages must declare fairness (SR112-SR114); symmetry with liveness is rejected (SR115). Primitive manifests may map kind View fields to restricted C# expressions (SR116-SR117), captured under the primitive's lock at bound sites and checked by trace validation. Site coverage and contract checks are scoped to targets that declare the field's instance. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Long safety checks of multi-instance models need more than two hours, and check-stage already accepted 48-hour deadlines. Stage, profile and editor schema limits now share ProjectWorkflow.MaxStageTimeoutSeconds. Storing a TLC result retries the directory move when a scanner briefly holds a new file open, and temporary-directory cleanup is best-effort. REFERENCE documents that deadlines do not count host sleep on Windows. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
The admission-gate kind signaled its drain in an internal step separate from the Exit or Close that left the gate closed and empty. Disposal paths that close several gates at once then interleave every signal order: in a two-lane connection model this step produced 78% of distinct states and the check did not finish. Implementations complete the drain task on the draining caller's stack right after its state change, and completing it only enables waiters, so the kind now sets signaled in that step. Every kind now defines Internal(i) == FALSE. A synchronous completion probe (IsCompleted, Status, ...) on a wait could observe the merged state, so SR118 rejects such sites unless excluded. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Only the admission-gate kind merges a signal that implementations complete after the state change. A latch's state is its task, so reading its completion is an exact state query; SR118 rejected such reads in the multiplexer's hello handling. The wait-probe mutant now also probes a latch, which is not reported. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Kristof Roomp (mcroomp)
marked this pull request as ready for review
November 23, 2026 06:37
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.
Adds first-class synchronization primitives and environments so TlaLink can check deadlock and progress models of concurrent C# against the code they describe. Design:
docs/proposals/synchronization-primitives.md. Developed against a real multiplexed RPC/bulk-transfer library as the first consumer; all examples and fixtures here are synthetic.What changes
src/tlalink/Tla/Primitives): register, latch, once, admission gate, counting resource, channel and cancellation source modules with a common interface. Every actionAalso has pureAEnabled/AApplyoperators, so a model can compose one atomic step that changes several instances of the same kind. Each kind ships with harnesses, reachability witnesses and named broken variants as negative controls.signals-async,non-blocking, ...) are statically checked where possible;state_mapping.lock_safe, obligations and evidence. Obligations appear as assumptions in plans and reports.synchronizationstage, and in preflight for model stages.instanceannotation binds region fields to kind-module instances. Roslyn finds every site that applies a primitive operation to an instance field, and SANY reference extraction checks that the bound model action applies the corresponding kind actions.fairness(SR112-SR114);state_mappingexpressions are restricted and checked (SR116-SR117) and captured under the primitive's lock at bound sites, so trace validation checks primitive state.dotneton PATH, which could change the pinned reference set mid-run (WF900);Dispose;timeout_secondsmay be up to 48 hours (check-stagealready allowed this), and storing a TLC result retries the final directory move when a scanner briefly holds a file.ExitorClosethat leaves the gate closed and empty setssignaled; there is no separate internalSignalaction, so every kind now hasInternal(i) == FALSE. Implementations complete the drain task on that caller's stack right after the state change, and completing it only enables waiters. Disposal paths close several gates at once, and the separate step interleaved every signal order: in the first consumer's two-lane model it produced 78% of distinct states and the check did not finish in 4 hours. It now completes in about 10 minutes (10.2M and 17.0M distinct states).IsCompleted,Status, ...) could observe the merged state and is rejected unless excluded. Other kinds complete their waits with their state change (a latch's state is its task), so their completion reads are not reported.Not included
Validation
All suites pass at the head commit:
--core485/485,--primitives49/49,--links49/49,--frontend15/15,--trace50/50,--workflow55/55,--evidence35/35 (Dafny viaTLALINK_DAFNY). Theexamples/Primitivesproject runs end to end: