Skip to content

Conversation

@rsb-tbg
Copy link
Contributor

@rsb-tbg rsb-tbg commented Nov 16, 2025

This PR adds support for AppserviceUserIdentity in appservice requests and introduces the SupportedPathBuilder trait to handle different PathBuilder types.

Changes:

  • Add SupportedPathBuilder trait for VersionHistory and SinglePath path builders
  • Update send_request_as to accept AppserviceUserIdentity instead of &UserId
  • Add send_customized_request_as function in lib.rs
  • Removed send_customized_matrix_request from HttpClientExt and send_customized_request method from Client
  • Add C::RequestBody: AsRef<[u8]> bounds required by ruma's try_into_http_request

Breaking changes documented in CHANGELOG.md.

@rsb-tbg rsb-tbg marked this pull request as ready for review November 18, 2025 03:23
Copilot AI review requested due to automatic review settings November 18, 2025 03:23
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR integrates AppserviceUserIdentity support for application service requests and introduces the SupportedPathBuilder trait to enable flexible handling of different path builder types (VersionHistory and SinglePath).

Key Changes:

  • Introduced SupportedPathBuilder trait to abstract path builder input handling across different PathBuilder implementations
  • Updated send_request_as to accept AppserviceUserIdentity instead of &UserId for better appservice support
  • Replaced manual query parameter manipulation with ruma's built-in try_into_http_request_with_identity method
  • Added C::RequestBody: AsRef<[u8]> bounds required by ruma's request conversion functions

Reviewed Changes

Copilot reviewed 5 out of 5 changed files in this pull request and generated 3 comments.

Show a summary per file
File Description
src/lib.rs Refactored request sending functions to use new authentication and path builder inputs; added send_customized_request_as for appservice requests
src/http_client.rs Updated HttpClientExt trait methods to accept path builder inputs and AppserviceUserIdentity; removed deprecated customization methods
src/client/builder.rs Added C::RequestBody: AsRef<[u8]> bounds and updated path builder input from &SupportedVersions to () for SinglePath compatibility
src/client.rs Introduced SupportedPathBuilder trait with implementations for VersionHistory and SinglePath; updated client methods with new bounds
CHANGELOG.md Documented breaking changes and improvements for this release

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@ruma ruma deleted a comment from Copilot AI Nov 18, 2025
@ruma ruma deleted a comment from Copilot AI Nov 18, 2025
@ruma ruma deleted a comment from Copilot AI Nov 18, 2025
Copy link
Contributor

@zecakeh zecakeh left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could we split this into 2 PRs? The first one just upgrades Ruma, and the second one integrates AppserviceUserIdentity.

@rsb-tbg
Copy link
Contributor Author

rsb-tbg commented Nov 18, 2025

Will do! I'll be offline for a couple weeks but will fix it up afterwards.

For the first PR, what version should I upgrade ruma to?

@zecakeh
Copy link
Contributor

zecakeh commented Nov 20, 2025

Since we had a new release of Ruma, I opened #19 to upgrade Ruma. You'll just need to rebase your AppserviceUserIdentity changes on top of it.

@rsb-tbg rsb-tbg force-pushed the integrate-appservice-user-identity branch 3 times, most recently from ced126a to 8acf4eb Compare November 29, 2025 16:44
@rsb-tbg
Copy link
Contributor Author

rsb-tbg commented Nov 29, 2025

How's this look? Happy to modify, just let me know. All advice is welcomed 😄

Copy link
Contributor

@zecakeh zecakeh left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This looks better overall. Could you avoid unnecessary changes like renaming function arguments and lifetimes, to reduce the diff?

@rsb-tbg rsb-tbg force-pushed the integrate-appservice-user-identity branch from 5784a13 to 34d4459 Compare December 1, 2025 18:40
Copy link
Contributor

@zecakeh zecakeh left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks, I just have a couple of nits left.

@jplatte
Copy link
Member

jplatte commented Dec 2, 2025

@rsb-tbg hey, is this Copilot review thing something you enabled knowingly? Could you please disable it for your PRs to our project? We do not accept LLM contributions as per our contributing guide.

@rsb-tbg
Copy link
Contributor Author

rsb-tbg commented Dec 2, 2025

Hey @jplatte, no I didn't enable anything. I do see the comments from 2 weeks ago from copilot now that you mention it. I'll check my settings and see if I can disable whatever it is. Sorry about that.

@jplatte
Copy link
Member

jplatte commented Dec 2, 2025

No worries. I would assume you can disable it here.

@rsb-tbg
Copy link
Contributor Author

rsb-tbg commented Dec 2, 2025

Yup, already turned it off. I'll keep an eye on it for next time. Thanks

@zecakeh
Copy link
Contributor

zecakeh commented Dec 4, 2025

I am sorry to tell you this now, but I think that we could now make the diff even smaller by using AppserviceUserIdentity::maybe_add_to_uri() rather than OutgoingRequestAppserviceExt. We can just keep calling Client::send_customized_request() and replace the call to add_user_id_to_query with AppserviceUserIdentity::maybe_add_to_uri().

We just need to upgrade Ruma to the latest commit, and we will make another release before releasing this crate.

@rsb-tbg
Copy link
Contributor Author

rsb-tbg commented Dec 4, 2025

No apology necessary. Will check that out now

@rsb-tbg rsb-tbg force-pushed the integrate-appservice-user-identity branch from b9b5c22 to 5d42df1 Compare December 4, 2025 19:01
Copy link
Contributor

@zecakeh zecakeh left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You can bump ruma to a git revision for now, so that this PR can pass CI.

Copy link
Contributor

@zecakeh zecakeh left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks, this looks good now. To be able to use ruma as a git dependency for now, we need to relax the cargo-deny config.

You need to modify .deny.toml:

  • In the [bans] section, change
    wildcards = "warn"
    
  • In the [sources] section, add
    allow-git = [
        "https://github.com/ruma/ruma",
    ]
    

Copy link
Contributor

@zecakeh zecakeh left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks a lot!

@zecakeh zecakeh merged commit e5ecbb9 into ruma:main Dec 5, 2025
10 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

3 participants