fix: write expanded HERMES_WEB_DIST back for web_server's raw read

Phase-2 review finding: the validation branch expanduser()s the path but
web_server.py reads os.environ['HERMES_WEB_DIST'] raw at import — a
'~/dist' value would validate here and still 404 there. Write the
expanded path back before the web_server import. Adds a regression test
asserting the env var holds the expanded path after cmd_dashboard.
This commit is contained in:
kshitijk4poor 2026-07-09 14:48:50 +05:30
parent d928017742
commit f5bc18f901
2 changed files with 27 additions and 0 deletions

View file

@ -12092,6 +12092,10 @@ def cmd_dashboard(args):
print(" Pre-build first: npm install --workspace web && npm run build -w web")
print(" Or unset HERMES_WEB_DIST to build and use the default web UI dist.")
sys.exit(1)
# Write the expanded path back: web_server reads HERMES_WEB_DIST raw
# at import (no expanduser), so a validated "~/dist" would otherwise
# pass here and still 404 there.
os.environ["HERMES_WEB_DIST"] = str(_dist_root)
print(f"→ Using web dist from HERMES_WEB_DIST: {_dist_root}")
# Discover and load plugins so any DashboardAuthProvider plugin