Skip to content

fix(embeddings): reject non-integer response indexes - #13012

Merged
lalalune merged 1 commit into
developfrom
fix/13008-embedding-integer-index
Jul 4, 2026
Merged

fix(embeddings): reject non-integer response indexes#13012
lalalune merged 1 commit into
developfrom
fix/13008-embedding-integer-index

Conversation

@lalalune

@lalalune lalalune commented Jul 4, 2026

Copy link
Copy Markdown
Member

Summary

Follow-up to #13008. During review, the duplicate-index guard fixed repeated integer indexes but the response-shape validator still accepted numeric non-integer indexes such as 0.5.

A response with index: 0.5 can pass the old range check, write to an object property rather than a real array slot, and leave a vector hole in the returned batch. This violates the plugin-embeddings contract: throw on malformed provider output, never return sparse/fabricated vectors.

Change

  • Require Number.isInteger(index) before accepting an embedding response item index.
  • Add a regression test for a 0.5 response index.

Validation

  • bun run --cwd plugins/plugin-embeddings test passed: 31 tests across 3 files.
  • bun run --cwd plugins/plugin-embeddings typecheck passed.
  • bunx @biomejs/biome check plugins/plugin-embeddings/src/models/embedding.ts plugins/plugin-embeddings/__tests__/embedding.test.ts passed.
  • git diff --check origin/develop...HEAD passed.

No UI, persistence, or model behavior changed; this is provider response-shape validation.

@greptile-apps greptile-apps Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Your trial has ended. Reactivate Greptile to resume code reviews.

@coderabbitai

coderabbitai Bot commented Jul 4, 2026

Copy link
Copy Markdown
Contributor

Important

Review skipped

Auto reviews are disabled on this repository. Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: f1a719d4-d551-48f5-a097-dc3cdd982486

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch fix/13008-embedding-integer-index

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@lalalune
lalalune merged commit 38b8192 into develop Jul 4, 2026
18 of 36 checks passed
@lalalune
lalalune deleted the fix/13008-embedding-integer-index branch July 4, 2026 06:20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant