Skip to content

feat: persist logs page-size preference in localStorage and exclude error_details from list query - #5327

Merged
Pratham-Mishra04 merged 1 commit into
devfrom
07-17-feat_configurable_page_size_for_logs_table
Jul 17, 2026
Merged

feat: persist logs page-size preference in localStorage and exclude error_details from list query#5327
Pratham-Mishra04 merged 1 commit into
devfrom
07-17-feat_configurable_page_size_for_logs_table

Conversation

@impoiler

Copy link
Copy Markdown
Contributor

Summary

This PR fixes a Cloud Run 500 error caused by the /api/logs response exceeding the 32MB body limit when many error-status log rows are returned, and replaces the auto-calculated table page size with a user-controlled, localStorage-persisted page size preference.

Changes

  • Exclude error_details from the logs list query: The error_details column is dropped from listSelectColumns in rdb.go because it can carry unbounded provider error payloads. With 25+ such rows, the combined response body can exceed Cloud Run's 32MB limit and return a 500. The full error detail remains available via the individual log detail endpoint (GET /api/logs/{id}).
  • Replace auto-sized page size with a user preference: The useTablePageSize hook (which inferred page size from container height) is replaced by useTablePageSizePreference, which stores the user's chosen page size in localStorage under a per-table key (e.g. bifrost.logs.pageSize). The preference is hydrated lazily after mount to avoid SSR/hydration mismatches and defaults to 25.
  • Add a "Rows per page" dropdown to the logs table footer: A ComboboxSelect with options [10, 25, 50, 100, 200] is added to the pagination controls, allowing users to explicitly choose how many rows to load per page. The selection is persisted across sessions.

Type of change

  • Bug fix
  • Feature

Affected areas

  • Core (Go)
  • UI (React)

How to test

  1. Navigate to the logs table in the UI.
  2. Confirm a "Rows per page" dropdown appears in the pagination footer with options 10, 25, 50, 100, and 200.
  3. Select a page size, reload the page, and verify the selection is restored from localStorage.
  4. Confirm that log list responses no longer include error_details in the payload, and that the full error is still visible when opening an individual log entry.
  5. Verify that workspaces with many error-status logs no longer trigger 500 responses from /api/logs.
# Core
go test ./framework/logstore/...

# UI
cd ui
pnpm i
pnpm test
pnpm build

Screenshots/Recordings

Before: Page size was inferred from container height with no user control.
After: A "Rows per page" dropdown is shown in the pagination bar, and the selection persists across page reloads.

Breaking changes

  • No

The error_details field is removed from list responses but remains available on the detail endpoint. Clients relying on error_details in the list response will need to fetch individual log entries to retrieve it.

Related issues

Closes the Cloud Run 32MB body limit 500 error on /api/logs.

Security considerations

No new auth, secrets, or PII exposure. Removing error_details from the list response reduces the amount of potentially sensitive provider error data sent in bulk responses.

Checklist

  • I read docs/contributing/README.md and followed the guidelines
  • I added/updated tests where appropriate
  • I updated documentation where needed
  • I verified builds succeed (Go and UI)
  • I verified the CI pipeline passes locally if applicable

@coderabbitai

coderabbitai Bot commented Jul 17, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

📝 Walkthrough

Walkthrough

The log list query no longer returns error_details. The logs table now persists a user-selected page size in localStorage, applies it to pagination, resets pagination when changed, and displays a rows-per-page selector.

Changes

Log list projection

Layer / File(s) Summary
Exclude error details from list queries
framework/logstore/rdb.go
listSelectColumns() removes error_details from list responses and documents the intentional exclusion.

Logs pagination preference

Layer / File(s) Summary
Define persisted page-size preference
ui/lib/hooks/useTablePageSizePreference.ts
Adds default page-size options and a hook that reads validated values from and writes selections to localStorage.
Wire page-size selection into logs pagination
ui/app/workspace/logs/views/logsTable.tsx
Replaces measured page sizing with the persisted preference, resets the offset when the size changes, removes container measurement, and adds the rows-per-page selector.

Estimated code review effort: 3 (Moderate) | ~20 minutes

Suggested reviewers: akshaydeo

Sequence Diagram(s)

