refactor: replace local upstream protos with xmtpd imports#97
Merged
Conversation
ApprovabilityVerdict: Unable to determine Macroscope's correctness review was unable to post its findings for this PR. Approvability cannot proceed without a successful correctness review. You can customize Macroscope's approvability policy. Learn more. |
356f73e to
5aab47d
Compare
3 tasks
Collaborator
Author
This was referenced Apr 5, 2026
5aab47d to
9674141
Compare
8c776b6 to
70db0e2
Compare
9674141 to
7fe7faa
Compare
70db0e2 to
c7d7e68
Compare
7fe7faa to
c4452ec
Compare
mkysel
approved these changes
Apr 8, 2026
3 tasks
Collaborator
Author
…yaml Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
c4452ec to
bc82114
Compare
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.

Summary
04-01-implement_api_schema_changesbranch for notification API proto typesbuf.gen.yaml(keep Swift/Kotlin/Java)pkg/proto/(75 .pb.go files)github.com/xmtp/xmtpd/pkg/proto/instead of local pathspkg/proto/notifications/(our own service proto) remains locally generatedThis is a prerequisite for the V4 listener — importing
xmtpd/pkg/envelopescauses proto namespace conflicts with locally generated copies of the same types.Test plan
go build ./...cleango test -p 1 ./...— all 73 existing tests passpkg/proto/only containsnotifications/🤖 Generated with Claude Code
Note
Replace local upstream protos with xmtpd imports and migrate subscription topics to binary storage
message_api,migration) with imports fromgithub.com/xmtp/xmtpd, and updates topic parsing to use structuredtopic.Topicobjects from xmtpd throughout the codebase.subscriptions.topiccolumn fromTEXTtoBYTEA, storing raw topic bytes (kind + identifier) instead of strings; non-conforming and duplicate rows are deleted.Subscriptionsinterface and all implementations (Subscribe,Unsubscribe,GetSubscriptions) to accept and return*topic.Topicinstead of plain strings.topic_bytes/topics_bytesfields to the notifications v1 protobuf (Subscription,SubscribeRequest,UnsubscribeRequest) and normalizes API handlers to accept both string and binary topics, with bytes taking precedence and deduplication across both forms.📊 Macroscope summarized bc82114. 28 files reviewed, 3 issues evaluated, 3 issues filtered, 0 comments posted
🗂️ Filtered Issues
pkg/db/migrations/00004_binary_topics.down.sql — 0 comments posted, 1 evaluated, 1 filtered
topicdata. The migration adds an emptytopic_legacy TEXTcolumn (line 4), then immediately drops thetopicBYTEA column containing the actual data (line 5), then renames the empty column totopic(line 6). There is noUPDATEstatement to convert the BYTEA data back to TEXT format before dropping the BYTEA column. [ Posting failed ]pkg/db/migrations/migrations.go — 0 comments posted, 1 evaluated, 1 filtered
MigrateUpTois documented as running migrations "up to (and including) the given version", butm.Migrate(version)will migrate in either direction. If the database is currently at version 5 andMigrateUpTo(ctx, db, 3)is called, the code will migrate DOWN to version 3, contradicting the function's name and documentation which imply only upward migration. Consider using a check likem.Version()to verify current version and prevent downward migration, or rename/redocument the function to reflect bidirectional behavior. [ Posting failed ]pkg/xmtp/listener.go — 0 comments posted, 1 evaluated, 1 filtered
processEnvelopeat line 192,return errreturns the last error froml.deliverinstead ofnil. If the last iteration of thesendRequestsloop callsl.deliverand it fails,erris set to that error. But if the last iteration hits theshouldDeliverskip branch (thecontinue),errretains the error from a previous iteration's failedl.delivercall, causingprocessEnvelopeto return a stale error. Conversely, if the loop completes without enteringl.deliverat all (all requests skipped),errstill holds the value from thel.installations.GetInstallationscall (which wasnil), so that path is fine. The real bug: when the loop processes multiple requests and an earlierdeliverfails but a later one succeeds,erris overwritten tonil, silently swallowing the earlier delivery error. And when an earlierdeliverfails but later iterations are skipped viacontinue, the stale error is returned, potentially causing the caller to log a misleading error. The function should either accumulate errors or returnnilsince individual delivery errors are already logged. [ Out of scope ]