Repository navigation
Never send empty text to the embedder - #1
Merged
Merged
Conversation
A pure insert has no old text and a pure delete has no new text, and deltaText was handing that empty string to the embedder. Real embedding endpoints reject it — TEI answers "413 `inputs` cannot be empty" — so every insert- or delete-shaped hunk failed the moment a real model was configured. Adding or removing a line is the common edit, so in practice the semantic diff was broken for most changes against a real endpoint. It went unnoticed because the offline LexicalEmbedder happily embeds "" and returns a zero vector. The fallback masked it completely, and the fallback is what every test until now had run under. An empty side is a total shift at that point by definition — content appeared or vanished — so it returns 1 directly and makes no embed call at all. Tests use a stub embedder that refuses empty input the way TEI does, covering insert, delete, append, delete-at-end and delete-everything. The lexical embedder cannot catch this class of bug, so the stub is the point. Measured against BAAI/bge-small-en-v1.5 via TEI, before and after: inserting a line mid-prompt and deleting a line both went from "Internal: diff failed" to a verdict.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
A pure insert has no old text and a pure delete has no new text, and
deltaTexthanded that empty string to the embedder. Real endpoints reject it — TEI answers413 \inputs` cannot be empty` — so every insert- or delete-shaped hunk failed as soon as a real model was configured. Adding or removing a line is the common edit, so in practice the semantic diff was broken for most changes against a real endpoint.It went unnoticed because the offline
LexicalEmbedderhappily embeds""and returns a zero vector. The fallback masked it completely — and the fallback is what every test until now had run under.An empty side is a total shift at that point by definition, so it returns 1 directly and makes no embed call.
Measured against
BAAI/bge-small-en-v1.5via TEI, before → after:Internal: diff failedInternal: diff failedTests use a stub embedder that refuses empty input the way TEI does — the lexical embedder cannot catch this class of bug, which is the whole point.