From 6fa34b6157a459c2c2be81711e1b4357154387c9 Mon Sep 17 00:00:00 2001 From: Lukas Heumos Date: Wed, 10 Jun 2026 08:36:51 +0200 Subject: [PATCH 1/2] Fix tascCODA always returning insignificant results The arviz 1.0 migration (#911) recomputed the posterior median in `summary_prepare` via `posterior[var_names].median(...).to_dataframe().stack().reindex(summ.index)`. That `stack()` yields a tuple MultiIndex (e.g. `("A", "x", "n0", "alpha")`) that never matches arviz's string row labels (e.g. `"b_tilde[x, n0]"`), so every median silently became NaN. tascCODA decides credibility with `|median| > delta`, so NaN medians made every node effect non-credible regardless of the data. scCODA is unaffected because it selects effects via inclusion probabilities rather than the median. Compute the medians positionally instead, which matches `az.summary`'s row order (by `var_names`, then C-order of each variable's dims) exactly. Also fix `run_hmc`, which passed a JAX PRNG key into `set_init_mcmc_states` where `np.random.default_rng` expects an int seed, raising `TypeError`. Co-Authored-By: Claude Opus 4.8 (1M context) Signed-off-by: Lukas Heumos --- pertpy/tools/_coda/_base_coda.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/pertpy/tools/_coda/_base_coda.py b/pertpy/tools/_coda/_base_coda.py index d929e739..3b6f70fd 100644 --- a/pertpy/tools/_coda/_base_coda.py +++ b/pertpy/tools/_coda/_base_coda.py @@ -556,8 +556,11 @@ def summary_prepare( ) summ = summ.convert_dtypes(dtype_backend="numpy_nullable").infer_objects() + # az.summary orders rows by var_names then C-order of each variable's dims, matching values.flatten(), so align the medians positionally. posterior = arviz_data["posterior"].to_dataset() - summ["median"] = posterior[var_names].median(dim=["chain", "draw"]).to_dataframe().stack().reindex(summ.index) + summ["median"] = np.concatenate( + [posterior[var].median(dim=["chain", "draw"]).values.flatten() for var in var_names] + ) effect_df = summ.loc[summ.index.str.match("|".join([r"beta\["]))].copy() intercept_df = summ.loc[summ.index.str.match("|".join([r"alpha\["]))].copy() From 70c4689522619813891986336a3a31a65366e335 Mon Sep 17 00:00:00 2001 From: Lukas Heumos Date: Wed, 10 Jun 2026 13:04:30 +0200 Subject: [PATCH 2/2] =?UTF-8?q?ci:=20fix=20codecov=20upload=20=E2=80=94=20?= =?UTF-8?q?token=20auth=20+=20bump=20to=20v7?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Two independent breakages in the v6 upload step: 1. Auth: `use_oidc: true` needs an `id-token`, which GitHub won't issue for fork PRs, while tokenless upload is rejected for the repo's own branches ("Token required because branch is protected"). The only config covering both is token auth with a tokenless fork fallback: pass CODECOV_TOKEN, which authenticates same-repo runs, while fork PRs get an empty secret and fall back to tokenless (the case tokenless is actually allowed). Drop `use_oidc`. 2. GPG: intermittent "Can't check signature: No public key" came from the uploader fetching its signing key from Codecov's deleted keybase account. v7 migrates the key to `codecovsecops`, fixing verification at the source. Co-Authored-By: Claude Opus 4.8 --- .github/workflows/test.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 4dc249b2..35db4162 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -89,10 +89,10 @@ jobs: uvx hatch run ${{ matrix.env.name }}:cov-report # report visibly uvx hatch run ${{ matrix.env.name }}:coverage xml # create report for upload - name: Upload coverage - uses: codecov/codecov-action@v6 + uses: codecov/codecov-action@v7 with: + token: ${{ secrets.CODECOV_TOKEN }} fail_ci_if_error: true - use_oidc: true check: name: Tests pass in all hatch environments