feat(ipc): IPC types, IpcChannels and IpcClient #25
Labels
No labels
area:config
area:contracts
area:engine
area:eventsourcing
area:frontend
area:git
area:ipc
area:persistence
area:provider
area:scaffold
area:terminal
type:user-story
No milestone
No project
No assignees
3 participants
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
charles/peon!25
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "peon/6"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Summary
AppCommand,AppEvent,TerminalCommand,GitCommand,SettingsCommandinbackend/src/ipc.rswithIpcChannels::new()constructorIpcClientinfrontend/src/ipc_client.rswithsend()/next_event()and cheapCloneviaArc<Mutex>OrchestrationCommandandStoredEventplaceholder stubs inorchestration/mod.rsto unblock compilation (full impl deferred to issue #4)app/src/main.rsCloses #6
Three acceptance-criterion mismatches, all in clear violation of the spec. Otherwise the implementation is solid: types are well-documented, error mapping is correct, the
broadcast/mpscsplit is right, and the 10 tests cover the important paths.\n\nBlocking on:\n1.IpcClient::Cloneshares a receiver instead of creating an independent broadcast subscription (silent data-loss bug when multiple UI components clone the client).\n2.IpcChannels::new()takes no args; AC requiresnew(cmd_buffer: usize, evt_buffer: usize).\n3.SettingsCommandis missing the requiredUpdateConfigvariant.@ -2,0 +81,4 @@/// Commands for modifying application settings.#[derive(Debug, Clone)]pub enum SettingsCommand {SettingsCommandis missing the requiredUpdateConfigvariant.AC: "
SettingsCommandplaceholder (at minimum anUpdateConfigvariant)".The PR ships
ReloadandUpdateKeybindingbut notUpdateConfig.UpdateKeybindingmaps closely to the keybindings-specific AC item in issue #6 and may be intentional, but the baselineUpdateConfigvariant the spec requires is absent.Fix: add the variant, even as a placeholder with no fields for now:
If
UpdateConfigis intentionally being split into more specific variants, that decision should be reflected in the issue/spec first.@ -2,0 +110,4 @@const COMMAND_CAPACITY: usize = 256;const EVENT_CAPACITY: usize = 1024;/// Create a fresh channel bundle with pre-tuned capacities.IpcChannels::new()signature deviates from the acceptance criterion.AC explicitly requires:
IpcChannels::new(cmd_buffer: usize, evt_buffer: usize) -> Self.The implementation uses a no-arg constructor with hardcoded constants instead. Callers (tests, app startup, future integration tests) can't control buffer sizes without editing source. The constants themselves are reasonable defaults, but the parameterised signature from the AC gives callers that control.
Fix: change the signature to accept the two sizes and pass them to the channel constructors:
Update
app/src/main.rsto callIpcChannels::new(256, 1024)(or useIpcChannels::default()) and update the tests accordingly.@ -2,0 +19,4 @@/// Frontend handle to the IPC channels.////// [`IpcClient`] is cheap to clone — all clones share the same underlying/// `mpsc::Sender` and wrap the same broadcast receiver behind an `Arc<Mutex>`.Wrong clone semantics — all clones share one receiver instead of subscribing independently.
AC says: "
IpcClientis Clone-able (sender clones, receiver subscribes to broadcast)". The derive +Arc<Mutex<Receiver>>design means every clone points at the same receiver position: whichever clone callsnext_event()first consumes the event, and the others see nothing. That defeats broadcast entirely.The fix is to store
broadcast::Sender<AppEvent>(not the receiver) inIpcClient, and implementClonemanually so each clone callsevent_tx.subscribe()to create its own independent cursor:Actually the cleanest fix is to carry both
event_tx(for cloning) and the per-instanceevent_rxwrapped inArc<Mutex>, but implementClonemanually:IpcClient::newwould need to acceptevent_tx: broadcast::Sender<AppEvent>instead ofevent_rx, or accept both. Theapp/src/main.rswiring andIpcChannelsevent_txfield are already public, so this is straightforward.9e1b90416c654d38ffd1