Skip to content

humanizeBytes renders Ki-range sizes as raw bytes #31

@lexfrei

Description

humanizeBytes (apps/console/src/lib/k8s-quantity.ts:32) has branches for Ti/Gi/Mi and then falls through to ${bytes}B, with no Ki branch. Any value in the range [1024, 1024²) bytes is rendered as raw bytes — for example a 512Ki PersistentVolumeClaim shows as 524288B instead of 512Ki.

This surfaces in the Storage admin views (ClusterStorageSection, StorageClassUsagePage), which feed PVC requested/bound sizes through humanizeBytes. PVCs are usually Gi-sized, so it rarely bites in practice, but any Ki/sub-Mi value displays incorrectly.

The current behavior is pinned by k8s-quantity.test.ts, so the fix must update that test.

Suggested fix: add a bytes >= 1024Ki branch before the bytes fallback, with a test covering a Ki-range value.

Metadata

Metadata

Assignees

No one assigned

    Labels

    area/consoleIssues or PRs related to apps/console — routes, detail pages, marketplace, command palettekind/bugCategorizes issue or PR as related to a bugpriority/backlogGeneral backlog priority. Lower than priority/important-longterm

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions