Link Reconstruction#118
Merged
Merged
Conversation
Sterling and SmallDog embed the RescueGroups toolkit, so an individual pet's page is reachable via #action_0=pet&animalID_0=<id>, where the id is exactly the RescueGroups animal id we already store as pet_id. Add a domain->template registry (adoption_sources/pet_links.py) and apply it in SourceRescueGroups so those pets link straight to the animal instead of the org landing page. Includes unit tests and a manual verification workflow/script that finds a supported-shelter pet from the live API and posts it to the Bluesky test account. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
The repo has no BLUESKY_TEST_* secrets; use the live BLUESKY_HANDLE/PASSWORD (authorized). Gate the live post behind a [verify-post] commit marker so routine pushes to this branch don't publish. [verify-post] Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Lets us target specific shelter domains (deep-linkable or not) to see their posts live. MSPCA will show a non-pet-specific fallback link, as expected. [verify-post] Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
The RescueGroups toolkit needs the standalone sentinel petIndex_0=-1 or it can show the full list instead of the specific animal (SmallDog link was landing on the list). Apply to both rgtools shelters and update tests. Also add an --inspect mode to dump the full raw API record for a shelter domain, to check whether MSPCA's internal a##### id is exposed anywhere (it determines whether MSPCA deep links are even possible). [verify-post] Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
MSPCA's pet pages are /pets/<rescueId lowercased>/ (e.g. a467410), and the API exposes that id as the 'rescueId' attribute. Generalize the registry to map each domain to (template, id_key) so toolkit shelters use the RescueGroups pet_id and MSPCA uses rescue_id. Capture rescueId on AdoptablePet and pass it through. [verify-post] Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Deep-link reconstruction is validated live for Sterling, SmallDog, and MSPCA. Ship only the source change + unit tests; drop the manual verify tooling. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
jonnyjohannes
approved these changes
Jun 10, 2026
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.
What I tried doing
RescueGroups gives us an org-level adoption URL or website URL, but not a direct animal page. For a few verified shelters, we can reconstruct the direct pet URL from IDs already present in the RescueGroups API response.
What changed
Added
adoption_sources/pet_links.pysterlingshelter.orgsmalldogrescuene.orgmspca.orgUpdated
adoption_sources/rescue_groups.pyrescueId, which MSPCA needs for its pet URLs.Updated
abstractions.pyrescue_idtoAdoptablePetso shelter-specific animal IDs can be carried through parsing.Why this matters
The social posts become more useful because users can click directly to the animal they saw, instead of landing on a general adoption/search page and having to find the pet manually.
Fallback behavior
If a pet comes from a shelter we have not verified, the code does not invent a URL. It keeps the existing default URL from the API.