Repository navigation
Scenario: a pet renamed twice while everyone follows it - #327
Conversation
petnames: a pet is renamed and given a new photo twice in a row by its owner, while everyone else follows it and it is on a meetup's roster. Every copy of its name and photo, on its posts, the follow lists and the roster, has to end with the last ones, and its post count must not move. 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: 14f316fe51
ℹ️ 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".
| const steps = []; | ||
| for (const k of [1, 2]) steps.push(await call(owner, "updatePetCallable", { petId: star, name: `Simpet ${SHORT} v${k}`, avatarUrl: photo(k) })); | ||
| const lastName = `Simpet ${SHORT} v2`; | ||
| const end = await settle(petCopies, (c) => outOfStep(c, lastName, photo(2)).length === 0); |
There was a problem hiding this comment.
Add the pet propagation trigger before enabling this scenario
With the reviewed commit alone, the documented default emulator run always times out here and exits unsuccessfully: a repo-wide search finds no onPetUpdated handler, and functions/src/index.ts exports no pet-update trigger, while updatePetCallable only updates pets/{petId}. Consequently the existing posts, follow-list entries, and participant record can never acquire lastName or photo(2). The propagation implementation needs to land with this scenario, or the scenario must not run by default until that dependency exists.
Useful? React with 👍 / 👎.
| check("pets: renamed with a new photo twice in a row, every copy ends with the last", | ||
| steps.every((st) => st.ok) && end.follows.length === tally(follows).ok && end.roster.length === 1 && left.length === 0, |
There was a problem hiding this comment.
Require every follower request to succeed
If any followPetCallable requests fail—for example because of a regression or transient callable refusal—the assertion still passes with fewer follow-list copies because it only compares the resulting count with tally(follows).ok. Even zero successful follows can pass once the posts and roster are synchronized, so this does not enforce the stated scenario that everyone except the owner follows the pet; include tally(follows).ok === N - 1 in the result.
Useful? React with 👍 / 👎.
| ]; | ||
| // Every follow is in place before the renames start. | ||
| await settle(petCopies, (c) => c.follows.length === tally(follows).ok); | ||
| const postCount = (await adminGet(`pets/${star}`))?.postCount; |
There was a problem hiding this comment.
Settle the post count before capturing the baseline
When post aggregation is delayed, this read can capture the pet's initial or partially updated postCount, because createPostCallable creates posts with an empty contribution and onPostWritten updates the pet asynchronously. The later synchronization wait gives that trigger time to finish, after which the final comparison reports that renaming changed the count even though only the earlier post events did. Settle this pet's count to the expected number of existing posts before recording the baseline.
Useful? React with 👍 / 👎.
Adds a
petnamesgroup tofunctions/scripts/scenario-many-users.mjs. The pet's owner renames it and gives it a new photo twice in a row, while everyone else follows it and it is on a meetup's roster. Every copy of its name and photo has to end with the last ones: on its posts, the follow lists and the roster. Its post count must not move.On the test project, with
onPetUpdated(#325) deployed there:Cleanup left nothing.
🤖 Generated with Claude Code