Imlementation of AtUri proposal#37
Merged
rudyfraser merged 7 commits intoblacksky-algorithms:mainfrom Jan 21, 2025
Merged
Conversation
… place of strings
rudyfraser
reviewed
Jan 18, 2025
rudyfraser
requested changes
Jan 18, 2025
Member
rudyfraser
left a comment
There was a problem hiding this comment.
Left a comment about updating the get_backlink_conflicts function but everything else LGTM, thank you
rudyfraser
approved these changes
Jan 21, 2025
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.
closes #36
Overview
This PR implements the
TryFromtrait forAtUrito handle string-to-AtUri conversions. This addresses multiple TODOs throughout the codebase where string manipulation was being used instead of proper AtUri types.Changes
Files modified:
Implementation Details
The core change is implementing TryFrom for AtUri with three variants:
This allows for ergonomic conversion of strings to AtUri types using the
try_into()method, replacing manual string manipulation throughout the codebase, e.g.:Review Notes
Please review the
get_backlink_conflictsfunction inrsky-pds/src/repo/record/mod.rs- specifically the use offlat_map. I choseflat_mapsince we're dealing withOption<AtUri>, but I'm not 100% sure if this is the optimal approach vs usingmap. Would appreciate input here.TODO: AtUri validation still needs to be implemented. I plan to add validation logic that mirrors the TypeScript implementation found at: https://github.com/bluesky-social/atproto/blob/main/packages/syntax/src/aturi_validation.ts - I don't intend on implementing the validation in the branch unless you'd prefer it that way. It's already a fairly large PR ready to go.