Skip to content

feat(web): home recency buckets (last hour / earlier today / yesterday / earlier this week)#256

Open
mgabor3141 wants to merge 1 commit into
feat/settings-hosts-tabfrom
feat/home-recency-buckets
Open

feat(web): home recency buckets (last hour / earlier today / yesterday / earlier this week)#256
mgabor3141 wants to merge 1 commit into
feat/settings-hosts-tabfrom
feat/home-recency-buckets

Conversation

@mgabor3141
Copy link
Copy Markdown
Contributor

Closes #252.

Top of the restructure stack: #255#254#253#248. Review/merge bottom-up; rebased onto main once parents land.

Summary

Final slice of the home/settings restructure (#252): replace the home page's flat, capped Recent section with recency buckets, so recents can grow useful without truncation.

Changes

  • partitionForHome rewritten: the idle-alive remainder is grouped into ordered buckets instead of a single recent list. Returns { needsAttention, running, buckets } where each bucket is { label, sessions }.
    • Last hour — rolling 60-minute window, takes priority over the calendar day.
    • Earlier today / Yesterday — local-midnight calendar boundaries (so an 11pm session reads as "yesterday", not "20 hours ago").
    • Earlier this week — the rolling 2–7 day tail.
    • Sessions older than a week (or without a parseable timestamp) are omitted from home — find them via the project page or search.
  • The old RECENT_WINDOW_MS / RECENT_FLOOR / RECENT_CAP constants are gone (replaced by RECENT_WINDOW_DAYS = 7).
  • Waiting / Active stay as priority sections; alive-only is unchanged. Empty buckets render nothing (existing per-section guard).
  • home.tsx maps the buckets into Sections; anyActivity accounts for buckets.

Testing

  • 426 web tests pass; lint/build clean. New bucket tests pin: four-bucket grouping, Last-hour-wins-over-calendar, the 7-day cutoff, empty-bucket omission, and within-bucket sort. NOW is built from local date parts so the calendar-boundary assertions are timezone-independent.
  • partitionForProject tests updated off the removed RECENT_CAP (its rest is still uncapped/unwindowed).
  • Verified in mock mode: home renders Activity → Waiting / Active / Last hour.

@greptile-apps
Copy link
Copy Markdown

greptile-apps Bot commented May 29, 2026

Greptile Summary

This PR replaces the home page's single capped recent list with four ordered recency buckets (Last hour / Earlier today / Yesterday / Earlier this week), removing the old RECENT_WINDOW_MS / RECENT_FLOOR / RECENT_CAP constants in favour of a RECENT_WINDOW_DAYS = 7 cutoff.

  • partitionForHome rewrite (store.ts): calendar boundaries (todayMidnight, yesterdayMidnight) are computed with the Date constructor so DST transitions are handled correctly; the rolling weekAgo uses fixed arithmetic, which is acceptable for a non-calendar cutoff.
  • home.tsx: the single {recent.length > 0 && <Section>} block becomes {buckets.map(b => <Section key={b.label}>)}, and anyActivity switches from summation to || short-circuit — both changes are correct.
  • Tests (home-partition.test.ts): NOW is built from local date parts for timezone-independence; new tests cover four-bucket grouping, last-hour-over-calendar priority, the 7-day drop, empty-bucket omission, and within-bucket ordering.

Confidence Score: 5/5

Safe to merge — the bucketing logic is correct, DST is handled properly through Date constructor normalization, and the new tests pin all boundary contracts.

The partition rewrite is well-contained and pure (no side effects, injected now), calendar boundaries use the DST-safe Date constructor idiom that was flagged and fixed in an earlier round, and tests cover every bucket edge case including timezone-independent calendar splits.

No files require special attention.

Important Files Changed

Filename Overview
apps/gmux-web/src/store.ts Replaces flat RECENT_WINDOW_MS/FLOOR/CAP constants with four recency buckets; DST is handled correctly via Date constructor for calendar boundaries; rolling weekAgo uses arithmetic (acceptable for a non-calendar window).
apps/gmux-web/src/home.tsx Consumes new buckets array, maps each to a keyed Section, and updates anyActivity to use
apps/gmux-web/src/home-partition.test.ts Old floor/window/cap tests replaced with bucket-boundary tests; NOW constructed from local date parts for timezone-independent calendar assertions; covers four-bucket grouping, last-hour priority, 7-day cutoff, empty-bucket omission, and within-bucket sort.

Flowchart

%%{init: {'theme': 'neutral'}}%%
flowchart TD
    A[idle-alive session] --> B{t > 0?}
    B -- No --> X[dropped]
    B -- Yes --> C{t >= hourAgo\nnow - 1h}
    C -- Yes --> L[Last hour bucket]
    C -- No --> D{t >= todayMidnight\nDate constructor}
    D -- Yes --> T[Earlier today bucket]
    D -- No --> E{t >= yesterdayMidnight\nDate constructor DST-safe}
    E -- Yes --> Y[Yesterday bucket]
    E -- No --> F{t >= weekAgo\nnow - 7x24h}
    F -- Yes --> W[Earlier this week bucket]
    F -- No --> X2[dropped — older than 7 days]
Loading
Prompt To Fix All With AI
Fix the following 1 code review issue. Work through them one at a time, proposing concise fixes.

---

### Issue 1 of 1
apps/gmux-web/src/home.tsx:1-5
The file-header comment still says "Three activity sections (Waiting / Active / Recent)" — "Recent" no longer exists, the count is no longer fixed at three, and the section names are now dynamic bucket labels.

```suggestion
// Home dashboard: activity-first overview of every session.
// Priority sections (Waiting / Active) are followed by recency
// buckets (Last hour / Earlier today / Yesterday / Earlier this week).
// Project configuration (add / reorder / remove) lives in Settings →
// Projects; project navigation lives in the sidebar. The home page is
// purely an overview surface.
```

Reviews (3): Last reviewed commit: "feat(web): home recency buckets (last ho..." | Re-trigger Greptile

Comment thread apps/gmux-web/src/store.ts Outdated
@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented May 29, 2026

Try this PR

curl -sSfL https://gmux.app/install-pr.sh | sh -s -- 256

Built from 61c1c7e — feat(web): home recency buckets (last hour / earlier today / yesterday / earlier this week)
Requires GitHub CLI with auth. Artifacts expire after 7 days.

@mgabor3141 mgabor3141 force-pushed the feat/home-recency-buckets branch from e05468d to 61c1c7e Compare May 29, 2026 22:56
@mgabor3141 mgabor3141 force-pushed the feat/settings-hosts-tab branch from 83bf5e3 to 4fc0682 Compare May 29, 2026 22:56
@mgabor3141
Copy link
Copy Markdown
Contributor Author

@greptile review

@mgabor3141 mgabor3141 force-pushed the feat/settings-hosts-tab branch from 4fc0682 to c614e25 Compare May 30, 2026 09:01
@mgabor3141 mgabor3141 force-pushed the feat/home-recency-buckets branch from 61c1c7e to 5671994 Compare May 30, 2026 09:01
@mgabor3141 mgabor3141 force-pushed the feat/settings-hosts-tab branch from c614e25 to 170d208 Compare May 30, 2026 09:04
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