fix: ToXML emits the <contact> endpoint attribute (INFR-207) - #142
Merged
Conversation
Event.ToXML() is a hand-written serializer; its <contact> block wrote only callsign and silently dropped endpoint, even though Contact.Endpoint was set. The TAK server keys its callsign->connection mapping off that endpoint, so a self-SA presence serialized without it (e.g. WithContact(Callsign:"NERVA", Endpoint:"*:-1:stcp") -> <contact callsign="NERVA"/>) never got a callsign assignment — inbound direct messages to that callsign were dropped at the server. This was the root cause of the "DMs to NERVA never arrive" bug (INFR-206; broadcasts worked because they ignore the callsign mapping). - ToXML: emit endpoint when non-empty, mirroring the callsign block. - roundtrip_test: TestContactEndpointRoundTrip guards it (endpoint appears in the XML AND survives a parse round-trip). - event_schema_error_test: add the missing `//go:build !novalidator` tag (it exercises the cgo-only validator init-error path; without the tag the package fails to compile under -tags novalidator). Pre-existing gap, fixed so the round-trip test is runnable without libxml2. Spot-audit of the other hand-written detail blocks: <group> (name, role) and <__chat> (id/message/sender/chatroom/groupOwner/senderCallsign/parent/ messageId/deleteChild/grps) are complete; other detail elements round-trip via the extension passthrough. The contact endpoint was the only dropped field. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Dependency Review✅ No vulnerabilities or license issues or OpenSSF Scorecard issues found.Scanned FilesNone |
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.
Hand-written ToXML block dropped the endpoint attribute (only wrote callsign), even when Contact.Endpoint was set. TAK server keys callsign->connection off endpoint, so DMs to that callsign were dropped at the server (root cause of INFR-206). Fix: emit endpoint when non-empty. Adds TestContactEndpointRoundTrip (endpoint in XML + survives round-trip) and a missing //go:build !novalidator tag on event_schema_error_test.go so the package builds under -tags novalidator. Validated: go test -tags novalidator -run RoundTrip passes. Consumers: takconnector has an interim vendored patch (revendor after merge); takmcp doesn't set endpoint (cosmetic).
🤖 Generated with Claude Code