Skip to content

Let the assistant read a CSV as the spreadsheet the reader sees — today the sheet tools refuse it as 'This file is not a spreadsheet' and read serves comma-joined lines, so the grid's B3 means nothing to the assistant #266

Open

Description

@bencode

Problem

A tabular CSV is a grid to the reader and raw text to the assistant. The preview parses it with parseCsv and renders it in the same SheetGrid a workbook gets, column letters included (ui-packages/web/src/features/reader/csv-reader.tsx:47-51, routed at document-tabs.tsx:66; letters at ui-packages/web/src/features/reader/xlsx-reader/sheet-grid.tsx:78-80) — so the reader can point at B3. The assistant gets none of that: a CSV's preview kind is text (ui-packages/web/src/core/files.ts:63), so open falls through to openTextSource's raw, comma-joined lines (ui-packages/web/src/features/assistant/document-access.ts:48-54), and even pointing the sheet tools at one fails — createXlsxRuntime refuses anything but preview kind xlsx with "This file is not a spreadsheet." (ui-packages/web/src/features/assistant/xlsx/runtime.ts:24-27). The spreadsheet skill is announced as XLSX-only, and its SKILL.md names CSV solely as a writable alternative (ui-packages/web/src/features/assistant/create-reader-agent.ts:43-47).

This breaks the contract the sheet layer states for itself: "Column letters and row numbers match what the preview shows, so a question about 'B3' means the same cell to the reader and to the agent" (ui-packages/web/src/formats/xlsx.ts:93-94). For a CSV, B3 means nothing to the assistant: it must count commas to find a column, and a quoted comma (Ada,"hello, world") — handled correctly by the preview's own parseCsv (ui-packages/web/src/formats/csv.ts:22) — can silently misalign every cell after it. Wide CSVs have no columnar access at all, where sheet_read would give "C:C" in one call.

Proposal

  • Route a stored CSV that parses as tabular (the preview's own isTabular test, ui-packages/web/src/formats/csv.ts:58) to the xlsx runtime as a one-sheet workbook: its rows are already the string grid Worksheet holds, and parseRange, selectCells and sheetText serve them unchanged.
  • sheet_info and sheet_read then answer for a CSV with the same A1 coordinates the reader's grid shows; read and search see the sheet's text view, not comma-joined lines.
  • A non-tabular CSV (one column throughout — the preview itself shows prose or a list) keeps today's text path.
  • The spreadsheet skill's description and SKILL.md stop implying sheet reading is XLSX-only.

Goal

After this, a question about "B3" of a tabular CSV returns the cell the reader's grid shows, sheet_info/sheet_read work on CSVs exactly as on workbooks, and a quoted comma can no longer misalign a cell the reader asked about.

Verification

pnpm --filter @gamma-reader/web test src/features/assistant
grep -rn 'csv' ui-packages/web/src/features/assistant/document-access.ts
pnpm check

Refs

Activity

  1. added
    enhancement
    source:scheduled
    on Oct 27, 2026
  2. bencode commented on Oct 27, 2026

    @bencode
    OwnerAuthor

    Independent review — posted by the scheduled issue-reviewer loop, independent of the authoring session. Audited against main@dbf9cb6d.

    Evidence audit: every anchor exact — files.ts:63 (csv in textExtensions → kind text), csv-reader.tsx:47-51 (parseCsv + isTabular → the same grid), document-tabs.tsx:66 routing, sheet-grid.tsx:78-80 column letters, xlsx.ts:93-94 coordinates contract, csv.ts:22/58 RFC 4180 parser + tabular test, create-reader-agent.ts:43-47 XLSX-only skill text, xlsx/runtime.ts:25 exact refusal, document-access.ts:48-54 xlsx-only routing. The contract-vs-reality argument is sound: the sheet layer promises B3 parity and the CSV path breaks it.

    Duplicate check: clean across open + closed; #41 (closed, done) is the reader-side mirror this extends, #69 a different act on the same grid.

    Sensor: lint ✓; verify ✗ (grep csv document-access.ts fails today — the anchor discriminates).

    Verdict: valid, keep open. Sharpening:

    1. Second lock the proposal doesn't name: routing a CSV to xlsx.openDocument (document-access.ts:50) still hits createXlsxRuntime's own gate — previewKind !== 'xlsx' throws "This file is not a spreadsheet." (runtime.ts:25) — and readSpreadsheet would re-parse the blob as a workbook zip. Say explicitly that the CSV path wraps parseCsv rows into the Worksheet shape and how the runtime gate opens for it, else an access-layer-only change ends in the same refusal.
    2. Outcome anchor over the presence grep: a runtime test — tabular CSV blob loads, sheet_read 'B3' returns the cell the grid shows, a quoted comma (Ada,"hello, world") lands in one column, and a non-tabular CSV stays on the text path. That is the xlsx.ts:93-94 contract made testable.
    3. The skill-description/SKILL.md wording update being part of the deliverable is right — keep it in the diff.
  3. bencode commented on Oct 29, 2026

    @bencode
    OwnerAuthor

    Re-audit — posted by the scheduled issue-reviewer loop, independent of the authoring session. Previous review ran against main@dbf9cb6; this beat re-audited against main@d05b6b6 (HEAD unchanged since). git diff dbf9cb6..d05b6b6 over every cited file — including create-reader-agent.ts, which the plugins feature also leaves untouched here — is empty.

  4. bencode commented on Nov 1, 2026

    @bencode
    OwnerAuthor

    Posted by the scheduled issue-reviewer loop, independent of the authoring session.

    Re-audit at d05b6b6 — valid, stays open (HEAD unchanged since the last review; this pass adds the gate-health check the 10-31 → 11-01 round gave the other issues).

  5. bencode commented on Nov 6, 2026

    @bencode
    OwnerAuthor

    Posted by the scheduled issue-reviewer loop, independent of the authoring session.

    Renewal @ 2026-11-07, HEAD still d05b6b6 — valid, stays open. No commits since the 11-01 re-audit; checks re-run, not assumed.

  6. bencode commented on Nov 10, 2026

    @bencode
    OwnerAuthor

    Posted by the scheduled issue-reviewer loop, independent of the authoring session.

    Renewal @ 2026-11-11, HEAD still d05b6b6 — valid, stays open. Checks re-run rather than assumed.

    • Anchors exact: files.ts:63 (csv among textExtensions), document-access.ts:49 (only previewKind === 'xlsx' reaches the sheet runtime), xlsx/runtime.ts:27 ("This file is not a spreadsheet." verbatim); csv still appears nowhere in document-access.ts.
    • Sensor: lint ✓; verify ✗ on main ✓ — assistant suite 14 files / 103 tests green (counts identical to prior reviews, no contract drift), failure is the csv grep. Correctly red.
    • Duplicates: nothing filed or closed since the 11-07 renewal touches assistant-side CSV routing. Still clean.
    • Standing sharpening unchanged and unaddressed: a runtime test with a tabular CSV blob asserting sheet_read B3 returns the grid's cell (quoted comma stays one column; non-tabular keeps the text path) — that makes the xlsx.ts:93-94 coordinates contract testable instead of greppable.
  7. bencode commented on Nov 13, 2026

    @bencode
    OwnerAuthor

    Posted by the scheduled issue-reviewer loop, independent of the authoring session.

    Fifth review @ d05b6b6 (still HEAD — no commits since 2026-10-28) — valid, stays open.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementsource:scheduled

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions