Skip to content
Open
Show file tree
Hide file tree
Changes from 6 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions .silo-translations
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
platform=android
version=2026.11.23-73e6a54
sha256=86e06e01b86d10bf79d824a9cd2c5307fbee294857b81bd655246f4ce6b86498
version=local-ec136c7f8672
sha256=-
2 changes: 1 addition & 1 deletion android-shared/silo-locales.properties
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Generated by silo-translations 2026.11.23-73e6a54 from catalog/*.arb; do not edit.
# Generated by silo-translations local-ec136c7f8672 from catalog/*.arb; do not edit.
# Resource qualifiers per app, for androidResources.localeFilters.
phone=en,es,de,fr,pt-rBR,nl,it,pl,tr,sv,da,nb,fi,cs,hr,ru,uk,ja,ko,b+zh+Hans,b+zh+Hant,ar,hu,ro,sk,sl,bg,el,ca,lt,lv,et,vi,pt-rPT,in,ms,iw,hi,th
tv=en,es,de,fr,pt-rBR,nl,it,pl,tr,sv,da,nb,fi,cs,hr,ru,uk,ja,ko,b+zh+Hans,b+zh+Hant,ar,hu,ro,sk,sl,bg,el,ca,lt,lv,et,vi,pt-rPT,in,ms,iw,hi,th
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
package org.siloserver.silo.common.catalog

import androidx.compose.runtime.Composable
import androidx.compose.ui.res.stringResource
import org.siloserver.silo.common.R
import org.siloserver.silo.common.i18n.LocaleFormat
import org.siloserver.silo.common.i18n.currentNumberLocale
import org.siloserver.silo.model.catalog.BrowseItem

/** A Settings → Not Interested row's caption: "2004 · Movie", or the kind alone without a year. */
@Composable
fun BrowseItem.notInterestedCaption(): String = listOfNotNull(
year.takeIf { it > 0 }?.let { LocaleFormat.integer(it, currentNumberLocale()) },
stringResource(if (type == "series") R.string.settings_notInterested_series else R.string.settings_notInterested_movie),
).joinToString(" · ")
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import org.siloserver.silo.common.data.db.entity.DirtyOperationEntity
import org.siloserver.silo.network.ApiResult
import org.siloserver.silo.network.AuthScopeSnapshot
import org.siloserver.silo.network.TokenManager
import org.siloserver.silo.network.map
import org.siloserver.silo.network.apiv2.MembershipV2Api

