Skip to content

refactor: Adapt HTML report generator to fusion doctor schema v2.0 - #47

Merged
alberto-miranda merged 8 commits into
mainfrom
refactor-html-generator
Mar 20, 2026
Merged

refactor: Adapt HTML report generator to fusion doctor schema v2.0#47
alberto-miranda merged 8 commits into
mainfrom
refactor-html-generator

Conversation

@alberto-miranda

@alberto-miranda alberto-miranda commented Mar 14, 2026

Copy link
Copy Markdown
Contributor

Summary

This PR refactors the HTML report generator to adapt it to the fusion doctor v2.0 JSON schema. The v2.0 extends the schema with information that the HTML reporter previously had to guess, which simplifies/removes most of the internal heuristics we were using for displaying information.

Changes

  • 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 from schema 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
  • Rename all keys to match fusion doctor v2.0 schema: categoryseverity, cpu_coresvcpus, memory_gb_minmemory_capacity_gb_min, disk_gb_mindisk_capacity_gb_min, cores_availablephysical_cores+vcpus
  • Update profile params, example JSONs, and tests accordingly

Test plan

  • python -m pytest tests/test_generate_fusion_report.py -v — 77 tests pass
  • HTML generation from all three example JSONs (passed/failed/degraded) succeeds
  • Generate report from real fusion doctor --format json v2.0 output
  • Visual check: catalog labels render correctly (e.g. "vCPUs" not "Cpu Vcpus")

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 <alberto.miranda@seqera.io>
Update test fixtures to use lowercase catalog labels matching real
output: "FUSE device", "disk capacity", "bucket read-write access",
"open files limit".

Signed-off-by: Alberto Miranda <alberto.miranda@seqera.io>
…a v2.0

Signed-off-by: Alberto Miranda <alberto.miranda@seqera.io>
- Filter out checks with status=skip in prepare_template_context
- Exclude skipped count from total_checks in the overview donut chart
- Untrack example JSON files (managed outside git)
- Pass through catalog labels as-is (capitalization handled upstream)

Signed-off-by: Alberto Miranda <alberto.miranda@seqera.io>
The function handles strings too, not just numbers.

Signed-off-by: Alberto Miranda <alberto.miranda@seqera.io>
Show catalog descriptions as dark tooltips on hover over check names
in all three sections (system, storage, object storage). Pure CSS
implementation — no icons, no JS.

Signed-off-by: Alberto Miranda <alberto.miranda@seqera.io>
- Show Yes/No for sub-check results instead of raw messages
- Display errors in a separate row with red background
- Short errors shown inline, long errors with expand/collapse toggle
- Skip sub-checks with status=skip
- Add check_description helper for catalog tooltips

Signed-off-by: Alberto Miranda <alberto.miranda@seqera.io>
- Fix bug where a later report's criticals:0 could overwrite an earlier
  critical failure detection
- Deduplicate all_checks list construction in prepare_template_context
- Hoist _SEVERITY_ORDER constant and markupsafe imports to module level
- Cache repeated check_description/sc_catalog calls in template loops

Signed-off-by: Alberto Miranda <alberto.miranda@seqera.io>
@alberto-miranda
alberto-miranda marked this pull request as ready for review March 16, 2026 16:40
@alberto-miranda alberto-miranda self-assigned this Mar 16, 2026
@alberto-miranda alberto-miranda changed the title refactor: Adapt HTML report generator to fusion doctor schema v2.0 refactor: Adapt HTML report generator to fusion doctor schema v2.0 Mar 16, 2026
@alberto-miranda

Copy link
Copy Markdown
Contributor Author

@adamrtalbot Minor changes to benefit from new schema, no refactoring towards dataclasses/Pydantic yet

@jonmarti jonmarti left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, but could you add some screenshot/s?

@alberto-miranda

alberto-miranda commented Mar 16, 2026

Copy link
Copy Markdown
Contributor Author

LGTM, but could you add some screenshot/s?

there's no major aesthetic changes from #42, so the screenshots there still apply.

@adamrtalbot

Copy link
Copy Markdown
Collaborator

@alberto-miranda feel free to merge.

@alberto-miranda
alberto-miranda merged commit 61cc930 into main Mar 20, 2026
3 checks passed
@alberto-miranda
alberto-miranda deleted the refactor-html-generator branch March 20, 2026 09:07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants