Skip to content

feat(tui): mark dev runtime with a DEV badge in the dashboard header#108

Merged
TraderSamwise merged 2 commits into
masterfrom
aimux-dev-ui
Jun 7, 2026
Merged

feat(tui): mark dev runtime with a DEV badge in the dashboard header#108
TraderSamwise merged 2 commits into
masterfrom
aimux-dev-ui

Conversation

@TraderSamwise

@TraderSamwise TraderSamwise commented Jun 7, 2026

Copy link
Copy Markdown
Owner

Summary

Makes the dev lane visually obvious in the TUI dashboard so it can't be confused with prod.

  • Header shows a high-contrast DEV badge (bold black-on-yellow) and a yellow rule, only in the dev lane. Prod is unchanged.
  • Threads an isDevRuntime flag through the dashboard view model, set from isDevelopmentRuntime().

Hardened lane detection

The previous check relied solely on AIMUX_ENV === "development". Given the recent runtime env-targeting work (a1e8206), launcher-env.ts normalizes four signals together and treats any one dev signal as the dev lane. isDevelopmentRuntime() now mirrors that multi-signal logic — AIMUX_ENV, resolved AIMUX_HOME (~/.aimux-dev), AIMUX_DAEMON_PORT (43191), or AIMUX_WEB_APP_URL (http://localhost:8081) — so the badge survives a single var being unset.

Tests

  • Unit tests for each detection signal plus prod default.
  • Renderer test asserts the badge shows only when isDevRuntime is true.
  • tsc clean; related vitest suites pass.

🤖 Generated with Claude Code

Summary by CodeRabbit

Release Notes

  • New Features

    • Added a visual "DEV" badge indicator in the dashboard header when running in a development environment, making it easier to distinguish development deployments.
    • Improved development runtime detection with support for additional environment configuration signals.
  • Tests

    • Expanded test coverage for runtime environment detection and dashboard rendering behavior.

Make the dev lane visually obvious so it can't be confused with prod.
The header shows a high-contrast DEV badge and a yellow rule only when
the runtime is the dev lane.

Harden lane detection: isDevelopmentRuntime now mirrors launcher-env's
multi-signal logic (AIMUX_ENV, AIMUX_HOME, AIMUX_DAEMON_PORT,
AIMUX_WEB_APP_URL) instead of relying on AIMUX_ENV alone, so the badge
survives a single var being unset.

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

vercel Bot commented Jun 7, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
app Ready Ready Preview, Comment Jun 7, 2026 10:11am

@coderabbitai

coderabbitai Bot commented Jun 7, 2026

Copy link
Copy Markdown

Review Change Stack

Warning

Review limit reached

@TraderSamwise, we couldn't start this review because you've reached your PR review rate limit.

More reviews will be available in 10 minutes and 54 seconds. Learn how PR review limits work.

Your organization has run out of usage credits. Purchase more in the billing tab.

⌛ How to resolve this issue?

After more reviews become available, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

We recommend that you space out your commits to avoid hitting the rate limit.

🚦 How do rate limits work?

CodeRabbit enforces hourly rate limits for each developer per organization.

Our paid plans include higher PR review limits than trial, open-source, and free plans. In all cases, reviews become available again over time. During sustained high-volume PR review activity, CodeRabbit may temporarily slow when the next review becomes available.

Please see our Fair Usage Limits Policy for further information.

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: e4fe398c-7692-48f3-b59f-84163b98d7d9

📥 Commits

Reviewing files that changed from the base of the PR and between ce9745f and de14689.

📒 Files selected for processing (2)
  • src/connection-targets.test.ts
  • src/tui/screens/dashboard-renderers.test.ts
📝 Walkthrough

Walkthrough

This PR expands development runtime detection beyond a single environment variable check to examine multiple signals (home directory path, daemon port, web app URL), threads the detection result through the dashboard data model, and renders a "DEV" badge in the TUI header when operating in development mode.

Changes

Development Runtime Detection and Dashboard Badge

Layer / File(s) Summary
Expanded isDevelopmentRuntime() detection
src/connection-targets.ts
isDevelopmentRuntime() now normalizes AIMUX_HOME values (including ~ and ~/... forms) and checks AIMUX_ENV, AIMUX_HOME match, AIMUX_DAEMON_PORT, and AIMUX_WEB_APP_URL pointing at localhost. Dev-specific constants DEV_HOME and DEV_DAEMON_PORT are introduced.
Development runtime detection test coverage
src/connection-targets.test.ts
Test environment setup captures AIMUX_HOME and AIMUX_DAEMON_PORT. New test suite verifies isDevelopmentRuntime() across all signals: no signals (false), AIMUX_ENV="development", dev home path, daemon port, localhost web app URL, and production home path (false).
Dashboard model and data threading
src/dashboard/index.ts, src/multiplexer/dashboard-view-methods.ts
DashboardViewModel adds optional isDevRuntime: boolean field. Dashboard class initializes it to false. dashboard-view-methods imports isDevelopmentRuntime and passes the runtime detection result into dashboard.update() during rendering.
Dashboard TUI header badge rendering
src/tui/screens/dashboard-renderers.ts, src/tui/screens/dashboard-renderers.test.ts
renderDashboardFrame conditionally prepends a "DEV" badge to the title and colors the divider line yellow when isDevRuntime is true. Test verifies the ANSI-styled badge appears only in dev runtime mode.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~12 minutes

Possibly related PRs

  • TraderSamwise/aimux#9: The expanded isDevelopmentRuntime() detection via AIMUX_HOME, AIMUX_DAEMON_PORT, and AIMUX_WEB_APP_URL directly supports the aimux-dev CLI that sets those env vars to create an isolated dev runtime.
  • TraderSamwise/aimux#10: Both PRs modify src/connection-targets.ts and its isDevelopmentRuntime() implementation, which is used to resolve dev vs prod connection target URLs.

Poem

🐰 Development badges bloom bright,
A dev home path glows in the night,
Yellow dividers dance with pride,
When daemon signals coincide,
The dashboard wears its dev disguise!

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 14.29% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The PR title accurately describes the main change: adding a 'DEV' badge to the dashboard header for dev runtime visualization. This is the primary visual/UX change across the changeset.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch aimux-dev-ui

Comment @coderabbitai help to get the list of available commands and usage tips.

@coderabbitai coderabbitai 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.

Actionable comments posted: 1

🧹 Nitpick comments (1)
src/tui/screens/dashboard-renderers.test.ts (1)

205-211: ⚡ Quick win

Consider adding test coverage for the yellow divider.

The test correctly verifies the DEV badge, but the PR description also mentions adding "a yellow rule in the TUI dashboard header" as a feature. Adding an assertion for the yellow ANSI-colored divider would provide more complete coverage of the dev runtime visual indicators.

✅ Suggested additional assertion
   it("shows a DEV badge in the header only for the dev runtime", () => {
     const prod = renderDashboardFrame(baseDashboardViewModel({ isDevRuntime: false }), 120, 40);
     expect(prod.frame).not.toContain(" DEV ");
+    expect(prod.frame).not.toContain("\x1b[33m───"); // No yellow divider in prod
 
     const dev = renderDashboardFrame(baseDashboardViewModel({ isDevRuntime: true }), 120, 40);
     expect(dev.frame).toContain("\x1b[1;30;43m DEV \x1b[0m");
+    expect(dev.frame).toContain("\x1b[33m───"); // Yellow divider in dev
   });
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@src/tui/screens/dashboard-renderers.test.ts` around lines 205 - 211, Add an
assertion to the existing test that checks for the yellow divider ANSI sequence
when isDevRuntime is true: in the "shows a DEV badge..." test (which calls
renderDashboardFrame and baseDashboardViewModel) assert that the rendered frame
contains the expected yellow rule/divider escape sequence (the same style used
for the header divider in the TUI) in addition to the existing DEV badge
assertion so the dev runtime visual indicator is covered.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@src/connection-targets.test.ts`:
- Around line 85-89: Add explicit tests that exercise tilde expansion by setting
process.env.AIMUX_HOME to the literal strings "~/.aimux-dev" and "~" (not the
expanded homedir path) before calling clearLaneEnv() and isDevelopmentRuntime();
assert that "~/.aimux-dev" normalizes to the user's homedir + "/.aimux-dev" and
therefore makes isDevelopmentRuntime() return true, and assert that "~"
normalizes to the homedir (and does not falsely detect the dev lane unless
homedir itself is ".aimux-dev"). Reference normalizeHome and
isDevelopmentRuntime when adding these cases in connection-targets.test.ts.

---

Nitpick comments:
In `@src/tui/screens/dashboard-renderers.test.ts`:
- Around line 205-211: Add an assertion to the existing test that checks for the
yellow divider ANSI sequence when isDevRuntime is true: in the "shows a DEV
badge..." test (which calls renderDashboardFrame and baseDashboardViewModel)
assert that the rendered frame contains the expected yellow rule/divider escape
sequence (the same style used for the header divider in the TUI) in addition to
the existing DEV badge assertion so the dev runtime visual indicator is covered.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 18c3e80a-4e5d-4513-b2a2-489ccaa19ba2

📥 Commits

Reviewing files that changed from the base of the PR and between cf6e311 and ce9745f.

📒 Files selected for processing (6)
  • src/connection-targets.test.ts
  • src/connection-targets.ts
  • src/dashboard/index.ts
  • src/multiplexer/dashboard-view-methods.ts
  • src/tui/screens/dashboard-renderers.test.ts
  • src/tui/screens/dashboard-renderers.ts

Comment thread src/connection-targets.test.ts
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@TraderSamwise

Copy link
Copy Markdown
Owner Author

@coderabbitai Addressed the yellow-divider nitpick in de14689 — the badge test now also asserts the \x1b[33m yellow rule is present in dev and absent in prod.

@coderabbitai

coderabbitai Bot commented Jun 7, 2026

Copy link
Copy Markdown

Tip

For best results, initiate chat on the files or code changes.

@TraderSamwise: Thanks for the follow-up! Asserting both the presence of \x1b[33m in the dev path and its absence in the prod path gives the test proper symmetry — that's exactly the right way to lock in the divider behavior. 🐇✨


🧠 Learnings used
Learnt from: CR
Repo: TraderSamwise/aimux PR: 0
File: AGENTS.md:0-0
Timestamp: 2026-06-06T13:18:56.821Z
Learning: `aimux-dev` should stay repo-linked for Aimux development with `AIMUX_HOME=~/.aimux-dev`, `AIMUX_DAEMON_PORT=43191`, `AIMUX_ENV=development`, and `AIMUX_WEB_APP_URL=http://localhost:8081`

Learnt from: CR
Repo: TraderSamwise/aimux PR: 0
File: AGENTS.md:0-0
Timestamp: 2026-06-06T13:18:56.821Z
Learning: Applies to src/**/*.ts : Use `aimux-dev` for live source iteration in Aimux development; rebuild with `yarn build` after `src/*.ts` changes

@TraderSamwise
TraderSamwise merged commit e39f203 into master Jun 7, 2026
3 checks passed
@TraderSamwise
TraderSamwise deleted the aimux-dev-ui branch June 7, 2026 10:34
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