Skip to content

fix: auto-fix CI type error in SessionStats component#564

Closed
github-actions[bot] wants to merge 1 commit intodevfrom
claude-fix-pr-561-20785939642
Closed

fix: auto-fix CI type error in SessionStats component#564
github-actions[bot] wants to merge 1 commit intodevfrom
claude-fix-pr-561-20785939642

Conversation

@github-actions
Copy link
Contributor

@github-actions github-actions bot commented Jan 7, 2026

CI Auto-Fix

Original PR: #561
Failed CI Run: Non-Main Branch CI/CD

Fixes Applied

File Fix Type
src/app/[locale]/dashboard/sessions/[sessionId]/messages/_components/session-stats.tsx Updated firstRequestAt and lastRequestAt types from string | null to Date | string | null TypeScript
src/app/[locale]/dashboard/sessions/[sessionId]/messages/_components/session-stats.tsx Updated TimeRow function to handle both Date and string inputs TypeScript
src/app/[locale]/dashboard/sessions/[sessionId]/messages/_components/session-stats.tsx Import ordering (lint auto-fix) Lint

Root Cause

The aggregateSessionStats function in src/repository/message.ts returns Date | null for firstRequestAt and lastRequestAt fields, but the SessionStats component interface expected string | null. This type mismatch caused the build to fail.

Not Auto-Fixable

The following pre-existing issues were not addressed as they require human review:

File Error Reason
session-stats.tsx Unused Tooltip import Pre-existing issue, flagged as unsafe fix by biome

Verification

  • bun run typecheck passes
  • No logic changes made - the fix is purely type-related and backwards compatible

Auto-generated by Claude AI

Greptile Summary

This PR fixes a TypeScript type mismatch between the SessionStats component interface and the aggregateSessionStats database query function. The aggregateSessionStats function returns Date | null for timestamp fields, but the component expected string | null, causing CI build failures.

Changes Made:

  • Updated SessionStatsProps.stats interface to accept Date | string | null for firstRequestAt and lastRequestAt fields
  • Modified TimeRow function to handle both Date objects and string inputs with type guard (instanceof Date)
  • Import reordering (lint auto-fix)

Key Points:

  • Backwards compatible - the fix handles both Date objects (from database) and string inputs
  • No logic changes - purely type-related fix
  • Pre-existing unused Tooltip import was intentionally not removed (requires human review)

The fix is minimal, correct, and safe to merge.

Confidence Score: 5/5

  • This PR is safe to merge with no risk - it's a minimal type fix with backwards compatibility
  • The fix correctly addresses the type mismatch between the database query return type (Date | null) and the component interface (string | null). The implementation properly handles both types with a type guard, maintains backwards compatibility, and includes no logic changes. The typecheck passes and the fix is exactly what's needed.
  • No files require special attention

Important Files Changed

Filename Overview
src/app/[locale]/dashboard/sessions/[sessionId]/messages/_components/session-stats.tsx Type fix for timestamp fields to accept Date objects from database query results - backwards compatible and properly handles both Date and string inputs

Sequence Diagram

sequenceDiagram
    participant Client as SessionMessagesClient
    participant Action as getSessionDetails()
    participant Repo as aggregateSessionStats()
    participant DB as Database
    participant Component as SessionStats

    Client->>Action: getSessionDetails(sessionId)
    Action->>Repo: aggregateSessionStats(sessionId)
    Repo->>DB: SELECT min(createdAt), max(createdAt)
    DB-->>Repo: Returns Date | null
    Repo-->>Action: Returns { firstRequestAt: Date | null, lastRequestAt: Date | null }
    Action-->>Client: sessionStats with Date objects
    Client->>Component: <SessionStats stats={sessionStats} />
    Component->>Component: TimeRow checks instanceof Date
    Component->>Component: Converts to Date if string, uses directly if Date
    Component-->>Client: Renders formatted timestamps
Loading

Fixed:
- Updated SessionStats interface to accept Date | string | null for firstRequestAt and lastRequestAt
- Updated TimeRow function to handle both Date and string types
- Applied lint auto-fix for import ordering

The type error occurred because aggregateSessionStats returns Date | null for these fields,
but SessionStats expected string | null.

CI Run: https://github.com/ding113/claude-code-hub/actions/runs/20785862610

Generated with Claude Code
@coderabbitai
Copy link

coderabbitai bot commented Jan 7, 2026

Important

Review skipped

Bot user detected.

To trigger a single review, invoke the @coderabbitai review command.

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.


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

@ding113 ding113 closed this Jan 7, 2026
@github-project-automation github-project-automation bot moved this from Backlog to Done in Claude Code Hub Roadmap Jan 7, 2026
@ding113 ding113 deleted the claude-fix-pr-561-20785939642 branch January 27, 2026 09:20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

1 participant