Skip to content

Fix/app ledger session tracking - #37

Open
rautaditya2606 wants to merge 4 commits into
nossa-y:mainfrom
rautaditya2606:fix/app-ledger-session-tracking
Open

Fix/app ledger session tracking#37
rautaditya2606 wants to merge 4 commits into
nossa-y:mainfrom
rautaditya2606:fix/app-ledger-session-tracking

Conversation

@rautaditya2606

Copy link
Copy Markdown

Description

Fixes #36 by finalizing and resetting active application session durations on app transitions in app_ledger().

Previously, cur_session only cleared on global idle gaps (gap > 300s). Switching away and returning to an app within 300s (e.g. Cursor (10m) -> Chrome (10m) -> Cursor (10m)) misreported 1 session of 20m instead of 2 sessions of 10m.

Changes

  • src/activity_frames/sessionize.py: Track cur_app transitions; finalize session length into longest[app] when the focused app changes.
  • pyproject.toml: Configured pythonpath = ["src"] under [tool.pytest.ini_options] for out-of-the-box pytest runs.
  • tests/test_sessionize.py: Added test_app_ledger_multiple_sessions_across_app_switches.

Testing

  • pytest (105 passed in 0.28s).

Copilot AI review requested due to automatic review settings July 30, 2026 18:53

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

@nossa-y nossa-y left a comment

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reproduced - the bug is real, and the core fix is right. Before merge:

  1. Respect the 20s flicker fold: a 5s interruption must not split a session (as-is app_ledger contradicts segments() on the repo fixture). Add test: A 10m, 5s B, A 10m => 1 session, 20m.
  2. Restore the assert reason in valid line clobbered in test_break_reason_in_output_with_debug.
  3. Drop the pyproject.toml line (separate chore PR if you want it).
  4. CHANGELOG entry for #36 (session counts change in aframes apps + get_day_summary).

@rautaditya2606
rautaditya2606 force-pushed the fix/app-ledger-session-tracking branch from 654547d to 25670b7 Compare August 2, 2026 16:42
@nossa-y
nossa-y force-pushed the main branch 3 times, most recently from 972b4d9 to e92e599 Compare August 6, 2026 18:51
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.

bug: app_ledger miscounts sessions across app switches

3 participants