From 84456b3689a08029dcedf04d807abf55503b0b24 Mon Sep 17 00:00:00 2001 From: Alberto Miranda Date: Sat, 14 Mar 2026 19:08:32 +0100 Subject: [PATCH 1/8] refactor: Adapt HTML report generator to `fusion doctor` schema v2.0 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Align nf-canary with the key renames from the fusion doctor v2.0 schema: category→severity, cpu_cores→vcpus, memory_gb→memory_capacity_gb, disk_gb→disk_capacity_gb, cores_available→physical_cores+vcpus. - Remove hardcoded heuristics (_CHECK_LABELS, _ACRONYMS, smart_title, _REQUIREMENT_KEYS, _ACTUAL_KEYS) from generate_fusion_report.py; use check_catalog labels and value_key/requirement_key instead - Move extract_actual, extract_reference, humanize_check from Jinja2 filters to globals so they accept multiple arguments in templates - Use check_summary.warnings/criticals for status computation - Update all profile params and YAML keys to match v2.0 names - Update example JSONs to schema v2.0 with catalog and new field names - Update tests for new function signatures and v2.0 fixtures Signed-off-by: Alberto Miranda --- README.md | 8 +- assets/templates/fusion_report_template.html | 26 +- bin/generate_fusion_report.py | 135 +++-- conf/fusion.config | 134 ++--- examples/fusion-doctor-report-degraded.json | 416 ++++++++++++++ examples/fusion-doctor-report-failed.json | 517 +++++++++++++++++ examples/fusion-doctor-report-passed.json | 414 ++++++++++++++ main.nf | 6 +- nextflow.config | 8 +- tests/test_generate_fusion_report.py | 568 ++++++------------- 10 files changed, 1674 insertions(+), 558 deletions(-) create mode 100644 examples/fusion-doctor-report-degraded.json create mode 100644 examples/fusion-doctor-report-failed.json create mode 100644 examples/fusion-doctor-report-passed.json diff --git a/README.md b/README.md index a71ea88..87ba987 100644 --- a/README.md +++ b/README.md @@ -211,15 +211,15 @@ You can override the default requirements using command-line parameters: nextflow run seqeralabs/nf-canary \ --fusion \ --fusion_kernel_version_min "5.10" \ - --fusion_memory_gb_min 8 \ - --fusion_disk_gb_min 100 + --fusion_memory_capacity_gb_min 8 \ + --fusion_disk_capacity_gb_min 100 ``` Available parameters: - `--fusion_kernel_version_min` - Minimum Linux kernel version (e.g., "5.10") -- `--fusion_memory_gb_min` - Minimum memory in GB (e.g., 8) -- `--fusion_disk_gb_min` - Minimum disk space in GB (e.g., 100) +- `--fusion_memory_capacity_gb_min` - Minimum memory in GB (e.g., 8) +- `--fusion_disk_capacity_gb_min` - Minimum disk space in GB (e.g., 100) - `--fusion_cache_path` - Path for Fusion cache directory (default: `/tmp`) - `--fusion_read_write_buckets` - Comma-separated list of read-write bucket URIs - `--fusion_read_only_buckets` - Comma-separated list of read-only bucket URIs diff --git a/assets/templates/fusion_report_template.html b/assets/templates/fusion_report_template.html index d398247..8ed8e58 100644 --- a/assets/templates/fusion_report_template.html +++ b/assets/templates/fusion_report_template.html @@ -1094,13 +1094,13 @@ {% macro check_row(check_name, check_data) %} - {% set actual = check_data.details|extract_actual %} - {% set ref = check_data.details|extract_reference %} + {% set actual = extract_actual(check_data.details, check_data.value_key) %} + {% set ref = extract_reference(check_data.details, check_data.requirement_key) %} {% set actual_val = actual or ('Detected' if check_data.status == 'pass' else '—') %} - {% set display_status = 'warn' if check_data.status == 'fail' and check_data.category == 'warning' else check_data.status %} + {% set display_status = 'warn' if check_data.status == 'fail' and check_data.severity == 'warning' else check_data.status %} {% if check_data.details or check_data.remediation %}{% endif %} - {{ check_name|humanize_check }} + {{ humanize_check(check_name, check_catalog) }} {{ actual_val }} @@ -1123,7 +1123,7 @@
Details
{% if check_data.details is mapping %} {% for key, val in check_data.details.items() %} - {{ detail_label(key, check_data.category|default('')) }} + {{ detail_label(key, check_data.severity|default(''), check_data.requirement_key) }} {{ format_detail_value(val, key) }} {% endfor %} {% else %}
{{ check_data.details|tojson(indent=2) }}
@@ -1258,13 +1258,13 @@