sequenceDiagram
  participant User
  participant LogsTable
  participant PageSizePreference
  participant localStorage
  participant Pagination
  User->>LogsTable: select rows-per-page value
  LogsTable->>PageSizePreference: update selected page size
  PageSizePreference->>localStorage: persist selected page size
  LogsTable->>Pagination: update limit and reset offset
  Pagination->>LogsTable: render updated page controls
Loading
🚥 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 clearly covers the two main changes: persisting logs page size and excluding error_details from the list query.
Description check ✅ Passed The description matches the template well, covering summary, changes, type, affected areas, testing, screenshots, breaking changes, issues, and security.
✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch 07-17-feat_configurable_page_size_for_logs_table

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

impoiler commented Jul 17, 2026

Copy link
Copy Markdown
Contributor Author

@impoiler impoiler changed the title feat: add persistent page-size preference to logs table and exclude error_details from list query feat: persist logs page-size preference in localStorage and exclude error_details from list query Jul 17, 2026
@impoiler impoiler self-assigned this Jul 17, 2026
@impoiler
impoiler marked this pull request as ready for review July 17, 2026 07:58
@coderabbitai
coderabbitai Bot requested a review from akshaydeo July 17, 2026 07:59
@greptile-apps

greptile-apps Bot commented Jul 17, 2026

Copy link
Copy Markdown
Contributor

Confidence Score: 5/5

This looks safe to merge.

  • Stored page sizes are limited to the values offered by the dropdown.
  • Invalid stored values fall back to the default size.
  • No blocking issues remain in the updated code.

Important Files Changed

Filename Overview
framework/logstore/rdb.go Removes unbounded error details from log-list projections while preserving detail retrieval.
ui/app/workspace/logs/views/logsTable.tsx Adds page-size controls and synchronizes the persisted preference with pagination.
ui/lib/hooks/useTablePageSizePreference.ts Adds SSR-safe localStorage hydration and validates stored values against the allowed sizes.

Reviews (4): Last reviewed commit: "feat: Configurable page size for logs ta..." | Re-trigger Greptile

Comment thread ui/lib/hooks/useTablePageSizePreference.ts

@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)
ui/lib/hooks/useTablePageSizePreference.ts (1)

1-1: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick win

Remove the "use client" directive — this project uses TanStack Router, not Next.js App Router.

The "use client" directive is a Next.js-specific construct that has no effect in the current Vite/TanStack Router toolchain. Introducing it can confuse contributors about the project's routing framework. Based on learnings, the UI code under ui/ should not include Next.js App Router conventions such as "use client" directives.

♻️ Proposed fix
-"use client";
-
 import { useCallback, useEffect, useState } from "react";
🤖 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 `@ui/lib/hooks/useTablePageSizePreference.ts` at line 1, Remove the top-level
"use client" directive from useTablePageSizePreference.ts, leaving the hook
implementation unchanged and preserving the existing TanStack Router/Vite
conventions.

Source: Learnings

🤖 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 `@ui/lib/hooks/useTablePageSizePreference.ts`:
- Line 1: Remove the top-level "use client" directive from
useTablePageSizePreference.ts, leaving the hook implementation unchanged and
preserving the existing TanStack Router/Vite conventions.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro Plus

Run ID: 3533eba4-125c-4b0d-bfca-5d1e8628c25c

📥 Commits

Reviewing files that changed from the base of the PR and between b30b2fb and 90632b8.

📒 Files selected for processing (3)
  • framework/logstore/rdb.go
  • ui/app/workspace/logs/views/logsTable.tsx
  • ui/lib/hooks/useTablePageSizePreference.ts

@impoiler
impoiler force-pushed the 07-17-feat_configurable_page_size_for_logs_table branch from 90632b8 to 7df1167 Compare July 17, 2026 08:20

@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.

Actionable comments posted: 1

🤖 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.

Inline comments:
In `@ui/lib/hooks/useTablePageSizePreference.ts`:
- Around line 27-31: Update useTablePageSizePreference to restrict the
defaultPageSize, hydrated localStorage value, and setPageSize input to values
included in DEFAULT_PAGE_SIZE_OPTIONS. Fall back to the supported default when
validation fails, and ensure the returned pageSize never reaches LogsDataTable
as an unsupported value.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro Plus

Run ID: 29fb0cb0-ca8a-4dc8-b9f2-b1c982f014d1

📥 Commits

Reviewing files that changed from the base of the PR and between 90632b8 and 7df1167.

📒 Files selected for processing (3)
  • framework/logstore/rdb.go
  • ui/app/workspace/logs/views/logsTable.tsx
  • ui/lib/hooks/useTablePageSizePreference.ts
🚧 Files skipped from review as they are similar to previous changes (2)
  • ui/app/workspace/logs/views/logsTable.tsx
  • framework/logstore/rdb.go

Comment thread ui/lib/hooks/useTablePageSizePreference.ts
@impoiler
impoiler force-pushed the 07-17-feat_configurable_page_size_for_logs_table branch from 7df1167 to 000ff52 Compare July 17, 2026 08:26
coderabbitai[bot]
coderabbitai Bot previously approved these changes Jul 17, 2026

Pratham-Mishra04 commented Jul 17, 2026

Copy link
Copy Markdown
Collaborator

Merge activity

  • Jul 17, 11:05 AM UTC: A user started a stack merge that includes this pull request via Graphite.
  • Jul 17, 11:53 AM UTC: Graphite rebased this pull request as part of a merge.
  • Jul 17, 11:54 AM UTC: @Pratham-Mishra04 merged this pull request with Graphite.

@Pratham-Mishra04
Pratham-Mishra04 changed the base branch from 07-17-fix_show_key_selectors_for_custom_providers_in_prompt_playground to graphite-base/5327 July 17, 2026 11:49
@Pratham-Mishra04
Pratham-Mishra04 changed the base branch from graphite-base/5327 to dev July 17, 2026 11:52
@Pratham-Mishra04
Pratham-Mishra04 dismissed coderabbitai[bot]’s stale review July 17, 2026 11:52

The base branch was changed.

@Pratham-Mishra04
Pratham-Mishra04 requested a review from a team as a code owner July 17, 2026 11:52
@Pratham-Mishra04
Pratham-Mishra04 force-pushed the 07-17-feat_configurable_page_size_for_logs_table branch from 000ff52 to 785f9cc Compare July 17, 2026 11:52
@Pratham-Mishra04
Pratham-Mishra04 merged commit 4982090 into dev Jul 17, 2026
15 checks passed
@Pratham-Mishra04
Pratham-Mishra04 deleted the 07-17-feat_configurable_page_size_for_logs_table branch July 17, 2026 11:54
akshaydeo pushed a commit that referenced this pull request Jul 17, 2026
…error_details` from list query (#5327)

## Summary

This PR fixes a Cloud Run 500 error caused by the `/api/logs` response exceeding the 32MB body limit when many error-status log rows are returned, and replaces the auto-calculated table page size with a user-controlled, localStorage-persisted page size preference.

## Changes

- **Exclude `error_details` from the logs list query**: The `error_details` column is dropped from `listSelectColumns` in `rdb.go` because it can carry unbounded provider error payloads. With 25+ such rows, the combined response body can exceed Cloud Run's 32MB limit and return a 500. The full error detail remains available via the individual log detail endpoint (`GET /api/logs/{id}`).
- **Replace auto-sized page size with a user preference**: The `useTablePageSize` hook (which inferred page size from container height) is replaced by `useTablePageSizePreference`, which stores the user's chosen page size in localStorage under a per-table key (e.g. `bifrost.logs.pageSize`). The preference is hydrated lazily after mount to avoid SSR/hydration mismatches and defaults to 25.
- **Add a "Rows per page" dropdown to the logs table footer**: A `ComboboxSelect` with options `[10, 25, 50, 100, 200]` is added to the pagination controls, allowing users to explicitly choose how many rows to load per page. The selection is persisted across sessions.

## Type of change

- [x] Bug fix
- [x] Feature

## Affected areas

- [x] Core (Go)
- [x] UI (React)

## How to test

1. Navigate to the logs table in the UI.
2. Confirm a "Rows per page" dropdown appears in the pagination footer with options 10, 25, 50, 100, and 200.
3. Select a page size, reload the page, and verify the selection is restored from localStorage.
4. Confirm that log list responses no longer include `error_details` in the payload, and that the full error is still visible when opening an individual log entry.
5. Verify that workspaces with many error-status logs no longer trigger 500 responses from `/api/logs`.

```sh
# Core
go test ./framework/logstore/...

