Group auto-launch: a specimen/patient analysis suppresses later per-sample launches, and a failure on the last file logs no event

Open
#2,924 2 comments 0 reactions 0 assignees View on GitHub

Maintainers usually reply within 1 day

Nobody has claimed this yet.

Assessment

Difficulty
4/5
Estimated time
3-5 days
Newbie friendliness
48/100
Issue type
Bug
Clarity
Mostly clear
Activity status
Active
Tech stack
django, python
Domain
backend, testing

Research direction

Start with analysis/tasks/auto_analysis_tasks.py:auto_run_analyses_for_vcf, analysis/auto_launch.py:auto_launch_analysis_templates_for_sample, and the import handlers in analysis/signals/signal_handlers.py. Trace template run records and group completeness for both successful and failed imports, including failures before BackendVCF creation. Add or run focused tests for the re-sent sample and last-file failure cases; done means launches are checked per template and blocked group launches log a warning.

Written by the indexing model from the issue text.

Description

🤖 Written by Claude

Two bugs in the group-level (Extraction / Specimen / Patient) auto-launch added in #2898, found in agent testing (https://github.com/SACGF/variantgrid/issues/2898#issuecomment-7187938517).

1. A group analysis stops later per-sample launches in that group

analysis/tasks/auto_analysis_tasks.py:auto_run_analyses_for_vcf passes skip_already_analysed=True, and analysis/auto_launch.py:auto_launch_analysis_templates_for_sample returns early if get_related_analysis_details_for_samples finds any analysis covering the sample. A Specimen-level sample node covers every sample in the specimen. So once the group analysis exists, a VCF for that specimen gets no per-sample analysis from a Sample-level rule, whether it's a re-sent file or a second sequencing run on the same specimen.

Repro: a Specimen-level rule and a Sample-level rule on the same kit. Import every file for a specimen (one group analysis, one analysis per sample), then re-send one file. The re-sent sample gets no per-sample analysis.

Proposed: decide "already analysed" per template, i.e. whether this template already ran for this sample (SampleAnalysisTemplateRun), rather than whether any analysis covers the sample.

2. No event when the file that blocks a launch is the last to arrive

The group completeness check (and its "Not launching … failed imports: …" warning event) only runs on import success and on a late link (analysis/signals/signal_handlers.py:handle_vcf_import_success, handle_sample_saved). When the last file to arrive for a group fails, nothing runs the check, so no event is logged and the missing analysis is silent. #2898 says a blocked launch should always be visible.

Repro: register four files for a specimen and import three successfully, then make the fourth fail (e.g. REF mismatch). No analysis appears (correct), but there's no warning event.

Proposed: also run the group check when a VCF import fails. Related, from reading the code only: a file that fails before the header step creates no BackendVCF, so the group check counts it as "waiting" rather than failed. Check that case too.

A minor one: when an earlier file failed, the warning is logged once for each later successful import (twice in the test). Logging it once per (template, group, run) would be enough.

Dominant language
Python
Stars
31
Forks
4
Avg merge
4h 52m
Merged PRs (30d)
183

Getting set up

This project ships no dev container, Dockerfile or contributing guide, so setting up is up to you: start from its README, and see our first-contribution guide for the general steps.

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from SACGF/variantgrid

All issues in SACGF/variantgrid

Similar issues

More Python issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.