Repository navigation
reach: make a 2xx with an empty or non-object body loud in the ollama-chat adapter - #86
Merged
Merged
Conversation
…-chat adapter A 200 whose body was empty, not JSON, or JSON that is not a plain object left body null, which observeRungs reports with error null, so reachReport listed every requested R3/R4 rung as silentlyDropped. A broken proxy answering 200 with nothing therefore produced the exact record the cloud drop measurement reads as the cloud dropping R4. Such a response now sets error to 'empty body' or 'malformed body', so nothing is reported dropped. Adds tests 18 to 20 covering an empty body, a non-JSON body, and bodies that parse to a non-object. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
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.
What was wrong
In
src/reach/ollama-chat.js(added by #75), a 2xx response whose body was empty, not JSON, or JSON that is not a plain object leftbodynull. A null body reachesobserveRungswitherror: null, soreachReportlisted every requested R3/R4 rung assilentlyDropped. A broken proxy answering 200 with an empty body therefore produced exactly the record the E1 experiment reads as "the cloud silently dropped R4". That contradicts the module's own "loud, never silent" claim.What changed
src/reach/ollama-chat.js: a 2xx whose parsed body is not a plain object now becomes{ error: 'empty body' }(blank text) or{ error: 'malformed body' }(anything else). This follows the existing style forhttp <status>andfetch: <message>.reachReportthen sees an error and reportssilentlyDropped: []. Non-2xx and fetch-throw paths are untouched, and a 2xx JSON object carrying its ownerrorstring behaves as before.test/reach-ollama-chat.test.js: tests 18 to 20 cover an empty 200 body, a non-JSON 200 body, and 200 bodies that parse to a non-object ([],"x",42,null). Each asserts a non-nullerrorandsilentlyDroppedof[]on bothrecordandreach.KNOWN-LIMITS.md: pin restamped in a separate commit, as the tripwire requires after a change undersrc/.Fail-first evidence
With the src change stashed and the new tests in place,
npm testgave 1386 tests, 1372 pass, 3 fail (tests 18, 19, 20; for exampleactual: null, expected: 'malformed body'). With the fix restored: 1386 tests, 1375 pass, 0 fail.Test counts
npm run limits-pin -- --check: the log describes the checked-out commit and matches.Not merged, per the work order.
🤖 Generated with Claude Code