[#397 audit follow-ups] LOW: batch-input embeddings e2e + null-embedding hardening
Nobody has claimed this yet.
- Dominant language
- Rust
- Stars
- 157
- Forks
- 32
- Avg merge
- 1h 25m
- Merged PRs (30d)
- 145
Description
Context
PR #397 audit raised two LOW findings, filed here as follow-ups so they don't block merge:
1. No multi-input (batch) e2e coverage on the embeddings round-trip
PR #397 covers data.length === 1 only. The wire-layer enum doesn't care about batch size (the surrounding Vec<OpenAiEmbeddingObject> already deserializes any-length arrays), but a regression that mangled the data[1+] indices on the way back would only be caught by a batch case.
Fix: add a 4th subtest in tests/e2e/src/cases/openai-embeddings-base64-e2e.test.ts:
- Request
input: ["hello", "world"] - Mock upstream returns 2 base64 entries
- Assert
data.length === 2and bothembeddingfields are strings
2. null embedding field still rejected
Pre-PR: embedding: Vec<f32> rejected null. Post-PR: embedding: EmbeddingVector (untagged enum over Vec<f32> and String) still rejects null — serde_json::from_str::<EmbeddingVector>("null") returns Err.
An out-of-spec upstream that emitted {"embedding": null} would still 502. Pre-PR did the same so this isn't a regression, but it's a wire-shape hardening opportunity.
Fix options:
- Add
Option<EmbeddingVector>wrapper atEmbeddingObject.embeddingso null deserializes toNone. Surface to the SDK asnullper JSON pass-through. - OR: explicit
Nullvariant onEmbeddingVector.
Either preserves pass-through semantics. The first is less invasive.
Tracking
- Parent: PR #397, issue #393.
- Severity: LOW (both are hardening, not customer-blockers).
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with tests/e2e/src/cases/openai-embeddings-base64-e2e.test.ts and the EmbeddingObject/EmbeddingVector deserialization definitions. Add the two-input round-trip coverage, then verify null embedding values deserialize without a 502 while preserving JSON pass-through. Done means the batch assertions pass and the null case is covered by an appropriate test.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- rust
- Domain
- api, testing
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Quiet
- Clarity
- Mostly clear
- Newbie friendliness
- 65/100