Expand description
GraphReFly Graph container — sugar layer over graphrefly_core::Core
with named namespace, mount/unmount composition, describe() JSON
introspection, and observe() sink-style message tap.
§Status (M2 Slice E+ — 2026-05-05)
Read-side introspection + composition slice. Lands the canonical-spec
Graph surface for state / derived / dynamic named sugar
(§3.9), add / node / name_of / try_resolve namespace (§3.5),
mount / mount_new / mount_with / unmount / ancestors
composition (§3.4), destroy / signal_invalidate lifecycle (§3.7),
describe() JSON form (§3.6 + Appendix B), and observe() /
observe_all() default sink-style tap (§3.6.2).
Hard-breaks the M2 starter (Slice D) sugar API: state(name, initial)
replaces state(initial), etc. Pre-1.0 — no compat shims (per
feedback_no_backward_compat.md).
Out of scope (subsequent slices):
- Reactive
describe()/observe()—Node<GraphDescribeOutput>andNode<ObserveChangeset>modes (§3.6.1 / §3.6.2 reactive variants). Need a Core-level topology-change notification primitive. - Async-iterable
observe()modes —structured/timeline/causal/derivedopts. describe()non-JSON formats — pretty / mermaid / d2 / stage-log.describe({ explain })/describe({ reachable })— causal chain + reachability walks.- Snapshot / restore + content addressing — V1 lazy CID / V2 schema validation / V3 caps + cross-graph refs (§3.8 + Phase 6).
mutate()factory — DS-14 RAII + audit append substrate.- Cross-Core (multi-binding) mount — open question 1 in
archive/docs/SESSION-rust-port-architecture.mdPart 6; post-M6. - Meta annotations + versioning fields in describe output — need metadata-storage primitive on Core.
§Crate lints
#![forbid(unsafe_code)] per workspace policy.
Structs§
- Edge
Describe - Edge between two named nodes (or a named node and an anonymous
dep, surfaced as
_anon_<NodeId>). - Graph
- Graph container — Phase 1+ public API.
- Graph
Describe Output - Top-level
describe()output (canonical Appendix B JSON schema). - Graph
Observe All - All-nodes observe handle.
subscribemultiplexes across every named node in the graph (NOT recursive into mounts — observers wanting recursion compose withchild.observe_all()per subgraph). - Graph
Observe AllReactive - Reactive variant of
GraphObserveAllthat auto-subscribes late-added named nodes via Graph namespace-change notifications. - Graph
Observe One - Single-node observe handle.
subscribetaps downstream messages from the observed node (same payload shape as a directgraphrefly_core::Core::subscribe, including the[Start, Data?]handshake when a cache is present per R1.2.3 / R1.3.5.a). - Graph
Persist Snapshot - Portable snapshot of a graph’s state — survives serialization round-trips (JSON, CBOR, etc.).
- Graph
Remove Audit - Result of
Graph::unmount(and exposed for futureGraph::removeparity, canonical spec §3.2.1GraphRemoveAudit). - Node
Describe - Per-node descriptor.
- Node
Slice - Per-node state within a snapshot.
- Reactive
Describe Handle - RAII handle for a reactive describe subscription. Dropping it stops the namespace listener and frees the describe-sink.
Enums§
- Describe
Value - Per-node cache value in
describeoutput. Surfaced asvalue: <u64>when produced byGraph::describe(raw handle view), or asvalue: <T>when produced byGraph::describe_with_debug(binding-rendered view). Serialized uniformly without an enum tag — consumers see either a number or whatever JSON shape the binding emits. - Mount
Error - Errors from
mount/mount_new/unmount. - Name
Error - Errors from name registration.
- Node
Snapshot Status - Lifecycle status stored in a snapshot.
- Node
Status - Canonical Appendix B
statusenum. - Node
Type Str - Canonical Appendix B
typeenum. - Path
Error - Path resolution errors returned by
Graph::try_resolve_checked. Slice V3: introduces typed path errors per porting-deferred.md. - Remove
Error - Errors from
Graph::remove. - Signal
Kind - Signal kind for
Graph::signal(canonical R3.7.1). - Snapshot
Error - Errors from
Graph::restoreandGraph::from_snapshot.
Traits§
- Debug
Binding Boundary - Render handles into JSON-shaped debug values.
Type Aliases§
- Describe
Sink - Sink type for reactive describe — receives a fresh
GraphDescribeOutputon every namespace change. - Node
Factory - Factory function for auto-hydration mode of
Graph::from_snapshot. Given a node name, its snapshot slice, and already-resolved depNodeIds, returns theNodeIdof the reconstructed node registered in the providedGraph. - Snapshot
Builder - Builder function for
Graph::from_snapshotbuilder mode.