Conversation
…29) `vepyr.annotate(pick_order=...)` accepted a Python list but silently ignored it: the value was stored verbatim into the options dict and the Rust boundary read it with `serde_json::Value::as_str()`, which returns `None` for a JSON array, so the engine fell back to its default pick order with no error or warning. A one-character type mistake therefore produced ~14.7% wrong `--pick_allele` output that looked plausible. Normalize `pick_order` at the Python boundary (in `annotate`): a list/tuple of terms is joined into the comma-separated string VEP's `--pick_order` parses; a plain string passes through unchanged; any other type now raises a clear `TypeError` instead of being dropped. Add unit tests (list -> comma-string round-trip in the options JSON; bad-type raises) alongside the existing pick-forwarding test. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_016fyjA7HKbWrUvNVqtrgHWH
|
@claude pls review |
|
@codex pls review |
|
Claude finished @mwiewior's task in 1m 38s —— View job Claude's Review
Summary: This fix correctly addresses the silent-drop bug. I traced it end-to-end: FindingsCorrect & well-tested
Minor nits (non-blocking)
Neither affects correctness; both are cosmetic. Not verified: I was unable to execute Overall: solid, minimal, well-targeted fix that closes a real correctness gap (~14.7% wrong |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: cd999fc2c8
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| if pick_order_str: | ||
| opts["pick_order"] = pick_order_str |
There was a problem hiding this comment.
Reject empty pick-order lists instead of falling back
When a caller supplies a programmatically constructed pick_order=[], it satisfies the new list[str] annotation and passes the all(...) validation, but joins to an empty string and is omitted by this guard. The engine then silently uses its default ranking—the same plausible-but-wrong fallback this change is intended to prevent. Reject empty lists (and empty terms), or otherwise ensure they cannot silently select the default order.
Useful? React with 👍 / 👎.
Fixes #29.
Root cause (by symbol)
annotate()insrc/vepyr/__init__.pystoredpick_orderinto the optionsdict verbatim (
if pick_order: opts["pick_order"] = pick_order). On the Rustside,
annotate_vcfinsrc/annotate.rsreads it withopts.get("pick_order").and_then(|v| v.as_str()).serde_json::Value::as_str()returns
Nonefor a JSON array, so a listpick_orderwas silentlydiscarded and the engine fell back to its default pick order — no
exception, no warning. Per #29 this produced ~14.7% wrong
--pick_alleleoutput that looked entirely plausible (list output was byte-identical to
None).Fix (Python boundary, minimal)
Normalize
pick_orderwhere it is consumed inannotate():str→ passed through unchanged;list/tupleofstr→ joined into the comma-separated string VEP's--pick_orderparses (the natural Python shape callers reach for);TypeErrorinstead of being silentlydropped.
This matches VEP semantics (
--pick_orderis a comma-separated list of terms)and fails loudly on an unparseable value, as the issue requested. The type hint
becomes
str | list[str] | Noneand the docstring is updated.Verification
Built with the fix (
maturin develop) and ran a real--pick_alleleannotation over the chr1 golden cache (100 variants), comparing the picked CSQ
Featureper variant under differentpick_ordershapes:The
list vs default = 70(was0before the fix) is the exact #29 signature,now inverted: the list is applied instead of dropped.
Tests
test_pick_order_list_is_joined_to_comma_string— a list round-trips to thecomma-string in the options JSON (regression guard for the silent drop).
test_pick_order_invalid_type_raises— a non-str/list raisesTypeError.test_pick_options_forward_to_vcf_writerstill passes.pytest -k "pick_order or pick_options"→ 3 passed.🤖 Generated with Claude Code
1. The base branch is
master, notdev-test. The body above says it targetsdev-test"per the repo's PR policy (nevermaster)". It actually targetsmaster— retargeted deliberately on 2026-07-26 so the diff is reviewable in isolation (2 files). To be unambiguous: this is a review PR only. I will not merge it; merging intomasteris your call alone.2. The verification claim is not gate-backed. "Built with the fix and ran…" was a manual run I did myself, not the
dual-gt-gate (chr22)verdict. The gate status on this head is apendingfrom a run that was cancelled, so this PR currently has no green gate. A fresh gate run was dispatched on 2026-07-27 after fixing a poller bug that had been silently skipping this PR (a cancelled run left a permanentpending, which the dedup logic read as "already gated" — so this SHA was never re-checked for ~24 h).Also note
vepyr-gt-validationhad a bug until this morning where a cancelled gate run postedstate=successwithout measuring anything; treat any pre-2026-07-27 gate green in these repos as unreliable.