Skip to content

Guard useTablePagination against missing metadata in API response - #859

Closed
amalykhi wants to merge 1 commit into
mainfrom
fix/quay-vulnerability-pagination-guard
Closed

amalykhi wants to merge 1 commit into
mainfrom
fix/quay-vulnerability-pagination-guard

Conversation

@amalykhi

@amalykhi amalykhi commented Oct 22, 2026 •

Copy link
Copy Markdown

Summary

  • Quay-backed vulnerability list responses can omit metadata entirely (e.g. for unindexed digests), and the unguarded data.metadata.remainingItemCount / data.metadata.continue access in useTablePagination threw, which is a likely contributor to the device-details page rendering fully blank for non-Quay or unindexed-digest images.
  • Adds optional chaining so pagination falls back to sane defaults instead of crashing when metadata is absent.

Test plan

  • Re-run the flightctl-ui-tests Jenkins job (branch quay-fixes) against a build that includes this change and confirm the "Quay image scoping" and "Quay sync" Cypress suites can reach the device-details page.
  • Manually load device details for an image whose vulnerability backend returns no metadata and confirm the page renders instead of going blank.

🤖 Generated with Claude Code

Summary

  • Updated useTablePagination in libs/ui-components/ to safely read items, metadata.remainingItemCount, and metadata.continue when the API response or its fields are missing. The hook uses the existing zero and empty-string fallbacks.
  • This changes a shared UI hook. Its callers include device, repository, vulnerability, fleet, image-build, catalog, enrollment-request, and other tables. The change can affect both standalone and OCP plugin apps wherever they use these shared components.
  • No changes are reported in libs/types/, libs/i18n/, libs/cypress/, apps/standalone/, apps/ocp-plugin/, proxy/, packaging/, or .github/workflows/.
  • The PR objectives describe a Quay vulnerability response without metadata causing a failure that can leave device details blank. The unchecked test plan reports no test results.

Risk classification

risk:ask — The labeling criteria make this the default when a change does not qualify for risk:ship or risk:show. Although this is a small functional change, useTablePagination is shared across multiple features, so it does not meet risk:show's contained-blast-radius requirement and matches the shared-infrastructure trigger. It is not risk:ship because it changes hand-maintained TypeScript source.

Quay-backed vulnerability queries can return a list response without a
metadata object (e.g. unindexed digests), and the unguarded
data.metadata.remainingItemCount access threw, leaving the
device-details page blank for those images.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
@coderabbitai

coderabbitai Bot commented Oct 22, 2026 •

Copy link
Copy Markdown

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration
  • Configuration used: Repository: flightctl/flightctl-ui/.coderabbit.yaml
  • Review profile: ASSERTIVE
  • Plan: Enterprise
  • Run ID: 710ddbd1-755e-42f6-a278-90082729f2bf
📥 Commits

Reviewing files that changed from the base of the PR and between d69e4cb and a241786.

📒 Files selected for processing: 1
  • libs/ui-components/src/hooks/useTablePagination.ts

Included review availability: This review used your included allowance. Your plan provides up to 12 included reviews per hour; 11 remain after this review.

Walkthrough

useTablePagination now safely accesses items and metadata in onPageFetched. Missing values use the existing zero and empty-string fallbacks.

Changes

Pagination Fallbacks

Layer / File(s) Summary
Optional pagination data access
libs/ui-components/src/hooks/useTablePagination.ts
onPageFetched now uses optional chaining to read items, metadata.remainingItemCount, and metadata.continue. Missing values use the existing fallbacks.

Priority: ➖ Normal

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

Change: Bug fix

Suggested labels: risk:ask, ui-components

Suggested reviewers: celdrake

Merge Risk: ⚪ Minimal · up to a2417

The fallback addresses the blank device-details page when Quay omits metadata. Whether those responses can also omit additional vulnerability pages is not established, so no concrete merge-blocking impact is demonstrated.

Important

Pre-merge checks failed

Please resolve all errors before merging. Addressing warnings is optional.

Failed Failed checks: 1 error

Check name Status Explanation Resolution
Ai-Attribution Error AI use is explicitly documented in the PR description (“Generated with Claude Code”), and the commit includes Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>. The check explicitly requires a… Remove the AI Co-Authored-By trailer from commit a241786. If attribution is required, replace it with an accepted trailer, such as Assisted-by: Claude Sonnet 5 <noreply@anthropic.com>, and amend or recre…
Passed Passed checks: 14 passed
Check name Status Explanation
Description Check Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check Passed The title clearly and concisely describes the main change: protecting useTablePagination from missing API response metadata.
Docstring Coverage Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check. Docstring coverage is scoped to functions touched by this diff. Analyzed 0 functions across 1…
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.
No-Hardcoded-Secrets Passed PASS — The pull request changes only optional chaining in useTablePagination.ts. The diff introduces no API keys, tokens, passwords, private keys, credentials, base64 strings, credential-bearing URL…
No-Weak-Crypto Passed PASS: The pull request changes only null-safe pagination access in libs/ui-components/src/hooks/useTablePagination.ts. The diff introduces no MD5, SHA1, DES, 3DES, RC4, Blowfish, ECB, custom cryptog…
No-Injection-Vectors Passed PASS. The pull request changes only null-safe property access in useTablePagination.ts. The diff introduces no eval/exec, dangerouslySetInnerHTML, os.system, exec.Command, or yaml.load u…
Container-Privileges Passed The pull request changes only libs/ui-components/src/hooks/useTablePagination.ts, a TypeScript hook. The diff adds optional chaining to API response field access and introduces no container or Kuber…
No-Sensitive-Data-In-Logs Passed The pull request changes only null-safe pagination reads in useTablePagination.ts. The diff adds no logging, telemetry, error reporting, or output of sensitive data. The sensitive-data-in-logs check…
Resource-Leaks Passed PASS: The pull request changes only libs/ui-components/src/hooks/useTablePagination.ts. It does not modify any Go files under proxy/, so it introduces no opened-file, response-body, network-connec…
Unchecked-Errors Passed PASS. The pull request changes only libs/ui-components/src/hooks/useTablePagination.ts, a TypeScript file. It does not change any Go file under proxy/, so this check has no applicable error return…
Generated-Files-Not-Hand-Edited Passed The pull request changes only libs/ui-components/src/hooks/useTablePagination.ts. It does not edit any listed generated files under libs/types/** or libs/i18n/locales/en/translation.json.
I18n-Compliance Passed The pull request changes only libs/ui-components/src/hooks/useTablePagination.ts. The diff contains no .tsx files, user-facing strings, or t() calls. Therefore, the i18n-compliance conditions do…
Full details: Docstring Coverage

Explanation

No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check. Docstring coverage is scoped to functions touched by this diff. Analyzed 0 functions across 1 files.

Full details: No-Hardcoded-Secrets

Explanation

PASS — The pull request changes only optional chaining in useTablePagination.ts. The diff introduces no API keys, tokens, passwords, private keys, credentials, base64 strings, credential-bearing URLs, or secret-like string assignments.

Full details: No-Weak-Crypto

Explanation

PASS: The pull request changes only null-safe pagination access in libs/ui-components/src/hooks/useTablePagination.ts. The diff introduces no MD5, SHA1, DES, 3DES, RC4, Blowfish, ECB, custom cryptography, or secret/token comparison.

Full details: No-Injection-Vectors

Explanation

PASS. The pull request changes only null-safe property access in useTablePagination.ts. The diff introduces no eval/exec, dangerouslySetInnerHTML, os.system, exec.Command, or yaml.load usage. The change does not introduce an injection vector.

Full details: Container-Privileges

Explanation

The pull request changes only libs/ui-components/src/hooks/useTablePagination.ts, a TypeScript hook. The diff adds optional chaining to API response field access and introduces no container or Kubernetes manifest. No privileged, hostPID, hostNetwork, hostIPC, SYS_ADMIN, allowPrivilegeEscalation, or root execution setting is introduced.

Full details: No-Sensitive-Data-In-Logs

Explanation

The pull request changes only null-safe pagination reads in useTablePagination.ts. The diff adds no logging, telemetry, error reporting, or output of sensitive data. The sensitive-data-in-logs check therefore passes.

Full details: Resource-Leaks

Explanation

PASS: The pull request changes only libs/ui-components/src/hooks/useTablePagination.ts. It does not modify any Go files under proxy/, so it introduces no opened-file, response-body, network-connection, or goroutine resource leak covered by this check.

Full details: Unchecked-Errors

Explanation

PASS. The pull request changes only libs/ui-components/src/hooks/useTablePagination.ts, a TypeScript file. It does not change any Go file under proxy/, so this check has no applicable error returns to assess.

Full details: I18n-Compliance

Explanation

The pull request changes only libs/ui-components/src/hooks/useTablePagination.ts. The diff contains no .tsx files, user-facing strings, or t() calls. Therefore, the i18n-compliance conditions do not apply.

Full details: Ai-Attribution

Explanation

AI use is explicitly documented in the PR description (“Generated with Claude Code”), and the commit includes Co-Authored-By: Claude Sonnet 5 &lt;noreply@anthropic.com&gt;. The check explicitly requires acceptable AI attribution trailers such as Assisted-by, Generated-by, or Made-with, and flags Co-Authored-By for AI tools.

Resolution

Remove the AI Co-Authored-By trailer from commit a241786. If attribution is required, replace it with an accepted trailer, such as Assisted-by: Claude Sonnet 5 &lt;noreply@anthropic.com&gt;, and amend or recreate the commit.

✨ Finishing Touches: 💡 1
📝 Generate docstrings
  • Commit to this branch
  • Create a new PR
🧪 Generate unit tests (beta)
  • Commit to this branch
  • Create a new PR
🛠️ Fix failing CI checks: 💡
  • Commit to this branch
  • Create a new PR

Warning

Some tools did not complete. Review the errors below.

🔧 ESLint

If the error stems from missing dependencies, add them to the package.json file. For unrecoverable errors (e.g., due to private dependencies), disable the tool in the CodeRabbit configuration.

ESLint install timed out. The project may have too many dependencies for the sandbox.

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

@coderabbitai coderabbitai Bot added risk:ask Ask: medium+ risk — human review required ui-components labels Oct 22, 2026
@amalykhi amalykhi closed this Oct 22, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

risk:ask Ask: medium+ risk — human review required ui-components

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant