# reconciler_cli An interactive REPL for exploring the reconciler module. Sets up a simulated three-resource state machine (device, transport, stream) with declared dependencies and lets you drive reconciliation manually — useful for understanding reconciler behaviour before wiring it into the node. --- ## Build From the repository root: ```sh make cli ``` The binary is placed in `build/cli/`. --- ## Usage ```sh ./reconciler_cli ``` Drops into an interactive prompt: ``` reconciler> _ ``` ### Demo resources Three resources are pre-configured: | Resource | States | Notes | |---|---|---| | `device` | CLOSED → OPEN → STREAMING | Simulates a V4L2 device | | `transport` | DISCONNECTED → CONNECTED | Depends on device=OPEN | | `stream` | INACTIVE → ACTIVE | Depends on transport=CONNECTED and device=STREAMING | Dependencies are checked before each transition: the reconciler will not advance a resource until all its prerequisites are met. Blocked resources show the unmet dependency in the status output. ### Commands ``` status print all resources with current/wanted state and transition status want set the desired state (by number or case-insensitive name) tick run one reconciler tick run tick until stable (max 20 ticks) or a failure occurs fail make the next action for this resource fail (simulates an error) help show commands quit / exit exit ``` ### Example session ``` reconciler> want device STREAMING reconciler> want transport CONNECTED reconciler> want stream ACTIVE reconciler> run [device] CLOSED → OPEN ok [device] OPEN → STREAMING ok [transport] DISCONNECTED → CONNECTED ok [stream] INACTIVE → ACTIVE ok reconciler> status device current=STREAMING wanted=STREAMING transport current=CONNECTED wanted=CONNECTED stream current=ACTIVE wanted=ACTIVE reconciler> fail transport reconciler> tick [transport] CONNECTED → DISCONNECTED error (simulated) reconciler> status device current=STREAMING wanted=STREAMING transport current=DISCONNECTED wanted=CONNECTED (will retry) stream current=ACTIVE wanted=ACTIVE (blocked: transport != CONNECTED) ``` --- ## Relationship to the Video Routing System The reconciler module manages device open/close and transport connect/disconnect in the video node. `reconciler_cli` lets you exercise the BFS pathfinding, dependency checking, and event-driven tick logic without any real hardware — the same code paths that run in the node on every incoming command or timer event.