Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions changelog.d/added-merge-banner-time-and-clock-format.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
- The Activity monitor's merge banner now shows the date and time it merged ("11/17 4:12 PM EST") on its head line, in the Display timezone. The time used to sit at the end of the title line, where a long title's ellipsis hid it, and it was the moment the tab noticed the merge rather than the ledger's `merged_at`. Settings → Appearance gains a **Time format** choice (browser locale, 12-hour or 24-hour) that applies to every dashboard time.
4 changes: 3 additions & 1 deletion src/docs/architecture.md
Original file line number Diff line number Diff line change
Expand Up @@ -434,7 +434,9 @@ flowchart LR
`nextKickAt`) and formatted in the browser through the shared display-timezone
helper. Users can choose **Settings → Appearance → Display timezone**:
browser local time (default), the hive server timezone from `/api/status`,
UTC, or an IANA zone.
UTC, or an IANA zone. **Time format** beside it picks the clock for every
dashboard time: the browser locale (default), 12-hour, or 24-hour. Both are
kept per browser in `localStorage`.
- `/api/audit` — recent audit entries for read-write users: dashboard config changes, logins, GitHub App setup changes, and agent lifecycle events such as start, stop, launch failure, pause/resume/kick, add/remove, backend changes, and model changes. Entries are kept in memory and, when `/data` exists, appended to `/data/audit.jsonl` with lumberjack rotation (5 MB files, 3 backups, 90 days).
- The machine-readable dashboard API reference is [dashboard/openapi.json](../../dashboard/openapi.json).
- `/api/events` — Server-Sent Events; the dashboard is pushed a fresh snapshot on
Expand Down
2 changes: 1 addition & 1 deletion src/docs/dashboard-sections/activity-monitor.md
Original file line number Diff line number Diff line change
Expand Up @@ -595,7 +595,7 @@ A thin bar at the top of the tracker — it stays pinned under the card header w

**Click the chip** for a popover of the recent merges — number (linked), title, *by hive* / *by @login*, lane, time — and the 30-day total; it is also where a merged row's trace lives once the row has left. When a PR on the list merges its row does **not** simply vanish on the next refresh: it stays pinned for about 3.5 s, its ✓ cell glows amber, the event line reads *Hive: merged #14947 · by hive*, and — in the operator's words — "an animation originates from the item's row where the check mark is and flies up to the top of the browser border; if the Merged pill is visible the animation stops there, if not we just see it go off the screen": a 🐝 (or **+1**, ⚙ → Merges → *Glyph*, `hive.tracker.celebrate_glyph`) rises out of the ✓ cell for ≈2 s on an ease-out with a slight arc, lands on the chip when the chip's box is inside the viewport (the count rolls up like a mileage odometer — each digit that rose slides up through the digits it passes over ≈0.9 s — with a soft scale-pop, and the merge zap, when sound is on, plays as it lands) or exits through the top edge otherwise (the count still rolls).

