Repository navigation
Description
What is broken.
The diary sign-in and the class memberships are meant to be independent. The server says so (current_diary: «a phone can be joined to a class without a diary account, and signed in to a diary without joining a class»). The phone's storage says so too: LessonsPreferences.clearSession keeps the diary keys on purpose, because «leaving a class is not leaving the diary». The navigation disagrees. The only way to reach the diary is Settings → «Дневник», which is a SettingsSectionScreen inside HomeShell. LessonsApp composes HomeShell only when the phone is in a class. Once the last class is gone, the app shows the join screen. The diary token (diary_token / diary_login) stays in DataStore, and nothing in the app can open the diary or sign out of it. The server-side diary session also stays, holding the sealed upstream credential, because POST /api/v1/diary/logout can no longer be sent from the phone. It lasts until the 30-day sweep in cron.py deletes it.
The failure scenario.
- A parent joins one class with its code, opens Settings → «Дневник» and signs in.
DiaryRepositoryImpl.signInwritesdiary_tokenanddiary_login. - The phone leaves that class. This happens in one of three ways:
- the parent presses «Выйти» → «Выйти из класса?»;
- the parent presses «Выйти из класса «…»»;
- an admin revokes the device from «📱 Устений»… — more precisely from «📱 Устройства», or deletes the class. The next sync or management call then gets a 401 and calls
sessionRepository.leaveActive()in the background, with no confirmation.
removeSession/clearSessiondrop the memberships and setonboarding_done. By design they leave the diary keys alone.SessionEffects.onSignedOutstops sync, alerts and the widget, and does not touch the diary either.AppShellViewModelseessession == nulland emitssignedIn = false.LessonsAppthen showsJoinScreen, andHomeShellis no longer composed.JoinScreenoffers the code field and «Адрес сервера», and nothing else.DiaryScreencannot be reached, so neither can its «Выйти из дневника». The parent cannot read the diary and cannot sign out of it, although the phone is still signed in. The confirmation for this sign-out, «Выйти из дневника?», promises that the two accounts are separate.- The only way back is to join a class again. Clearing the app's data removes the local token without the server's
logout. The server row, with the family's sealed upstream bearer, then stays untilDIARY_SESSION_TTL(30 days since last use) removes it.
Where.
android/app/src/main/kotlin/com/lumenpearson/lessons/navigation/LessonsApp.kt:178-207: the no-class branch (false ->) showsOnboardingScreen/JoinScreen, and onlytrue ->composesHomeShell.android/app/src/main/kotlin/com/lumenpearson/lessons/navigation/LessonsApp.kt:787-798: the only caller ofSettingsSectionScreen.android/app/src/main/kotlin/com/lumenpearson/lessons/ui/settings/SettingsScreen.kt:339-349: the only placeDiaryScreenis composed.android/app/src/main/kotlin/com/lumenpearson/lessons/ui/diary/DiaryScreen.kt:197,:414: «Выйти из дневника».android/app/src/main/kotlin/com/lumenpearson/lessons/ui/AppShellViewModel.kt:98-99:signedInis «any class session».android/core/data/src/main/kotlin/com/lumenpearson/lessons/core/data/datastore/LessonsPreferences.kt:127-178:removeSession/clearSessionkeep the diary keys on purpose (comment at :151-158).android/core/data/src/main/kotlin/com/lumenpearson/lessons/core/data/repository/SessionRepositoryImpl.kt:153-184:leave/signOut.android/core/data/src/main/kotlin/com/lumenpearson/lessons/core/data/di/LessonsContainer.kt:223,:295: a 401 on the class token callsleaveActive().server/app/api/diary.py:114-117: the stated independence of the two tokens.server/app/api/cron.py:49,:101-119: the stranded server row lasts until the 30-day sweep.
Metadata
Metadata
Assignees
Type
Projects
- StatusShow more project fieldsDone
Activity
Let a phone sign in to its own diary and hand our server only the ses…
Let a family in through its own school's diary at the first run, and …
Document the phone's half: the first run through your own school's di…