[nu-demo] hero_slides: hardcoded /Volumes/T7 path in dashboard.js — should derive from $CODEROOT #13
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Symptom
Opening Slides island in hero_os shows a default scan path of
/Volumes/T7/code0/hero_slides/examplesin the scan input. This is the maintainer's personal macOS SSD volume name, baked into a static JS file served by hero_slides_ui. Any host that isn't that Mac sees a broken default.See also: hero_slides#29 filed earlier on same topic.
Root cause
hero_slides/crates/hero_slides_ui/static/js/dashboard.js:4073:Static JS can't know the server's
$CODEROOTat runtime. No server-side injection, no defaults endpoint.Demo workaround (applied 2026-04-23 on heronu.gent01.grid.tf)
sed -i 's|/Volumes/T7/code0/hero_slides/examples|/home/driver/hero/code0/hero_slides/examples|g' crates/hero_slides_ui/static/js/dashboard.jsthen rebuilt + restartedhero_slides_ui. Matches the VM's CODEROOT. Not portable.Proper fix
The nu-shell
init mainflow already cascadesDISKS_EXTERNAL→ROOTDIR→CODEROOT = $ROOTDIR/code0into env.hero_slides_uijust needs to surface that to the browser.One of:
index.html. Addscan_path_default: Stringto the template context populated fromstd::env::var("CODEROOT")at request time; emit as<meta name="hero-scan-default" content="{{ scan_path_default }}/hero_slides/examples">or<body data-scan-default="…">. JS reads the meta/data attribute as fallback instead of the hardcoded literal.GET /api/defaultsreturns{"scanPath": "$CODEROOT/hero_slides/examples"}. JS fetches on load.Same treatment needed in any other UI that hardcodes filesystem paths (search the workspace for
/Volumes/to find them).Wider ask
This is one instance of a broader pattern: UIs should derive paths from the Hero env cascade, not hardcoded developer-machine paths. Worth a dedicated architectural pass across
hero_*_uicrates. Either:hero_ui_defaults?) exposingcodroot(),assets_dir(),webdav_storage(), etc., that every_uiuses for browser-side defaults.Env to use
Reference:
ROOTDIRinit mainfromDISKS_EXTERNAL/home/driver/heroCODEROOTinit main=$ROOTDIR/code0/home/driver/hero/code0BUILDDIRinit main=$ROOTDIR/build/home/driver/hero/buildCARGO_TARGET_DIRinit main=$BUILDDIR/cargo/home/driver/hero/build/cargoFiled from the 2026-04-23 nu-shell-stack demo bring-up on
heronu.gent01.grid.tf. Signed-off-by: mik-tfOriginally filed as home#122 on 2026-04-23 by mik-tf — moved to hero_demo as part of consolidating issue tracking.