Skip to content

Orbit File tab: stream a head preview for large text files instead of rejecting #58

@nekrut

Description

@nekrut

Current behavior

`app/src/main/files-handler.ts` rejects `files:read` for any file > 5 MB (`MAX_READ_BYTES`) with a flat error. `app/src/renderer/files/file-viewer.ts` never gets bytes for those files, so the File tab shows nothing useful — testers hit this on real bioinformatics outputs (FASTQ, large VCF, BAM-derived TSVs).

Proposal

For text files past the limit, stream just a head preview instead of rejecting:

  1. First 10 lines, capped on bytes — if those 10 lines together exceed e.g. 64 KB (a single uncompressed VCF data line can be tens of KB; rare but happens), truncate the rendered text and append a marker.
  2. Render in the File tab with a banner: "Showing first 10 lines of ({size} total). Open externally to see the full file."
  3. Hide the editor / save controls — preview-only.

Decisions to make:

  • Where to draw the line. Today: hard reject at 5 MB. Proposal: full read up to 5 MB, head-preview between 5 MB and (say) 1 GB, hard reject above 1 GB.
  • Whether to extend the head-preview behavior to all large text files (uniform UX) or only to those past the existing 5 MB cap.
  • How to surface this in the file tree: the existing size column already shows the bytes; maybe a tooltip on the File tab "(preview only)" when in head-mode.

Out of scope

  • Tail preview / random access — not needed for the typical "is this output sane?" use case.
  • Pagination — same.
  • Binary preview — separate concern.

Files touched

  • `app/src/main/files-handler.ts` — add a streaming head-read path for files > MAX_READ_BYTES.
  • `app/src/renderer/files/file-viewer.ts` — banner + read-only mode for preview content.
  • IPC contract: `files:read` could grow a `{ truncated: true, headLines, lineLimit }` shape, or add a new `files:read-head` invoke.

Why now

Filed after a tester loaded a real Galaxy output into the analysis directory, opened the File tab, and got a useless error. Common enough that the current error-only behavior is a regression vs. just having no File tab at all.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions