Skip to content

fix(DriverVersionsCatalog): formatDate missing UTC timezone, deprecated word-break CSS, jq selector escaping, versionMissing suppressed #22

@castrojo

Description

@castrojo

Summary

Four bugs found in CodeRabbit review of src/components/DriverVersionsCatalog.tsx. Deferred from the SBOM pipeline PR (upstream-pr/sbom-pipeline) as they are pre-existing and out of scope.


Bug 1 — formatDate: missing UTC timezone (date-display off-by-one)

File: src/components/DriverVersionsCatalog.tsx:42-51

return parsed.toLocaleDateString('en-US', {
  year: 'numeric',
  month: 'short',
  day: 'numeric',
  // Missing: timeZone: 'UTC'
});

Date strings like 2025-03-15 are parsed as UTC midnight, then rendered in the user's local timezone. Users west of UTC will see the previous day. Same issue exists in FeedItems.tsx:formatLongDate.

Fix: Add timeZone: 'UTC' to the toLocaleDateString options object in both formatDate functions.


Bug 2 — word-break: break-word is deprecated CSS

Likely location: src/components/DriverVersionsCatalog.module.css

word-break: break-word is not part of the CSS spec (it was a WebKit extension). The correct values are break-all or overflow-wrap: anywhere.

Fix: Replace word-break: break-word with overflow-wrap: anywhere (or word-break: break-all if hard-breaking is intentional).


Bug 3 — rebaseCommandForTag: jq selector escaping

File: src/components/DriverVersionsCatalog.tsx:80-83

The jq filter uses escaped double-quotes inside single-quoted jq syntax. Verify the escaping survives copy-paste from the browser's clipboard — some renderers unescape \" to ", breaking the shell command.

Fix: Test the rendered output in the browser to confirm the jq selector appears correctly. Consider using bracket notation: .["image-name"].


Bug 4 — valueOrFallback suppresses versionMissing CSS class

File: src/components/DriverVersionsCatalog.tsx:53-55, 94-96

function valueOrFallback(value: string | null | undefined, fallback = 'N/A') {
  return value || fallback;  // returns string always
}

// Later:
const kernel = valueOrFallback(row.versions.kernel);  // always a string
// ...
<VersionValue value={kernel} />  // never null → versionMissing never applied

VersionValue renders styles.versionMissing only when value is null/undefined, but because valueOrFallback already converts null to 'N/A', the versionMissing CSS class is never triggered in the ReleaseNode component. The only path that correctly uses VersionValue directly (and can show the missing style) is the hwe value on line 97 which passes the raw value.

Fix: Remove the valueOrFallback calls for kernel/nvidia/mesa in ReleaseNode and pass the raw values directly to VersionValue, which already handles null/undefined gracefully.


Acceptance Criteria

  • formatDate uses UTC timezone — dates display consistently regardless of user timezone
  • CSS uses spec-compliant word-break/overflow-wrap property
  • jq selector in rebaseCommandForTag renders correctly when copy-pasted from browser
  • versionMissing CSS class is visually applied when a version value is null

Context

Found in CodeRabbit review of the SBOM pipeline PR. Pre-existing issues in DriverVersionsCatalog.tsx, deferred to keep the SBOM PR scoped.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workingtask/p2Medium priority task

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions