Skip to content

Commit efd01cc

Browse files
committed
Move development notes out of the README into AGENTS.md
The README is for someone deciding whether to install the app, so build commands, module layout, signing and the migration internals do not belong in it. AGENTS.md also collects the things that have already gone wrong here and are invisible in the code: R8 stripping ML Kit's reflective constructors, dex refusing commas in test method names, Robolectric double-starting Koin.
1 parent 32df5c5 commit efd01cc

2 files changed

Lines changed: 86 additions & 30 deletions

File tree

AGENTS.md

Lines changed: 73 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,73 @@
1+
# Working in this repo
2+
3+
Notes for anyone, human or otherwise, changing this codebase. Things the code
4+
itself does not say.
5+
6+
## Layout
7+
8+
shared/ domain model, repositories, SQLDelight schema, most of the tests
9+
composeApp/ Android app: UI, widget, notifications, camera, migration
10+
config/ detekt configuration
11+
store-assets/ Play listing assets, with the scripts that generate them
12+
13+
`shared` is multiplatform-shaped but only Android is wired up. Nothing outside
14+
`androidMain` may depend on Android.
15+
16+
## Commands
17+
18+
./gradlew :composeApp:assembleDebug
19+
./gradlew ciCheck # ktlint, detekt, Android Lint, unit tests, debug build
20+
./gradlew ciCheckDevice # the above plus instrumented tests
21+
22+
`ciCheck` and `.github/workflows/ci.yml` must stay in step. CI runs one task per
23+
job step so failures are attributable; adding a task to `ciCheck` means adding a
24+
step there too.
25+
26+
Run the formatter and linter after changing code, and fix what they flag.
27+
28+
## Conventions
29+
30+
- ktlint is wired through the CLI, not the Gradle plugin. AGP 9 supplies its own
31+
Kotlin plugin, so `org.jetbrains.kotlin.android` is never applied and
32+
ktlint-gradle registers no source-set tasks. Style comes from `.editorconfig`.
33+
- American English throughout, including comments and strings. The pre-2.0 code
34+
was British.
35+
- Radii come from `EdrShapes`. No one-off `RoundedCornerShape` values.
36+
- Comments explain why, not what. A rule or a workaround with no stated reason is
37+
one nobody can safely delete later.
38+
39+
## Things that have already gone wrong
40+
41+
- **`LegacyImporter`** is the only path that can lose data users cannot get back.
42+
It reads the 1.5 database and image cache on first launch, once, and leaves the
43+
original files alone. Treat changes here as the highest-risk edits in the repo.
44+
- **R8 strips ML Kit's reflective constructors.** The failure is silent: the app
45+
starts, logs `NoSuchMethodException` at WARN, and scanning never works. Keep
46+
rules and their reasoning are in `composeApp/proguard-rules.pro`. A debug build
47+
cannot show this, so exercise `assembleRelease` before shipping.
48+
- **Widget sizing** lives in `WidgetSizing.kt` as plain Kotlin, deliberately, so
49+
it is testable without Glance. It still leaves dead space and drops its overflow
50+
line at tall sizes.
51+
- **Schema defaults and `AppSettings()` must agree.** They silently disagreed
52+
once; `SettingsDefaultsTest` is the guard.
53+
- **Instrumented test method names cannot contain commas.** Dex will not represent
54+
them. JVM tests can keep backticked sentences.
55+
- **Robolectric boots the real `EdrApplication`** and Koin then refuses to start
56+
twice. Use `@Config(application = Application::class)`.
57+
58+
## Signing
59+
60+
Release builds are signed only when `keystore.properties` exists in the project
61+
root, holding `storeFile`, `storePassword`, `keyAlias` and `keyPassword`. It is
62+
gitignored, along with `*.jks` and `*.keystore`, and must stay that way. Without
63+
it the build produces an unsigned artifact rather than failing configuration, so
64+
CI needs no secrets.
65+
66+
Upload `mapping.txt` with every bundle or Play Console crash reports are
67+
unreadable.
68+
69+
## Known gaps
70+
71+
- The eight translations are machine generated and unreviewed.
72+
- OCR and the GenAI path have only ever run on an emulator.
73+
- Install-over-1.5 has never been tested through a real Play install.

README.md

Lines changed: 13 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,12 @@ and not after. Food, medicine, warranties, passports, anything with a date on it
1111
</a>
1212
</p>
1313

14-
By Anish Sahoo, MIT licensed. Version 2.0 is a rewrite of the 2019-2022 Java app;
15-
that history is still in this repo, below the rewrite commit.
14+
## About
15+
16+
Created by Anish Sahoo and released under the MIT license.
17+
18+
Version 2.0 is a rewrite of the 2019-2022 Java app. That history is still in this
19+
repo, below the rewrite commit.
1620

1721
## Features
1822

@@ -24,7 +28,8 @@ that history is still in this repo, below the rewrite commit.
2428
- Date formats picked from your region, changeable in settings
2529
- Eight languages, and colors that follow your wallpaper on Android 12+
2630

27-
Everything is stored on device. No account, and the camera is only used when you scan.
31+
Everything is stored on device. There is no account, and the camera is used only
32+
when you scan.
2833

2934
## Technicalities
3035

@@ -33,32 +38,10 @@ Everything is stored on device. No account, and the camera is only used when you
3338
- ML Kit Text Recognition, with the GenAI Prompt API where the device supports it
3439
- Glance for the widget, WorkManager for reminders
3540
- minSdk 31 (Android 12), targetSdk 36, JVM 21
36-
- Item photos live in `filesDir`, readable only by the app
37-
38-
Layout:
39-
40-
shared/ domain model, repositories, SQLDelight schema, most of the tests
41-
composeApp/ Android app: UI, widget, notifications, camera, migration
42-
config/ detekt configuration
43-
store-assets/ Play listing icon, feature graphic and screenshots, with generators
44-
45-
## Building
46-
47-
./gradlew :composeApp:assembleDebug
48-
./gradlew ciCheck # ktlint, detekt, Android Lint, unit tests, debug build
49-
./gradlew ciCheckDevice # the above plus instrumented tests
50-
51-
`ciCheck` is what GitHub Actions runs, one step per gate.
52-
53-
Release builds are signed only when a gitignored `keystore.properties` exists in the
54-
project root (`storeFile`, `storePassword`, `keyAlias`, `keyPassword`). Without it the
55-
build still produces an unsigned artifact rather than failing. Upload `mapping.txt`
56-
with the bundle or Play Console crash reports are unreadable.
57-
58-
## Migrating from 1.5
41+
- Item photos live in the app's private storage, readable only by the app
5942

60-
`LegacyImporter` reads the old app's SQLite database and image cache on first launch
61-
and imports both. It runs once, is idempotent, and leaves the old data in place. It is
62-
the only code path that can lose data users cannot get back, so it carries the most tests.
43+
Upgrading from 1.5 imports your existing items and photos automatically on first
44+
launch.
6345

64-
Privacy policy in [PrivacyPolicy.md](PrivacyPolicy.md).
46+
Privacy policy in [PrivacyPolicy.md](PrivacyPolicy.md). Notes for contributors in
47+
[AGENTS.md](AGENTS.md).

0 commit comments

Comments
 (0)