Skip to content

Return a 422 error when not_expected is called without a split name - #2226

Merged
moveson merged 1 commit into
masterfrom
oveson/claude/fix-not-expected-nil-split-name
Aug 19, 2026
Merged

Return a 422 error when not_expected is called without a split name#2226
moveson merged 1 commit into
masterfrom
oveson/claude/fix-not-expected-nil-split-name

Conversation

@moveson

Copy link
Copy Markdown
Collaborator

Summary

Fixes the production 500 captured in Scout error group 123521: GET /api/v1/event_groups/:id/not_expected without a split_name param crashed with NoMethodError: undefined method 'parameterize' for nil.

  • FindNotExpectedBibs now parameterizes the split name nil-safely, so a missing split name falls through to the existing validate_setup inclusion check and the controller renders its normal 422 with the "Invalid split name" error body.
  • Adds a spec for the service (valid, invalid, and nil split names) — there was none. The nil case was verified to fail against the pre-fix code.
  • Clears the two pre-existing rubocop offenses in the touched service: replaces OpenStruct with a Response struct (matching the Struct.new convention used elsewhere in the app) and converts validate_setup to a guard clause.

Resolves#2224

Testing

  • bundle exec rspec spec/services/find_not_expected_bibs_spec.rb — 3 examples, 0 failures
  • rubocop clean on touched files

🤖 Generated with Claude Code

FindNotExpectedBibs crashed with NoMethodError when the split_name
param was missing, turning a malformed API request into a 500.
Parameterize nil-safely so the existing split name validation
produces its normal error response.
Also replace OpenStruct with a Response struct and use a guard
clause in validate_setup to clear pre-existing rubocop offenses.
Resolves#2224
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
@moveson
moveson merged commit 81c8a27 into masterAug 19, 2026
12 of 14 checks passed
@moveson
moveson deleted the oveson/claude/fix-not-expected-nil-split-name branch August 19, 2026 17:21
Sign up for freeto 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.

API 500: not_expected endpoint crashes when split_name param is missing

1 participant

@moveson