dcd36234095a

fix: MN-7 feedback no longer fakes success when no endpoint configured — submit throws FeedbackUnavailableException, UI shows 'Feedback unavailable — endpoint not configured' (v2.2.3)

time
2026-06-09 18:47 UTC · 5 months ago
machine
koh2
agent
claude-opus-4-8
session
audit fixes feedback honesty
parent
1ba870491492
2 files app/src/main/java/com/peachpasswords/feedback/FeedbackRepository.kt+12 −10app/src/main/java/com/peachpasswords/ui/settings/SettingsViewModel.kt+2 −0
app/src/main/java/com/peachpasswords/feedback/FeedbackRepository.kt+12 −10
@@ -18,12 +18,14 @@1818  * `{ category, message, version, browser, source }`, POSTed as1919  * `application/json`.2020  *21- * As in the browser, [FEEDBACK_ENDPOINT] is empty by default: when unset the22- * submission is a no-op that reports success, so the UI flow works end-to-end23- * without a live backend. The orchestrator fills in the real URL once it exists24- * (see INTEGRATION.md). The `source` discriminator is `"peach-android"` here25- * (the browser sends `"peach-extension"`).21+ * MN-7: [FEEDBACK_ENDPOINT] is empty until a real backend exists. The browser22+ * returns ok:true (a silent no-op) in this case, but here we deliberately diverge23+ * and throw [FeedbackUnavailableException] so the UI tells the user feedback is24+ * unavailable rather than falsely reporting it was sent. The `source` discriminator25+ * is `"peach-android"` (the browser sends `"peach-extension"`).2626  */27+class FeedbackUnavailableException : Exception("feedback_endpoint_not_configured")28+2729 @Singleton2830 class FeedbackRepository @Inject constructor() {2931 @@ -32,8 +34,8 @@3234     suspend fun submit(type: String, message: String) {3335         if (message.isBlank()) throw IllegalArgumentException("message_empty")3436 35-        // No-op success when no endpoint is configured (matches browser behaviour).36-        if (FEEDBACK_ENDPOINT.isBlank()) return37+        // No endpoint → be honest, never fake a successful send (MN-7).38+        if (FEEDBACK_ENDPOINT.isBlank()) throw FeedbackUnavailableException()3739 3840         withContext(Dispatchers.IO) {3941             val payload = JSONObject().apply {@@ -55,9 +57,9 @@5557     }5658 5759     companion object {58-        // TODO(orchestrator): set to the real Peach feedback endpoint when it59-        // exists. The browser source ships this empty (FEEDBACK_ENDPOINT = "")60-        // and treats empty as a no-op success. Keep that contract.60+        // Set to the real Peach feedback endpoint when it exists (the browser source61+        // also ships this empty). While empty, submit() throws so the UI reports the62+        // feature as unavailable rather than silently pretending success (MN-7).6163         const val FEEDBACK_ENDPOINT: String = ""6264 6365         private val JSON = "application/json; charset=utf-8".toMediaType()

view file

app/src/main/java/com/peachpasswords/ui/settings/SettingsViewModel.kt+2 −0
@@ -60,6 +60,8 @@6060             _feedbackState.value = try {6161                 feedback.submit(type, message)6262                 FeedbackState.Sent63+            } catch (e: com.peachpasswords.feedback.FeedbackUnavailableException) {64+                FeedbackState.Error("Feedback unavailable — endpoint not configured")6365             } catch (e: Exception) {6466                 FeedbackState.Error("Couldn't send feedback — check your connection")6567             }

view file