Fix WASM e2e regressions: genetic-code numeric ID and tree-source mount race - #138
Merged
Merged
Conversation
Two regressions in v0.1.0-beta.32 blocking WASM e2e tests. Regression 1: The Bug 4 fix in #136 switched --code to pass the numeric geneticCodeId on the assumption that HyPhy WASM's CLI accepts it. It does not. HyPhy rejects --code 0 with "'0' is not a valid value for parameter 'Choose Genetic Code'", breaking every analysis since beta.32. Revert to passing the descriptive name. The original Bug 4 (multi-word names like 'Vertebrate mitochondrial' getting space-split by aioli) returns, but only affects users who pick a non-Universal code — the proper fix is to pass args as an array to cliObj.exec(cmd, argsArray), which is a larger refactor tracked separately. Regression 2: The Bug 3 fix's reactive switch fired at component mount before any file was loaded. At that point treeStore is empty, so hasInferredTree is false and selectedTreeSource gets switched away from 'inferred'. When the user later loads a file with a valid NJ tree, the state is stuck at 'upload-new' and clicking Run throws "No uploaded tree file available". Gate the reactive on $fileMetricsStore so it only runs after datareader has completed.
6 tasks
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
Two regressions in v0.1.0-beta.32 (PR #136) blocking WASM e2e tests. Caught by the failing `FEL analysis end-to-end` job — screenshot showed the analysis crashing with `HyPhy error: '0' is not a valid value for parameter 'Choose Genetic Code'`, which led to the second regression once the first was fixed.
Regression 1 — `--code` numeric ID rejected by HyPhy
The Bug 4 fix in #136 switched `--code` from passing the descriptive name to passing the numeric `geneticCodeId`, on the assumption (taken from `BackendAnalysisRunner`) that HyPhy accepts numeric codes. It does not. HyPhy WASM rejects `--code 0` with `'0' is not a valid value for parameter 'Choose Genetic Code'`, breaking every analysis since beta.32.
Revert to passing the descriptive name. The original Bug 4 (multi-word names like `'Vertebrate mitochondrial'` getting space-split by aioli's `exec()` into `--code Vertebrate` + stray `mitochondrial`) returns, but only affects users who pick a non-Universal code.
Proper fix tracked separately: refactor `WasmAnalysisRunner.js` to pass args as an array to `cliObj.exec(cmd, argsArray)` instead of building a single space-joined string. The aioli worker source confirms this bypasses the split entirely.
Regression 2 — tree-source auto-switch race
The Bug 3 fix added a reactive in `AnalyzeTab.svelte` to switch `selectedTreeSource` away from `'inferred'` when `hasInferredTree` was false. That reactive fired at component mount, before any file was loaded. At that point `treeStore` is empty and `hasInferredTree` is false, so it switched the state to `'upload-new'`. When the user then loaded a file with a valid NJ tree, the state was stuck and clicking Run threw "No uploaded tree file available".
Gate the reactive on `$fileMetricsStore` so it only runs after datareader has completed. At that point `treeStore` has been populated (in the same synchronous block as `fileMetricsStore.set`), so the reactive sees the correct `hasInferredTree` value.
Test plan
Follow-up