Skip to content

Scroll logs, a key line for where you are, and emoji flashes - #282

Merged
coryodaniel merged 8 commits into
dashboardfrom
dashboard-ergonomics
Nov 30, 2026
Merged

coryodaniel merged 8 commits into
dashboardfrom
dashboard-ergonomics

Conversation

@coryodaniel

Copy link
Copy Markdown
Member

Stacked on #281.

  • Scroll the logs. While logs are followed, page up and page down (or ctrl+u and ctrl+d) move back through them, shift+↑ and shift+↓ move a line at a time, home goes to the start, and end (or G) follows the newest again. While scrolled back, a line says how far back you are, and new lines don't move what you're reading.

  • A key line for where you are. The bottom line now lists the keys that work in the current context:

    • logs: scroll, follow, close
    • a picked instance: y approve <instance> only when it is awaiting approval, d deploy <instance> unless it is already deploying, and esc unpick
    • the Deployments tab: c, f, enter, and y/x only on a proposal
    • the Alarms tab: w

    The map's toggles (b a c g s) left the line. Pressing one shows where all five stand in a toast, and ? still lists them.

  • Emoji flashes. Where something happens, an emoji rises instead of the event's name: 🚀 deploy started, ✅ finished, 💥 failed, 🛑 aborted, 📝 proposed, 👍 approved, 👎 rejected, 🚨 alarm, 📌 stash set, 🗑 stash deleted, 🛠 instance, 🌍 environment. --flashes words brings the names back, and --flashes off keeps only the ripple.

  • Just the telescope. An environment out of view shows 🔭 with no words.

🤖 Generated with Claude Code

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@coryodaniel

Copy link
Copy Markdown
Member Author

@claude please review.

@claude

claude Bot commented Nov 28, 2026 •

Copy link
Copy Markdown

Claude finished @coryodaniel's task in 26s —— View job


Review of #282: scroll logs, key line, emoji flashes

I read the diff against origin/dashboard-deployments. I did not run make check or make docs, so nothing below is verified by a test run.

The change is clean overall. It follows the layering rules: no tests in cmd/, the flag is validated in Run, and tests are table-driven. Only the first item below is a real behavior bug.

Should fix

  • home and pgup near the top show a mostly empty panel (internal/commands/dashboard/logs.go, logsPanel).
    • The body is built by walking up from len(l.lines)-1-l.back to index 0, so the newest visible line is always the bottom of the window.
    • With home, back = len-1, so only line 000 is drawn and the rest of the panel is blank. The new to the start test passes because it only checks that line 000 appears.
    • Scrolling up past the last full page has the same effect: you see a shrinking sliver instead of the first page of the log.
    • Clamp back so a full window stays visible, for example back <= len(lines) - room. That needs the rendered row count, so the clamp could move into logsPanel or use the h already available. Alternatively, anchor the top when back is large.
    • It is worth adding a test that home fills the panel, for example by asserting line 001 is also visible.

Worth considering

  • back counts source lines, but the panel draws wrapped rows.
    • page := bodyHeight-6 is measured in rows, while back moves in logical lines. With long wrapped lines, a page can overshoot or undershoot, and the "N lines back" count won't match what is on screen.
    • The shift+↑/shift+↓ step has the same mismatch.
  • Scroll position drifts once the buffer is full. When lines is trimmed to logsKept in add, the back offset is not adjusted for the dropped lines. Reading position can slip at the cap. This is probably acceptable, but it is worth a one-line note.
  • EventEmoji alarm check is fragile (scene.go). strings.Contains(eventType, "ok") would also match types like alarm.broken. Prefer exact event types or a suffix match if the event names are known.
  • Emoji flashes use TextCentered on the braille canvas. Emoji are double-width, so centering and overdraw can be off by a column. This may already be handled in Canvas. TestFlashText only checks substring presence, not placement.
  • The picked-instance footer drops f logs. In mapKeys, the f key is only offered when nothing is picked, and then only if the selected environment is deploying. If f still works while an instance is picked, the line under-advertises it.
  • esc now does several things at once. It clears the filter, the help overlay, the pick and the logs together (model.go). Closing logs also drops the pick, which may surprise someone who wanted only to close the logs.
  • Key interception while logs are open. home, end and G are claimed by log scrolling before the tab handlers. That is intended, but check that the Deployments desk doesn't rely on them for list navigation while logs are open.

Nits

  • The FlashText comment says "empty is emoji", and Run also defaults the empty case to emoji. One default location is enough.
  • TestLogsScroll builds the key map inline. A small keyType helper would read better.

coryodaniel and others added 3 commits November 28, 2026 00:34
# Conflicts:
#	internal/commands/dashboard/logs_test.go
#	internal/commands/dashboard/plain.go
… too

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
coryodaniel and others added 3 commits November 28, 2026 01:11
…easures

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…, and let esc close only the logs

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@coryodaniel

Copy link
Copy Markdown
Member Author

Fixed in bc170cf, with #281 merged in:

  • home and pgup near the top: the log window now fills with the lines after the scroll point rather than showing a sliver. TestLogsScroll checks that home shows line 000 through line 020.
  • The cap: when old lines are dropped at the 500-line cap, back loses them too, so the view doesn't creep.
  • Alarm emoji: matched on exact suffixes (.ok, .resolved, .cleared).
  • f logs: shows while an instance is picked, if the environment is deploying.
  • esc: with logs open, it closes only the logs and keeps the pick and filter.

