The §6.3 EXIF row deferred implementation to "M4+ when the JVM
attachment intake lands" — it landed in M4.4c, so the last NoOp
placeholder is gone. JvmImageOrientationNormalizer keeps the Android
contract exactly: orientation 6/3/8 -> bake 90/180/270 into pixels,
re-encode JPEG @ 0.92, return input UNCHANGED for normal/absent/mirror
tags or any decode/rotate failure.
Tooling differs, contract doesn't: com.drewnoakes:metadata-extractor
2.19.0 (first Central pull this phase — recorded) for the tag read,
BufferedImage + AffineTransform for the rotate, ImageIO JPEG writer at
explicit 0.92 for the encode. DesktopContainer now wires it into
NoteRepositoryImpl (was ImageOrientationNormalizer.NoOp).
New probe: :core:data-jvm:orientationSmoke hand-builds an
EXIF-Orientation-90 JPEG (APP1 splice — metadata-extractor is
read-only) and asserts: no-EXIF passthrough, EXIF-90 rewrite, pixels
rotated (4x2 -> 2x4), output stability, garbage passthrough.
Verified: :core:data-jvm:orientationSmoke (RESULT: M4.4e PASS, 5/5)
+ ./gradlew assembleDebug :desktopApp:build SUCCESSFUL
+ :desktopApp:run --self-test (SELFTEST id=1 -> RENDER notes=1
selected=1); objectbox-models clean.
The probe asserts exact note counts; running it twice in a row against the surviving build/data-jvm-smoke directory failed on count assertions (found while verifying m2.5). The task now cleans the directory like backupSmoke does.
Phase 1 M2 task 5 (tools/DESKTOP_PHASE_PLAN.md §4): measure & record,
no redesign. New :core:data-jvm:backupMemory probe (2g heap) samples
heap-used at 1 ms during BackupBridge.exportPlain — the phone's own
export path — across four fresh libraries:
24 MB data (3 att) → peak 230 MB | 2 MB text x2000 notes → 140 MB
80 MB data (10 att) → peak 777 MB | 320 MB data (40 att) → OOM at -Xmx2g
Attachments drive memory (~9–10x allocation pressure: store load →
base64 String → UTF-8 bytes → JsonElement tree); note count alone is
trivial. The plan's 250 MB gate trips at ~25–30 MB of attachments, and
the phone (no largeHeap) shares the ceiling — a pre-existing Android
limitation, unchanged by the bridge extraction. The real library
exports at 366 KB ≈ 1000x headroom. Bonus: a ~1.6 GB library dies in
objectbox-java's DbFullException before the bridge ever sees it.
Verdict: record, don't redesign. Streaming formatVersion=2 stays parked
for Phase 2, required only if attachment libraries approach ~25 MB.
Phase 1 M2 verification probe, driven by a real phone export (27 notes,
1 attachment, 14 orphan tags; the file is user data and stays out of the
repo):
- :core:data-jvm:backupSmoke --args="<export.incido.json> [libDir]" —
preview, import into a fresh JVM library, re-export + field-by-field
compare, encrypted envelope export (wrong passphrase rejected),
encrypted import into a 2nd library with attachment-byte equality.
The probe caught a PRE-EXISTING Android bug the phone also has: upsert /
saveNoteWithHashtags stamped createdAt+updatedAt to now on every insert,
so backup import rewrote every note's history — and would defeat the
(createdAt, updatedAt, sha256(content)) dedupe key M2 task 3 depends on.
Justified behavior change (invariant 1: not silent): non-zero caller
timestamps are now honoured, 0 still means now. The Android editor
passes its own stamps (verified at both Note(...) sites), so only the
import path changes. addAttachment gains createdAt: Long = 0L;
importSnapshot passes the phone value through.
Verification passed: :core:data-jvm:backupSmoke (RESULT: M2 round-trip
PASS on the real export) + assembleDebug + :core:data-jvm:smoke (after a
forced codegen regen: "ID model file unchanged") + :desktopApp:run
--self-test + :spike:data-jvm:run — all green; output recorded in
DESKTOP_FEASIBILITY.md.
Known pre-existing gap left open (documented): importSnapshot never
recreates orphaned hashtag rows.
Phase 1 milestone M1a (Development Plan §6, desktop track): make the whole
data layer usable from a non-Android build, without touching what the
Android app compiles.
:core:data splits its sources:
src/main/kotlin platform-neutral — entities, repository, field
crypto, NoteCryptoService. Compiled by BOTH
:core:data and :core:data-jvm. Must not import
android.*
src/androidMain/kotlin Android-only seam implementations.
Two seams were required, both identified by the Phase-0 spike:
ObjectBoxStore Context on Android, a directory on desktop. Same
FQN in sibling modules that are never on one
classpath — which is also what keeps
objectbox-android and objectbox-java (they ship
the same io.objectbox.* classes) apart.
ImageOrientationNormalizer EXIF rotation needs a bitmap decoder; the
implementation moved verbatim out of
NoteRepositoryImpl, which is now platform-free.
The parameter is required, not defaulted, so a
platform that forgets it fails the build.
New :core:data-jvm compiles those shared sources against objectbox-java /
objectbox-linux with its own codegen. `:core:data-jvm:smoke` runs the real
NoteRepositoryImpl (save + hashtags + attachment round-trip + close/reopen)
on the JVM: PASS, with the generator reporting "ID model file unchanged" —
one schema, two generated runtimes.
Also: .gitignore excluded **/objectbox-models/, so the schema contract was
never committed and a fresh clone regenerated UIDs. default.json is now
tracked; the rest of that directory stays ignored. This matters more now
that two modules generate from it.
Verified: :core:data-jvm:smoke PASS, assembleDebug green.