Skip to content

refactor: simplify session ownership and output preferences - #437

Merged
rosuH merged 2 commits into
masterfrom
codex/simplify-state-ownership
Oct 2, 2026
Merged

rosuH merged 2 commits into
masterfrom
codex/simplify-state-ownership

Conversation

@rosuH

@rosuH rosuH commented Oct 2, 2026 •

Copy link
Copy Markdown
Owner

Session already owns the editor image list, selection, offsets and export state, but WaterMarkRepository kept a second copy and fed it back through reducer effects. Remove that mirror and return Session snapshots directly, preserving selection/export ordering and offset CAS behavior.

Also remove the unused PreviewPaintPolicy and iOS cache-hit stub. Output controls now update only the edited preference through existing repository methods, so changing format cannot overwrite quality with a stale UI value. Android still invalidates old export results on either edit. CONTEXT and ADRs 0017/0030 describe the resulting ownership.

Validation:

  • Independent review found no blocking code issue. Regression coverage checks immediate export after selection, accepted/rejected selection publication, offset identity and independent output preference writes.
  • Earlier local workspace runs passed Android build/unit tests, Desktop tests, iOS simulator tests, Desktop headless export and Android instrumentation (14 passed, one opt-in test skipped). An Android emulator walk verified two-photo selection, filmstrip switching, JPEG/PNG quality retention and 2/2 successful exports.
  • On isolated PR commit 32a1e779, Android assembleDebug passed; Android unit tests 117/117, Desktop tests 502/502 and iOS simulator tests 451/451 passed. Desktop application headless text/icon exports and template roundtrip also passed. Final-head CI on f35ed9f9 passed Android/Desktop checks, iOS simulator tests plus app build, and license compliance. The follow-up only corrects historical interface references in CONTEXT; product code is identical to the locally tested commit.

Validation limits: the local, uncommitted testmap harness is outside this PR. Its two attempted Android replays diverged on an absent filmstrip selector and Chinese text on an English screen; the full repeat batch, human Confirm, iOS app XCUITest and physical-device verification remain incomplete. The local verify report records these gaps; this PR does not claim full e2e acceptance. The owner explicitly requested creation and merge after these limits were reported.

Unrelated working-tree changes and the uncommitted test harness are excluded. The Android instrumentation package assertion now uses BuildConfig.APPLICATION_ID so it checks the installed debug package.

Copilot AI balanced review requested due to automatic review settings October 2, 2026 15:07
@chatgpt-codex-connector

Copy link
Copy Markdown

You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard.
To continue using code reviews, add credits to your account and enable them for code reviews in your settings.

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot review overview

🟡 Changes recommended

docs/CONTEXT.md still contains canonical rows describing APIs and constructor wiring deleted by this PR.

Review effort: Balanced
Findings: 1 Low severity

Open (1)
What changed in this PR

Simplifies session ownership by removing transient image mirrors from WaterMarkRepository and making output preference writes independent.

Changes:

  • Makes Session authoritative for selection, offsets, and export state.
  • Writes format and quality independently to prevent stale-value overwrites.
  • Removes obsolete preview/output helpers and updates regression coverage and architecture docs.
File Description
shared/​src/​iosTest/​kotlin/​me/​rosuh/​easywatermark/​ui/​IosSourceOwnershipTransactionTest.kt Updates repository construction.
shared/​src/​iosTest/​kotlin/​me/​rosuh/​easywatermark/​ui/​IosProgressiveAdoptionTest.kt Tests stale callbacks after deletion.
shared/​src/​iosTest/​kotlin/​me/​rosuh/​easywatermark/​ui/​IosProductRootHostPreviewIdentityTest.kt Updates repository construction.
shared/​src/​iosTest/​kotlin/​me/​rosuh/​easywatermark/​ui/​IosProductRootDisposeTest.kt Updates repository construction.
shared/​src/​iosTest/​kotlin/​me/​rosuh/​easywatermark/​ui/​IosPhotoKitNeighborCacheTest.kt Updates repository construction.
shared/​src/​iosTest/​kotlin/​me/​rosuh/​easywatermark/​ui/​IosLibraryReadUpsellTest.kt Updates repository construction.
shared/​src/​iosTest/​kotlin/​me/​rosuh/​easywatermark/​ui/​IosH2CacheBudgetHostTest.kt Updates repository construction.
shared/​src/​iosTest/​kotlin/​me/​rosuh/​easywatermark/​ui/​IosFiftyImageSessionLatencyTest.kt Updates repository construction.
shared/​src/​iosTest/​kotlin/​me/​rosuh/​easywatermark/​session/​IosSourceStagingIdentityTest.kt Updates repository construction.
shared/​src/​iosTest/​kotlin/​me/​rosuh/​easywatermark/​session/​IosReadySelectionTransactionTest.kt Updates repository construction.
shared/​src/​iosTest/​kotlin/​me/​rosuh/​easywatermark/​session/​IosPickGenerationPublishBoundaryTest.kt Verifies Session-only publication boundaries.
shared/​src/​iosTest/​kotlin/​me/​rosuh/​easywatermark/​session/​IosG4StagingMemoryTest.kt Updates repository construction.
shared/​src/​iosTest/​kotlin/​me/​rosuh/​easywatermark/​data/​repo/​IosWatermarkConfigBridgeTest.kt Updates repository construction.
shared/​src/​iosMain/​kotlin/​me/​rosuh/​easywatermark/​ui/​IosProductRootHost.kt Uses field-specific preference writes and removes cache stub.
shared/​src/​iosMain/​kotlin/​me/​rosuh/​easywatermark/​session/​IosAppServices.kt Updates repository construction.
shared/​src/​iosMain/​kotlin/​me/​rosuh/​easywatermark/​data/​repo/​IosWatermarkConfigBridge.kt Updates repository construction.
shared/​src/​desktopTest/​kotlin/​me/​rosuh/​easywatermark/​ui/​FiftyImageFilmstripSwitchDiagnosisTest.kt Removes obsolete stub assertion.
shared/​src/​desktopTest/​kotlin/​me/​rosuh/​easywatermark/​session/​TypedExportSessionTest.kt Updates repository construction.
shared/​src/​desktopTest/​kotlin/​me/​rosuh/​easywatermark/​session/​SessionOffsetIdentityTest.kt Documents Session offset ownership.
shared/​src/​desktopTest/​kotlin/​me/​rosuh/​easywatermark/​session/​OffsetExportOrderingTest.kt Expands selection and export ordering coverage.
shared/​src/​desktopTest/​kotlin/​me/​rosuh/​easywatermark/​session/​G3LifecycleFaultMatrixTest.kt Updates repository construction.
shared/​src/​desktopTest/​kotlin/​me/​rosuh/​easywatermark/​session/​ExportCancellationSessionTest.kt Updates repository construction.
shared/​src/​desktopTest/​kotlin/​me/​rosuh/​easywatermark/​session/​DesktopImportExportSemanticsTest.kt Updates repository construction.
shared/​src/​desktopTest/​kotlin/​me/​rosuh/​easywatermark/​session/​DesktopCloseBackPolicyTest.kt Updates repository construction.
shared/​src/​desktopTest/​kotlin/​me/​rosuh/​easywatermark/​data/​datastore/​UserConfigDataStoreRoundtripTest.kt Tests independent preference writes.
shared/​src/​desktopTest/​kotlin/​me/​rosuh/​easywatermark/​data/​datastore/​DesktopWaterMarkStoreRoundtripTest.kt Updates repository construction.
shared/​src/​commonTest/​kotlin/​me/​rosuh/​easywatermark/​session/​WatermarkSessionViewModelTest.kt Adapts to direct reducer snapshots.
shared/​src/​commonTest/​kotlin/​me/​rosuh/​easywatermark/​session/​SessionReducerTest.kt Tests direct Session transitions.
shared/​src/​commonTest/​kotlin/​me/​rosuh/​easywatermark/​render/​PreviewPaintPolicyTest.kt Removes obsolete policy tests.
shared/​src/​commonMain/​kotlin/​me/​rosuh/​easywatermark/​session/​WatermarkSessionViewModel.kt Removes repository mirroring and effects.
shared/​src/​commonMain/​kotlin/​me/​rosuh/​easywatermark/​session/​SessionReducer.kt Returns Session snapshots directly.
shared/​src/​commonMain/​kotlin/​me/​rosuh/​easywatermark/​session/​AppIntent.kt Removes repository-selection synchronization intent.
shared/​src/​commonMain/​kotlin/​me/​rosuh/​easywatermark/​render/​PreviewPaintPolicy.kt Deletes unused preview policy.
shared/​src/​commonMain/​kotlin/​me/​rosuh/​easywatermark/​domain/​OutputPrefsEditor.kt Deletes pair-write preference wrapper.
shared/​src/​commonMain/​kotlin/​me/​rosuh/​easywatermark/​data/​repo/​WaterMarkRepository.kt Removes transient image state and APIs.
docs/​CONTEXT.md Documents ownership and preference behavior.
docs/​adr/​0030-cross-platform-preview-working-set.md Records preview policy removal.
docs/​adr/​0017-shared-session-viewmodel-cmp-first.md Records Session ownership decision.
desktopApp/​src/​main/​kotlin/​me/​rosuh/​easywatermark/​desktop/​DesktopWindow.kt Writes output preferences independently.
desktopApp/​src/​main/​kotlin/​me/​rosuh/​easywatermark/​desktop/​DesktopWatermarkFlow.kt Updates repository construction.
app/​src/​test/​java/​me/​rosuh/​easywatermark/​platform/​AndroidShareInDirectUriBehaviorTest.kt Updates repository construction.
app/​src/​main/​java/​me/​rosuh/​easywatermark/​ui/​MainViewModel.kt Splits format and quality updates.
app/​src/​main/​java/​me/​rosuh/​easywatermark/​ui/​MainActivity.kt Calls field-specific output methods.
app/​src/​main/​java/​me/​rosuh/​easywatermark/​di/​RepositoryModule.kt Removes obsolete logging dependency.
app/​src/​androidTest/​java/​me/​rosuh/​easywatermark/​ExampleInstrumentedTest.kt Uses the variant application ID.

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment thread docs/CONTEXT.md
@rosuH
rosuH merged commit 19391c2 into master Oct 2, 2026
4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants