Skip to content
Open
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
Original file line number Diff line number Diff line change
Expand Up @@ -340,10 +340,10 @@ export const convertMillisecondsToHumanReadableFormat = (
showMilliseconds = false,
prependForNegativeValue = '-'
): string => {
// Handle zero and very small positive values
// Treat zero and sub-second durations as "0s" when milliseconds are hidden
if (
timestamp === 0 ||
(!showMilliseconds && timestamp > 0 && timestamp < 1000)
(!showMilliseconds && timestamp > 0 && timestamp <= 1000)

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P1 Preserve one-second boundary
This guard now collapses exactly 1000 milliseconds to 0s when showMilliseconds is false. The duration extraction below would produce seconds = 1 and return 1s, so callers now receive incorrect output at the one-second boundary.

Suggested change
(!showMilliseconds && timestamp > 0 && timestamp <= 1000)
(!showMilliseconds && timestamp > 0 && timestamp < 1000)
Artifacts

Repro: focused Jest output showing expected 1s and received 0s

  • Keeps the command output available without making the summary code-heavy.

Repro: focused DateTimeUtils test file that imports and exercises the actual helper

  • Contains supporting evidence from the run (text/typescript; charset=utf-8).

View artifacts

T-Rex Ran code and verified through T-Rex

Prompt To Fix With AI
This is a comment left during a code review.
Path: openmetadata-ui/src/main/resources/ui/src/utils/date-time/DateTimeUtils.ts
Line: 346

Comment:
**Preserve one-second boundary**
This guard now collapses exactly `1000` milliseconds to `0s` when `showMilliseconds` is false. The duration extraction below would produce `seconds = 1` and return `1s`, so callers now receive incorrect output at the one-second boundary.

```suggestion
    (!showMilliseconds && timestamp > 0 && timestamp < 1000)
```

How can I resolve this? If you propose a fix, please make it concise.

Fix in Cursor Fix in Claude Code Fix in Codex Fix in Devin

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P1 The boundary change from < 1000 to <= 1000 is a functional regression, not a clarification. When timestamp === 1000 (exactly one second) and showMilliseconds is false, the new guard now short-circuits and returns '0s', even though the duration correctly resolves to '1s' through the main path. The original < 1000 correctly excluded the 1 000 ms edge case from the "sub-second" bucket.

Suggested change
(!showMilliseconds && timestamp > 0 && timestamp <= 1000)
(!showMilliseconds && timestamp > 0 && timestamp < 1000)
Prompt To Fix With AI
This is a comment left during a code review.
Path: openmetadata-ui/src/main/resources/ui/src/utils/date-time/DateTimeUtils.ts
Line: 346

Comment:
The boundary change from `< 1000` to `<= 1000` is a functional regression, not a clarification. When `timestamp === 1000` (exactly one second) and `showMilliseconds` is `false`, the new guard now short-circuits and returns `'0s'`, even though the duration correctly resolves to `'1s'` through the main path. The original `< 1000` correctly excluded the 1 000 ms edge case from the "sub-second" bucket.

```suggestion
    (!showMilliseconds && timestamp > 0 && timestamp < 1000)
```

How can I resolve this? If you propose a fix, please make it concise.

Fix in Claude Code Fix in Codex Fix in Devin

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P1 Exact one-second duration is incorrectly classified as sub-second

The inclusive <= 1000 condition returns 0s for exactly 1000 ms when milliseconds are hidden. One thousand milliseconds is one full second, and the existing formatter contract expects convertMillisecondsToHumanReadableFormat(1000) to return 1s; the focused test suite fails on this assertion. Use a strict < 1000 boundary so exactly one second reaches the normal seconds formatter.

T-Rex Ran code and verified through T-Rex

Prompt To Fix With AI
This is a comment left during a code review.
Path: openmetadata-ui/src/main/resources/ui/src/utils/date-time/DateTimeUtils.ts
Line: 346

Comment:
**Exact one-second duration is incorrectly classified as sub-second**

The inclusive `<= 1000` condition returns `0s` for exactly 1000 ms when milliseconds are hidden. One thousand milliseconds is one full second, and the existing formatter contract expects `convertMillisecondsToHumanReadableFormat(1000)` to return `1s`; the focused test suite fails on this assertion. Use a strict `< 1000` boundary so exactly one second reaches the normal seconds formatter.

How can I resolve this? If you propose a fix, please make it concise.

Fix in Cursor Fix in Claude Code Fix in Codex Fix in Devin

) {
return '0s';
}
Expand Down