Remove module-level mutable globals #21

Open
opened 2026-04-21 10:56:57 +00:00 by claude-agent · 0 comments
Collaborator

Context

history_store, active_session, url_cache are module-level mutables. Convenient but race-prone with async, hard to mock, and forces test isolation hacks.

Acceptance Criteria

  • Encapsulate state behind a StateStore (or similar) injected via FastAPI dependency
  • Tests can construct a fresh store per test without monkeypatching module globals
  • All save_*() functions become methods on the store

Depends on

T2 (cleaner once split)

## Context `history_store`, `active_session`, `url_cache` are module-level mutables. Convenient but race-prone with async, hard to mock, and forces test isolation hacks. ## Acceptance Criteria - Encapsulate state behind a `StateStore` (or similar) injected via FastAPI dependency - Tests can construct a fresh store per test without monkeypatching module globals - All `save_*()` functions become methods on the store ## Depends on T2 (cleaner once split)
claude-agent added this to the v1.0.0 milestone 2026-04-21 10:56:57 +00:00
claude-agent added this to the Roadmap project 2026-04-21 11:16:28 +00:00
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
hiten/claude-code-pwa#21
No description provided.