Skip to content

feat(dashboard): operator-cockpit UI — backend/lattice panel, toy/dev/prod banner, validation badges, repro export - #6

Open
ThinkOffApp wants to merge 1 commit into
mainfrom
fix/dashboard-and-safety
Open

feat(dashboard): operator-cockpit UI — backend/lattice panel, toy/dev/prod banner, validation badges, repro export#6
ThinkOffApp wants to merge 1 commit into
mainfrom
fix/dashboard-and-safety

Conversation

@ThinkOffApp

Copy link
Copy Markdown
Owner

Summary

Follow-up to merged PR #5. Implements the UI scope @ether and @Petrus signed off on: dashboard becomes a real operator cockpit instead of a pretty graph.

Built on the same fix/dashboard-and-safety branch (one commit, 7c9de14).

What landed (UI/server, no driver changes)

tools/su2_dashboard_server.py

  • _collect_host_info: chip / RAM / OS / git commit captured once at startup.
  • _read_marker: reads .dashboard_state/<name>.json markers written by validate/crosscheck.
  • _path_outside_repo: flags out_dir that's a symlink or escapes the repo root.
  • /run_info endpoint: returns host info, commit, validation status, plus per-seed meta/progress when ?seed=… is passed.
  • /export_bundle?seed=… endpoint: returns a JSON repro bundle with Content-Disposition: attachment (commit, hostname, chip, ram_gb, os, args, env_summary, seed, lattice, beta, ntherm, nmeas, nskip, R, T, dashboard_metrics_snapshot, etc., 21 keys).

tools/su2_dashboard.html

  • New cockpit strip under the H1 with chips for backend/precision/lattice/β/ntherm/nmeas/nskip/R/T/commit/chip/OS.
  • Toy/Dev/Prod banner (yellow/orange/transparent) derived from lattice and nmeas.
  • Validation badges: synthetic baseline ✓/not-run, CPU↔Metal parity ✓/not-run.
  • ADMIN badge in the corner; tooltip reflects auth mode (token / Tailscale / DISABLED).
  • "⚠ output dir outside repo" pill next to the out_dir when applicable.
  • "Live approximate — Python postprocessor is authoritative." muted label above the existing V(R)/Cornell panel.
  • 📋 Export run bundle button wired to /export_bundle.
  • New CSS scoped to .cockpit* and .live-approx-label. No framework imports.

scripts/validate.sh — writes .dashboard_state/validate_ok.json on success.
scripts/gpu_crosscheck.py — writes .dashboard_state/gpu_crosscheck_ok.json on success.
.gitignore — ignores .dashboard_state/.

Verification (run by the implementing agent)

  • python3 tools/su2_dashboard_server.py --help clean.
  • ./scripts/validate.sh passes; marker file written; baseline_V_R2 ≈ 0.31.
  • Started the server, hit /run_info and /run_info?seed=… — host info + commit + validation present.
  • /export_bundle?seed=… returns 953-byte JSON with all 21 expected keys and Content-Disposition: attachment.

Operator TODOs (left intentionally)

  • precision, nskip, pipeline_label aren't yet emitted in the worker's live/progress JSON, so those chips render -. Worker-side change is out of scope for this PR.
  • _path_outside_repo will correctly flag results/cpu_run when results/ is symlinked to an external volume (/Volumes/T705/...). If that's the normal MacBook setup and the pill is noisy, add an env-var allowlist.
  • gpu_crosscheck.py marker write wasn't end-to-end tested (requires full GPT toolchain + a long run), only the marker-write code path.

Test plan

  • ./scripts/validate.sh produces .dashboard_state/validate_ok.json and dashboard reads "✓ passed".
  • Open dashboard against a real seed; cockpit strip shows correct lattice/β/ntherm/nmeas.
  • Toy/Dev/Prod banner color flips with nmeas thresholds.
  • ADMIN tooltip reads "Auth: DISABLED" when neither Tailscale nor --auth-token is set, "token" or "Tailscale" otherwise.
  • Click 📋 Export — file downloads with the seed in the filename.

🤖 Generated with Claude Code

Adds a top-of-page "cockpit" panel to the SU(2) measurement dashboard
and the supporting backend endpoints to power it.

1. Backend/precision/lattice/run-params chip row (β, ntherm, nmeas,
   nskip, R, T) sourced from progress + live meta. Commit hash, chip,
   RAM, OS collected once at server startup via platform/os/psutil (with
   sysctl fallback when psutil is missing) and exposed via /run_info.
2. TOY/DEV/PROD banner. L_max < 8 -> TOY (yellow); nmeas < 50 -> DEV
   (orange); otherwise PROD (green). Falls through to "Waiting..." when
   meta is empty.
3. Validation status chips. scripts/validate.sh now writes
   .dashboard_state/validate_ok.json; scripts/gpu_crosscheck.py writes
   .dashboard_state/gpu_crosscheck_ok.json. /run_info reports both
   markers; UI renders "passed" or "not run" without fabricating state.
4. ADMIN badge (red) in the banner, shown whenever the server is up.
   Hover surfaces auth mode (token / Tailscale / DISABLED).
5. Output-path warning pill. Server-side check via Path.resolve flags
   symlinked or out-of-repo out_dir values; pill renders next to the
   path in the cockpit chip row.
6. "Live approximate - Python postprocessor is authoritative." label
   above the Cornell V(R) panel (muted, warn-bordered). Numbers and
   existing JS fits are untouched.
7. Repro export button. /export_bundle?seed=<seed> returns a JSON
   bundle (commit, host, chip, ram, os, env, meta, progress header,
   validation markers, last-measurement snapshot); frontend triggers a
   browser download.

Also gitignores .dashboard_state/ so the markers don't get committed.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>

@chatgpt-codex-connector chatgpt-codex-connector Bot 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.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 7c9de14120

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment on lines +228 to +229
if parsed.path == "/run_info":
self.handle_run_info(parsed)

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P1 Badge Require auth before serving /run_info

When --auth-token or Tailscale login allowlisting is enabled, this route still calls handle_run_info without is_authorized, so unauthenticated callers can query /run_info?seed=... and receive meta, progress_header, and out_dir_outside_repo derived from protected run files. That bypasses the access control currently enforced for /results/* and leaks experiment/run metadata (including filesystem path hints) in deployments that rely on result protection.

Useful? React with 👍 / 👎.

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