Skip to content

feat: SessionManager — central observation orchestrator#5

Merged
AxaySharma merged 1 commit into
developfrom
feature/session-manager
Jun 9, 2026
Merged

feat: SessionManager — central observation orchestrator#5
AxaySharma merged 1 commit into
developfrom
feature/session-manager

Conversation

@AxaySharma

Copy link
Copy Markdown
Contributor

What this adds

  • src/session-manager.ts — SessionManager orchestrator class
  • src/db/database.ts — extended with sessions.getSince()
  • tests/session-manager.test.ts — 14 behavioural tests

Session lifecycle

startSession() → recordSignal() × N → endSession()
pause() / resume() supported mid-session

Privacy

  • String value coercion rejected at runtime in recordSignal()
  • Paused state drops signals silently — no content ever stored
  • Every state change logged to audit trail

Tests

42/42 passing (10 + 9 + 9 + 14)

- startSession(): creates session, audits, validates no duplicate
- recordSignal(): anonymizes → stores → increments count → audits
- endSession(): closes session, extracts features, returns CompletedSession
- pause()/resume(): drops signals when paused, session stays alive
- getState(): live ObserverState with sessions_today + hours_today

database.ts: added sessions.getSince() for daily stats computation

Privacy: recordSignal() throws STRING_VALUE_REJECTED if string
value bypasses type system via coercion. Tested explicitly.
Paused signals dropped silently — no session data lost.

Tests: 14 new, 42/42 total passing
@AxaySharma
AxaySharma merged commit 1112973 into develop Jun 9, 2026
2 checks passed
@AxaySharma
AxaySharma deleted the feature/session-manager branch June 9, 2026 13:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant