Skip to content

Commit 6717d3c

Browse files
committed
Clean up Desktop locale seed docs
1 parent 9ddcef5 commit 6717d3c

3 files changed

Lines changed: 5 additions & 5 deletions

File tree

docs/CONTEXT.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ Domain vocabulary and invariants. Agents and humans: use these words with these
3434
| **DynamicColorCapability** | Platform-neutral Material You gate (replaces direct `:cmonet`/`CMonet` in the live Compose consumers). **Landed (S4d-43, accepted 2026-06-25)** as `interface DynamicColorCapability { isAvailable(): Boolean; setForcedSupport(enabled: Boolean) }` in `shared/commonMain/.../platform`, bound as a Koin `single`. Android actual `AndroidDynamicColorCapability` delegates **verbatim** to unchanged `:cmonet` (same OEM allowlist + `dynamic_color_force` SP key); Desktop/iOS return `false` (static `Theme.kt` schemes are the fallback). Migrated consumers: `ComposeMainActivity` `AppTheme` gate + About-route initial toggle state, `AboutViewModel` toggle write — these must **not** call `CMonet` directly anymore. `:cmonet` is **retained** behind the actual; `MyApp.init`, `ContextExtension` getters, and the logo path still use `:cmonet` directly (owner-gated absorption follow-up). |
3535
| **ImageFormat (planned)** | App-owned export format enum (replaces `Bitmap.CompressFormat` in models/UI). JPEG honors quality (snapped to multiples of 20, min 20); PNG ignores it. |
3636
| **Template** | Saved watermark text snippets (Room entity), prepopulated from locale-selected bundled DBs (`ewm-db-ch.db` / `ewm-db-eng.db`). |
37-
| **Desktop templates persistence** | **S4d-141..S4d-143b (accepted 2026-06-28)** proved the first Desktop templates persistence lane before making templates visible. Desktop now has a `shared/desktopMain` `buildTemplateDatabase(dir)` that uses Room KMP with `BundledSQLiteDriver` for an empty local DB, plus `TemplateRepository`/`TemplateEditor` roundtrip coverage and a `:desktopApp --headless` app-level witness. `desktopApp` declares `room.runtime` because it directly consumes the public `RoomDatabase` supertype exposed by `AppDatabase`; Android stays on compatibility mode and remains `sqlite-bundled`/native-sqlite clean. **S4d-160** surfaced that empty-store path in the Desktop window with Save/List/Use/Delete, backed by the same `TemplateRepository` + `TemplateEditor`. **S4d-224 (accepted 2026-06-29, commit `c7959d0`)** implemented Desktop default seeding from the English Android seed DB via a `:shared` desktopMain resource + `TemplateDatabaseSeeds.unpackDefaultTemplateSeed` + `buildTemplateDatabase(dir, seedFile)`; the empty-store `buildTemplateDatabase(dir)` path is preserved. Because Room KMP off-Android does not expose `createFromFile`/`createFromAsset`, the seeded path copies the seed file to the final DB location before Room opens it and Room validates the `room_master_table` identity hash. Existing user DBs are not reseeded. Locale-aware seed choice remains deferred. |
37+
| **Desktop templates persistence** | **S4d-141..S4d-143b (accepted 2026-06-28)** proved the first Desktop templates persistence lane before making templates visible. Desktop now has a `shared/desktopMain` `buildTemplateDatabase(dir)` that uses Room KMP with `BundledSQLiteDriver` for an empty local DB, plus `TemplateRepository`/`TemplateEditor` roundtrip coverage and a `:desktopApp --headless` app-level witness. `desktopApp` declares `room.runtime` because it directly consumes the public `RoomDatabase` supertype exposed by `AppDatabase`; Android stays on compatibility mode and remains `sqlite-bundled`/native-sqlite clean. **S4d-160** surfaced that empty-store path in the Desktop window with Save/List/Use/Delete, backed by the same `TemplateRepository` + `TemplateEditor`. **S4d-224 (accepted 2026-06-29, commit `c7959d0`)** implemented Desktop default seeding from the English Android seed DB via a `:shared` desktopMain resource + `TemplateDatabaseSeeds.unpackDefaultTemplateSeed` + `buildTemplateDatabase(dir, seedFile)`; the empty-store `buildTemplateDatabase(dir)` path is preserved. Because Room KMP off-Android does not expose `createFromFile`/`createFromAsset`, the seeded path copies the seed file to the final DB location before Room opens it and Room validates the `room_master_table` identity hash. Existing user DBs are not reseeded. **S4d-225 (accepted 2026-06-29, commit `875b105`)** made the seed choice locale-aware: `ewm-db-ch.db` for `zh` JVM locales, `ewm-db-eng.db` otherwise. |
3838
| **Recovery mode** | Crash-loop self-heal: uncaught-exception handler counts crashes, relaunches into a recovery screen (today: legacy `MainActivity` + `activity_recovery` layout) offering reset. Must survive `MainActivity` retirement (plan C1.6). |
3939

4040
## User flows

progress.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,13 +5,13 @@
55
- **S4d-225 (implementation, accepted; commit `875b105 Add Desktop locale-aware template seed`, 5 modified + 1 new file):** the Desktop templates Room DB now selects its seed by JVM locale, matching Android: `Locale.getDefault().language.contains("zh")` selects the Chinese Android seed DB (`ewm-db-ch.db`), otherwise the English seed DB (`ewm-db-eng.db`). The Chinese seed is packaged as a `:shared` desktopMain resource (`shared/src/desktopMain/resources/seed/ewm-db-ch.db`, byte-identical to `app/src/main/assets/ewm-db-ch.db`). Extended `TemplateDatabaseSeeds` with `defaultTemplateSeedLanguage()` and `unpackTemplateSeed(output, language)`; `unpackDefaultTemplateSeed(output)` now delegates to the locale-based selection. Empty-store `buildTemplateDatabase(dir)` and existing-DB no-reseed protection remain unchanged. Wired through `DesktopWindow.kt` and `Main.kt` unchanged except for comment/temp-filename updates.
66
- **Verification:** `:shared:desktopTest` (`TemplateDatabaseSeedingTest` now 5/5, including Chinese seed, English seed, existing-DB protection, and locale-rule tests) + `:desktopApp:compileKotlin` + `:desktopApp:run --args='--headless'` green (`--max-workers=8`, daemon stopped). The headless witness loaded the Chinese seed on the host's `zh` JVM locale. `git diff --check` clean.
77
- **Boundary (no overclaim):** release-grade Desktop template seeding correctness, **not** Android v2.10.0 1:1 UI/UX parity; template edit-in-place remains a separate gate. PR #358 stays Draft.
8-
- **S4d-225b (this entry):** docs-only closeout — record S4d-225 in durable docs and remove stale "locale-aware seeding deferred" language.
8+
- **S4d-225b (this entry):** docs-only closeout — record S4d-225 in durable docs and remove stale seed-pending language.
99

1010
## 2026-06-29 — S4d-224 Desktop template default seeding (+S4d-224b docs)
1111

