feat(federation): Matrix spec compliance improvements with Complement diagnostics#10
Merged
EdGeraghty merged 2 commits intocomplement/homerunner-portbindingfrom Oct 30, 2025
Merged
Conversation
Copilot
AI
changed the title
[WIP] Add diagnostics for homerunner port binding
chore(complement): diagnostic analysis for homerunner port binding issue
Oct 30, 2025
Owner
|
@copilot you're correct that there are code sections in here for test compliance. Please update the pr description to accurately reflect what this PR contains, include doing a full code review as I think there are also unit tests for the new behaviour? If there aren't unit tests, work out if the code changes are spec compliant and then write some. |
Co-authored-by: EdGeraghty <20861699+EdGeraghty@users.noreply.github.com>
Contributor
Author
Code review completed. The PR contains 4 Matrix spec-compliant changes with full test coverage:
All 15 new unit tests pass. PR description updated with complete details. Commit: abb59bb |
Copilot
AI
changed the title
chore(complement): diagnostic analysis for homerunner port binding issue
feat(federation): Matrix spec compliance improvements with Complement diagnostics
Oct 30, 2025
EdGeraghty
approved these changes
Oct 30, 2025
Copilot AI
added a commit
that referenced
this pull request
Oct 30, 2025
Co-authored-by: EdGeraghty <20861699+EdGeraghty@users.noreply.github.com>
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.
This PR contains Matrix Spec v1.16 compliance improvements for federation and client APIs, plus diagnostic artifacts for Complement testing.
Matrix Spec Compliance Changes
1. State Event Routes (Client API)
Files:
src/main/kotlin/routes/client-server/client/room/RoomRoutes.ktAdded support for optional
stateKeyparameter in state event endpoints:PUT /_matrix/client/v3/rooms/{roomId}/state/{eventType}/{stateKey?}- stateKey now optionalPUT /_matrix/client/v3/rooms/{roomId}/state/{eventType}- defaults stateKey to empty stringSpec Reference: Matrix Spec v1.16 Section 6.3.6.1 - State events can have empty state_key, represented by omitting the path segment or providing empty string.
2. Federation User Profile Query
Files:
src/main/kotlin/routes/server_server/federation/v1/FederationV1UserQuery.ktProfile query responses now always include
displaynameandavatar_urlkeys, even when null, ensuring consistent response format across federation.Spec Reference: Matrix Spec v1.16 Section 11.6.2.1 - Profile responses must include standard fields consistently.
3. Federation V2 Send Join Auth Chain
Files:
src/main/kotlin/routes/server_server/federation/v2/FederationV2Routes.ktSend join responses now include complete
auth_chainarray with all authorization events, enabling receiving servers to verify event authorization.Spec Reference: Matrix Spec v1.16 Section 11.3.2.1.4 - send_join must return auth_chain for event verification.
4. Get Missing Events Implementation
Files:
src/main/kotlin/routes/server_server/federation/v1/FederationV1Events.kt,FederationV1Utils.ktImplemented breadth-first search for missing events:
originandorigin_server_tsin response per specpdusarraySpec Reference: Matrix Spec v1.16 Section 11.5.2.1 - get_missing_events must return events between earliest and latest.
Test Coverage
All code changes are covered by unit tests:
StateEventRoutesTest.kt- 5 tests for state event route changesFederationProfileQueryTest.kt- 6 tests for federation profile query changesFederationV2AuthChainTest.kt- 3 tests for auth_chain implementationMissingEventsTest.kt- 1 test for get_missing_events implementationTotal: 15 unit tests, all passing
Complement Diagnostic Artifacts
Port Binding Analysis
The diagnostic log shows
HSPortBindingIP:127.0.0.1in Complement config. Docker containers resolvehost.docker.internalto the host's bridge IP (e.g.,192.168.65.254) but cannot reach ports bound to localhost only.Resolution: Run Complement with
HOMERUNNER_HS_PORTBINDING_IP=0.0.0.0to bind all interfaces.Diagnostic Files
complement-test-output.txt(964KB) - Captured Complement test run outputCOMPLEMENT_LOCAL_RUN.md- Instructions for running Complement tests locally on Windows/WSLDiagnostic Commands (PowerShell)
Verification
Shoutout to the FERRETCANNON massive for spec compliance! 🎆
✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.