Support indexed map deserialization for Jev Score legend and probabilities #105

Closed
opened 2026-09-23 14:37:51 +00:00 by yuris · 0 comments
Owner

What to build

Update ScoreAnswer deserialization in src/jev/primitives.rs to support both sequence arrays and string-indexed maps (such as 0: val0, 1: val1) for legend and probabilities fields. OpenRouter System One serializes score level distributions as maps keyed by level index strings rather than plain arrays, which caused schema validation errors (malformed_answer). The deserializer must accept either wire format, sort map entries by numeric index, and assemble them into standard vectors while preserving strict probability summation and score alignment invariants. Add unit and integration tests with verbatim OpenRouter Score payloads.

Acceptance criteria

  • ScoreAnswer deserializes legend and probabilities from plain sequence arrays
  • ScoreAnswer deserializes legend and probabilities from string-indexed maps (such as 0, 1, 2)
  • Probability sum, highest choice, and weighted score invariants are validated identically across both representations
  • Unit tests in src/jev/primitives.rs cover real OpenRouter System One score responses
  • Integration tests in tests/jev_client_tests.rs verify end-to-end score question evaluation against OpenRouter mock payloads
  • Zero regressions across existing test suite

Blocked by

None - can start immediately

## What to build Update ScoreAnswer deserialization in src/jev/primitives.rs to support both sequence arrays and string-indexed maps (such as 0: val0, 1: val1) for legend and probabilities fields. OpenRouter System One serializes score level distributions as maps keyed by level index strings rather than plain arrays, which caused schema validation errors (malformed_answer). The deserializer must accept either wire format, sort map entries by numeric index, and assemble them into standard vectors while preserving strict probability summation and score alignment invariants. Add unit and integration tests with verbatim OpenRouter Score payloads. ## Acceptance criteria - [x] ScoreAnswer deserializes legend and probabilities from plain sequence arrays - [x] ScoreAnswer deserializes legend and probabilities from string-indexed maps (such as 0, 1, 2) - [x] Probability sum, highest choice, and weighted score invariants are validated identically across both representations - [x] Unit tests in src/jev/primitives.rs cover real OpenRouter System One score responses - [x] Integration tests in tests/jev_client_tests.rs verify end-to-end score question evaluation against OpenRouter mock payloads - [x] Zero regressions across existing test suite ## Blocked by None - can start immediately
yuris closed this issue 2026-09-23 14:51:19 +00:00
Sign in to join this conversation.
No labels
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
yuris/life-service#105
No description provided.