Skip to content

Give the project its first instrumented tests, and fix three defects the walkthrough left - #187

Merged
lumenpearson merged 6 commits into
mainfrom
agents/first-android-test
Sep 26, 2026
Merged

lumenpearson merged 6 commits into
mainfrom
agents/first-android-test

Conversation

@lumenpearson

Copy link
Copy Markdown
Owner

Description

The project gets its first instrumented tests, and three of the four defects #186 filed and left open are fixed. The four commits were made on the night of 26–27 September. A fifth was added when the branch was picked up again: a hardening of the single flight, found while reviewing it before the push.

# What was wrong What it does now
#110 There was no androidTest source set anywhere, so where half a slot really falls under the arranging gesture could only be asked at Robolectric's densities ToolbarOnDeviceTest in :core:designsystem drags a tab 0.7 and 0.4 of a slot in one touch at the device's own density, and checks that a tap on the page closes the mode and reaches nothing. Espresso 3.7.0 and runner 1.7.0 are pinned in the catalog, because the Compose BOM's Espresso 3.5.0 fails on API 34 and later
#175 Both diary sign-in forms said «по HTTPS, прямо в дневник» twice, one paragraph under the other with a host, the sentence naming it also says the password goes nowhere else, and the next paragraph covers only the session. One function builds the paragraphs for both forms
#176 The join screen kept a connection error about an address it no longer used each error is kept with the address it answered, and it is shown only while that is still the address
#171 A join downloaded the whole school year twice at the same moment syncs of one class's year go through a single flight keyed by class and year; a caller that overlaps a running sync takes its answer

The hardening on #171 (f787357). A waiter whose owner was cancelled retries for itself. It could wake before the owner had removed its finished run, find that same run again and again, and loop without ever suspending. A run that is no longer active is now never joined. None of the three tests reproduces that window, so it is argued from the code rather than shown red.

HANDOVER.md carries the close-out: the batch, the ref that had to be restored from its reflog, a Teleport auto-stash that holds only IDE-generated files and is left for the owner, and the gates.

Closes #110
Closes #171
Closes #175
Closes #176

What is affected

  • server/app/api — the client-facing API
  • server/app/bot — the bot
  • server/app/services — the rules the bot and the API share
  • server/app/providers/petersburg — the electronic diary
  • server/migrations — the database schema
  • android/core/model — the models and the state engine
  • android/core/data — Room, network, sync, notifications
  • android/core/designsystem — theme and components
  • android/widget — the widget
  • android/app — the screens
  • docs/, README.md
  • .github/ — build and automation

Boundaries

  • app/schedule.py still imports neither FastAPI nor aiogram — the server is not touched
  • The rule did not appear in two places — passwordPrivacyParagraphs is the one place both forms read
  • A model change comes with an Alembic revision — there is no model change; EXPECTED_REVISION is still 0017
  • Nothing is scheduled "in process" on the server
  • "Now" is taken in the class's time zone — nothing here reads a clock
  • :core:data does not depend on :widget
  • Every new Russian string has its English twin in values-en/ — diary_password_session
  • There is no token, class code, password or keystore path in the diff

Verification

cd android && ./gradlew test  → BUILD SUCCESSFUL; 1446 tests, 0 failures
                                 (:core:model 125, :core:data 540, :core:designsystem 112, :widget 113, :app 556)
cd android && ./gradlew assembleDebug assembleRelease  → BUILD SUCCESSFUL
cd android && ./gradlew :core:designsystem:connectedDebugAndroidTest  → 3 of 3, 11.5 s, Pixel_10_Pro_XL AVD, API 37

The server was not touched, so ruff, mypy and pytest were not run.

  • ./gradlew assembleDebug
  • ./gradlew assembleRelease
  • Checked on a device or an emulator: Pixel_10_Pro_XL AVD, API 37. This branch's debug build, with its data cleared, went through the first run and joined «9А» with DEMO24 against a local server. The server's log showed POST /api/v1/join 200, then GET /api/v1/bundle?start=2026-09-01&days=273 200, then the same request answered 304, one after the other on one connection
  • The widget checked at two sizes at least — the widget is not touched

What is NOT covered

Documentation

  • docs/ updated — docs/build.md has «Instrumented tests», and docs/architecture.md has the device source set and the new counts
  • CLAUDE.md updated — the connectedDebugAndroidTest command
  • README.md updated — the honest status and the gate table
  • No update needed

🤖 Generated with Claude Code

program-perfect and others added 6 commits September 27, 2026 01:04
…ging gesture on a device

There was no androidTest source set anywhere, so the one thing a hand
notices about the arranging gesture could not be asked: whether half a
slot, at a device's real density and with its real long-press timeout,
is where a tab changes place. The JVM tests drag ten thousand pixels to
land on an answer Robolectric's densities cannot move.

ToolbarOnDeviceTest, in :core:designsystem, holds a tab and drags it 0.7
and 0.4 of a slot in one touch: the first moves it exactly one place and
is not taken for a tap, the second puts it back. A third taps the page
with the mode open and checks the dismiss layer closes it and passes
nothing through. All three pass on the API 37 emulator in 14 seconds,
with `./gradlew :core:designsystem:connectedDebugAndroidTest`.

