Skip to content

fix(experiments): fall back to the GPU label when the name cell is blank - #882

Open
ANIRUDDHA ADAK (aniruddhaadak80) wants to merge 1 commit into
synthetic-sciences:mainfrom
aniruddhaadak80:fix/gpu-inventory-empty-name
Open

ANIRUDDHA ADAK (aniruddhaadak80) wants to merge 1 commit into
synthetic-sciences:mainfrom
aniruddhaadak80:fix/gpu-inventory-empty-name

Conversation

@aniruddhaadak80

Copy link
Copy Markdown
Contributor

What does this PR do, and why?

GpuInventory.parse in backend/cli/src/experiments/gpu.ts reads rows of
nvidia-smi output and builds a Gpu per row. The name fell back like this:

name: cells[1] ?? "GPU",

?? only covers null and undefined. nvidia-smi reports an unnamed slot as
an empty cell, which is "", so "" ?? "GPU" is "" — the row produced a
Gpu whose name is the empty string. That satisfies z.string(), so nothing
downstream complained, and the GPU rendered with a blank label instead of GPU.

The same function already gets this right four lines below:

temperatureC: cells[5] === undefined || cells[5] === "" || cells[5] === "[N/A]" ? null : number(cells[5]),

so a blank temperature correctly reads as absent while a blank name did not.
This change gives the name the same treatment rather than leaving the two
inconsistent.

Linked issue

small fix, no issue

How did you verify it?

Bun 1.3.14, at main = 23fdd654. GpuInventory.parse is a pure exported
function, so no server or Instance harness is involved.

The new test fails on the unmodified tree:

$ bun test --timeout 15000 ./test/experiments/gpu.test.ts

(fail) GpuInventory.parse > falls back to the label when the name cell is blank
error: expect(received).toBe(expected)
Expected: "GPU"
Received: ""

 2 pass
 1 fail

and passes with the fix:

$ bun test --timeout 15000 ./test/experiments/gpu.test.ts

(pass) GpuInventory.parse > falls back to the label when the name cell is blank [8.23ms]
(pass) GpuInventory.parse > keeps a real name [0.51ms]
(pass) GpuInventory.parse > still reads a blank temperature as absent [1.09ms]

 3 pass
 0 fail

The other two tests are there to hold the behaviour that was already correct:
a real name is still kept, and a blank temperature still reads as null. Both
pass before and after, so the change is scoped to the blank name.

Formatting was checked against the repo's own config
(prettier --config package.json --end-of-line lf --check): clean.

Checklist

  • bun run check is green (format, typecheck, backend + frontend/ui + SDK tests)
  • bun run --cwd frontend/workspace build succeeds if I touched frontend/workspace or frontend/ui
  • ./tooling/repo/generate.ts was run and the tooling/sdk output committed if I changed backend/cli/src/server
  • CHANGELOG.md has an Unreleased entry if the change is user-visible
  • The matching docs page under frontend/docs/src/content/openscience/ is updated if behavior changed
  • Screenshots or a short video are attached for UI changes
  • No version bumps (package.json versions and tags are written by the release workflow)
  • install and frontend/landing/public/install are still byte-identical if I touched either

Not applicable: this does not touch frontend/workspace, frontend/ui or
backend/cli/src/server, so no workspace build and no SDK regeneration.

On the first box: I ran the new test file with the same runner and timeout the
repo's own script uses (bun run --cwd backend/cli test adds
--timeout 15000). I did not run the full bun run check across every
workspace — this checkout is a worktree with a borrowed node_modules rather
than a full bun run setup, so I will not claim a result I did not observe.
tsgo reports no error in either file this PR changes.

`??` only catches null and undefined, so a row whose name cell is empty
took the empty string and rendered a blank label instead of "GPU". The
same parser already treats a blank temperature cell as absent, so the
name now uses the same test.
Copilot AI balanced review requested due to automatic review settings October 2, 2026 02:51
@vercel

vercel Bot commented Oct 2, 2026

Copy link
Copy Markdown

ANIRUDDHA ADAK (@aniruddhaadak80) is attempting to deploy a commit to the InkVell Team on Vercel.

A member of the Team first needs to authorize it.

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

2 participants