wordpress-mobile / wordpress-mobile/WordPress-Android

Remove the sync_publishing feature flag and dead code behind it

Open
#22,777 2 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

[Type] Tech Debt
Dominant language
Kotlin
Stars
3.2k
Forks
1.4k
Avg merge
1d 11h
Merged PRs (30d)
69

Description

Summary

The sync_publishing feature flag (backing PostConflictResolutionFeatureConfig) is hardcoded to false in build.gradle and has never been enabled. All code gated behind it is dead code. We should remove the flag and clean up all associated code paths.

What the flag gates

The flag controls a post conflict resolution system that detects when a post has been edited on another device and presents UI to resolve the conflict. When disabled (current state), all conflict checks are skipped (shouldSkipConflictResolutionCheck = true) and legacy dialogs are shown instead of the newer overlay UI.

Key behaviors gated behind the flag
  1. Post/Page conflict resolution overlay — A Compose-based bottom sheet (PostResolutionOverlayFragment) that lets users choose between a local or remote version of a conflicted post/page
  2. Post freshness checking in the editor — On opening a post in EditPostActivity / GutenbergKitActivity, checks if a newer remote version exists and shows an "Updating Post" UI
  3. if_not_modified_since header on push — Sends a last-modified timestamp when pushing posts so the backend can return a 409 on conflict (via PostConflictResolutionFeatureUtils.getRemotePostPayloadForPush)
  4. Conflict detection on edit — In PagesViewModel.checkAndEdit(), checks for unhandled conflicts before opening the editor

Files to modify or remove

Files to delete entirely
  • WordPress/src/main/java/org/wordpress/android/util/config/PostConflictResolutionFeatureConfig.kt
  • WordPress/src/main/java/org/wordpress/android/ui/posts/PostConflictResolutionFeatureUtils.kt
  • WordPress/src/main/java/org/wordpress/android/ui/posts/PostResolutionOverlay.kt
  • WordPress/src/main/java/org/wordpress/android/ui/posts/PostResolutionOverlayAnalyticsTracker.kt
  • WordPress/src/main/java/org/wordpress/android/ui/posts/PostResolutionOverlayFragment.kt
  • WordPress/src/main/java/org/wordpress/android/ui/posts/PostResolutionOverlayListener.kt
  • WordPress/src/main/java/org/wordpress/android/ui/posts/PostResolutionOverlayUiState.kt
  • WordPress/src/main/java/org/wordpress/android/ui/posts/PostResolutionOverlayViewModel.kt
  • WordPress/src/main/java/org/wordpress/android/ui/posts/PostConflictResolver.kt
  • WordPress/src/main/java/org/wordpress/android/viewmodel/pages/PageConflictResolver.kt
  • WordPress/src/test/java/org/wordpress/android/ui/posts/PostConflictResolutionFeatureUtilsTest.kt
  • WordPress/src/test/java/org/wordpress/android/ui/posts/PostResolutionOverlayAnalyticsTrackerTest.kt
  • WordPress/src/test/java/org/wordpress/android/ui/posts/PostResolutionOverlayViewModelTest.kt
  • WordPress/src/test/java/org/wordpress/android/ui/posts/PostConflictResolverTest.kt
Files to modify (remove flag references and simplify)
  • WordPress/build.gradle — Remove the SYNC_PUBLISHING buildConfigField
  • WordPress/src/main/java/org/wordpress/android/ui/posts/PostListDialogHelper.kt — Remove flag-gated branches; keep only the else (disabled) paths
  • WordPress/src/main/java/org/wordpress/android/viewmodel/pages/PageListDialogHelper.kt — Same as above
  • WordPress/src/main/java/org/wordpress/android/ui/posts/PostListMainViewModel.kt — Remove PostConflictResolutionFeatureUtils injection and _conflictResolutionAction
  • WordPress/src/main/java/org/wordpress/android/viewmodel/pages/PagesViewModel.kt — Remove PostConflictResolutionFeatureUtils injection and conflict check in checkAndEdit()
  • WordPress/src/main/java/org/wordpress/android/ui/posts/editor/StorePostViewModel.kt — Remove PostConflictResolutionFeatureConfig injection and checkIfUpdatedPostVersionExists()/handlePostRefreshedIfNeeded() gated logic
  • WordPress/src/main/java/org/wordpress/android/ui/posts/EditPostActivity.kt — Remove PostConflictResolutionFeatureConfig injection and freshness-check observers
  • WordPress/src/main/java/org/wordpress/android/ui/posts/GutenbergKitActivity.kt — Same as EditPostActivity
  • WordPress/src/main/java/org/wordpress/android/ui/uploads/PostUploadHandler.java — Remove PostConflictResolutionFeatureUtils; always set shouldSkipConflictResolutionCheck = true
  • WordPress/src/main/java/org/wordpress/android/ui/posts/PostActionHandler.kt — Remove PostConflictResolutionFeatureUtils injection; simplify payload construction
  • WordPress/src/test/java/org/wordpress/android/viewmodel/pages/PagesViewModelTest.kt — Remove mock/references
  • WordPress/src/test/java/org/wordpress/android/ui/posts/editor/StorePostViewModelTest.kt — Remove mock/references
  • WordPress/src/test/java/org/wordpress/android/ui/posts/PostListMainViewModelTest.kt — Remove mock/references
  • WordPress/src/test/java/org/wordpress/android/ui/posts/PostListMainViewModelCopyPostTest.kt — Remove mock/references
FluxC files to review
  • libs/fluxc/src/main/java/org/wordpress/android/fluxc/store/PostStore.java — Check if shouldSkipConflictResolutionCheck / lastModifiedForConflictResolution on RemotePostPayload can be simplified
  • libs/fluxc/src/main/java/org/wordpress/android/fluxc/network/rest/wpcom/post/PostRestClient.java — Same
  • libs/fluxc/src/main/java/org/wordpress/android/fluxc/network/xmlrpc/post/PostXMLRPCClient.java — Same

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with WordPress/build.gradle and the listed WordPress UI, view-model, upload, and editor files; trace references to sync_publishing and the conflict-resolution classes. Remove the flag-gated code and listed dead files, update the named tests, then review the FluxC PostStore and client files for remaining conflict fields. Done means no obsolete flag or conflict-resolution references remain and the affected tests pass.

Written by the indexing model from the issue text.

Assessment

Tech stack
android, java, kotlin
Domain
build-system, mobile
Issue type
Refactor
Difficulty
4/5
Estimated time
3-5 days
Activity status
Quiet
Clarity
Clearly specified
Newbie friendliness
48/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.