Skip to content

Fix WASM e2e regressions: genetic-code numeric ID and tree-source mount race - #138

Merged
stevenweaver merged 1 commit into
mainfrom
fix/analyze-tab-tree-source-race
Jun 9, 2026
Merged

Fix WASM e2e regressions: genetic-code numeric ID and tree-source mount race#138
stevenweaver merged 1 commit into
mainfrom
fix/analyze-tab-tree-source-race

Conversation

@stevenweaver

Copy link
Copy Markdown
Member

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

  • All 201 unit tests pass
  • All 3 WASM e2e tests pass locally (`npx playwright test e2e/07-wasm-analysis.spec.js --project=chromium`)
  • Failing test `FEL analysis end-to-end` now passes (31.2s)

Follow-up

  • Open a separate issue: refactor `WasmAnalysisRunner.js` to pass args as an array to `cliObj.exec(cmd, argsArray)` so multi-word genetic codes (and any other multi-word value) work correctly. This is the right fix for the original Bug 4.

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.
@stevenweaver
stevenweaver merged commit c09d9a2 into main Jun 9, 2026
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant