fix: prevent refresh_state cursor increment when commit log is disabled#3416
Open
xmtp-coder-agent wants to merge 2 commits intoxmtp:mainfrom
Open
fix: prevent refresh_state cursor increment when commit log is disabled#3416xmtp-coder-agent wants to merge 2 commits intoxmtp:mainfrom
xmtp-coder-agent wants to merge 2 commits intoxmtp:mainfrom
Conversation
Change publish_commit_log return type from Result<()> to Result<bool> so callers can distinguish a real publish (true) from a no-op (false). D14N returns false since commit log is not yet implemented, preventing the CommitLogWorker from incorrectly advancing the refresh_state cursor. Resolves xmtp#2983 Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #3416 +/- ##
==========================================
+ Coverage 83.06% 83.07% +0.01%
==========================================
Files 378 378
Lines 51829 51834 +5
==========================================
+ Hits 43050 43061 +11
+ Misses 8779 8773 -6 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Resolves #2983
Summary
publish_commit_logreturn type fromResult<()>toResult<bool>across theXmtpMlsClienttrait and all implementationsOk(false)(no-op), V3 returnsOk(true)(actually published)CommitLogWorker::publish_commit_logs_to_remoteonly updates therefresh_statecursor when the publish actually occurred (Ok(true))Problem
When using the D14N client,
publish_commit_logreturnsOk(())without actually publishing anything (commit log is not yet implemented for D14N). The caller treats this as success and increments theEntityKind::CommitLogUploadcursor inrefresh_state, even though no data was uploaded.Test plan
cargo checkpasses for all affected cratescargo clippypasses with no warningsrefresh_statefor entity kind 3🤖 Generated with Claude Code
Note
Prevent
refresh_statecursor increment when commit log publishing is disabledXmtpMlsClient::publish_commit_logtrait method to returnResult<bool>instead ofResult<()>, wherefalsesignals a no-op (e.g. commit log disabled) andtruesignals successful publication.Ok(false)with a debug log when commit log publishing is disabled.CommitLogWorker::publish_commit_logs_to_remotein commit_log.rs skips updating upload cursors when the API returnsfalse, preventing cursor advancement on no-op publishes.XmtpMlsClientimplementors must now handle a boolean return frompublish_commit_log; the v3 client returnsOk(true)on success.Macroscope summarized fc58d64.