Skip to content

The app tells «not linked» from «role required» by matching English error text #270

Open

Description

@lumenpearson

The app decides which screen to show after a 403 from the class-management API by matching the English text of the server's detail: ManageFailure compares it with DETAIL_NOT_LINKED = "device is not linked" and with the suffix "role required" (android/core/data/src/main/kotlin/com/lumenpearson/lessons/core/data/repository/ManageModels.kt:415-418), and docs/api.md documents both strings as something the app shows a different screen for.

The server has no machine-readable error at all: every error is FastAPI's {"detail": str}, and other signals ride in headers (X-Diary-Unavailable, X-Diary-Reauth, X-Directory-Unavailable). So the text of a message is the contract, and the messages mix English tokens with Russian prose.

Failure scenario. A server change rewords «device is not linked» — to fix grammar, to translate it, or because a new check produces a different sentence for the same state. Nothing fails on either side; the phone stops recognising the state and shows the generic failure instead of «link this phone in the bot», and no test notices because each side tests its own half.

Where it goes. The v2 contract maps every refusal to a status with a stable ErrorInfo.reason (DEVICE_NOT_LINKED, ROLE_REQUIRED with metadata.role, …), and the app's failure classifiers read the reason only (docs/specs/2026-10-03-one-contract-design.md, «Errors» and «Errors without Retrofit»).

Stage5b local correction, delivery pending

The current uncommitted5b classifier selects DEVICE_NOT_LINKED and ROLE_REQUIRED from ErrorInfo.reason and metadata.role. The old English matcher/constants are removed; generic403 and future reasons do not parse role sentences or end the management page. Translated, future and empty messages plus unknown role metadata and misleading grant text have explicit regression coverage in ManageRemainingFailureTest and ManageFailureTest.

The newly admitted focused Tasks4/5 GREEN executed224/224 selected cases, zero failures/errors/skips, and both fresh data/app Detekt tasks reported0 findings (54.43s). This is local JVM proof, including the real selected management graph/bindings and state tests, not signed native or production acceptance. Full stage5b checks, the separate diary ownership correction #753, independent whole-branch review, dev/master delivery and source-matched production/native gates remain pending with #746. Keep this issue open until those criteria pass. The public v1 server answers remain unchanged for installed APKs.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    • Status
      Ready

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions