villebro opened a new pull request, #43436:
URL: https://github.com/apache/superset/pull/43436

   ### SUMMARY
   
   Step 7 of the [GAQ→GTF epic](https://github.com/apache/superset/pull/43407) 
(targets `gaq-to-gtf`) — **realtime list views**, the headline capability of 
the new websocket transport. A list built on `useListViewResource` now 
live-patches its on-screen rows as the underlying entities change, with no 
manual refresh. The Task List is the first surface; any other list opts in with 
two args.
   
   **Shared realtime client** (`src/middleware/realtime.ts`) — owns the single 
browser socket and fans the generic `{channel, payload}` envelope out to any 
number of subscribers, so features share one connection. Socket ownership is 
extracted out of `asyncEvent.ts`, which now simply subscribes for its tier-2 
chart-data handler. The client is payload-agnostic (routes on `channel`) and 
best-effort (reconnects on close); connection auth is the `superset-ws-token` 
JWT cookie riding the handshake.
   
   **`useListViewResource` realtime** (opt-in via `enableRealtime`, 
`realtimeIdField`) — subscribes to `entity-changes:<resource>`, ignores nudges 
for rows not currently displayed, **debounce-collects** the rest (~500ms) and 
issues **one batched fetch** of just those rows through the normal authorized 
list endpoint (`col:<idField> op:in`), merging them in place by id. Update-only 
(no new-row insertion, no full refetch/redraw), so:
   - authz/RLS are unchanged — the socket only carries opaque ids; real data 
comes from the authorized REST endpoint;
   - a burst of changes can't hammer the backend (one coalesced fetch per 
window);
   - untouched rows keep their reference, so React only re-renders what changed.
   
   **Task List = first surface** — realtime enabled with `realtimeIdField: 
'uuid'` (tasks are UUID-facing). Tasks already emit `entity-changes:task` 
nudges at completion (shipped in 6a, #43431), so this works end-to-end with no 
new backend nudge. Added `uuid` to the task API `search_columns` so the batched 
refetch can filter by it.
   
   **Known limitation / follow-up:** tasks currently nudge only on terminal 
completion (per 6a), so intermediate transitions (pending→in_progress, 
progress) don't yet live-update; emitting nudges on those transitions, and 
adding nudges at other entities' DAO/command commit points 
(dashboards/charts/datasets/…), are incremental follow-ups — each new list 
inherits realtime for free once its backend nudges land.
   
   ### TESTING INSTRUCTIONS
   
   Automated (all green locally):
   - `jest src/middleware/realtime.test.ts` — shared client: 
dispatch/subscribe/unsubscribe, malformed/handler-error isolation, 
enabled/disabled connect, reconnect-on-close, disconnect.
   - `jest src/middleware/asyncEvent.test.ts` — refactored onto the shared 
client; tier-2 acceleration still settles/rejects/ignores correctly.
   - `jest src/views/CRUD/hooks.test.tsx` — realtime nudge live-patches a 
displayed row in place (batched `col:id op:in` fetch + merge); nudges for 
off-screen rows are ignored.
   - `pytest tests/unit_tests/tasks/` — 359 passed (search_columns addition).
   - `tsc` / `eslint` / `ruff` / `pylint` clean.
   
   Manual (with `WEBSOCKET_ENABLED`, `DISTRIBUTED_COORDINATION_CONFIG`, 
`superset-websocket` running same-host):
   1. Open the Task List, trigger async work → completed task rows update their 
status/duration in place without a manual refresh, while the rest of the page 
stays put.
   2. Kill the websocket server → the list still reflects state on its next 
normal load/refresh (best-effort degradation).
   
   ### ADDITIONAL INFORMATION
   - [ ] Has associated issue:
   - [x] Required feature flags: `WEBSOCKET_ENABLED` (realtime transport)
   - [x] Changes UI
   - [ ] Includes DB Migration
   - [x] Introduces new feature or API
   - [ ] Removes existing feature or API
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to