fix(speakers): honour payload bio on createMySpeaker instead of always overriding with member bio#564
fix(speakers): honour payload bio on createMySpeaker instead of always overriding with member bio#564romanetar wants to merge 1 commit into
Conversation
…s overriding with member bio Signed-off-by: romanetar <roman_ag@hotmail.com>
📝 WalkthroughWalkthrough
ChangesSpeaker bio precedence
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~20 minutes Poem
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
|
📘 OpenAPI / Swagger preview ➡️ https://OpenStackweb.github.io/summit-api/openapi/pr-564/ This page is automatically updated on each push to this PR. |
There was a problem hiding this comment.
🧹 Nitpick comments (1)
tests/oauth2/OAuth2SummitSpeakersApiTest.php (1)
2084-2094: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick winRun cleanup in a
finallyblock so a failed assertion doesn't leak the Member/Speaker.Assertions on lines 2084-2088 run before the cleanup on lines 2090-2093. If an assertion fails, the test aborts and the created member (and the speaker created by
createMySpeaker) are never removed, leaking state into subsequent tests in this class.Separately,
setUserExternalId(mt_rand())(line 2049) can in rare cases collide with the seeded members' external ids, which could make auth resolution flaky; consider a deterministic unique value derived from$prefix.♻️ Suggested structure
$this->assertResponseStatus(201); try { $speaker = json_decode($response->getContent()); $this->assertNotNull($speaker); $this->assertEquals($payloadBio, $speaker->bio, "Speaker bio must match what the user submitted, not the member/FNid bio."); } finally { $this->resetEmIfNeeded(); self::$em->remove(self::$em->find(Member::class, $newMember->getId())); self::$em->flush(); }🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@tests/oauth2/OAuth2SummitSpeakersApiTest.php` around lines 2084 - 2094, Move the cleanup in the test around the response/assertion checks into a finally block so `createMySpeaker`-created state is always removed even if `assertResponseStatus`, `assertNotNull`, or `assertEquals` fails. Use the existing `resetEmIfNeeded()` and `self::$em->remove(...)`/`flush()` cleanup sequence after the assertions, and also replace the `setUserExternalId(mt_rand())` value with a deterministic unique value derived from `$prefix` to avoid rare collisions with seeded members.Source: Linters/SAST tools
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Nitpick comments:
In `@tests/oauth2/OAuth2SummitSpeakersApiTest.php`:
- Around line 2084-2094: Move the cleanup in the test around the
response/assertion checks into a finally block so `createMySpeaker`-created
state is always removed even if `assertResponseStatus`, `assertNotNull`, or
`assertEquals` fails. Use the existing `resetEmIfNeeded()` and
`self::$em->remove(...)`/`flush()` cleanup sequence after the assertions, and
also replace the `setUserExternalId(mt_rand())` value with a deterministic
unique value derived from `$prefix` to avoid rare collisions with seeded
members.
ℹ️ Review info
⚙️ Run configuration
Configuration used: defaults
Review profile: CHILL
Plan: Pro
Run ID: 2b7da1f7-fe99-4c0f-b5d1-44a013d78819
📒 Files selected for processing (2)
app/Http/Controllers/Apis/Protected/Summit/OAuth2SummitSpeakersApiController.phptests/oauth2/OAuth2SummitSpeakersApiTest.php
ref https://app.clickup.com/t/9014802374/86badw3a0
Summary by CodeRabbit
Bug Fixes
Tests