Repository navigation
Closed
Description
What is broken.
The app turns a diary failure into a message with DiaryFailure.of, and that function knows only 401, 404, 422, 502 and 503. It never reads the body the server sent. Three answers the server or the platform really gives come out wrong on the phone:
- 429 from
POST /api/v1/diary/login. The server says «Слишком много попыток входа. Попробуйте позже.» and sendsRetry-After. The app has no 429 case, so it becomesUnexpectedand the screen prints Retrofit's exception message: «Не получилось: HTTP 429 Too Many Requests», or «Не получилось: HTTP 429 » over HTTP/2, where the reason phrase is empty.docs/api.mdsays the app should "wait outRetry-After, and do not blame the password". The phone does not say to wait or for how long, and never says that there were too many attempts. - 503 because
DIARY_SECRETis unset. The server says «Дневник на этом сервере выключен.».DiaryDisabled's own docstring says the person should be told that «instead of «попробуйте позже»». The app maps every 503 toUnavailableand shows «Дневник не отвечает. Попробуйте позже.», which is exactly the sentence the server set out to avoid. Waiting or retrying can never change it; only an operator can. - 504. A request that outlives
maxDuration: 30is answered 504 by the platform. The server never emits a 504 itself: this is a timeout in front of it, and the Petersburg client allows 20 s of read per upstream call. This is the "the diary is slow, try again" case. The app has no branch for it, so it also falls toUnexpectedand shows «Не получилось: HTTP 504 ».
The English build has the same problem with «It did not work: HTTP 429» and «The diary is not answering. Try again later.».
The failure scenario.
- Make ten failed diary sign-ins from one address within fifteen minutes, then press «Войти» an eleventh time.
- The server answers
429withdetail«Слишком много попыток входа. Попробуйте позже.» and aRetry-After. DiaryFailure.ofhas no 429 case and returnsUnexpected(429, HttpException).- The «Не удалось войти» dialog reads «Не получилось: HTTP 429 Too Many Requests», or «Не получилось: HTTP 429 » over HTTP/2. It does not say there were too many attempts, and it does not say how long to wait.
- On a deployment without
DIARY_SECRET, press «Войти» with any credentials. The server answers503«Дневник на этом сервере выключен.». 503 -> Unavailable, so the dialog reads «Дневник не отвечает. Попробуйте позже.». Every later attempt gives the same answer, however long the person waits.- Open a week of the diary while the upstream is slow enough that the function passes 30 s. The platform answers
504, and the card reads «Не получилось: HTTP 504 » under «Повторить» instead of the «Дневник не отвечает» it has a sentence for.
Where.
android/core/data/src/main/kotlin/com/lumenpearson/lessons/core/data/repository/DiaryModels.kt:368-385:ofHttphas no 429 or 504 case, and at :383 it maps every 503 toUnavailable. The doc comment at :324 says "503: the diary is down. Worth retrying, and only that."android/app/src/main/kotlin/com/lumenpearson/lessons/ui/diary/DiaryScreen.kt:318:Unavailablebecomes «Дневник не отвечает».android/app/src/main/kotlin/com/lumenpearson/lessons/ui/diary/DiaryScreen.kt:323-326:Unexpectedprintsreason.message, which isHttpException's "HTTP".android/app/src/main/kotlin/com/lumenpearson/lessons/ui/diary/DiarySignInScreen.kt:242-245: the sign-in dialog falls through toasText()for everything but a 401.android/app/src/main/res/values/strings_diary.xml:34,39, twinned atvalues-en/strings_diary.xml:34,39.server/app/api/diary.py:268-275: the 429.server/app/api/diary.py:290-301: the 503 for a switched-off diary.server/app/services/diary.py:55-61: the stated intent not to say «попробуйте позже».docs/api.md:1165: the documented app behaviour for 429.vercel.json:8:maxDuration: 30.android/core/data/src/test/kotlin/com/lumenpearson/lessons/core/data/repository/DiaryFailureTest.kt: pins only503 -> Unavailableand the generic fallback. No test covers 429 or 504.
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 …