[EPIC] feat: Component Subscription System #27
Reference in New Issue
Block a user
Delete Branch "%!s()"
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?
Context-Aware Part Subscription System — Workbench UI and Sync
Repository:
silo-modType: Feature
Depends on:
silo-clientsubscription + edit session + checkpoint methods,siloserver endpointsSummary
Add subscription management, automatic background sync, edit session locking, and editing-context-driven checkpoint pushing to the Silo workbench. The system hooks into Kindred Create's
EditingContextResolverat both ends of the editing lifecycle:The result: real-time presence awareness, conflict prevention before it happens, and automatic file distribution — all driven by the signals the
EditingContextResolveralready emits.Architecture
Phase A: Edit Session Enforcement
Context Entry Gate
The
ContextSyncHookintercepts downward context transitions (shallower → deeper) on Silo-tracked documents and gates them through the server's edit session system.Acquiring Locks on Entry
Blocking Hard Interference
When hard interference is detected, the user is prevented from entering the editing context. This requires integration with the
EditingContextResolverto cancel or reject the transition:The
_cancel_context_entrymethod calls theEditingContextResolverto reject the transition. Implementation detail depends on whether the resolver supports acancelTransition()API or whether we need to immediately callresetEdit()to back out.Soft Interference Warning
Soft interference allows entry but shows a non-blocking indicator:
Presence Indicators via SSE
The sync manager listens for
edit.session_acquiredandedit.session_releasedevents to maintain a live map of who's editing what. This is displayed before the user attempts to enter a context:The Start Panel, feature tree, and
Silo_Infodialog can querysync_manager.active_remote_sessionsto show who's editing what before the user even tries to enter edit mode.Phase B: Checkpoint Push on Context Exit
Releasing Locks on Exit
Checkpoint Queue Processing
Handling Handoff Requests
When the server sends
edit.handoff_requestedSSE:The Activity pane renders the handoff request with action buttons:
Release Now: pushes a checkpoint if dirty, then releases the session. The user is exited from the editing context.
Defer: sends a response SSE (future — for now, just dismisses the notification).
Phase C: Subscription UI and Background Sync
New Commands
Silo_SubscribeSilo_SubscriptionsSilo_SyncStatusSubscribe Dialog
Presence indicators (🟢/🟡) show active edit sessions inline in the item list. This leverages the same
active_remote_sessionsmap used for interference detection.Background Download Queue (Inbound)
SSE event handling:
subscription.revisionsubscription.checkpointsubscription.sync_requiredget_sync_diff(), queue allsubscription.updateget_sync_diff(), queue resultsPer-file download flow:
client.download_file()→ compute hashclient.ack_sync()→ update sync stateSkip own checkpoints (
checkpoint_user == current_user).Reconnect Reconciliation
On every SSE connection:
get_sync_diff(workstation_id)— catch up on missed updatesget_edit_sessions()for any items we have subscriptions to — rebuild presence mapFile Conflict Handling
Phase D: Activity Pane and Presence Polish
Activity Pane Events
Outbound checkpoint:
Inbound revision:
Inbound checkpoint:
Hard interference blocked:
Soft interference warning:
Handoff request:
Feature Tree Presence (Future Polish)
When
presence_changedfires, update visual indicators on the feature tree:This is lower priority than the functional locking but significantly improves the UX by surfacing conflicts before the user clicks into edit mode.
Settings
edit_locking_enabledtruepush_on_context_closetruesubscription_auto_synctruesubscription_max_downloads2subscription_sync_on_connecttruesubscription_notifytrue"Edit locking enabled" disables the acquire/release flow entirely. Useful for solo users who don't want server round-trips on every context transition. When disabled, the
ContextSyncHookstill pushes checkpoints on exit but does not acquire locks on entry.Signals
Acceptance Criteria
Phase A: Edit Session Enforcement
acquire_edit_sessionedit_locking_enabled=falseskips acquisition entirelyedit.session_acquired/releasedevents update presence mapPhase B: Checkpoint Push on Exit
push_checkpointsession_idincluded in checkpoint → atomic releasepush_on_context_close=falsedisables push but session still releasedsketch_closereleases sketch session, keeps body sessionbody_closereleases body sessionPhase C: Subscriptions and Background Sync
subscription.checkpointevents trigger download (skip self)subscription.revisionevents trigger downloadsync/diff+ rebuilds presence mapPhase D: Activity Pane and Presence