1212
- **S4d-224 (implementation, accepted; commit `c7959d0 Seed Desktop template database`, 3 modified + 3 new files):** the interactive Desktop window's templates Room DB now seeds from the existing English Android seed DB on first creation. The seed asset is packaged as a `:shared` desktopMain resource (`shared/src/desktopMain/resources/seed/ewm-db-eng.db`, byte-identical to `app/src/main/assets/ewm-db-eng.db`) so `:shared` does not depend on `:desktopApp` resources. Added `shared/desktopMain` `TemplateDatabaseSeeds.unpackDefaultTemplateSeed(output): File` to extract the resource to a writable file, and an overload `buildTemplateDatabase(dir, seedFile)` that copies the seed to the final DB path before Room opens it; the existing empty-store `buildTemplateDatabase(dir)` path is preserved for tests and callers that want an empty DB. Because Room KMP off-Android does not expose `createFromFile`/`createFromAsset`, seeding is done by direct file copy; Room validates the `room_master_table` identity hash (`72366f557b971b39675d0f26cbc46e0a`, already proven matching in S4d-143b). Wired both `DesktopWindow.kt` (real app DB under `~/.easywatermark`) and `Main.kt` (repo-local headless witness). Existing user DBs are **not** reseeded — the copy only happens when the target DB file does not exist. Headless witness is repeatable by deleting/recreating only its disposable `build/s4d143a-desktop-templates` directory before each run.
1313
- **Verification:** `:shared:desktopTest` (including new `TemplateDatabaseSeedingTest`) + `:desktopApp:compileKotlin` + `:desktopApp:run --args='--headless'` green on two consecutive runs without manual pre-clean (`--max-workers=8`, daemon stopped). `git diff --check` clean.
14-
- **Boundary (no overclaim):** release-grade Desktop template default seeding, **not** Android v2.10.0 1:1 UI/UX parity; locale-aware seed choice (`ewm-db-ch.db` for Chinese locales, English otherwise) remains deferred; template edit-in-place remains a separate gate. PR #358 stays Draft.
14+
- **Boundary (no overclaim):** release-grade Desktop template default seeding, **not** Android v2.10.0 1:1 UI/UX parity; locale-aware seed choice landed in S4d-225; template edit-in-place remains a separate gate. PR #358 stays Draft.
1515
- **S4d-224b (this entry):** docs-only closeout — recorded the above in `progress.md`, `task_plan.md`, `docs/CONTEXT.md`, and `AGENTS.md` and removed stale "default-template seeding deferred" language.
1616

1717
## 2026-06-29 — S4d-222 Desktop save output filename collision avoidance (+S4d-222b docs)
@@ -144,7 +144,7 @@
144144
- **S4d-143a (implementation, accepted; commit `07ac7b6`):** added the `:desktopApp --headless` templates witness. The app builds a Desktop DB under `build/s4d143a-desktop-templates`, constructs `TemplateRepository` + `TemplateEditor`, proves empty count, add/list/delete, and closes the DB. `desktopApp` now declares the existing `room.runtime` dependency because it directly consumes the public `RoomDatabase` supertype exposed by `AppDatabase`; Android remains `sqlite-bundled`/native-sqlite clean.
145145
- **S4d-143b (read-only seed decision, accepted):** proved Desktop seed parity is viable but still optional. Both Android seed DB assets (`ewm-db-eng.db`, `ewm-db-ch.db`) contain one template row and `room_master_table` identity hash `72366f557b971b39675d0f26cbc46e0a`, matching generated Room `AppDatabase_Impl` for Android, Desktop, and both iOS targets. The worker-created SQLite WAL/SHM sidecars under `app/src/main/assets` were generated artifacts and were explicitly removed before acceptance.
146146
- **Decision (S4d-143b, superseded by S4d-224):** do not implement Desktop seed packaging yet. The empty-store builder and app witness were enough for the initial Desktop release-code migration lane; `createFromFile` seed packaging was deferred to a separate slice (now implemented as S4d-224 via direct seed-file copy, because Room KMP off-Android does not expose `createFromFile`/`createFromAsset`).
147-
- **Next (S4d-143b-era, now partly done):** S4d-224 implemented the Desktop default English seed. Locale-aware seed choice and template edit-in-place remain separate gates; Android v2.10.0 screenshot/recording 1:1 parity remains deferred until release-grade code migration completes.
147+
- **Next (S4d-143b-era, now mostly done):** S4d-224 implemented the Desktop default English seed and S4d-225 made it locale-aware. Template edit-in-place remains a separate gate; Android v2.10.0 screenshot/recording 1:1 parity remains deferred until release-grade code migration completes.
148148

149149
## 2026-06-28 — S4d-140 Desktop Save-As destination accepted
150150

