Repository navigation
Tolerate optional genome load failures and explain the fatal ones - #2111
Merged
Merged
Conversation
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
A genome needs chromosome names only to pick a starting locus, so check for a locus before the browser changes. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Readers record optional-part failures on the genome and the browser alerts; the alert queue keeps alerts for dialogs not yet on the page. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
A name derived from the URL would just repeat the URL on the next line. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
A test that breaks when a message is reworded is a maintenance burden; assert on the error's kind, resource and cause instead. Co-Authored-By: Claude Fable 5.1 <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.
Summary
Loading a genome no longer fails when an optional part fails. A 2bit
.bptindex, chrom.sizes, the alias bigBed, the alias file and cytobands are each left out with a fallback where there is one (the 2bit's internal index, chromosomes loaded on demand, the next alias source; there is always an alias source, the defaults at least). Only the sequence, a specified FASTA index, and a starting locus are required: a 2bit with an external index now supplies its first sequence name as the default locus.Optional failures are reported to the user with what failed and its likely consequence. Readers stay UI-free: they record
{kind, url, message, warning}on the genome, which the browser reports in one alert with the track failures. Parts that load lazily (cytobands, aliases) are reported as they fail, through a hook the browser sets once it has taken the genome and clears when the genome is replaced or disposed.Fatal failures, of a genome, a session file or a track, now reject with a message written for the user instead of the raw request error (
Error accessing resource: <url> status: 0). A reader that fails on a required resource throwsLoadError(kind, url, cause)(js/util/loadFailure.js), andgenomeLoadError,sessionLoadErrorandtrackLoadErrorwrap it. The message says in one sentence which part failed and what happened to it, then the resource, then a hint where there is one, one per line:A request failure is explained by its status (0 is "could not be reached" with a CORS hint, 404 "was not found", 401/403 "could not be accessed"), and any other error by its message. When the part that failed is the thing being loaded (a session file, a track's file) it is said once: "The track was not found (HTTP status 404). / ". A track is named only by a configured name, since one derived from the URL would repeat it. A failed load leaves the browser unchanged, so the caller can carry on with the current genome and tracks. The original error is kept as
cause.Alerts are queued across every dialog on the page, so an alert presented while another is open waits instead of replacing it. Dialogs removed from the page or disposed of are skipped; a dialog not yet attached (a browser created in a detached div) keeps its alert until it is attached and meanwhile doesn't block others. The dialog renders line breaks and sizes itself to its message, scrolling beyond 70% of the viewport height.
Also: hub genomes are loaded through one
loadHubGenomeConfig, which fails as an assembly hub failure; all 2bit reads go throughbuildOptions, so configured headers and tokens are sent on every request.Test plan
npm test(307 passing): genome tests for each optional-part failure and the alias fallbacks, fatal fasta/index/2bit/not-2bit failures, session file failures (missing, not JSON, corrupt, hub without genome), and the load-failure helpers. Tests assert on the error's kind, url and cause, not on message wording.npx eslint jsloadGenome, bad session URL, bad track URL, each showing the message above with line breaks in the igv.js alert and in igv-webapp.bpt: the genome loads from the 2bit's internal index and one alert warns about the index, with the URL and the reason ("was not found (HTTP status 404)" for a same-origin 404; "could not be reached" with the CORS hint for a UCSC 404, whose response has no CORS headers)🤖 Generated with Claude Code