5.8 KiB
5.8 KiB
AGENTS.md
Android app (Kotlin + Jetpack Compose, single module :app), 100 % local HRT tracking.
Docs, comments and CHANGELOG are French-first; README.md (FR) ↔ README.en.md must stay in sync.
Build & Test
./gradlew assembleDebug— debug APK./gradlew testDebugUnitTest— 346 JVM tests (292 without local data)./gradlew connectedDebugAndroidTest— 16 Compose UI tests (emulator/device required)./gradlew lint— must be green before any release- No CI: these gates run locally; every release commit needs
testDebugUnitTestgreen. - Needs
local.properties(sdk.dir=…) orANDROID_HOME; platform 37 auto-downloaded; JDK 17+.
Command order (release)
lint → testDebugUnitTest → connectedDebugAndroidTest → assembleRelease →
emulator validation of the RELEASE APK (§16.ter) → tag → publish.
Release-APK validation before tagging is OBLIGATORY (checklist step 3.bis).
Toolchain — pinned; bump only after reading docs/DEVELOPPEMENT.md §3
- AGP 9.4.0 / Kotlin compose plugin 2.3.21 / KSP 2.3.11 / Gradle 9.7.1 / Compose BOM 2026.08.00 — tested together.
- No version catalog, no ktlint/detekt.
app/lint.xmldowngrades two Compose checks to warnings;StringFormatMatchesstays a blocking error (it caught bugs #47/#48). - Bump
versionCode+versionNameinapp/build.gradle.ktsBEFORE the release commit/tag (v1.3.0–v1.3.2 shipped with a stale VERSION_NAME).
Release
- Every release adds a
## [X.Y.Z]section todocs/CHANGELOG.md(no "v" prefix) — thecopyChangelogtask embeds it in the APK ("Nouveautés" dialog); missing section = empty dialog. - Annotated tag
vX.Y.Z, pushed to BOTH remotes:origin(gitea.cloudyfy.fr) andfarewell(gitea.farewell.dev, SSH; push-to-create disabled). - Publish both APKs:
python3 scripts/publish-release.py cloudyfy|farewell vX.Y.Z(purge + upload + verify by download). Do NOT usescripts/gitea-release.pyfor APKs (mono-APK; concurrent uploads overwrite each other — lesson #43). - Gitea tokens come from the macOS keychain, scope
write:repository. Never commit secrets;keystore.properties/*.keystoreare gitignored. Never compare tags as strings (v1.2.10<v1.2.5lexicographically). - Signing:
assembleReleaseuses the DEBUG key whilekeystore.propertiesis absent (release installs over debug, no data loss).scripts/make-release-keystore.shcreates it — signature then changes ⇒ on-device migration: export → uninstall → reinstall → import (§16.quater). - Commits are layered with prefixes:
engine:/data:/reminders+ui:/scripts/docs:/release.
R8 / Gson traps (release-only bugs)
proguard-rules.procarries explicit-keeprules for Gson-reflected models (data.model.**,BackupData,TConfig) and WorkManager classes.- Two crashes happened ONLY in release (#64 class removed by R8, #72
cycleEntriesnull under R8) — JVM tests never exercise R8; smoke-test backup export/import + charts on a release build.
Emulator recipe (docs/DEVELOPPEMENT.md §16.ter)
scripts/seed-emulator.py <db> <backup.json>injects real data (fromlocal-test-data/) into the debug app DB; extract the DB together with its-walfile afterforce-stop(WAL trap).- ⚠️
connectedDebugAndroidTestUNINSTALLS the app (DB + DataStore wiped) — seed AFTER the last instrumented run. - Pan/pinch on the chart is NOT testable via
adb input swipeheadless (no intermediate moves).
Tests
- Unit:
app/src/test/java/com/hormonetrack/(pk, data, ui, util, reminder, settings); UI:app/src/androidTest/java/com/hormonetrack/. - Data-driven regressions load real exports from
local-test-data/(gitignored) and SKIP when absent — that's the 292 vs 346 delta. Regressions are numbered (e.g. #73 →CycleEntrySliderTest). ui/ChartScreenSourceGuardTest.ktreadsChartScreen.ktsource and pins the gesture block (+ itsrememberUpdatedStatealias) in that file — restructuring ChartScreen (~700 lines, the #54–#70 hotspot) means rewriting this guard by design.- No TODO/FIXME markers in code — remaining work lives in docs/DEVELOPPEMENT.md §19 (limits), §20 (ideas), §21 (release manual checklist — NOT a TODO list).
Architecture
- Packages in
app/src/main/java/com/hormonetrack/:pk/pure PK engine (no Android deps, time zones parameterized for deterministic tests),data/Room (hand-written migrations v1→v4,exportSchema=false),reminder/(exact alarms, notification actions, boot),settings/(DataStore),ui/(Compose;screens/settings/= cards). - Assets:
mcmc_samples.json(ESE MCMC cloud) in main;pk_profiles.jsonis test-only (src/test/assets/) since v1.9.0 — Estrannaise is analytic at runtime. - Backup JSON is versioned (
BackupData.version); import rejects newer/unparsable backups BEFORE wiping (transactionaldb.withTransaction); keep optional-field retrocompat when extending.
Hard privacy constraints
- The repo must NEVER contain health data:
local-test-data/andTODO.mdare gitignored; history was scrubbed before the first push (§8.bis). - No
android.util.Log, noGlobalScopeinapp/src/main— health logging goes throughAppLog(privatefilesDirbuffer).allowBackup=false.
Web port
- Separate repo
Siphonight/HormoneTrack-web(same Gitea remotes), synced release-by-release; Android-only features (Cycles, v1.14.0) are not ported yet. Engine/chart changes have JS mirrors (pk-engine.js,chart.js) — flag sync needs in releases.
Docs map
docs/DEVELOPPEMENT.md— full dev doc: §3 versions, §14 numbered bugs, §16 release checklist, §16.ter emulator, §16.quater keystore, §19–§21.docs/CHANGELOG.md(embedded in app),docs/GUIDE_INSTALLATION.md(user guide),docs/MONTRE-GADGETBRIDGE.md(watch).