# Bug and Performance Review — 2026-12-02 Full-codebase review at `main` `54367e74`, scoped to **correctness bugs and performance only** (no style or docs findings). Eight parallel reviewers each covered one area and wrote a per-area report in this directory. Everything was found by reading the code: nothing was built, run or exercised live. The fix plan is in [PLAN.md](PLAN.md). Gitea issues: phases #251–#257, High findings #241–#250. ## Reports | Area | Report | Prefix | High | Medium | Low | |---|---|---|---|---|---| | Server: Sessions + gRPC | [server-sessions-grpc.md](server-sessions-grpc.md) | `SES` | 3 | 2 | 3 | | Server: Workers, Metrics, Diagnostics | [server-workers-metrics.md](server-workers-metrics.md) | `WRK` | 0 | 2 | 8 | | Server: Dashboard | [server-dashboard.md](server-dashboard.md) | `DSH` | 2 | 4 | 4 | | Server: Security, Configuration, Alarms | [server-security-config-alarms.md](server-security-config-alarms.md) | `SEC` | 3 | 5 | 6 | | Worker: MxAccess | [worker-mxaccess.md](worker-mxaccess.md) | `MXA` | 2 | 4 | 5 | | Worker: IPC, STA, Conversion, Bootstrap | [worker-ipc-sta-conversion.md](worker-ipc-sta-conversion.md) | `WIP` | 2 | 3 | 5 | | Clients: .NET + Go | [clients-dotnet-go.md](clients-dotnet-go.md) | `CDN` / `CGO` | 0 | 5 | 14 | | Clients: Rust + Java + Python | [clients-rust-java-python.md](clients-rust-java-python.md) | `CRS` / `CJV` / `CPY` | 0 | 6 | 11 | | **Total** | | | **12** | **31** | **56** | Each report gives location, failure scenario, suggested fix, test idea and a confidence rating (Confirmed / Plausible) for every finding. ## High findings | ID | Category | Finding | |---|---|---| | SES-002 (#241) | Bug (authz) | `Invoke` and `CloseSession` are not owner-scoped. Another key with `events:read` can `Invoke(DrainEvents)` a session and steal its events, which never reach the owner's stream or replay ring. Spot-checked: `OwnerKeyId` is compared only in `EventStreamService.cs:58`. | | SES-003 (#242) | Bug (authz) | `AddBufferedItem` has no case in `ApplyConstraintsAsync`, so it skips API-key read constraints. Spot-checked. | | DSH-001 (#243) | Bug (authz) | `Routes.razor` uses a plain `RouteView`, so the `[Authorize(AlarmsPolicy)]` on `/alarms` is enforced only on a full page load. In-circuit navigation lets anonymous localhost reach the alarm feed. Spot-checked. `/admin/secrets` may be exposed the same way (unverified). | | SEC-001 (#244) | Bug (security) | The gRPC failure limiter partitions on `context.Peer`, which includes the ephemeral port, so the per-peer throttle resets on every new connection. | | SEC-002 (#245) | Bug (security) | The aggregate throttle runs before the verification cache, so an unauthenticated sprayer who knows a key id can lock out its legitimate holder. | | SEC-005 (#250) | Bug | A restart of the alarm monitor clears its cache without sending Clear or provider-status frames, so alarms cleared during the gap stay active for feed subscribers. | | MXA-001 (#249) | Bug | Alarm failover never engages, or falsely "recovers", when the wnwrap primary fails to subscribe: `PollOnce` is a silent no-op that resets the failure counter. | | SES-001 (#247) | Bug | On host stop, Kestrel waits 30 s on open `StreamEvents`, then every worker is killed instead of closed gracefully. | | DSH-002 (#248) | Bug | A failed dashboard live read drops the session without closing it, orphaning it and its x86 worker for the 30-minute lease. Repeated failures can exhaust `MaxSessions`. | | WIP-001 (#246) | Bug | Under sustained heavy event load (about 700 ev/s or more for over 15 s), the unbounded message-pump drain starves STA commands and the activity stamp, so the session is killed as `StaHung`. | | MXA-002 / WIP-002 (#235, #236) | Performance | None of the `perf.md` worker fixes (record-info pin, dedicated drain thread, synchronous flush, single write per frame) are on `main`. They exist only on the local branches `feat/worker-perf-prototype` and `feat/gateway-relay-hops` (#236, #235), which `perf.md` measured cutting worker CPU from 45% to 0.3% of a core. | ## Patterns across areas - **No gRPC keepalive anywhere.** Neither the server (SES-005) nor any of the five clients (CDN-004, CGO-001, CRS-001, CJV-003, CPY-002) sets HTTP/2 keepalive. A half-open connection hangs a deadline-less stream forever and pins the session against the owner's reconnect. - **Payload-less replies read as handle 0.** Four clients return `0` or null from `Register` / `AddItem` / `AddItem2` when the reply lacks its payload (CDN-008, CGO-007, CJV-006, CPY-004). - **CLI batch mode dials a new channel per line** in four clients (CDN-011, CGO-008, CRS-004, CPY-005). - **Alarm pipeline state** is lost or wrong on restart, reconcile, late ack and bad quality (SEC-005–007, SEC-009, MXA-001, MXA-005, MXA-007, DSH-005). - **Resume / `ReplayGap` plumbing is correct** in all five clients. No duplicate-event or lost-event defects were found there.