Skip to content

Accept modern rootless Terraform DOT input - #72

Merged
Ianyliu merged 2 commits into
mainfrom
agent/fix-issue-45-dot-input
Jul 26, 2026
Merged

Accept modern rootless Terraform DOT input#72
Ianyliu merged 2 commits into
mainfrom
agent/fix-issue-45-dot-input

Conversation

@Ianyliu

@Ianyliu Ianyliu commented Jul 26, 2026

Copy link
Copy Markdown
Owner

Summary

  • add POST /api/graphs/render for JSON DOT rendering with SVG, graph data, and warnings
  • accept valid modern Terraform graphs without the obsolete [root] root node
  • preserve /input and /upload response compatibility
  • return structured 400, 413, and 422 errors for bad input
  • display paste/upload failures inline and remove the reload confirmation flow

Root Cause

The frontend treated [root] root as a required node and dereferenced it even after labeling the graph invalid. Current Terraform versions can emit valid dependency graphs without that historical synthetic node, so pasted output was incorrectly rejected and could trigger a JavaScript error.

User Impact

Users can paste or upload current terraform graph output directly. Invalid, malformed, or oversized input now produces an actionable message within the graph tab instead of a reload prompt.

Validation

  • /tmp/blast-radius-plan-venv/bin/python -m pytest -q — 17 passed, 7 subtests passed
  • actual local Graphviz render through /api/graphs/render — HTTP 200, two nodes
  • node --check blastradius/server/static/js/blast-radius.js
  • Ruff passes for the new regression tests
  • git diff --check main...HEAD
  • coverage includes rootless DOT, legacy input/upload routes, invalid JSON/options/DOT, 2 MiB limit behavior, missing refocus warnings, and inline frontend errors

Compatibility

/input, /upload, /graph.svg, and /graph.json remain available. Legacy form routes retain their SVG/JSON response keys; the new API uses lowercase typed fields and an object-shaped graph value.

Fixes #45

Copilot AI review requested due to automatic review settings July 26, 2026 03:57

Copilot AI 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.

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

@Ianyliu
Ianyliu merged commit ba33277 into main Jul 26, 2026
5 checks passed
@Ianyliu
Ianyliu deleted the agent/fix-issue-45-dot-input branch July 26, 2026 03:59
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.

Pasting output of terraform graph into web interface results in Invalid graph detected!

2 participants