Integrate Approved Session Tracking Fixes into 10.0.x #566
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
References:
Approved PR: thoth-tech#83
Unmerged PR: thoth-tech#74
Description
This PR merges the changes from the approved PR #83 into the 10.0.x branch. It ensures the session tracking logic integrated includes schema fixes, environment blockers, and backend improvements previously approved in #83.
This PR directly references the approved work from #83 and makes it available in the target branch for further development and frontend integration.
Fixes identified issues that blocked development and limited the usefulness of the existing schema:
Frontend impact
Persisting duration_minutes enables direct aggregation via the API and removes the need for complex time-delta calculations in the Angular frontend. This change is intended to support(thoth-tech/doubtfire-web#402). By providing this data via the API, we avoid complex time-delta calculations in the Angular frontend, allowing 402 to be refactored to connect directly to this backend logic since the frontend contributions are yet to connect to exisitng backend.
Type of change
How Has This Been Tested?
Test A: Migration Sequence
Executed bundle exec rails db:migrate:redo VERSION=20250922103033.
Verified:
marking_sessionstable is created successfullyduration_minutescolumn existsNo MySQL tablespace errors occur
Test B: Session Tracking Logic
Ran
bundle exec ruby -I test test/services/session_tracker_test.rb.Result: 2 runs, 13 assertions, 0 failures, 0 errors.
Ran
bundle exec rails test test/api/marking_sessions_api_test.rb6 runs, 67 assertions, 0 failures, 0 errors, 0 skips
Confirmed:
15-minute "sticky" session window works
duration_minutesis correctly updated upon activity.Checklist: