Skip to content

Commit fa511ba

Browse files
marevolclaude
andauthored
fix(auth): prevent unexpected logout during file upload (#48)
* test(backend): Expand test coverage for commands, auth, services, and tasks Add new test modules for management commands (assign_owners, create_api_key, create_test_users), project service, and user service. Extend existing tests for authentication (scope permissions, ambiguous prefix), data upload (preview endpoint, cross-owner access), event views (API key access control, slot/project mismatch), serializers, schedule service, and Celery tasks (training, tuning, scheduled retraining, error handling). Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> * fix(auth): prevent logout during file upload by refreshing token proactively - Add ensureFreshToken() to auth store: checks token expiry and refreshes if within 60 seconds of expiry, preventing stale-token upload failures - Add visibilitychange listener: re-schedules proactive refresh when the tab regains focus, covering tokens that expired in background tabs - Add 401 retry in DataUploadPage: if the XHR returns 401 (token expired mid-upload), refresh the token and retry the upload once automatically - Attach .status to XHR errors so the 401 can be detected in catch blocks - Update tests: switch nextTick → flushPromises for async ensureFreshToken, add 23 new tests covering all new behaviours Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com> * style(tests): apply ruff formatting to test files Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com> --------- Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
1 parent 4df990a commit fa511ba

4 files changed

Lines changed: 520 additions & 15 deletions

File tree

0 commit comments

Comments
 (0)