Skip to content

fix: auto-download UI in viz when bundle is missing#1104

Open
CoronRing wants to merge 3 commits into
mainfrom
fix/viz-auto-download-ui
Open

fix: auto-download UI in viz when bundle is missing#1104
CoronRing wants to merge 3 commits into
mainfrom
fix/viz-auto-download-ui

Conversation

@CoronRing
Copy link
Copy Markdown
Contributor

Summary

Fixes #1103

  • railtracks viz now checks for .railtracks/ui/index.html before starting the server and automatically downloads the UI bundle if it is missing, making railtracks init an optional step rather than a silent prerequisite
  • Switched the path-validity check from FileNotFoundError to OSError so the invalid-filename fallback actually fires on Windows (where bad chars raise OSError errno 22, not FileNotFoundError)

Test plan

  • Delete .railtracks/ui/ and run railtracks viz — bundle should download automatically, browser should load the UI
  • Run railtracks viz with UI already present — should start immediately with no download
  • Run railtracks init then railtracks viz — still works as before

railtracks viz started the server even when .railtracks/ui/ did not
exist, silently serving {"error":"File not found"} on every request
with no indication that railtracks init was required first.

- viz now checks for index.html before starting and downloads the UI
  bundle automatically if missing
- Path validity check switched from FileNotFoundError to OSError so
  the Windows invalid-filename fallback actually fires

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>

create_railtracks_dir()

ui_index = Path(f"{cli_directory}/ui/index.html")
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Let's wait until #1110 is merged, then change this line to

ui_index = resolve_railtracks_home() / "ui" / "index.html"

As now we rely on absolute path generate by the paths/resolve_railtracks_home function.

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.

bug: railtracks viz serves {"error":"File not found"} with no indication that init is required

2 participants