A background task, a second broadcast channel and a whole module existed to remap SessionEvent onto CatalogEvent one variant at a time. SessionManager now emits CatalogEvent directly.
Deleted: local_events.rs, the publisher task, the LocalEventBus channel, enum SessionEvent, LocalApiState::events, and the duplicate capacity constant — events_capacity was declared twice, in session.rs and local_events.rs, for one logical stream.
Lag semantics get better, not just simpler. There were two lag points:
the publisher task falling behind the manager, which broadcast a single Lagged to every connected client;
each WS subscriber falling behind the bus.
Only (2) survives, and pump_events already handled it. A slow client now makes only itself resync instead of forcing a full refetch on everyone.
Also adds the first daemon-level tests for WS /api/events — the review noted it had none. Two cases: the Snapshot-then-deltas contract, and that a subscriber connecting late gets a Snapshot of current state rather than an empty one. The subscribe-before-snapshot ordering was previously described only in a comment.
Net −20 lines, and one fewer place for an event to get stuck.
Verification
cargo fmt --all -- --check ok
cargo clippy --all-targets -- -D warnings 0
cargo test --all 300 passed, 0 failed
Count is 300 rather than 301 because the three LocalEventBus unit tests went with the module; two richer WS tests replaced them.
Fourth of nine from the architecture review (#40, #41, #42 merged).
A background task, a second broadcast channel and a whole module existed to remap `SessionEvent` onto `CatalogEvent` one variant at a time. `SessionManager` now emits `CatalogEvent` directly.
Deleted: `local_events.rs`, the publisher task, the `LocalEventBus` channel, `enum SessionEvent`, `LocalApiState::events`, and the duplicate capacity constant — `events_capacity` was declared twice, in `session.rs` and `local_events.rs`, for one logical stream.
**Lag semantics get better, not just simpler.** There were two lag points:
1. the publisher task falling behind the manager, which broadcast a single `Lagged` to *every* connected client;
2. each WS subscriber falling behind the bus.
Only (2) survives, and `pump_events` already handled it. A slow client now makes only itself resync instead of forcing a full refetch on everyone.
Also adds the first daemon-level tests for `WS /api/events` — the review noted it had none. Two cases: the Snapshot-then-deltas contract, and that a subscriber connecting late gets a Snapshot of current state rather than an empty one. The subscribe-before-snapshot ordering was previously described only in a comment.
Net −20 lines, and one fewer place for an event to get stuck.
<details>
<summary>Verification</summary>
```
cargo fmt --all -- --check ok
cargo clippy --all-targets -- -D warnings 0
cargo test --all 300 passed, 0 failed
```
Count is 300 rather than 301 because the three `LocalEventBus` unit tests went with the module; two richer WS tests replaced them.
</details>
Fourth of nine from the architecture review (#40, #41, #42 merged).
A background task, a second broadcast channel and a whole module existed
to remap SessionEvent onto CatalogEvent one variant at a time.
SessionManager now emits CatalogEvent directly.
Deletes local_events.rs, the publisher task, the LocalEventBus channel,
enum SessionEvent, LocalApiState::events, and the duplicate capacity
constant — events_capacity was declared twice for one logical stream.
Lag semantics improve. There were two lag points: the publisher falling
behind the manager, which broadcast one Lagged to every client, and each
WS subscriber falling behind the bus. Only the per-subscriber one is left,
which pump_events already handled — a slow client now makes only itself
resync.
Adds the first daemon-level tests for WS /api/events: the Snapshot-then-
deltas contract, and that a late subscriber gets a Snapshot of current
state. Both were described only in a comment.
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Blocking a user prevents them from interacting with repositories, such as opening or commenting on pull requests or issues. Learn more about blocking a user.
A background task, a second broadcast channel and a whole module existed to remap
SessionEventontoCatalogEventone variant at a time.SessionManagernow emitsCatalogEventdirectly.Deleted:
local_events.rs, the publisher task, theLocalEventBuschannel,enum SessionEvent,LocalApiState::events, and the duplicate capacity constant —events_capacitywas declared twice, insession.rsandlocal_events.rs, for one logical stream.Lag semantics get better, not just simpler. There were two lag points:
Laggedto every connected client;Only (2) survives, and
pump_eventsalready handled it. A slow client now makes only itself resync instead of forcing a full refetch on everyone.Also adds the first daemon-level tests for
WS /api/events— the review noted it had none. Two cases: the Snapshot-then-deltas contract, and that a subscriber connecting late gets a Snapshot of current state rather than an empty one. The subscribe-before-snapshot ordering was previously described only in a comment.Net −20 lines, and one fewer place for an event to get stuck.
Verification
Count is 300 rather than 301 because the three
LocalEventBusunit tests went with the module; two richer WS tests replaced them.Fourth of nine from the architecture review (#40, #41, #42 merged).
No findings.