task_plan.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ Phase J - Desktop EXIF orientation done (S4d-21/22); iOS EXIF = Skia decode bake
1515
- **Android production v2.10.0 remains the only visual/behavior baseline**: Android debug must match it first after code migration; iOS/Desktop then align to the same Android baseline with platform-appropriate differences.
1616
- **Non-trivial implementation uses the ACSP cowork loop**: coordinator publishes a narrow filesystem session, worker executes, bounded poll monitors, coordinator reviews real artifacts/diff and accepts/requeues.
1717
- **S4d-59/S4d-77 completed under ACSP**: S4d-59 selected the next smallest code-migration slice from current repo evidence; S4d-60 moved the watermark config model into commonMain; S4d-61 moved config normalization rules into commonMain; S4d-62 mapped state/use-case boundaries; S4d-63 retired the duplicate `waterMark`/`selectedImage` LiveData wrappers; S4d-64 converted `saveResult` to nullable StateFlow; S4d-65 converted `compressedResult` to nullable StateFlow; S4d-66 converted `saveProcess` to snapshot-safe nullable StateFlow; S4d-67 removed the dead private `saveImageUri` state; S4d-68 retired the unobserved `imageList` LiveData wrapper and its dead `autoScroll` flag; S4d-69 converted `galleryPickedImageList` to nullable StateFlow; S4d-70 mapped the next larger seams; S4d-71 moved `ImageInfo` to `shared/commonMain`; S4d-72 moved `FuncType` + `WatermarkConfigChange` into `shared/commonMain`; S4d-73 mapped DataStore/Room/Koin KMP readiness (read-only); S4d-74 landed the first DataStore KMP code in `:shared` (commonMain driver-free helper + androidMain plain store-creation function, no `commonMain expect`); S4d-75 mapped the common-prefs-consumer feasibility (read-only); S4d-76 moved `UserPreferences` to commonMain; S4d-77 moved `UserConfigRepository` to commonMain (first real common DataStore Preferences consumer, `okio.IOException` with no dep change). `MainViewModel` is now free of LiveData/MutableLiveData source usage and the old branch-local config `Any` casts.
18-
- **Desktop product-flow lane started**: S4d-119 accepted the read-only readiness decision that Desktop was still a CLI witness and chose the smallest non-speculative product-flow slice before adding a Compose Desktop dependency. S4d-120..S4d-123 established the headless save spine, minimal Compose Desktop window, text color/typeface/style honoring, and shared drawStyle paint support. S4d-124..S4d-130 added real image input, JPEG/PNG encode support, persisted output preference wiring, and window-side JPEG/80 + PNG/100 presets. S4d-132..S4d-137 completed the Desktop icon/Text/source mini-epic at functional-code level: icon composition, Image-mode save branch, Open icon, Use text watermark, and remembered source-image reuse. S4d-138/S4d-140 closed the immediate Desktop product-readiness harness and destination gaps with `DesktopSaveDecision` plus a destination-only "Save as..." button. **S4d-141..S4d-143b are accepted**: Desktop now has an empty-store Room templates builder (`buildTemplateDatabase(dir)` with `BundledSQLiteDriver`), a `:desktopApp --headless` TemplateRepository/TemplateEditor witness, and a read-only seed decision proving Android seed DB identity hashes match generated Room (`72366f557b971b39675d0f26cbc46e0a`). **S4d-145..S4d-160 are accepted**: the Desktop window now covers manual edit controls, preview, save/save-as, share substitute, drag/drop image input, and a minimal Templates UI (Save current text / list / Use / Delete). **S4d-198 is accepted (commit `1f0019b5`)**: explicit editor/mode/template-Use actions and Open image/drop source changes now auto-refresh the preview through one `refreshPreview()` helper (bounded to explicit clicks/source events, not per-keystroke; preview writes only the temp file and never sets `lastSavedFile`; Render & Save / Save as stay real-save-only). **S4d-224 is accepted (commit `c7959d0`)**: Desktop templates DB now seeds from the English Android seed DB via a `:shared` desktopMain resource + helper on first creation; existing user DBs are not reseeded. Locale-aware seed selection remains deferred. Screenshot/recording 1:1 parity work stays out of scope until the code migration is release-grade.
18+
- **Desktop product-flow lane started**: S4d-119 accepted the read-only readiness decision that Desktop was still a CLI witness and chose the smallest non-speculative product-flow slice before adding a Compose Desktop dependency. S4d-120..S4d-123 established the headless save spine, minimal Compose Desktop window, text color/typeface/style honoring, and shared drawStyle paint support. S4d-124..S4d-130 added real image input, JPEG/PNG encode support, persisted output preference wiring, and window-side JPEG/80 + PNG/100 presets. S4d-132..S4d-137 completed the Desktop icon/Text/source mini-epic at functional-code level: icon composition, Image-mode save branch, Open icon, Use text watermark, and remembered source-image reuse. S4d-138/S4d-140 closed the immediate Desktop product-readiness harness and destination gaps with `DesktopSaveDecision` plus a destination-only "Save as..." button. **S4d-141..S4d-143b are accepted**: Desktop now has an empty-store Room templates builder (`buildTemplateDatabase(dir)` with `BundledSQLiteDriver`), a `:desktopApp --headless` TemplateRepository/TemplateEditor witness, and a read-only seed decision proving Android seed DB identity hashes match generated Room (`72366f557b971b39675d0f26cbc46e0a`). **S4d-145..S4d-160 are accepted**: the Desktop window now covers manual edit controls, preview, save/save-as, share substitute, drag/drop image input, and a minimal Templates UI (Save current text / list / Use / Delete). **S4d-198 is accepted (commit `1f0019b5`)**: explicit editor/mode/template-Use actions and Open image/drop source changes now auto-refresh the preview through one `refreshPreview()` helper (bounded to explicit clicks/source events, not per-keystroke; preview writes only the temp file and never sets `lastSavedFile`; Render & Save / Save as stay real-save-only). **S4d-224 is accepted (commit `c7959d0`)**: Desktop templates DB now seeds from the English Android seed DB via a `:shared` desktopMain resource + helper on first creation; existing user DBs are not reseeded. **S4d-225 is accepted (commit `875b105`)**: the seed choice is now locale-aware (`ewm-db-ch.db` for `zh` JVM locales, `ewm-db-eng.db` otherwise). Screenshot/recording 1:1 parity work stays out of scope until the code migration is release-grade.
1919
- **iOS editor lane advanced through S4d-113**: S4d-101..S4d-105 made iOS a real off-Android consumer of shared watermark text/degree/tileMode/alpha; S4d-106 selected text color as the next non-default-preserving field; S4d-107 wired `WaterMark.textColor`; S4d-108 mapped remaining render-default mismatches; S4d-109 wired `WaterMark.textSize`; S4d-110 wired `WaterMark.hGap/vGap`; S4d-112 wired `WaterMark.textTypeface`; S4d-113 wired `WaterMark.textStyle` through the iOS config bridge, Swift workflow, and Skiko render edge. Fresh iOS renders now align to shared/Android amber `#FFB800`, text size `14`, gaps `0/0`, default `Normal`, and default `Fill`; **S4d-123 resolved the S4d-122 Stroke paint gap**, so Stroke is raster-honored on iOS Skiko too. These are release-migration alignments, **not** final Android v2.10.0 1:1 UI/UX parity.
2020
- **iOS image-watermark lane closed at functional-code level**: the text-field editor/render lane from S4d-108/S4d-113 is exhausted, and the `iconUri`/`markMode` mini-epic is now accepted through **S4d-118**: S4d-115 Kotlin-only icon render foundation, S4d-116 durable iOS icon-byte persistence, S4d-117 Text/Image render branch, and S4d-118 SwiftUI icon `PhotosPicker` -> `setIconFromBytes` UI. A user can pick a source photo, pick an icon, render, save, and share on iOS; real PHPicker grid-cell automation remains the known S4d-57 toolchain limitation. This is release-migration functionality, **not** final Android v2.10.0 1:1 UI/UX parity. `enableBounds` remains deferred debug overlay work.
2121
- **Renderer sizing + config-default single-sourcing (S4d-181/182/184/186, accepted 2026-06-28)**: image-space text sizing single-sourced to commonMain `WatermarkGeometry.REF_WIDTH`/`fontPx` (Android `PainKtx`, Desktop, iOS), the icon scale to `WatermarkCellComposer.ICON_SCALE_REFERENCE_TEXT_SIZE`, and the `WaterMarkRepository` read default fallbacks to `WaterMark.default` — all byte-identical, no golden rebaseline. Android text/icon production raster/draw stays native; the dead Android renderer `REF_WIDTH` const was deleted in S4d-188. S4d-185 selected the config slice and S4d-187 closed out the docs. Behavior-preserving migration cleanup, **not** 1:1 parity.

0 commit comments

Comments
 (0)