Add unfollow to the mock repo and MockPDS#44
Merged
Conversation
The inverse of `follow`: `MockRepo.unfollow(did:)` removes every follow record whose subject matches, and `MockPDS.unfollow(did:from:)` delegates to it. Lets a test construct a "not followed" social-graph state — the anchor welcome route's silence-and-relay case — which was previously unreachable (the mocks had follow and block, but no way to undo a follow). MockAtmosphere parity lands in AtprotoOAuth. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
🦋 Changeset detectedLatest commit: 64e1d97 The changes in this PR will be included in the next version bump. This PR includes changesets to release 1 package
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
Both `getGraph` and the new `unfollow` decoded every record in a graph collection with `try`, so a single foreign or newer-schema record would abort the whole read / unfollow. Decode best-effort instead — skip a record that doesn't parse as its type rather than throwing on it — so one bad record can't strand the follows/blocks that do decode. Neither can fail now, so both drop `throws`. A test injects an un-decodable record alongside a real follow and checks getGraph still returns the good one and unfollow still removes it. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
The loop already iterated a snapshot (untypedRepo[collection] ?? [:] is evaluated once and copy-on-write isolates it from the in-loop deletes), but that relied on value semantics a reader had to infer. Name it. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.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.
Adds the inverse of
followto the mocks:MockRepo.unfollow(did:)removes every follow record whose subject matches, andMockPDS.unfollow(did:from:)delegates to it. The mocks hadfollowandblockbut no way to undo a follow, so a "not followed" social-graph state was unconstructible.Motivation: the germDM anchor welcome route silence-and-relays a not-followed peer (distinct from a blocked peer, which now drops). That not-followed path had no test because the harness couldn't produce the state.
MockAtmosphere.unfollowparity is added in AtprotoOAuth (depends on this release), and germDM re-pins to exercise it.Additive/mock-only;
AtprotoClientMocksbuilds clean. Changeset: minor.