Skip to content

fix(feedback): fix patching flakes with test_openai.py #95577

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jul 15, 2025

Conversation

aliu39
Copy link
Member

@aliu39 aliu39 commented Jul 15, 2025

Discovered in #95392 the monkeypatching of OpenAI class in test_create_feedback.py can affect test_openai.py, I'm guessing when they are ran in parallel. I haven't seen this flake anywhere else, but don't believe it's related to the changes in #95392. Using the patch context manager should fix this.

"not spam" return value bleeds over to the openai test:
Screenshot 2025-07-15 at 10 51 22 AM

Ref REPLAY-513: [PR Tracker] refactor backend user feedback code

@aliu39 aliu39 requested a review from a team as a code owner July 15, 2025 17:52
Copy link

linear bot commented Jul 15, 2025

Copy link
Member

@cmanallen cmanallen left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Whenever you set an attr you have to unset otherwise the state of the application is mutated and it persists for the next test.

Copy link

codecov bot commented Jul 15, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

✅ All tests successful. No failed tests found.

Additional details and impacted files
@@            Coverage Diff             @@
##           master   #95577      +/-   ##
==========================================
- Coverage   80.82%   80.82%   -0.01%     
==========================================
  Files       10547    10547              
  Lines      607945   607965      +20     
  Branches    23825    23825              
==========================================
+ Hits       491384   491394      +10     
- Misses     115852   115862      +10     
  Partials      709      709              

@aliu39
Copy link
Member Author

aliu39 commented Jul 15, 2025

Whenever you set an attr you have to unset otherwise the state of the application is mutated and it persists for the next test.

ah good to know, what if it's done in a fixture like mock_produce_occurrence_to_kafka?

@aliu39 aliu39 merged commit 0cf8d97 into master Jul 15, 2025
62 checks passed
@aliu39 aliu39 deleted the aliu/openai-flake branch July 15, 2025 18:28
@vishnupsatish
Copy link
Member

wow, I was facing this exact issue when I was trying to test feedback summaries - thanks for cleaning it up

aliu39 added a commit that referenced this pull request Jul 17, 2025
#95392)

User reports are the same product as feedback and owned by replay team.
I'd like to move the code here for organizational purposes. Same goes
for the feedback summary endpoint. This PR only moves things around, no
implementation changes.

Ref [REPLAY-513: \[PR Tracker\] refactor backend user feedback
code](https://linear.app/getsentry/issue/REPLAY-513/pr-tracker-refactor-backend-user-feedback-code)

I plan to follow up with quality improvements to the ingest functions,
making them more composable, so that module's subject to change.

Also fixes a flaky test `test_openai` described in
#95577
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants