Skip to content

fix(web): disclose omitted columns in saved table previews - #312

Merged
mikamikasuki merged 1 commit into
mikamikasuki:mainfrom
Dcastroro:fix/table-preview-column-truncation
Oct 21, 2026
Merged

mikamikasuki merged 1 commit into
mikamikasuki:mainfrom
Dcastroro:fix/table-preview-column-truncation

Conversation

@Dcastroro

Copy link
Copy Markdown
Contributor

Summary

Saved table previews display at most 100 columns. The API already reports the total column count and whether columns were truncated, but the Files page did not display that information. A wide CSV could therefore look like a complete table.

Show an English/Chinese status message above the preview when columns are omitted, stating how many columns are shown out of the total and pointing to the original download. Reuse the existing preview heading styles. The API limit, source bytes, row pagination and download behavior are unchanged.

Fixes #103.

Validation

Tested base: 01df33a5f5eca13b350efd90de4fdd6a02464e70.

  • New Playwright regression against the original production frontend: 2 failed, 2 passed. Both 101-column cases fail because the omission notice is absent; the 100- and 3-column controls pass.
  • Same Playwright regression against the corrected production frontend: 4 passed.
  • npm --prefix apps/web test -- --maxWorkers=2: 102 passed across 20 files.
  • npm --prefix apps/web run build: TypeScript and production build pass.
  • Prettier checks on both changed files and git diff --check pass.

The browser tests use real upload, preview and download APIs backed by an isolated temporary SQLite database and synthetic CSV files. No API responses are mocked. They cover English and Chinese, 1440px and 390px viewports, a header-only wide CSV, row pagination, page reload, omission notices only above the 100-column cap, unchanged downloaded bytes, and no page errors. Separate rendered checks confirmed the notice fits at desktop and narrow widths without document overflow.

Limits and AI assistance

PostgreSQL, the full backend suite, other browsers and dark-mode visual checks were not run. No worker/model execution was needed for this file-preview change, and no scientific measurements are claimed. The existing build warning about the large Monaco chunk and the two high-severity dependency advisories reported during the unchanged base install remain outside this change; no dependency or lockfile was modified.

Implementation, tests, investigation and this description were prepared with OpenAI Codex on Dcastroro's instructions. No human code review is claimed. No credentials, authentication changes, dependencies, workflows or disabled security checks are introduced.

Display the preview's existing truncation metadata in English and Chinese,
without changing column limits, stored data or downloads.

Exercise real uploads, previews and byte-identical downloads in Playwright,
including the 100-column boundary, header-only CSV, reload and pagination.

Fixes mikamikasuki#103

Assisted-by: OpenAI Codex
Copilot AI balanced review requested due to automatic review settings October 21, 2026 14:37

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.

🟢 Approval recommended

The change is a minimal, correct frontend disclosure of existing API truncation metadata, backed by a real-backend regression test, with no correctness or invariant concerns.

No open issues 🎉

What changed in this PR

This PR fixes issue #103: the saved table preview on the Files page caps displayed columns at 100 but never disclosed that columns were omitted, so a wide CSV could appear complete. The preview API already returns column_count and truncated_columns, and this change surfaces that metadata to the user.

The change is a small, well-scoped presentational fix in FileTablePreview. When truncated_columns is true, it renders a bilingual role="status" notice above the table stating how many columns are shown out of the total and directing the user to the original download. The notice reuses the existing .file-table-heading style, and the API limit, row pagination, and download behavior are untouched. I verified that the API caps the returned columns array at 100 (services/api/files.py:294, :313, :332), so data.columns.length accurately reflects the number of columns actually shown, and column_count carries the true total.

Changes:

  • Add a conditional bilingual omission notice in FileTablePreview driven by truncated_columns, interpolating the shown/total column counts.
  • Add a Playwright regression covering 101/100/3-column fixtures across EN/ZH and desktop/narrow viewports, including API metadata, header counts, notice visibility, pagination, reload persistence, and unchanged downloaded bytes.
File Description
apps/​web/​src/​pages/​FilesPage.tsx Renders a role="status" notice above the preview table when columns are truncated, reusing the heading style.
apps/​web/​tests/​file-preview-columns.spec.ts New Playwright spec exercising the real upload/preview/download APIs to verify the notice appears only above the 100-column cap.

I confirmed the test selectors are unambiguous for this scenario: with a single uploaded file the file-tree pagination does not render (FilesPage.tsx:572), so the Next/Previous buttons resolve to the table pagination, and the .file-table-preview [role=status] locator excludes the unrelated editor loading status at FilesPage.tsx:750. The interpolated EN/ZH strings match the exact text asserted in the test.

Review effort: Balanced

@mikamikasuki
mikamikasuki merged commit e8819a5 into mikamikasuki:main Oct 21, 2026
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.

Saved table preview does not disclose omitted columns

3 participants