# UI
cd ui
pnpm i
pnpm test
pnpm build
```

## Screenshots/Recordings

Before: Page size was inferred from container height with no user control.
After: A "Rows per page" dropdown is shown in the pagination bar, and the selection persists across page reloads.

## Breaking changes

- [x] No

The `error_details` field is removed from list responses but remains available on the detail endpoint. Clients relying on `error_details` in the list response will need to fetch individual log entries to retrieve it.

## Related issues

Closes the Cloud Run 32MB body limit 500 error on `/api/logs`.

## Security considerations

No new auth, secrets, or PII exposure. Removing `error_details` from the list response reduces the amount of potentially sensitive provider error data sent in bulk responses.

## Checklist

- [ ] I read `docs/contributing/README.md` and followed the guidelines
- [ ] I added/updated tests where appropriate
- [ ] I updated documentation where needed
- [ ] I verified builds succeed (Go and UI)
- [ ] I verified the CI pipeline passes locally if applicable
akshaydeo pushed a commit that referenced this pull request Jul 18, 2026
…error_details` from list query (#5327)

## Summary

This PR fixes a Cloud Run 500 error caused by the `/api/logs` response exceeding the 32MB body limit when many error-status log rows are returned, and replaces the auto-calculated table page size with a user-controlled, localStorage-persisted page size preference.

## Changes

- **Exclude `error_details` from the logs list query**: The `error_details` column is dropped from `listSelectColumns` in `rdb.go` because it can carry unbounded provider error payloads. With 25+ such rows, the combined response body can exceed Cloud Run's 32MB limit and return a 500. The full error detail remains available via the individual log detail endpoint (`GET /api/logs/{id}`).
- **Replace auto-sized page size with a user preference**: The `useTablePageSize` hook (which inferred page size from container height) is replaced by `useTablePageSizePreference`, which stores the user's chosen page size in localStorage under a per-table key (e.g. `bifrost.logs.pageSize`). The preference is hydrated lazily after mount to avoid SSR/hydration mismatches and defaults to 25.
- **Add a "Rows per page" dropdown to the logs table footer**: A `ComboboxSelect` with options `[10, 25, 50, 100, 200]` is added to the pagination controls, allowing users to explicitly choose how many rows to load per page. The selection is persisted across sessions.

## Type of change

- [x] Bug fix
- [x] Feature

## Affected areas

- [x] Core (Go)
- [x] UI (React)

## How to test

1. Navigate to the logs table in the UI.
2. Confirm a "Rows per page" dropdown appears in the pagination footer with options 10, 25, 50, 100, and 200.
3. Select a page size, reload the page, and verify the selection is restored from localStorage.
4. Confirm that log list responses no longer include `error_details` in the payload, and that the full error is still visible when opening an individual log entry.
5. Verify that workspaces with many error-status logs no longer trigger 500 responses from `/api/logs`.

```sh
# Core
go test ./framework/logstore/...

# UI
cd ui
pnpm i
pnpm test
pnpm build
```

## Screenshots/Recordings

Before: Page size was inferred from container height with no user control.
After: A "Rows per page" dropdown is shown in the pagination bar, and the selection persists across page reloads.

## Breaking changes

- [x] No

The `error_details` field is removed from list responses but remains available on the detail endpoint. Clients relying on `error_details` in the list response will need to fetch individual log entries to retrieve it.

## Related issues

Closes the Cloud Run 32MB body limit 500 error on `/api/logs`.

## Security considerations

No new auth, secrets, or PII exposure. Removing `error_details` from the list response reduces the amount of potentially sensitive provider error data sent in bulk responses.

## Checklist

- [ ] I read `docs/contributing/README.md` and followed the guidelines
- [ ] I added/updated tests where appropriate
- [ ] I updated documentation where needed
- [ ] I verified builds succeed (Go and UI)
- [ ] I verified the CI pipeline passes locally if applicable
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.

2 participants