The Compose BOM's ui-test-junit4 brings Espresso 3.5.0, which reaches
for InputManager.getInstance by reflection; API 34 removed it and every
test failed at its first onIdle. Espresso 3.7.0 and runner 1.7.0 are
pinned in the catalog, read from Google Maven's metadata, where each is
the current release.

Not in CI, on purpose: CI has no device. CLAUDE.md, docs/build.md, the
README and docs/architecture.md say how to run it and that it is the only
test that touches a device.

Closes #110
Both forms that take a diary password showed the sentence naming the
diary's host beside the general notice, and the notice opened by saying
it again: «по HTTPS, прямо в дневник», one paragraph under the other.

With a host known, the sentence that names it now also says the password
goes nowhere else, and the second paragraph is only what happens to the
session. Without one, the general notice stands alone as before. One
function decides the paragraphs for both forms, so they cannot drift
apart again. PasswordPrivacyTest counts «HTTPS» across what is drawn, in
both languages, and fails on the old pair.

Closes #175
A refusal is an answer from one address. The join screen kept it after
the address under the button was changed to a working one, until the
next keystroke or the next press, so it showed a connection error about
an address it no longer used.

The view model now keeps each error with the address it was an answer
from and shows it only while that is still the address. That covers a
change from the screen's own link and one made in the settings alike,
which clearing the error in one handler would not. A code of the wrong
length is about the code, not a server, and stays whatever the address.
JoinErrorAddressTest fails on the old behaviour.

It did not reproduce on the second try on the emulator; the code path
that keeps it is plain when read, and the test holds it.

Closes #176
A join asked for the whole school year twice in the same second: the
join screen's own refresh, and the one-off worker the class switch
schedules. Neither had stored an ETag yet, so the server's log showed
two 200s of ~273 days on two connections for every phone that joined.

Syncs of one class's year now go through a single flight keyed like the
tag, by class and year: a second caller while the first is on the wire
waits for it and takes its answer. Nothing is remembered once a run
ends, so a later refresh still asks again, and a waiter whose run was
cancelled under it starts its own instead of inheriting the
cancellation. ConcurrentSyncTest holds all three; the first fails on the
old code with two requests.

Closes #171
A caller waiting on a sync whose owner was cancelled retries for itself,
which is right, but the owner takes its entry out only after it has
completed the run's deferred. On a pool of threads the waiter can wake
in between, find the same finished run still under the key, await it,
get the same cancellation at once and go round again, until the owner
gets the lock back — a loop that recurses and never suspends.

A run that is no longer active is now treated as absent: the next
caller starts its own and puts it under the key, and the old owner's
identity check leaves the new entry where it is.

ConcurrentSyncTest's three cases still pass. None of them reproduces
the loop: under the test dispatchers the waiter's resumption is queued
behind the owner, which finishes its cleanup first, so the window this
closes is argued from the code rather than shown red.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…y left

HANDOVER.md opens on #187 and gains its batch: #110's device test and
the catalog pins it needed, #175, #176 and #171 with the hardening made
at review, the branch ref that came back as NUL bytes and was restored
from its reflog, and a teleport stash of IDE-generated files left for
the owner. It records the gates on f787357, the join seen on the
emulator — one 200 and one 304, never the overlap the fix coalesces —
and what that leaves unverified. #186's summary moves into its own
section, now «What the session before it added», and the chain below it
shifts by one. Sections 5 and 7 no longer say there is no androidTest
or that C: has 1.3 GB.

The Android test count is 1446 in its three places, and the README's
gate table carries the device run, marked as outside CI.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@vercel

vercel Bot commented Sep 26, 2026 •

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated
lessons Ready Ready Preview Sep 26, 2026 10:47pm UTC

@lumenpearson
lumenpearson marked this pull request as ready for review September 26, 2026 22:56
@lumenpearson
lumenpearson merged commit 2a408d8 into main Sep 26, 2026
5 checks passed
lumenpearson pushed a commit that referenced this pull request Sep 27, 2026
…they left

HANDOVER.md opens on #189 and gains its batch: #174's diagnosis
corrected (the phone's 2×2 is SMALL_TALL, not LARGE) before the fix,
the fix, #188 found while checking it and fixed, what the emulator
showed in both languages and at font scale 2.0, how the widget can and
cannot be redrawn from a shell, and the gates on 675cafe. #187's section
becomes «What the session before it added» and records its merge; the
chain below shifts by one, and two references to #186's section now
name it by its subject, since «What the batch before added» is shared.
Section 5 says what #189 did not see: the one-line size during lessons
at a large font, a system font-scale change, any other launcher. Section
7 has this batch's cost in disk.

The Android test count is 1459 in its three places.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@lumenpearson
lumenpearson deleted the agents/first-android-test branch September 27, 2026 10:08

This branch was successfully deployed

1 active deployment
Preview — 056bd616 Deployed Sep 26, 2026 by vercel[bot]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment