From 7721b46c0f6d24586322a50cf3cdfdca2e00819d Mon Sep 17 00:00:00 2001 From: an-altosian Date: Tue, 19 May 2026 20:54:40 +0000 Subject: [PATCH] fix(multiplex-quant): auto-download chemistry registry on first use MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Previously, the first invocation of `simpleaf multiplex-quant --chemistry ` would bail with "Chemistry registry not found at . Run `simpleaf chemistry refresh` first." when `chemistries.json` did not already exist under `$ALEVIN_FRY_HOME`. `simpleaf quant` does not have this requirement — it resolves chemistry via `get_single_custom_chem_from_file` → `parse_resource_json_file`, which transparently downloads the registry from `CHEMISTRIES_URL` on first miss. Replace the explicit bail in `multiplex_map_and_quant` with the same `prog_utils::download_to_file(CHEMISTRIES_URL, &chem_path)` call that `parse_resource_json_file` itself uses, so multiplex-quant's first-use UX matches `quant`'s. --- src/simpleaf_commands/multiplex_quant.rs | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/src/simpleaf_commands/multiplex_quant.rs b/src/simpleaf_commands/multiplex_quant.rs index 84f4d60..6ec60fa 100644 --- a/src/simpleaf_commands/multiplex_quant.rs +++ b/src/simpleaf_commands/multiplex_quant.rs @@ -11,7 +11,7 @@ use crate::core::{context, exec, index_meta}; use crate::simpleaf_commands::MultiplexQuantOpts; use crate::utils::af_utils::IndexType; use crate::utils::chem_utils::{CustomChemistry, CustomChemistryMap}; -use crate::utils::constants::CHEMISTRIES_PATH; +use crate::utils::constants::{CHEMISTRIES_PATH, CHEMISTRIES_URL}; use crate::utils::probe_utils; use crate::utils::prog_parsing_utils; use crate::utils::prog_utils; @@ -247,10 +247,7 @@ pub fn multiplex_map_and_quant(af_home: &Path, opts: MultiplexQuantOpts) -> anyh let chem: Option = if let Some(ref chem_name) = opts.chemistry { let chem_path = af_home.join(CHEMISTRIES_PATH); if !chem_path.exists() { - bail!( - "Chemistry registry not found at {}. Run `simpleaf chemistry refresh` first.", - chem_path.display(), - ); + prog_utils::download_to_file(CHEMISTRIES_URL, &chem_path)?; } let chem_file = std::fs::File::open(&chem_path)?; let chem_map: CustomChemistryMap = serde_json::from_reader(chem_file)