Skip to content

feat(sessions): show calendar dates with relative time and enable dat… - #556

Merged
tt-a1i merged 6 commits into
openpi-dev:mainfrom
rhine9473:feat/sessions-timestamp-format
Sep 22, 2026
Merged

tt-a1i merged 6 commits into
openpi-dev:mainfrom
rhine9473:feat/sessions-timestamp-format

Conversation

@rhine9473

Copy link
Copy Markdown
Contributor

Summary

This PR improves the session timestamp presentation and searchability in /sessions:

  1. Consistent Structure: Replaces ragged and inconsistent relative words (e.g. Yesterday vs 3d ago) with a unified two-part format:
    • Today's sessions: HH:MM (Xm/Xh ago) (e.g. 14:30 (2h ago))
    • Past sessions: MM-DD (Xd ago) (e.g. 09-06 (12d ago)), or YYYY-MM across years.
    • The primary time column (HH:MM and MM-DD) maintains a strictly aligned 5-character width.
  2. Date Searchability: Includes formatted date and relative time strings into buildSearchText, allowing users to filter sessions by year, month, or calendar date (e.g.
    typing 2026 or 09-).
  3. Unit Tests: Adds test coverage under tests/extensions/sessions/sessions.test.ts.

Testing

  • node --test --experimental-strip-types tests/extensions/sessions/*.test.ts (11 passed, 0 failed)
  • Verified locally in interactive TUI on Windows.
  • Biome check verified clean.

@tt-a1i tt-a1i left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

审查提交:f0fdbee361a7b4bb76adc4dd31aeb26e0bbde22f

需要修改后再合并。

具体问题

P2 — 依赖真实时钟的日期测试每天凌晨必然失败 · tests/extensions/sessions/sessions.test.ts:151

Freeze Asia/Shanghai clock at 2026-09-21 00:05: test expects HH:mm (10m ago), gets 09-20 (0d ago). 6 pass / 1 fail. Also cross-year assumptions affect January.

验证范围

Complete two-file diff reviewed; deterministic frozen-clock reproduction saved in test-midnight.log.

限制与后续

No real TUI acceptance; yesterday 0d label is an additional UX ambiguity, not separately escalated.

@rhine9473
rhine9473 force-pushed the feat/sessions-timestamp-format branch from f0fdbee to 8112d6e Compare September 22, 2026 01:14

@tt-a1i tt-a1i left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

复审提交 8112d6e6b872c499c9debcd185488876217c6358

此前的确定性问题已修复:格式化函数接收显式时钟,测试固定了普通、跨午夜和跨年边界,不再依赖运行时当天日期。当前所有远端检查通过,未发现新的阻断问题。

当前语义按经过时长划分:不足 24 小时即使跨过午夜仍显示 HH:mm,而不是按日历日立即切为 MM-DD。这是当前实现和新增断言明确选择的行为;如果产品要求“昨天一律显示日期”,需要另行调整,但不再是测试偶发问题。未执行真实 TUI 目视验收。

@tt-a1i
tt-a1i merged commit 2f5b7f5 into openpi-dev:main Sep 22, 2026
6 checks passed
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.

2 participants