/**
Expand All @@ -24,7 +25,7 @@ class MembershipOutbox(
private val processOwner: String,
) {
data class Authority(val key: String, val scope: AuthScopeSnapshot)
enum class ListKind { FAVORITE, WATCHLIST }
enum class ListKind { FAVORITE, WATCHLIST, NOT_INTERESTED }
enum class Resolution { ACKNOWLEDGED, RECONCILED, NEEDS_RECONCILIATION, PAUSED, NOT_CLAIMED }
data class Result(val resolution: Resolution, val mayPublish: Boolean = false)

Expand Down Expand Up @@ -66,6 +67,8 @@ class MembershipOutbox(
else api.removeFavorite(command.targetContentId, authority.scope)
"MEMBERSHIP_WATCHLIST" -> if (present) api.addToWatchlist(command.targetContentId, authority.scope)
else api.removeFromWatchlist(command.targetContentId, authority.scope)
"MEMBERSHIP_NOT_INTERESTED" -> if (present) api.markNotInterested(command.targetContentId, authority.scope)
else api.clearNotInterested(command.targetContentId, authority.scope)

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

kody code-review Kody Rules high

Definite not-interested clear refusals are treated as unknown outcomes

A definite 4xx refusal from clearNotInterested is sent to reconciliation and can remain unresolved if the follow-up read fails. Surface definite refusals directly while continuing to reconcile ambiguous network and 5xx outcomes.

Also found in:

  • android-shared/src/androidMain/kotlin/org/siloserver/silo/common/data/sync/MembershipOutbox.kt:70-70

Kody rule violation: Reconcile ambiguous mutation outcomes without replaying them

Prompt for LLM
File android-shared/src/androidMain/kotlin/org/siloserver/silo/common/data/sync/MembershipOutbox.kt, line 71:

Definite not-interested clear refusals are treated as unknown outcomes

Handle a definite 4xx refusal from this mutation separately from an ambiguous network or 5xx outcome. The shared response handling currently sends every non-success into reconciliation, so a refused clear is not reported directly and can remain unresolved if the follow-up read fails. Extend the result and response handling to surface definite refusals while reconciling unknown outcomes.

**Also found in:**
- `android-shared/src/androidMain/kotlin/org/siloserver/silo/common/data/sync/MembershipOutbox.kt:70-70`

Kody rule violation: [Reconcile ambiguous mutation outcomes without replaying them](https://kodus.siloserver.org/settings/code-review/1247142403/kody-rules/12d2fb1e-2010-487a-b35d-d4feb93e724b?teamId=ba9922fc-c0ea-4cf8-87bb-9d4f42ffc73e)

Talk to Kody by mentioning @kody

Was this suggestion helpful? React with 👍 or 👎 to help Kody learn from this interaction.

​

​

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Not changed: this is the outbox's rule for every membership kind. Favorites and Watchlist send a 4xx to reconciliation the same way on main, and docs/membership-api-v2.md documents it (single attempt, then a read). Not interested only joins that path.

🤖 Claude Code (claude-opus-5-5)

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Thanks for the clarification. Since the existing membership contract explicitly specifies a single mutation attempt followed by reconciliation, and this change applies that same behavior to Not Interested, I would not require a separate 4xx handling change in this PR.

The possibility of an unresolved outcome if the follow-up read fails is a broader outbox concern, not a regression introduced by this change.

else -> error("Invalid membership operation")
}
if (response is ApiResult.Success) {
Expand All @@ -91,14 +94,15 @@ class MembershipOutbox(
command.profileId != authority.scope.profileId.orEmpty() || command.state !in listOf(RECONCILE, PAUSED) ||
authority.scope != tokens.snapshotCurrentScope()) return Result(Resolution.NOT_CLAIMED)
val claim = command.membershipClaim ?: return Result(Resolution.NOT_CLAIMED)
val response = when (command.opKind) {
"MEMBERSHIP_FAVORITE" -> api.favorite(command.targetContentId, authority.scope)
"MEMBERSHIP_WATCHLIST" -> api.watchlist(command.targetContentId, authority.scope)
val response: ApiResult<Boolean> = when (command.opKind) {
"MEMBERSHIP_FAVORITE" -> api.favorite(command.targetContentId, authority.scope).map { it != null }
"MEMBERSHIP_WATCHLIST" -> api.watchlist(command.targetContentId, authority.scope).map { it != null }
"MEMBERSHIP_NOT_INTERESTED" -> api.notInterested(command.targetContentId, authority.scope).map { it != null }
else -> return Result(Resolution.PAUSED)
}
if (authority.scope != tokens.snapshotCurrentScope()) return Result(Resolution.NEEDS_RECONCILIATION)
if (response !is ApiResult.Success) return Result(Resolution.NEEDS_RECONCILIATION)
if ((response.data != null) == command.payloadJson.toBooleanStrict()) {
if (response.data == command.payloadJson.toBooleanStrict()) {
val removed = dao.resolveMembership(id, claim, authority.key, command.state) == 1
// Observed state is not an acknowledgement that mutation side effects were replayed.
return Result(if (removed) Resolution.RECONCILED else Resolution.NOT_CLAIMED)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,10 +54,13 @@ class RoomMembershipPort(

override suspend fun read(authority: DurableLoginAuthority, itemId: String, kind: MembershipPort.Kind): ApiResult<Boolean> {
if (authority != runtime.captureAuthority()) return ApiResult.Error(0, "identity_changed", "The viewer changed")
val result = if (kind == MembershipPort.Kind.FAVORITE) api.favorite(itemId, authority.scope)
else api.watchlist(itemId, authority.scope)
val result = when (kind) {
MembershipPort.Kind.FAVORITE -> api.favorite(itemId, authority.scope).map { it != null }
MembershipPort.Kind.WATCHLIST -> api.watchlist(itemId, authority.scope).map { it != null }
MembershipPort.Kind.NOT_INTERESTED -> api.notInterested(itemId, authority.scope).map { it != null }
}
if (authority != runtime.captureAuthority()) return ApiResult.Error(0, "identity_changed", "The viewer changed")
return result.map { it != null }
return result
}

override suspend fun pending(authority: DurableLoginAuthority, limit: Int): List<MembershipPort.Command> {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ import org.siloserver.silo.common.R
import org.siloserver.silo.repository.MembershipActions
import org.siloserver.silo.repository.port.MembershipPort

/** What a Favorites or Watchlist change that didn't land tells the viewer; each app draws it as its own dialog. */
/** What a Favorites, Watchlist or Not Interested change that didn't land tells the viewer; each app draws it as its own dialog. */
data class MembershipNotice(
val title: String,
val message: String,
Expand Down Expand Up @@ -89,18 +89,20 @@ private fun unconfirmedNotice(
onDismiss: () -> Unit,
onAction: () -> Unit,
): MembershipNotice {
val favorite = action.intent.key.kind == MembershipPort.Kind.FAVORITE
val kind = action.intent.key.kind
val adding = action.intent.present
val recorded = action.command != null
if (action.completion?.disposition == MembershipPort.Disposition.PAUSED) {
return MembershipNotice(
title = stringResource(R.string.shell_membership_notSaved_title),
message = stringResource(
when {
favorite && adding -> R.string.shell_membership_notSaved_addFavorite
favorite -> R.string.shell_membership_notSaved_removeFavorite
adding -> R.string.shell_membership_notSaved_addWatchlist
else -> R.string.shell_membership_notSaved_removeWatchlist
when (kind) {
MembershipPort.Kind.FAVORITE -> if (adding) R.string.shell_membership_notSaved_addFavorite
else R.string.shell_membership_notSaved_removeFavorite
MembershipPort.Kind.WATCHLIST -> if (adding) R.string.shell_membership_notSaved_addWatchlist
else R.string.shell_membership_notSaved_removeWatchlist
MembershipPort.Kind.NOT_INTERESTED -> if (adding) R.string.shell_membership_notSaved_markNotInterested
else R.string.shell_membership_notSaved_clearNotInterested
},
),
actionLabel = stringResource(R.string.shell_membership_checkStatus),
Expand All @@ -109,11 +111,13 @@ private fun unconfirmedNotice(
)
}
val unconfirmed = stringResource(
when {
favorite && adding -> R.string.shell_membership_notConfirmed_addFavorite
favorite -> R.string.shell_membership_notConfirmed_removeFavorite
adding -> R.string.shell_membership_notConfirmed_addWatchlist
else -> R.string.shell_membership_notConfirmed_removeWatchlist
when (kind) {
MembershipPort.Kind.FAVORITE -> if (adding) R.string.shell_membership_notConfirmed_addFavorite
else R.string.shell_membership_notConfirmed_removeFavorite
MembershipPort.Kind.WATCHLIST -> if (adding) R.string.shell_membership_notConfirmed_addWatchlist
else R.string.shell_membership_notConfirmed_removeWatchlist
MembershipPort.Kind.NOT_INTERESTED -> if (adding) R.string.shell_membership_notConfirmed_markNotInterested
else R.string.shell_membership_notConfirmed_clearNotInterested
},
)
val next = stringResource(
Expand Down
Loading
Loading