Repository navigation
fix(web): disclose omitted columns in saved table previews - #312
mikamikasuki merged 1 commit into
Conversation
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
There was a problem hiding this comment.
🟢 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
FileTablePreviewdriven bytruncated_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
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.npm --prefix apps/web test -- --maxWorkers=2: 102 passed across 20 files.npm --prefix apps/web run build: TypeScript and production build pass.git diff --checkpass.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.