Skip to content

fix(dashboard): make the LiveView dashboard start and render - #2

Merged
developerfred merged 1 commit into
chore/repo-hygienefrom
fix/dashboard-liveview
Oct 18, 2026
Merged

developerfred merged 1 commit into
chore/repo-hygienefrom
fix/dashboard-liveview

Conversation

@developerfred

@developerfred developerfred commented Oct 18, 2026 •

Copy link
Copy Markdown
Owner

Stacked on #1 (base is chore/repo-hygiene); retarget to main after #1 merges.

Problem

Every dashboard page returned 500, and the dashboard could not actually start:

  • ELIXIR_CLAW_START_DASHBOARD is documented in the README but nothing read it.
  • The endpoint had no port, secret_key_base, pubsub_server, session plug (needed by :fetch_session / CSRF), or error views. The missing ErrorView is what turned every failure into an opaque 500.
  • Layouts.live/1 read @inner_block, but a layout receives @inner_content.
  • The LiveView client JS was never served, so pages could not connect.

Changes

  • ElixirClaw.Dashboard: enabled?/0 and runtime config from env (ELIXIR_CLAW_START_DASHBOARD, _DASHBOARD_HOST, _DASHBOARD_PORT, _SECRET_KEY_BASE). Binds to 127.0.0.1 by default because the dashboard has no authentication; a random secret key is generated when none is set.
  • config/config.exs: compile-time endpoint settings (pubsub_server, render_errors). New ErrorHTML / ErrorJSON modules.
  • Endpoint: Plug.Session, and phoenix.min.js / phoenix_live_view.min.js served straight from the deps (no asset pipeline). Router sets a root layout; Layouts.live/1 becomes Layouts.root/1 with CSRF meta and the LiveSocket bootstrap.
  • README documents the variables. lazy_html added as a test-only dependency (required by LiveView 1.x tests).

Verification

  • mix test: 96 tests, 0 failures (16 :hardware excluded), on macOS and in an elixir:1.19 Linux container; format and --warnings-as-errors clean
  • Started the app with ELIXIR_CLAW_START_DASHBOARD=true: /, /nodes, /approvals, /telemetry, /config, /api/* and both JS assets return 200, unknown paths return 404
  • In the browser the LiveView connects (phx-connected) and the Approve button round-trips without errors
  • GitHub Actions

Known limitations (not addressed here)

  • The pages show demo data from ElixirClaw.DashboardStub; Approve/Reject don't change it.
  • Run it with mix run or a release, not the standalone escript (the JS is served from the deps' priv).
  • ElixirClaw.Registry is keys: :unique, so Events.subscribe/1 only works for one process per key; a second open dashboard tab won't receive events.

The dashboard returned 500 on every page and could not actually start:
ELIXIR_CLAW_START_DASHBOARD was documented but never read, and the endpoint
had no port, secret key base, PubSub, session plug, error views or LiveView
client script. The layout also read @inner_block instead of @inner_content.

Add ElixirClaw.Dashboard (runtime config, localhost by default), compile-time
endpoint config, error views, a root layout that serves the LiveView JS from
the deps, and tests (lazy_html as a test dependency).
@developerfred
developerfred merged commit 1e54dc5 into chore/repo-hygiene Oct 18, 2026
4 checks passed
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