Skip to content

fix(dashboard): derive accepted/drafted totals from the per-depth arrays - #490

Open
dajiaohuang wants to merge 1 commit into
youssofal:mainfrom
dajiaohuang:fix/dashboard-aggregate-accepted-drafted
Open

dajiaohuang wants to merge 1 commit into
youssofal:mainfrom
dajiaohuang:fix/dashboard-aggregate-accepted-drafted

Conversation

@dajiaohuang

Copy link
Copy Markdown

Summary

The Per-depth acceptance subtitle and the Drafted / verify call tile read accepted_drafts and drafted_tokens, which _metrics_envelope does not emit — it emits accepted_by_depth and drafted_by_depth. Both surfaces therefore rendered — accepted of — drafted and 0.00 tok/call while the bars beside them drew real per-depth numbers.

Both now total the per-depth arrays they already receive, through a shared depthTotal helper. The helper still prefers a flat total, so nothing changes if the envelope later carries one.

This is the aggregate half of #401. The Recent requests WHEN column is deliberately untouched: no metrics row persists a completion timestamp (the last_metrics entries carry durations only), so a relative time needs a new field on the envelope and on its request-log row — a server-side contract change rather than a dashboard one.

Verification

  • bun run typecheck (tsc --noEmit): clean.
  • bun run build (tsc -b && vite build): success. The rebuilt mtplx/dashboard/_static is included here; the CSS asset hash is unchanged (index-ZaQvA7xU.css), so only the JS chunk moved.
  • The rebuilt bundle was confirmed inside the wheel from python -m build: it carries assets/index-CUmjZF08.js and no longer carries the stale index-CjL8TS30.js.
  • The derivation was exercised directly against real envelope shapes with bun: per-depth arrays only gives 13 verify calls · 23 accepted of 36 drafted and 2.77 tok/call; an emitted flat total still wins; empty or absent arrays give and 0 drafted · 0 verifies.
  • python -m build: success (mtplx-2.11.2).
  • python -m pytest tests/test_no_mlx_imports.py tests/test_runtime_kpis.py: 13 passed, 8 failed, and all 8 failures are Windows-only artifacts (no mlx; mtplx/thermal.py imports pwd, which does not exist on Windows). The diff changes no .py file. tests/test_public_cli.py cannot be collected on Windows at all (os.geteuid), and CONTRIBUTING's scripts/fresh_venv_smoke.sh expects a POSIX venv layout ($VENV/bin/python), so neither ran here.
  • git diff --check: clean.

Benchmark Evidence

Not applicable — this changes dashboard rendering only, not the runtime path.

… arrays

`_metrics_envelope` emits accepted_by_depth and drafted_by_depth but not
the flat accepted_drafts and drafted_tokens, so the Per-depth acceptance
subtitle rendered "— accepted of — drafted" and the Drafted / verify call
tile rendered 0.00 tok/call with "0 drafted", even though the per-depth
bars beside them had real numbers to draw (issue youssofal#401).

Both surfaces now total the arrays they already receive, through a shared
depthTotal helper that still prefers a flat total if the envelope ever
carries one. The Recent requests WHEN column is left alone: no metrics row
persists a completion timestamp, so rendering it is a server-side contract
change rather than a dashboard fix.

The committed _static bundle is rebuilt from the changed sources; the CSS
asset hash is unchanged, so only the JS chunk moved.
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