fix(realtime): deliver realtime updates for analysis & project node lists#1684
fix(realtime): deliver realtime updates for analysis & project node lists#1684tada5hi wants to merge 1 commit into
Conversation
…ists Analysis- and project-node lists (incl. the node-execution list) never updated in realtime. In a realm namespace the client subscribed to and filtered on the directional rooms (analysisNodeOut/In, projectNodeOut/In), but the subscriber only ever publishes to the base entity room, so every event was dropped. The client's built-in room check also demanded the base room, contradicting the directional filter, so the path could never match. Realm isolation is already provided by the socket namespace (/resources/<realmId>); the in/out split only needs to gate permissions. Unify all directional subscriptions onto the base entity room (the room the subscriber emits to) and keep the directional event names solely for their permission checks. - server: directional analysis-/project-node subscribe handlers join the base room; fix the analysis-node base handler whose unsubscribe listener was registered on the SUBSCRIBE event name - client: drop the contradictory isSameSocketRoom check; lists' and managers' room checks use the base entity room - pass the effective realmId into buildSubscribe/UnsubscribeEventName so master-realm sockets (root namespace) emit the base subscribe and join the base room, while realm sockets emit the directional subscribe - fix FProjectNode realm-field swap in processEvent (PROJECT/NODE were comparing the wrong *_realm_id field)
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (8)
📝 WalkthroughWalkthroughSocket room subscription routing is corrected for ChangesSocket Room Routing and Realm-Aware Event Naming
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~25 minutes Poem
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
Problem
Analysis- and project-node lists — including the node-execution list on the analysis view — never updated in realtime. New
execution_status/approval changes only showed up after a manual reload.Root cause
In a realm namespace the client subscribed to and filtered on the directional socket rooms (
analysisNodeOut/In,projectNodeOut/In), but the TypeORM subscriber only ever publishes to the base entity room (analysisNode/projectNode). Every realtime event was therefore delivered to a room nobody was listening in, and dropped.The contradiction was actually twofold: the list's custom
isSameSocketRoomcheck demanded the directional room whilecreateEntitySocket's built-in room check demanded the base room — so the realm+direction path could never match, regardless of what the server emitted.Approach
Realm isolation is already provided by the socket namespace (
/resources/<realmId>— the analysis realm and node realm are distinct namespaces). The in/out split therefore only needs to gate permissions, not separate rooms. So all directional subscriptions now join the base entity room (the one the subscriber emits to), and the directional event names are kept solely for their permission checks (ANALYSIS_APPROVE/ANALYSIS_UPDATE,PROJECT_APPROVE/PROJECT_UPDATE).Changes
Server (
server-core)…Out/…In.SUBSCRIBEevent name (base subscribe joined then immediately left).Client (
client-vue)FAnalysisNodes,FProjectNodes): dropped the contradictoryisSameSocketRoomcheck;processEventnow only confirms the event belongs to the viewed source.FAnalysisNode,FProjectNode):buildChannelNamenow targets the base room.createEntitySocketpasses the effective realmId intobuildSubscribe/UnsubscribeEventName, so master-realm sockets (root namespace) emit the base subscribe and join the base room, while realm sockets emit the directional subscribe — the subscribe event now always matches the namespace the socket actually connects to.FProjectNode.processEventrealm-field swap (PROJECT/NODEwere comparing the wrong*_realm_id).Behavior after
isSocketEventForSource.Verification
eslintclean on all touched files.server-core(tsc) andclient-vue(vue-tsc) build/type-check.execution_statuschange — badge/progress update without reload.Follow-ups (not in this PR)
Summary by CodeRabbit