Skip to content

chore: fix CodeQL parsing of Sorbet fallback#303

Merged
jbeckwith-oai merged 1 commit into
mainfrom
codex/fix-codeql-ruby-parser
Jul 13, 2026
Merged

chore: fix CodeQL parsing of Sorbet fallback#303
jbeckwith-oai merged 1 commit into
mainfrom
codex/fix-codeql-ruby-parser

Conversation

@jbeckwith-oai

Copy link
Copy Markdown
Contributor

Summary

  • parenthesize the NotImplementedError argument in the endless Sorbet fallback method
  • preserve runtime behavior while allowing CodeQL to parse lib/openai/internal/util.rb

Rationale

The existing def to_sorbet_type = raise NotImplementedError is valid Ruby, but CodeQL's underlying tree-sitter Ruby parser misparses a command-style call on the right-hand side of an endless method definition. CodeQL 2.26.0 consequently reports an extraction warning at this line and may provide incomplete analysis around it.

Using raise(NotImplementedError) is the minimal workaround recommended in github/codeql#14279 and tracked upstream in tree-sitter-ruby#242. It does not change runtime behavior.

Validation

  • ruby -c lib/openai/internal/util.rb
  • bundle exec rake test TEST=test/openai/internal/util_test.rb (36 runs, 154 assertions)
  • bundle exec rubocop lib/openai/internal/util.rb --except Lint/RedundantCopDisableDirective,Layout/LineLength
  • git diff --check

@jbeckwith-oai jbeckwith-oai marked this pull request as ready for review July 13, 2026 21:39
@jbeckwith-oai jbeckwith-oai requested a review from a team as a code owner July 13, 2026 21:39
@openai-sdks

openai-sdks Bot commented Jul 13, 2026

Copy link
Copy Markdown

OkTest Summary

237/237 SDK tests passed in 8.733s for Ruby SDK PR #303.

Test results — 42 files
Test Result Time
tests/chat-completions-complex-body.test.ts ✅ Passed 162ms
tests/chat-completions-create.test.ts ✅ Passed 223ms
tests/chat-completions-stream.test.ts ✅ Passed 143ms
tests/files-content-binary.test.ts ✅ Passed 285ms
tests/files-create-multipart.test.ts ✅ Passed 206ms
tests/files-list-pagination.test.ts ✅ Passed 186ms
tests/initialize-config.test.ts ✅ Passed 212ms
tests/instance-isolation.test.ts ✅ Passed 224ms
tests/models-list.test.ts ✅ Passed 165ms
tests/responses-background-lifecycle.test.ts ✅ Passed 194ms
tests/responses-body-method-errors.test.ts ✅ Passed 356ms
tests/responses-cancel-timeout.test.ts ✅ Passed 282ms
tests/responses-cancel.test.ts ✅ Passed 230ms
tests/responses-compact-retries.test.ts ✅ Passed 247ms
tests/responses-compact.test.ts ✅ Passed 240ms
tests/responses-create-advanced-stream.test.ts ✅ Passed 147ms
tests/responses-create-advanced.test.ts ✅ Passed 217ms
tests/responses-create-disconnect.test.ts ✅ Passed 165ms
tests/responses-create-errors.test.ts ✅ Passed 258ms
tests/responses-create-malformed-api-responses.test.ts ✅ Passed 129ms
tests/responses-create-retries.test.ts ✅ Passed 303ms
tests/responses-create-stream-failures.test.ts ✅ Passed 156ms
tests/responses-create-stream-timeout.test.ts ✅ Passed 264ms
tests/responses-create-stream-wire.test.ts ✅ Passed 2.014s
tests/responses-create-stream.test.ts ✅ Passed 91ms
tests/responses-create-terminal-states.test.ts ✅ Passed 252ms
tests/responses-create-timeout.test.ts ✅ Passed 292ms
tests/responses-create.test.ts ✅ Passed 295ms
tests/responses-delete.test.ts ✅ Passed 313ms
tests/responses-input-items-errors.test.ts ✅ Passed 173ms
tests/responses-input-items-list.test.ts ✅ Passed 172ms
tests/responses-input-items-options.test.ts ✅ Passed 174ms
tests/responses-input-tokens-count-timeout.test.ts ✅ Passed 276ms
tests/responses-input-tokens-count.test.ts ✅ Passed 252ms
tests/responses-malformed-inputs.test.ts ✅ Passed 2.135s
tests/responses-not-found-errors.test.ts ✅ Passed 298ms
tests/responses-parse.test.ts ✅ Passed 156ms
tests/responses-retrieve-retries.test.ts ✅ Passed 304ms
tests/responses-retrieve.test.ts ✅ Passed 227ms
tests/responses-stored-method-errors.test.ts ✅ Passed 797ms
tests/retry-behavior.test.ts ✅ Passed 1.994s
tests/sdk-error-shape.test.ts ✅ Passed 361ms

View OkTest run #29287130540

SDK merge (5d4087763d72) · head (7340666fa61d) · base (6737a8875d53) · OkTest (cb7f0514ccd2)

@HAYDEN-OAI HAYDEN-OAI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

thanks, this is exactly the right minimal workaround. parenthesizing the same notimplementederror argument preserves runtime behavior while avoiding the documented tree-sitter and codeql parse failure, and the full supported ruby matrix plus lint are green. approving!

@jbeckwith-oai jbeckwith-oai changed the title fix CodeQL parsing of Sorbet fallback chore: fix CodeQL parsing of Sorbet fallback Jul 13, 2026
@jbeckwith-oai jbeckwith-oai merged commit 7d0dcaf into main Jul 13, 2026
11 checks passed
@jbeckwith-oai jbeckwith-oai deleted the codex/fix-codeql-ruby-parser branch July 13, 2026 21:44
@stainless-app stainless-app Bot mentioned this pull request Jul 13, 2026
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.

2 participants