mirror of
https://github.com/saltbo/zpan.git
synced 2026-08-29 00:01:42 +08:00
6521d1b722
* feat(events): unify SSE stream, replace frontend polling Add a single /api/events SSE endpoint that multiplexes domains via named events. Jobs and notifications are always-on; download tasks are an opt-in per-connection subscription carried in the EventSource URL, so the server only polls what an open page needs and a browser tab holds one connection. - Replace refetchInterval polling: sidebar active-job badge, tasks list, notification unread count - Fold the download-tasks SSE into the unified endpoint; remove the now-dead /api/download-tasks/events route, downloadTaskEventsUrl, downloadTasksUrlApi - Client subscription registry: useServerEvents (single connection, reconnects when the merged subscription query changes) + useServerEventSubscription - Decouple the keep-alive heartbeat (25s idle) from the 2s data poll Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> * fix(downloader): regenerate OpenAPI spec/client after dropping /events Removing /api/download-tasks/events from the unified-SSE refactor drifted the generated downloader OpenAPI doc and Go client (caught by openapi:downloader:check in CI). Regenerate both. With the events operation gone, the single-value assignedTo enum constant collapses from GetApiDownloadTasksParamsAssignedToMe to Me, so update the hand-written client reference to match. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> * test(events): cover unified SSE store and endpoint Codecov flagged the new SSE code as uncovered. - Unit-test the pure server-events-store (merge/sort query key, listener notifications, subscription lifecycle) - Integration-test GET /api/events: 401 unauthenticated, and that an authed user with a queued job receives jobs + notifications events - Exclude useServerEvents.ts (EventSource/React-effect glue, not unit-testable without a DOM) from coverage, matching the existing src/routes & src/components exclusions; its logic lives in the now-covered store Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> * fix(e2e): stop waiting on networkidle now that SSE is always connected The unified /api/events stream is mounted on every authenticated page, so the network never goes idle and waitForLoadState('networkidle') hangs until the job times out. Drop the four networkidle waits (sign-in helper + image-host reloads); subsequent navigations and element auto-waits already gate readiness. Also broaden the /api/events test to cover the abort and error branches. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> --------- Co-authored-by: Claude Fable 5 <noreply@anthropic.com>
22 lines
819 B
YAML
22 lines
819 B
YAML
coverage:
|
|
# React components and route files cannot be unit-tested without a DOM
|
|
# environment. Pure logic extracted from these files is tested separately
|
|
# in co-located *.test.ts files. Exclude from coverage tracking to avoid
|
|
# false negatives on patch/project checks.
|
|
ignore:
|
|
- "src/routes/**"
|
|
- "src/components/**"
|
|
# EventSource + React-effect glue; not unit-testable without a DOM. Its pure
|
|
# logic lives in server-events-store.ts, which is covered.
|
|
- "src/hooks/useServerEvents.ts"
|
|
|
|
status:
|
|
patch:
|
|
default:
|
|
# Exclude React UI files from patch coverage requirement.
|
|
# Only backend and shared library code is measurable via unit tests.
|
|
paths:
|
|
- "!src/routes/**"
|
|
- "!src/components/**"
|
|
- "!src/hooks/useServerEvents.ts"
|