analysis::concurrency::deadlock transforms typed channel, lock, def-use, and
call-target evidence into two immutable cyclic projections:
- process wait-for SCCs (
CommunicationCycle); and - conflicting resource lock-order SCCs (
LockOrderCycle).
It owns no parser, scheduler, or graph mutation.
| API/type | Contract |
|---|---|
communication_deadlocks(&CodePropertyGraph) |
ordered advisory findings from both projections |
DeadlockFindingKind |
stable communication/lock category with as_str() |
DeadlockFinding |
sorted process/resource ids, precise witnesses, explanatory detail |
DeadlockWitness::Communication |
waiter/producer/channel plus receive/send sites and ranges |
DeadlockWitness::LockOrder |
processes, resources, modes, sites/ranges, optional call site |
LockKind / LockMode |
frontend/adapter-owned typed synchronization metadata |
Both flows end in GraphProjection::External and projection_sccs. The module
does not duplicate Tarjan SCC logic. Internal ordered maps select stable
representative producer/acquisition sites; findings retain every internal SCC
edge after deterministic sorting.
- Every process, resource, and site id exists in the input CPG.
- Every range equals its witness site's stored
SourceRange. - Unresolved resource identity never becomes a name-derived id.
- Results and the CPG are unchanged by input node and edge insertion order.
- The analysis never mutates the source CPG.
- Communication edges require all known producers to be initially blocked.
- All-read lock SCCs are not returned as conflicting candidates.
- Recursive acquisition summaries terminate on the finite resource universe.
| Dependency | Purpose |
|---|---|
| channel event extraction | ordered MsgKind and ChannelId evidence |
| function scope helper | top-level process-local skeletons |
| DFG/reference overlay | stable channel and lock identity |
| call targets | interprocedural acquisition summaries |
GraphProjection |
canonical CSR wait/order graph |
| SCC decomposition | deterministic cyclic-component recognition |
Missing message or lock metadata removes the site from the corresponding skeleton. An unresolved receive cannot create a wait edge. An unresolved acquire cannot create an order edge. An unresolved release clears held state. A dangling call target contributes no summary. These choices prefer visible incompleteness and false negatives over invented semantic identity.
Unit tests cover semantic predicates, direct/interprocedural cycles, breakers, release/read-mode behavior, recursion, witness validity, immutability, serde, and generated determinism/rings. Public integration tests consume the crate-root API and a real Rholang Mode-B tree. DFG regressions protect outer lexical capture and sibling-function isolation.