On a change only the wheels whose digit changed roll (the rightmost always spins a full turn, carry wheels roll too); the others keep their cell. *N today · N this week* roll the same way, drawn plain; a number that falls (today → 0 at midnight), the first draw after a reload (the tab's last values are remembered in `sessionStorage`, so a reload rolls up from them), and reduced motion swap instantly and the drum stays — the odometer look is the resting state, not an effect of the roll ("where is my odometer look and feel?", after #15409 had sized only the flying bee and drawn the roll as a 900 ms overlay over plain text). The pill's width never changes mid-roll (the drum's cells set it). The roll waits for the bee: while a glyph is in the air nothing on the drum moves — not the day/week line, not a total the server has already raised, not a merge over the flight cap — and the moment the last glyph lands (its `animationend`, or a timer at the flight's length when the event never fires) the drum rolls once to the final numbers and the zap plays; several merges in one flight are one roll, not a queue (#15568: "the odometer should roll only after the bee animation finishes so it looks correlated"). It works at any scroll position (`position: fixed`, `pointer-events: none`). At the same moment a **banner** appears at the bottom right — *✓ #15067 merged — fix: enable bulk delegation… (adopted, by hive, 17:42)* — and stays until dismissed or for twice the configured `toast_info_s` (30 s at the default), draining a countdown bar along its bottom edge, stacked (newest at the bottom, at most five) when several merge together — a banner pushed out of the stack stops its countdown — with **Show row** (scrolls to the row and glows it again; once the row has left, says so and opens the list), **Open on GitHub** and **All merges**. Merge detection survives a reload: the last observed PR states and the merges already announced are kept in `sessionStorage` (`hive.tracker.merge-session.v1`), so an open → merged transition that straddles a reload is still announced, and each merge is announced exactly once per tab.
On a change only the wheels whose digit changed roll (the rightmost always spins a full turn, carry wheels roll too); the others keep their cell. *N today · N this week* roll the same way, drawn plain; a number that falls (today → 0 at midnight), the first draw after a reload (the tab's last values are remembered in `sessionStorage`, so a reload rolls up from them), and reduced motion swap instantly and the drum stays — the odometer look is the resting state, not an effect of the roll ("where is my odometer look and feel?", after #15409 had sized only the flying bee and drawn the roll as a 900 ms overlay over plain text). The pill's width never changes mid-roll (the drum's cells set it). The roll waits for the bee: while a glyph is in the air nothing on the drum moves — not the day/week line, not a total the server has already raised, not a merge over the flight cap — and the moment the last glyph lands (its `animationend`, or a timer at the flight's length when the event never fires) the drum rolls once to the final numbers and the zap plays; several merges in one flight are one roll, not a queue (#15568: "the odometer should roll only after the bee animation finishes so it looks correlated"). It works at any scroll position (`position: fixed`, `pointer-events: none`). At the same moment a **banner** appears at the bottom right — *✓ #15067 merged by 🐝 hive · 11/17 4:12 PM EST — fix: enable bulk delegation… (adopted, by hive)* — and stays until dismissed or for twice the configured `toast_info_s` (30 s at the default), draining a countdown bar along its bottom edge, stacked (newest at the bottom, at most five) when several merge together. The date and time sit on the head line, where a long title cannot clip them; they are the ledger's `merged_at` when it has the PR (otherwise when the tab noticed the merge), in the Display timezone and Time format chosen under Settings → Appearance. A banner pushed out of the stack stops its countdown. Each banner has **Show row** (scrolls to the row and glows it again; once the row has left, says so and opens the list), **Open on GitHub** and **All merges**. Merge detection survives a reload: the last observed PR states and the merges already announced are kept in `sessionStorage` (`hive.tracker.merge-session.v1`), so an open → merged transition that straddles a reload is still announced, and each merge is announced exactly once per tab.

Several merges in one refresh stagger 200 ms apart with at most three glyphs in flight (the rest bump the count without flying); a merged PR that is filtered out or on another page still counts and still gets its banner. Under reduced motion nothing flies: the glyph fades in place, the count bumps, the row glows, the banners appear without sliding. A PR drawn inline on its issue's row (the usual case — one covering PR, no sub-row) celebrates on that issue row: every row stamps the PR keys it draws (`data-ham-prs`) and the SPA remembers each PR's host row from the last payload, so the flight has somewhere to start from even when the merge also closes the issue.

Expand Down
94 changes: 94 additions & 0 deletions src/pkg/dashboard/dashboard_clock_format_test.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,94 @@
package dashboard

import (
"os/exec"
"strings"
"testing"
)

func TestDashboardClockFormatControlExists(t *testing.T) {
html := indexHTML(t)
for _, want := range []string{
"const DASHBOARD_CLOCK_STORAGE_KEY = 'hive-dashboard-clock-format';",
"id=\"dashboard-clock-select\"",
"data-change-action=\"setDashboardClockPreference\"",
"function setDashboardClockPreference(",
"Browser locale (default)",
} {
if !strings.Contains(html, want) {
t.Fatalf("static/index.html missing clock format marker %q", want)
}
}
}

// TestDashboardClockFormatAndMergeBannerTime runs the shipped date helpers
// (not jsFunc's UTC stand-ins) in America/New_York: the Time format choice
// reaches every formatted time, and the merge banner carries the date and
// time on its head instead of at the end of the clipped title line.
func TestDashboardClockFormatAndMergeBannerTime(t *testing.T) {
node, err := exec.LookPath("node")
if err != nil {
t.Skip("node unavailable: clock format helpers were not executed")
}
html := indexHTML(t)
fn := func(name string) string {
src, ok := jsFuncOptional(html, name)
if !ok {
t.Fatalf("index.html does not define %s()", name)
}
return src
}
script := strings.Join([]string{
"const assert = require('node:assert/strict');",
// The helpers format in the runner's default locale; pin en-US so
// an en-GB runner's "4:12 pm GMT-5" does not fail the wording.
"const RealDTF = Intl.DateTimeFormat; Intl.DateTimeFormat = function (locales, opts) { return new RealDTF(locales && locales.length ? locales : 'en-US', opts); };",
"const store ={ 'hive-dashboard-display-timezone': 'America/New_York' };",
"const localStorage = { getItem: k => (k in store ? store[k] : null) };",
jsConstLine(t, html, "DASHBOARD_TIMEZONE_STORAGE_KEY"),
jsConstLine(t, html, "DASHBOARD_TIMEZONE_BROWSER"),
jsConstLine(t, html, "DASHBOARD_TIMEZONE_SERVER"),
jsConstLine(t, html, "DASHBOARD_CLOCK_STORAGE_KEY"),
jsConstLine(t, html, "_dashboardDateFormatters"),
"let _dashboardServerTimeZone = '';",
fn("validDashboardTimeZone"),
fn("browserDashboardTimeZone"),
fn("dashboardTimeZonePreference"),
fn("dashboardClockPreference"),
fn("selectedDashboardTimeZone"),
fn("dashboardDateFormatter"),
fn("formatDashboardDateTime"),
fn("stageTrackerMergedByText"),
fn("stageTrackerMergerText"),
fn("stageTrackerMergeBannerNumber"),
fn("stageTrackerMergeBannerText"),
`
const plain = s => String(s).replace(/[  ]/g, ' ');
const at = Date.UTC(2026, 10, 17, 21, 12); // 4:12 PM EST
const clock = v => { if (v) store[DASHBOARD_CLOCK_STORAGE_KEY] = v; else delete store[DASHBOARD_CLOCK_STORAGE_KEY]; };

clock('');
assert.equal(dashboardClockPreference(), '');
assert.equal(formatDashboardDateTime(at), '11/17 4:12 PM EST', 'default keeps the caller format');
const b = { repo: 'o/r', number: 5, title: 'fix: five', lane: 'hive', merged_by: 'hive', at };
const t = stageTrackerMergeBannerText(b, 0);
assert.equal(t.when, '11/17 4:12 PM EST', 'the banner names date and local time');
assert.equal(t.meta, '(hive, by hive)', 'the clipped title line no longer carries the time');
assert.equal(t.text, 'fix: five (hive, by hive) · merged 11/17 4:12 PM EST');

clock('24');
assert.equal(formatDashboardDateTime(at), '11/17 16:12 EST', '24-hour overrides the caller hour12');
assert.equal(stageTrackerMergeBannerText(b, 0).when, '11/17 16:12 EST');
assert.match(formatDashboardDateTime(Date.UTC(2026, 10, 18, 5, 0)), /^11\/18 0?0:00 EST$/, 'midnight is 00:00, never 24:00');

clock('12');
assert.equal(plain(formatDashboardDateTime(at, { hour: '2-digit', minute: '2-digit', hourCycle: 'h23' })), '04:12 PM', '12-hour overrides a caller 24-hour cycle');

clock('bogus');
assert.equal(dashboardClockPreference(), '', 'an unknown stored value is ignored');
`,
}, "\n")
if out, err := runNodeStdin(node, script); err != nil {
t.Fatalf("node: %v\n%s", err, out)
}
}
4 changes: 2 additions & 2 deletions src/pkg/dashboard/dashboard_idle_work_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -28,10 +28,10 @@ function clearInterval(id) { timers.delete(id); }
function visibility(hidden) { document.hidden = hidden; listeners.visibilitychange(); }
`
script += jsVarLine(t, html, "DASHBOARD_INTERVALS") + "\n" + html[start:end]
for _, name := range []string{"_dashboardDateFormatters", "DASHBOARD_TIMEZONE_STORAGE_KEY", "DASHBOARD_TIMEZONE_BROWSER", "DASHBOARD_TIMEZONE_SERVER", "_dashboardServerTimeZone"} {
for _, name := range []string{"_dashboardDateFormatters", "DASHBOARD_TIMEZONE_STORAGE_KEY", "DASHBOARD_TIMEZONE_BROWSER", "DASHBOARD_TIMEZONE_SERVER", "DASHBOARD_CLOCK_STORAGE_KEY", "_dashboardServerTimeZone"} {
script += jsVarLine(t, html, name) + "\n"
}
for _, name := range []string{"dashboardDateFormatter", "selectedDashboardTimeZone", "dashboardTimeZonePreference", "validDashboardTimeZone", "browserDashboardTimeZone", "animateSparklinePart"} {
for _, name := range []string{"dashboardDateFormatter", "selectedDashboardTimeZone", "dashboardTimeZonePreference", "dashboardClockPreference", "validDashboardTimeZone", "browserDashboardTimeZone", "animateSparklinePart"} {
script += jsFunc(t, html, name) + "\n"
}
script += `
Expand Down
12 changes: 7 additions & 5 deletions src/pkg/dashboard/stage_tracker_cues_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -674,7 +674,9 @@ assert.strictEqual(odoText(n), '33', 'never backwards');
stageTrackerNoteMerges({ items: [], merged: merged(34, [rec(1, 'hive', 'feat: one'), rec(31, 'clubanderson'), rec(30)]) });
assert.strictEqual(odoText(n), '33', 'held back while the glyph flies');
tick(0); assert.strictEqual(flights().length, 1);
assert.ok(banners.children[0].innerHTML.includes('feat: one (hive, by hive, '), 'the banner carries the ledger title and merger: ' + banners.children[0].innerHTML);
assert.ok(banners.children[0].innerHTML.includes('feat: one (hive, by hive) · merged '), 'the banner carries the ledger title and merger: ' + banners.children[0].innerHTML);
// The time is the ledger's merged_at, not the poll that noticed it, and rides the head line.
assert.ok(banners.children[0].innerHTML.includes('<time class="merge-banner-when" datetime="' + new Date(clock - 60000).toISOString() + '">· '), 'the head carries when it merged: ' + banners.children[0].innerHTML);
assert.ok(banners.children[0].innerHTML.includes('href="https://github.com/o/r/pull/1"'), 'and the link');
assert.ok(banners.children[0].innerHTML.includes('<span class="merge-banner-num">#1</span> merged'), 'the head carries the number although esc drops non-strings: ' + banners.children[0].innerHTML);
// The number may live only in a nested pr record or the GitHub URL (an issue-headed ledger row): the head still reads "#15122 merged", never a bare "#".
Expand Down Expand Up @@ -714,13 +716,13 @@ const closeBtn = el('button'); banners.children[0].appendChild(closeBtn); closeB
hamBannerDismiss(closeBtn); tick(180 * 1.5 + 1);
assert.strictEqual(banners.children.length, before - 1, 'dismissed');
// The banner body is itself the dismiss target (a tap on a phone); the title
// and its "(lane, by, hh:mm)" tail are separate spans so the phone CSS can
// stack them, while the full line still rides the title attribute.
// and its "(lane, by)" tail are separate spans so the phone CSS can stack
// them, while the full line, time included, still rides the title attribute.
while (banners.children.length) banners.children[0].remove();
const split = stageTrackerMergeBanner({ key: 'o/r/pr#40', repo: 'o/r', number: 40, title: 'fix: forty', merged_by: 'clubanderson', lane: 'review', at: 0 });
assert.strictEqual(split.attrs['data-action'], 'hamBannerDismiss'); assert.strictEqual(split.attrs['data-arg-types'], 't');
assert.ok(split.innerHTML.includes('<span class="merge-banner-title">fix: forty</span> <span class="merge-banner-meta">(review, by @clubanderson, '), split.innerHTML);
assert.ok(split.innerHTML.includes('title="fix: forty (review, by @clubanderson, '), split.innerHTML);
assert.ok(split.innerHTML.includes('<span class="merge-banner-title">fix: forty</span> <span class="merge-banner-meta">(review, by @clubanderson)</span>'), split.innerHTML);
assert.ok(split.innerHTML.includes('title="fix: forty (review, by @clubanderson) · merged '), split.innerHTML);
assert.ok(split.innerHTML.includes('data-action="hamBannerOpenLink" data-stop="1">Open on GitHub</a>'), 'the link stops the tap from also dismissing: ' + split.innerHTML);
split.remove();
// Phone (≤480px): only the newest STAGE_TRACKER_MERGE_BANNER_PHONE_MAX banners
Expand Down
1 change: 1 addition & 0 deletions src/pkg/dashboard/static-src/css/tracker.css
Original file line number Diff line number Diff line change
Expand Up @@ -844,6 +844,7 @@
.merge-banner-head { font-weight: var(--fw-semibold); }
.merge-banner-head .merge-banner-num { color: var(--amber); font-variant-numeric: tabular-nums; }
.merge-banner-head .merge-banner-by { font-weight: 500; }
.merge-banner-head .merge-banner-when { color: var(--muted); font-weight: normal; white-space: nowrap; font-variant-numeric: tabular-nums; }
.merge-banner-text { margin-top: var(--sp-1); color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.merge-banner-links { margin-top: var(--sp-2); display: flex; gap: var(--sp-4); font-size: var(--fs-xs); }
.merge-banner-links button, .merge-banner-links a { border: 0; padding: 0; background: transparent; color: var(--accent); cursor: pointer; font: inherit; text-decoration: none; }
Expand Down
Loading
Loading