Skip to content

fix: guard treemap empty-data crash; normalize source_domains/target_modules string→object#38

Merged
simongonzalezdc merged 1 commit into
mainfrom
fix/template-viz-guards
May 26, 2026
Merged

fix: guard treemap empty-data crash; normalize source_domains/target_modules string→object#38
simongonzalezdc merged 1 commit into
mainfrom
fix/template-viz-guards

Conversation

@simongonzalezdc
Copy link
Copy Markdown
Member

@simongonzalezdc simongonzalezdc commented May 26, 2026

  • Treemap: guard against empty source_treemap.data to prevent D3 crash on d.data.name.length
  • Creative DNA Sankey: normalize source_domains/target_modules string entries to {domain, repo_count, total_files} objects to prevent crash on .domain.replace

View with Codesmith Autofix with Codesmith
Need help on this PR? Tag @codesmith with what you need. Autofix is disabled.

Summary by CodeRabbit

  • Bug Fixes
    • Architecture "Source Treemap" chart now displays an informative message when no source structure data is available
    • Universe "Creative DNA Sankey" chart improved to handle various data input formats consistently

Review Change Stack

@simongonzalezdc simongonzalezdc merged commit c5cc881 into main May 26, 2026
2 of 12 checks passed
@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented May 26, 2026

Caution

Review failed

The pull request is closed.

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro Plus

Run ID: de79f246-3ea4-4d8d-a268-46c25f4dc092

📥 Commits

Reviewing files that changed from the base of the PR and between f825557 and df1bc9f.

📒 Files selected for processing (1)
  • archaeology/visualization/template.html

📝 Walkthrough

Walkthrough

The PR adds defensive handling to two visualization charts in the template file. The Source Treemap now checks for an empty modules array and displays a fallback message instead of attempting to render a treemap with no data. The Creative DNA Sankey normalizes its input data by converting raw string entries into structured objects with the expected field shapes before constructing nodes and links.

Changes

Visualization Chart Robustness

Layer / File(s) Summary
Source Treemap empty state handling
archaeology/visualization/template.html
When the computed modules array is empty, the chart displays "No source structure data available" and returns without constructing the D3 treemap.
Creative DNA Sankey input normalization
archaeology/visualization/template.html
dna.source_domains and dna.target_modules string entries are converted to objects with expected fields: { domain, repo_count: 0, total_files: 0 } for sources and { label, domain } for targets.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~8 minutes

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch fix/template-viz-guards

Comment @coderabbitai help to get the list of available commands and usage tips.

@simongonzalezdc simongonzalezdc deleted the fix/template-viz-guards branch May 26, 2026 20:56
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.

1 participant