Skip to content

Skip middleware actions for zero-sample profiles#217

Open
oiahoon wants to merge 1 commit into
Shopify:mainfrom
oiahoon:fix/drop-empty-profiles
Open

Skip middleware actions for zero-sample profiles#217
oiahoon wants to merge 1 commit into
Shopify:mainfrom
oiahoon:fix/drop-empty-profiles

Conversation

@oiahoon

@oiahoon oiahoon commented Jul 12, 2026

Copy link
Copy Markdown

Summary

Unusable empty profiles no longer trigger middleware actions. The middleware now returns the original response when StackProf reports zero samples instead of uploading, enqueueing, or viewing a profile that Speedscope cannot consume.

Behavior

The zero-sample guard runs after after_profile, preserving the existing hook behavior and direct backend/profile APIs. Profiles with positive samples and backends without the StackProf samples field are unchanged.

Verification

  • failure-before regression reproduced the unexpected UploadAction.call
  • middleware tests passed with three sequential seeds: 47 runs and 281 assertions each
  • full Ruby 3.4 suite: 250 runs, 836 assertions
  • RuboCop: 70 files, no offenses
  • gem build
  • git diff --check

Closes #2

@oiahoon

oiahoon commented Jul 12, 2026

Copy link
Copy Markdown
Author

I have signed the CLA!

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.

Middleware's action should not be called if there are no samples in the profile

1 participant