Skip to content

fix(rest-api): Nil check DPU extension timestamp error logging#3744

Merged
hwadekar-nv merged 2 commits into
NVIDIA:mainfrom
hwadekar-nv:fix/dpu-extension-db-error
Jul 21, 2026
Merged

fix(rest-api): Nil check DPU extension timestamp error logging#3744
hwadekar-nv merged 2 commits into
NVIDIA:mainfrom
hwadekar-nv:fix/dpu-extension-db-error

Conversation

@hwadekar-nv

@hwadekar-nv hwadekar-nv commented Jul 20, 2026

Copy link
Copy Markdown
Contributor

Description:

  • The timestamp parse branch was inverted, causing successful parses to log errors while failures were silent.
  • The fix logs non-empty parse failures and preserves the existing fallback timestamp.
  • Added coverage for valid and invalid timestamps, then ran the full dpuextensionservice package tests successfully.

Type of Change

  • Fix - Bug fixes

Testing

  • Unit tests added/updated

@hwadekar-nv hwadekar-nv self-assigned this Jul 20, 2026
@hwadekar-nv
hwadekar-nv requested a review from a team as a code owner July 20, 2026 22:27
@coderabbitai

coderabbitai Bot commented Jul 20, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

Walkthrough

UpdateDpuExtensionServicesInDB now logs invalid non-empty version timestamps before falling back to the service update time. Tests add invalid-timestamp fixtures, capture logs, and verify both persisted timestamps and error output.

Changes

Timestamp Parse Error Handling

Layer / File(s) Summary
Parse error logging and fallback
rest-api/workflow/pkg/activity/dpuextensionservice/dpuextensionservice.go
Invalid non-empty Created values now produce a parse-failure log while retaining the Updated timestamp fallback.
Invalid timestamp regression coverage
rest-api/workflow/pkg/activity/dpuextensionservice/dpuextensionservice_test.go
Adds invalid-timestamp fixtures, log capture, expected timestamp assertions, and validation of the parse-error message.

Estimated code review effort: 2 (Simple) | ~10 minutes

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
Title check ✅ Passed The title accurately reflects the DPU extension timestamp error logging fix.
Description check ✅ Passed The description is directly aligned with the logging fix, fallback behavior, and test coverage.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

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

@hwadekar-nv
hwadekar-nv requested review from hanyux-nv and removed request for hanyux-nv July 20, 2026 22:29
@github-actions

Copy link
Copy Markdown

🔐 TruffleHog Secret Scan

No secrets or credentials found!

Your code has been scanned for 700+ types of secrets and credentials. All clear! 🎉

🔗 View scan details

🕐 Last updated: 2026-07-20 22:30:59 UTC | Commit: d93cbd6

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🧹 Nitpick comments (1)
rest-api/workflow/pkg/activity/dpuextensionservice/dpuextensionservice_test.go (1)

302-334: 🎯 Functional Correctness | 🔵 Trivial | ⚡ Quick win

Add coverage for an empty Created value.

This case verifies invalid non-empty input, but the changed Created != "" guard also defines empty-input behavior. Add a case expecting the Updated fallback with expectTimestampParseError: false; otherwise the corrected branch is only partially covered.

As per path instructions, “Review Go code for correctness, clean control flow, error handling, context propagation, test coverage, performance, and cohesive organization.”

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In
`@rest-api/workflow/pkg/activity/dpuextensionservice/dpuextensionservice_test.go`
around lines 302 - 334, Add a separate test case alongside the existing
invalid-timestamp case in the DPU extension service inventory tests, using an
empty Created value. Assert that the service’s Updated timestamp is used as
expectedCreated, set expectTimestampParseError to false, and keep wantErr false
to cover the empty-input branch guarded by the Created check.

Source: Path instructions

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Nitpick comments:
In
`@rest-api/workflow/pkg/activity/dpuextensionservice/dpuextensionservice_test.go`:
- Around line 302-334: Add a separate test case alongside the existing
invalid-timestamp case in the DPU extension service inventory tests, using an
empty Created value. Assert that the service’s Updated timestamp is used as
expectedCreated, set expectTimestampParseError to false, and keep wantErr false
to cover the empty-input branch guarded by the Created check.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Enterprise

Run ID: 52e058b3-02fd-4b01-83b3-4d705406b309

📥 Commits

Reviewing files that changed from the base of the PR and between 113c774 and d93cbd6.

📒 Files selected for processing (2)
  • rest-api/workflow/pkg/activity/dpuextensionservice/dpuextensionservice.go
  • rest-api/workflow/pkg/activity/dpuextensionservice/dpuextensionservice_test.go

@hwadekar-nv
hwadekar-nv force-pushed the fix/dpu-extension-db-error branch from d93cbd6 to ae2e1b2 Compare July 20, 2026 22:33
@github-actions

Copy link
Copy Markdown

@kfelternv kfelternv left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

This is the correct logical fix, the else if here meant that there could have been no err, err = nil but we would still enter the else if because the value was set.

@hwadekar-nv
hwadekar-nv merged commit a8af00d into NVIDIA:main Jul 21, 2026
118 checks passed
@hwadekar-nv

Copy link
Copy Markdown
Contributor Author

Thanks @kfelternv and @hanyux-nv

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.

3 participants