Replace IReadOnlyDictionary with IEnumerable<KeyValuePair>#13
Merged
Conversation
There was a problem hiding this comment.
Pull request overview
This PR fixes an AT Protocol query-parameter serialization bug where endpoints requiring repeated query keys (e.g. app.bsky.feed.getPosts?uris=a&uris=b) previously failed due to Dictionary.Add collisions. It updates the public client API and the URL-building/generation pipeline to use an IEnumerable<KeyValuePair<string,string>> parameter model that can represent repeated keys.
Changes:
- Replaces
IReadOnlyDictionary<string, string>query-parameter plumbing withIEnumerable<KeyValuePair<string, string>>acrossIATProtoClientand HTTP URL building to support repeated query keys. - Updates the source generator to emit a sequence of
KeyValuePairentries (one per array item) instead of building a dictionary. - Adds unit tests for repeated-key query serialization and for the generator output; updates the AuthTest sample to demonstrate multi-URI
getPosts.
Reviewed changes
Copilot reviewed 10 out of 10 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
| tests/CarpaNet.UnitTests/Identity/IdentityResolverTests.cs | Updates mock client interface signatures to match the new query-parameter type. |
| tests/CarpaNet.UnitTests/Http/XrpcHttpHandlerTests.cs | Adds coverage ensuring repeated keys serialize as repeated query parameters. |
| tests/CarpaNet.UnitTests/Generation/ApiGeneratorTests.cs | Adds tests asserting generated parameter classes emit KeyValuePair sequences and avoid dictionaries for arrays. |
| src/CarpaNet/IATProtoClient.cs | Changes public interface GET/Subscribe parameter type to IEnumerable<KeyValuePair<string,string>>. |
| src/CarpaNet/Http/XrpcHttpHandler.cs | Updates URL building APIs to accept IEnumerable<KeyValuePair<...>> and emit repeated query params; adjusts repo-resolution lookup logic. |
| src/CarpaNet/ATProtoClient.cs | Propagates the new parameter type through the concrete client implementation. |
| src/CarpaNet.SourceGen/Generation/ApiGenerator.cs | Changes generated ToDictionary() implementation to return a sequence of KeyValuePair entries (supporting repeated keys). |
| src/CarpaNet.OAuth/ATProtoOAuthClient.cs | Updates OAuth client implementation signatures to match the new parameter type. |
| samples/AuthTest/Program.cs | Adds an interactive “Get posts by URIs” sample flow exercising repeated uris query parameters. |
| samples/AuthTest/AuthTest.csproj | Resolves the app.bsky.feed.getPosts lexicon for the new sample usage. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Mostafa-Ehab
added a commit
to Mostafa-Ehab/CarpaNet
that referenced
this pull request
May 24, 2026
Replace IReadOnlyDictionary with IEnumerable<KeyValuePair> (drasticactions#13)
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.
Fixes #12