Repository navigation
tests: port carbon classification and settle waits from Python carbon… - #555
Merged
Merged
Conversation
vitalyster
force-pushed
the
carbon-test-review
branch
7 times, most recently
from
October 15, 2026 12:53
453defc to
f0857a7
Compare
An incoming legacy message goes to the resource that replied last, or to the highest-priority resource before any resource has replied. In server mode the transport also copies the message to every other resource as a XEP-0280 <received> carbon. In gateway mode the XMPP server makes those copies itself, because the message passes through it. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01ALrWqtcsbL3cuX4sC5yrmS
In gateway mode a carbon of a message the account sent from another legacy client must come from the user's bare JID, which a component cannot send from. The transport asks the server to send it through a XEP-0356 <privilege> wrapper, but always used urn:xmpp:privilege:1. Prosody's mod_privilege only accepts urn:xmpp:privilege:2, so those carbons were dropped and never reached the user's XMPP clients. Parse both namespaces, remember the one the server announces its permissions in, and send the wrapper in it. Until the announcement arrives, use urn:xmpp:privilege:2. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01ALrWqtcsbL3cuX4sC5yrmS
A message the account sent from another legacy client was forwarded in its <sent> carbon as coming from the last-replied resource, or from a made-up "bot" resource when there was none. No XMPP resource sent it, so use the user's bare JID instead. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01ALrWqtcsbL3cuX4sC5yrmS
ForwardIQHandler is added after Swift's internal handlers, so it saw the replies to the backend's own requests (disco, caps) first and relayed them to the transport. The transport sent them on as IQ errors without a recipient; Prosody rejected the stanza, raised an error in its component handler and dropped the stream, so every stanza after it was lost, including the carbon copies. Relay only replies to IQs the backend sent on behalf of the user. In gateway mode, also make the transport drop backend IQs without a valid recipient. In server mode an IQ without 'to' is a valid server-directed IQ and is left alone.
vitalyster
force-pushed
the
carbon-test-review
branch
from
October 15, 2026 12:55
f0857a7 to
843255b
Compare
Server mode: a legacy message goes only to the last-replied resource and every other resource gets exactly one <received> carbon. Gateway mode: run the transport as a Prosody component with the swiften backend logged in as responder@localhost/Spectrum, with three XMPP resources of the same user. Check the same rules and that the copies follow the last-replied resource when another resource replies. Then send the transport a message the account sent from another legacy client (carbon=true) and check that every resource gets exactly one <sent> carbon from the user's bare JID through the XEP-0356 privilege wrapper, and that the legacy contact does not get it again. Prosody enables mod_privilege for the transport, and the test data gets an offline storage directory. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01ALrWqtcsbL3cuX4sC5yrmS
Start Prosody with tests/libpurple_jabber/prosody.cfg.lua instead of the Slack test config, because it defines the gateway component and its XEP-0356 privileges. Make the mounted test data writable for the container user, so Prosody can write its offline storage. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01ALrWqtcsbL3cuX4sC5yrmS
vitalyster
force-pushed
the
carbon-test-review
branch
from
October 15, 2026 13:16
843255b to
90e11f0
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.
…s test
Classify carbons by kind, sender and body as carbons.py did, fail on unexpected carbons or plain messages, and wait for a settle period before exact counts so late duplicates are caught. Responder count and gateway-mode carbons are not covered yet.