Files
Froidefond Julien 2d266f89f9 feat(perf): implement performance optimizations for session handling
- Introduced a new configuration file `config.yaml` for specifying project context and artifact rules.
- Added `.openspec.yaml` files for tracking changes related to performance improvements.
- Created design documents outlining the context, goals, decisions, and migration plans for optimizing session performance.
- Proposed changes include batching database queries, debouncing event refreshes, purging old events, and implementing loading states for better user experience.
- Added tasks and specifications to ensure proper implementation and validation of the new features.

These enhancements aim to improve the scalability and responsiveness of the application during collaborative sessions.
2026-03-10 08:06:47 +01:00

1.2 KiB

ADDED Requirements

Requirement: Centralized broadcast module

The system SHALL provide a centralized src/lib/broadcast.ts module used by all workshop SSE routes to push events to connected clients.

Scenario: Server Action triggers broadcast

  • WHEN a Server Action mutates session data and calls broadcast(sessionId, event)
  • THEN all clients subscribed to that session SHALL receive the event immediately without waiting for the next poll cycle

Scenario: Broadcast module subscribe/unsubscribe

  • WHEN an SSE route calls subscribe(sessionId, callback)
  • THEN the callback SHALL be invoked on every subsequent broadcast(sessionId, ...) call
  • WHEN the returned unsubscribe() function is called
  • THEN the callback SHALL no longer receive events

Requirement: Granular cache invalidation via revalidateTag

Server Actions SHALL use revalidateTag with session-scoped tags instead of revalidatePath to limit cache invalidation scope.

Scenario: Session mutation invalidates only that session's cache

  • WHEN a Server Action mutates a specific session (e.g., adds an item)
  • THEN only the cache tagged session:<id> SHALL be invalidated
  • THEN other sessions' cached data SHALL NOT be invalidated