Repository navigation
Pets: a new name or photo reaches every copy of it - #325
Conversation
Posts, follow lists, meetup rosters and check-ins each keep the pet's name, and all but check-ins its photo, as they were when written, and the apps show those copies. A pet renamed or given a new photo went on showing the old ones everywhere but its own page. People's names have had onUserUpdated for this; pets had nothing. onPetUpdated runs when a pet's name or photo changes and writes the pet's current ones onto every copy, then looks at the pet again and goes round once more if it changed in the meantime, so two changes in quick succession end with the latest. A copy already up to date is not written, and one that went while the copies were being written (a follow undone) is left out rather than written back. Roster entries are found through the pet's owners, on the index that exists. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Authorized by the owner on 2026-10-14 with the change that adds it, so that it can be tested with many people on the test project. It binds no secret, calls nothing outside and runs on no schedule; Firestore only. The entry now expects 42 functions. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: ffc651afbb
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| db.collectionGroup("checkins").where("petId", "==", petId), | ||
| { petName: name } |
There was a problem hiding this comment.
Provision the check-ins index before querying it
When onPetUpdated is deployed to petnote-devtest, every name or photo change executes this collection-group query, but STATUS.md:796-798 records that the test project deliberately does not have the checkins.petId single-field collection-group index. Its existing petId + createdAt DESC composite cannot satisfy this query's document-ID ordering, so the Promise.all rejects with FAILED_PRECONDITION and the trigger retries after potentially updating the other copy types. Provision the required index before exporting this trigger to the test project.
Useful? React with 👍 / 👎.
| createPetCallable, | ||
| deletePetCallable, | ||
| followPetCallable, | ||
| onPetUpdated, |
There was a problem hiding this comment.
Register the new trigger in the local acceptance shim
Exporting this trigger does not make it run in the repository's local acceptance environment: functions/scripts/callable-shim.mjs:278-298 manually enumerates every Firestore trigger and has no onPetUpdated entry. Consequently, editing a pet through the shim leaves posts, follows, rosters, and check-ins stale even though the same flow works after deployment, so local client-wiring acceptance cannot exercise the behavior introduced here. Add the pets collection update watcher alongside the export.
Useful? React with 👍 / 👎.
Several places keep their own copy of a pet's name, and all but check-ins its photo, as they were when written:
The apps show those copies, so a pet renamed or given a new photo went on showing the old ones everywhere but its own page. This was true on the web too. People's names have had
onUserUpdatedfor this; pets had nothing. The owner approved the fix on 2026-10-14.onPetUpdatedruns when a pet's name or photo changes. It writes the pet's current values onto every copy:petName,petAvatarUrlpetIdpetName,petAvatarfollowingPetscollection group,petIdpetName,petAvatarparticipantsbyuserIdover the pet's ownerspetNamecheckinscollection group,petIdHow it behaves:
userId, and deploying indexes from the file would remove production-only settings. An entry by someone who has since left the pet's family keeps its old copy.Test project. The second commit adds
onPetUpdatedto the test project's entry, authorized with this change. The entry now expects 42 functions. It is deployed topetnote-devtestonly.Tests. Five new emulator tests:
Taking out the second look at the pet fails the fourth test; taking out the leaving-out fails the fifth. The full suite passes: 295 tests.
🤖 Generated with Claude Code