Skip to content

test: add error handling tests to Python and Go bindings #79

Description

@aepfli

Problem

The Rust core and Java bindings have tests for error conditions (invalid JSON, malformed flag configs, type mismatches), but Python and Go bindings have minimal or no error handling coverage.

Proper error handling at the WASM boundary is critical — the evaluator must never panic and should return structured error responses that bindings can surface to callers.

Current Coverage

Error Scenario Rust Java Python Go
Invalid JSON input
Malformed flag config
Type mismatch (e.g., boolean flag evaluated as string)
Missing flag key
Empty/null context partial

Scope

For Python and Go bindings, add tests for:

  1. Invalid JSON — Passing malformed JSON to update_state and evaluate
  2. Schema validation errors — Flag configs that fail JSON Schema validation
  3. Type mismatches — Evaluating a flag and expecting the wrong type
  4. Missing flags — Evaluating a flag key that doesn't exist
  5. Empty/null context — Evaluating with no context when targeting rules expect context
  6. Error response structure — Verify error responses include error_code and error_message

Related

  • Part of the test gap analysis from the cross-implementation review

Metadata

Metadata

Assignees

No one assigned

    Labels

    priority: mediumMedium prioritytestingTest coverage gaps and new test suites

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions