Say why a call failed, and stop padding the ones that succeed - #9
Open
Robbie1977 wants to merge 1 commit into
Open
Say why a call failed, and stop padding the ones that succeed#9Robbie1977 wants to merge 1 commit into
Robbie1977 wants to merge 1 commit into
Conversation
Four defects found by testing every tool against the live service. An error body was thrown away. Ten catch sites interpolated the caught exception directly, so a caller who passed an unknown query_type got "AxiosError: Request failed with status code 400" while the response body sitting in that exception said "Unknown query_type: NotARealQueryType" and listed all 43 names it would have accepted. rejectionDetail now also handles a timeout (the server keeps computing and caches the result, so retrying is the right advice, and that is the failure most likely to be misread as "no data"), appends the server's `available` and `suggestions` lists, and notes a `status: computing` body. A new failureText() puts every catch site on it. fetchAvailableQueryTypes was typed Promise<string[]> but returned the raw Queries array, whose entries are objects. formatAvailableQueriesHint then JSON.stringify'd them, so the run_query error path emitted every query's argument schema and empty preview block. It now maps to the query names. get_hierarchy returned the same tree three times: as data, as `display`, as a byte-identical `display_full`, and as an `html` document written for the VFB site's ROI browser. The HTML is now behind include_html (default false) and display_full is dropped when it duplicates display. 4.3 KB -> 1.4 KB on a one-level Kenyon cell tree. get_term_info carried an argument schema and an empty preview block for every entry in Queries, and six file URLs for every image. Trimmed by default with a `trimmed` field naming what went and where the dropped file URLs live, so nothing is unrecoverable; verbose: true returns the untouched response. 15.7 KB -> 7.6 KB on FBbt_00100249. test/live-smoke.js drives the built server over stdio and checks all four against the live service; npm run test:live. Calls are spaced, and every one goes through v3-cached. Co-Authored-By: Claude <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Y8ZAhRM7gh8arDx9SuSWcT
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.
Four defects, all found by running every tool against the live service after the v1.10.0 deploy. Ships as v1.11.0.
1. The error body was being thrown away
Ten catch sites interpolated the caught exception directly (
${error}). A caller who passed an unknownquery_typegot this back:The reason was sitting inside that exception the whole time. The same request via curl returns a 400 whose body is
{"error": "Unknown query_type: NotARealQueryType", "available": [...43 names...]}. Now:rejectionDetailwas already written but wired into only two of the ten sites. It now also:ECONNABORTED/ETIMEDOUT), which has no body at all and is the failure most likely to be misread as "there is no data". The client gives up at 60s but the server keeps computing against its 180s budget and caches the result, so the honest advice is to retry — and that is what the message now says.availableandsuggestionsarrays, so a rejection carries the alternatives instead of forcing another guess.status: "computing"body (the 503 the origin returns on a budget overrun).A new
failureText(context, error)puts every catch site on the same path and appends the HTTP status.2.
fetchAvailableQueryTypesreturned objects where names were expectedDeclared
Promise<string[] | null>, but it returnedresult.data.Queriesraw — and each entry there is an object ({query, label, function, takes, preview, preview_columns, preview_results, output_format, count}).formatAvailableQueriesHintthenJSON.stringify’d the lot, so the error path — the path where the caller is already confused — emitted every query’s argument schema and empty preview block. It now maps toq.queryand joins with commas.3.
get_hierarchyreturned the same tree three timesOnce as data in
descendants/ancestors, once as adisplaystring, once as a byte-identicaldisplay_full, and once as anhtmldocument written for the VFB site’s ROI browser. On a one-level Kenyon cell tree the HTML alone was 3.2 KB of a 4.3 KB response.New
include_htmlparameter, default false.display_fullis dropped when it duplicatesdisplay. 4.3 KB → 1.4 KB. The response carries atrimmedfield saying what went and how to get it back.4.
get_term_infowas mostly scaffoldingEvery entry in
Queriescarried its argument schema plus apreview_resultsblock whoseheadersrepeatedpreview_columnsverbatim above an emptyrows— seven times over onFBbt_00100249. Every image listed six file URLs differing only in filename.Trimmed by default: 15.7 KB → 7.6 KB (52% smaller). Nothing is unrecoverable — the
trimmedfield names the dropped file URLs (they sit beside the thumbnail asthumbnailT.png,volume.nrrd,volume.wlz,volume_man.obj,volume.swc), andverbose: truereturns the untouched response.Testing
test/live-smoke.js(npm run test:live) drives the built server over stdio and checks all four against the live service — 14 assertions, all passing. Happy-path regression onlist_connectome_datasets,search_terms,resolve_combinationandlist_search_facetsconfirms thefailureTextrewiring did not disturb the success paths.Calls are issued one at a time with 7–8s between them, and every one goes through
v3-cached, per the standing rule about load on VFBquery.Review notes
htmlorQueries[].takes— hence the minor bump to 1.11.0 rather than a patch.search_terms’auto_fetch_term_infopath foldsget_term_infointo its response; that call now gets the trimmed shape too. Intentional.package.json,package-lock.jsonandserver.json.