Skip to content

fix(ofrep): read camelCase errorCode and errorDetails from error responses - #293

Open
yuminn-k wants to merge 1 commit into
open-feature:mainfrom
yuminn-k:fix-ofrep-error-response-casing
Open

yuminn-k wants to merge 1 commit into
open-feature:mainfrom
yuminn-k:fix-ofrep-error-response-casing

Conversation

@yuminn-k

@yuminn-k yuminn-k commented Nov 2, 2026

Copy link
Copy Markdown

Summary of Changes

Fixes #283

OpenFeature::OFREP::Client#parse_error_response looked for error_code and error_details, but the OFREP evaluationFailure schema names them errorCode and errorDetails (open-feature/protocol service/openapi.yaml). A 400 from a spec-compliant server raised ParseError and the server's error code and details were lost. The parser now reads the spec's field names. The error-path fixtures in client_spec.rb and provider_spec.rb used the same snake_case keys, so they are updated to the spec casing.

ParseError is still not rescued in Provider#evaluate. That is left for a separate change, as the issue suggests.

Type of Change

  • Bug fix (non-breaking change that fixes an issue)
  • New feature (non-breaking change that adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • Documentation update

Testing

With the fixtures switched to camelCase and the old parser, client_spec.rb:45 and provider_spec.rb:120 fail with OpenFeature::OFREP::ParseError (44 examples, 2 failures). With the fix, bundle exec rake (standard + rspec) passes: 44 examples, 0 failures, no offenses, on Ruby 3.4.

Checklist

  • Tests pass (bundle exec rspec)
  • Linter passes (bundle exec rubocop)
  • PR title follows Conventional Commits
  • Commits are signed off (DCO: git commit -s)

…onses

OFREP's evaluationFailure schema names the fields errorCode and errorDetails, so a spec-compliant 400 raised ParseError instead of returning the server's error code. Update the error-path fixtures to the spec casing.

Signed-off-by: YuMin Kim <yuminkim.dev@gmail.com>
@yuminn-k
yuminn-k requested a review from a team as a code owner November 2, 2026 15:45
@coderabbitai

coderabbitai Bot commented Nov 2, 2026 •

Copy link
Copy Markdown

Review in Change Stack →

No actionable comments were generated in the recent review.

Recent review info
Run configuration
  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: Organization UI
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 9a46f872-ba98-4b73-bf1a-09b372375847
Commits

Reviewing files that changed from the base of the PR and between dea9d43 and 3512d7f.

Files selected for processing: 3
  • providers/openfeature-ofrep-provider/lib/openfeature/ofrep/provider/client.rb
  • providers/openfeature-ofrep-provider/spec/openfeature/ofrep/provider/client_spec.rb
  • providers/openfeature-ofrep-provider/spec/openfeature/ofrep/provider_spec.rb

Included review availability: This review used your included allowance. Your plan provides up to 1 included review per hour; 0 remain after this review.

Walkthrough

The OFREP client now parses error responses using errorCode and errorDetails. Related client and provider test fixtures use those JSON field names.

Changes: OFREP error parsing

Layer / File(s) Summary
Parse OFREP error fields
providers/openfeature-ofrep-provider/lib/openfeature/ofrep/provider/client.rb, providers/openfeature-ofrep-provider/spec/openfeature/ofrep/provider/client_spec.rb, providers/openfeature-ofrep-provider/spec/openfeature/ofrep/provider_spec.rb
The client requires and reads errorCode and errorDetails. Error-response fixtures use these camelCase keys, with expected results unchanged.

Estimated code review effort: 2 (Simple) | ~8 minutes

Change: Bug fix · Severity of issue fixed: Medium

Suggested reviewers: josecolella

Merge Risk: Minimal · up to 3512d

The change matches the OFREP error-response contract and is ready to merge.

Pre-merge checks: Passed 4 · Failed 1

Failed Failed checks: 1 warning

Check name Status Explanation Resolution
Docstring Coverage Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff with cyclomatic complexity of at least 2. Documentat… Write docstrings for the functions missing them to satisfy the coverage threshold.
Passed Passed checks: 4 passed
Check name Status Explanation
Title check Passed The title clearly and concisely describes the main change: reading the camelCase OFREP error fields errorCode and errorDetails.
Description check Passed The description directly explains the parser fix, the related fixture updates, the testing results, and the deferred ParseError handling.
Linked Issues check Passed Issue #283 requires OFREP error responses to use errorCode and errorDetails. The PR updates parse_error_response to require and read those fields. Provider#evaluate already returns the default…
Out of Scope Changes check Passed All changes stay within issue #283. The source change fixes OFREP error-field parsing, and the test changes update error-path fixtures to the specified field names. No unrelated production or test cha…
Full details: Linked Issues check

Explanation

Issue #283 requires OFREP error responses to use errorCode and errorDetails. The PR updates parse_error_response to require and read those fields. Provider#evaluate already returns the default value with the parsed error code and details when the error response parses. The client and provider fixtures now use the specified camelCase fields. The optional rescue for malformed responses is separate from parsing a spec-conformant 400.

Full details: Out of Scope Changes check

Explanation

All changes stay within issue #283. The source change fixes OFREP error-field parsing, and the test changes update error-path fixtures to the specified field names. No unrelated production or test changes are present.

Full details: Docstring Coverage

Explanation

Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff with cyclomatic complexity of at least 2. Documentation-only edits and deletions within surviving functions are included; unchanged diff context and fully deleted functions are excluded. Analyzed 1 functions across 3 files.

Resolution

Write docstrings for the functions missing them to satisfy the coverage threshold.

  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

This branch has not been deployed

No deployments
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.

[BUG] (ofrep) Error responses are parsed with snake_case keys, so no spec-conformant 400 can be parsed

2 participants