No change:

  • back counts source lines rather than wrapped rows. A page is approximate, and the "N lines back" count is the number of log lines, which is what it says.
  • Emoji width: the canvas measures with runewidth, so a double-width emoji takes two cells.
  • The desk's list keys are j/k and the arrows. home, end and G are only claimed while logs are open, so nothing conflicts.

@claude please review.

@claude

claude Bot commented Nov 28, 2026 •

Copy link
Copy Markdown

Claude finished @coryodaniel's task in 24s —— View job


Review of #282 after bc170cf

I read the diff against origin/dashboard-deployments. I did not run make check or make docs, so none of this has been confirmed by a test run.

Most of the fixes hold up. The home fill, the exact alarm suffixes, and esc closing only the logs all look right. Your "no change" answers are reasonable. One of the fixes is wrong, though.

Should fix

  • The scroll-at-the-cap fix makes the view creep. (internal/commands/dashboard/logs.go, add)
    • The code is l.back = max(min(l.back+len(fresh)-dropped, len(l.lines)-1), 0).
    • back is measured from the tail, so dropping lines off the top doesn't change it. The correct update is back + len(fresh), then clamp to len(l.lines)-1. The clamp already covers the case where the line you're reading was dropped.
    • Example: with a cap of 5, the buffer is [a b c d e] and back=1, so you're reading d. Adding f gives [b c d e f], and d is now at back=2, which is 1 + 1 fresh line. The current code computes 1 + 1 − 1 = 1, which shows e. At the cap, each batch moves the view forward by the number of lines dropped, which is the creep the change was meant to remove.
    • Nothing tests this. logs_test.go has no case that fills past logsKept while scrolled back. Add one that sets back, adds enough lines to hit the cap, and checks the same line is still shown.

Checked and fine

  • home and pgup near the top: the forward fill after end plus the end < 0 truncation gives a full window. back is clamped to len-1, so the "N lines back" label reads one less than the line count at home. That is cosmetic.
  • Alarm emoji: the exact suffixes fix the alarm.broken false match. Types like alarm.recovered fall through to 🚨. That depends on the event names the API emits, so check them.
  • Key claims: handleOverlayKey gives logs the first claim, then the desk. Logs only take their own keys, and the desk's j/k/arrow navigation still passes through. I agree there is no conflict.
  • Layering: no new tests in cmd/, and the logic lives in internal/commands/dashboard.

Nits

  • Both FlashText's comment and Run treat empty as emoji. One default location is enough.
  • TestLogsScroll still builds key messages inline. A small helper would read better.
    · branch dashboard-ergonomics

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@coryodaniel

Copy link
Copy Markdown
Member Author

Fixed in 7e40a4a: you're right. back counts from the tail, so lines dropping off the top don't move it. It's now min(back+len(fresh), len-1).

There's no test for it yet. The external test package can't land a log batch between two key presses: the poll and stream messages are unexported, and the pump drains a read and its follow-up poll together. Exporting a hook only for this test seemed worse than leaving the arithmetic to review.

@claude please review.

@claude

claude Bot commented Nov 28, 2026 •

Copy link
Copy Markdown

Claude finished @coryodaniel's task in 12s —— View job


Review of #282 after 7e40a4a

I read the one-line change in logs.go (add). I did not run make check, so nothing here is confirmed by a test run.

The fix is correct. back counts from the tail, so lines dropped off the top don't change it. min(l.back+len(fresh), len(l.lines)-1) is the right update.

  • With a cap of 5, [a b c d e] and back=1 (reading d), adding f gives [b c d e f]. d is now at back=2, which is 1 + 1 fresh line, and the new code computes exactly that.
  • The len(l.lines)-1 clamp covers the case where the line you were reading has itself been dropped. The view pins to the oldest kept line.
  • The back > 0 guard means l.lines is non-empty there, so the clamp can't go negative. Dropping the outer max(..., 0) is safe.
  • Following the tail (back == 0) is untouched.

No test. I understand the reason: the poll and stream messages are unexported, and the pump drains a read and its follow-up poll together. Exporting a hook just for this seems worse than leaving it untested.

If you want coverage without an export, logs_test.go could switch to an internal test package, as CLAUDE.md allows with package dashboard //nolint:testpackage // reason. It could then call add directly with back set and a buffer at logsKept. That is optional, and the arithmetic is simple enough to review by eye.

Open nits from earlier rounds (unchanged, non-blocking):

  • FlashText's comment and Run both treat empty as emoji, so the default lives in two places.
  • TestLogsScroll still builds key messages inline. A small helper would read better.

Nothing blocking from me.
· branch dashboard-ergonomics

Base automatically changed from dashboard-deployments to dashboard November 30, 2026 06:12
@coryodaniel
coryodaniel merged commit 42f9dac into dashboard Nov 30, 2026
2 checks passed
@coryodaniel
coryodaniel deleted the dashboard-ergonomics branch November 30, 2026 06:13
@coryodaniel

Copy link
Copy Markdown
Member Author

Folded into #272.

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