Repository navigation
feat(attachments): in-app previews for text, Markdown and CSV/TSV (TASK-4074) - #2310
Merged
Merged
Conversation
The card's touch-action is now pan-x pan-y, so a wide table or an unwrapped line can pan sideways; the IDEA-2712 spec still pinned pan-y. No viewer gesture collides: pan/pinch arm only over a decoded bitmap and nothing swipes between attachments. The stage-is-not-none leg stays. Claude-Session: https://claude.ai/code/session_017ofcsFmgnoVDPxeHwuxCjg
…n-y (TASK-4074) Comment-only: two CSS comments still named the pre-TASK-4074 pan-y. Claude-Session: https://claude.ai/code/session_017ofcsFmgnoVDPxeHwuxCjg
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
In-app previews for text, code, Markdown and CSV/TSV attachments (TASK-4074, slice (a) of IDEA-4073). Until now these types offered only a download.
What's new
surfaceRenderers.ts, TASK-2476).'text'now covers exactlytext/plain,text/markdown,application/json,application/yamlandapplication/toml. A new'table'renderer covers exactlytext/csvandtext/tab-separated-values. Both allowlists are MIME-exact, never matched by category.text/xml,application/xhtml+xml,text/html,text/javascript,image/svg+xmland an unresolved MIME claim no renderer, and a test pins each one.internal/attachments/mime.gois untouched. ItsinlineSafeallowlist (the server'sContent-Disposition: inlineset) is unchanged in meaning and in bytes. The diff touches no Go at all. Previews fetch bytes through the normal attachment API (viewerTextLoader) and never navigate to the raw URL.size_bytesrefuses without any request, and the response gate cancels a stream that runs past the cap. Text is capped at 1 MiB (unchanged) and CSV/TSV at 2 MiB.AttachmentTablePreview.svelte, with an in-repo parser incsv.tsand no new dependency). It has a sticky header and text-only cells: no HTML, no links, no formula evaluation. The parser never throws. A malformed file renders what parsed, plus "Could not parse past row N". Blank lines are skipped. A quote that doesn't start a field is literal. "Showing N of M rows · N of M columns" is exact, because the parser counts every record. Rendering is stepped by cell count: the first render and each "Show more rows" step mount at most 5,000 cells (2,500 on the phone sheet). Steps append without re-mounting existing rows, up to a 1000-row × 50-column ceiling, with cells truncated at 500 code points.sanitizeMarkdownHtmlthat item content uses, with a Rendered/Raw toggle. A test feeds<script>,javascript:links andon*=attributes to both the helper and the mounted arm.<pre>with a Wrap toggle. Wrap is on by default for text and off for JSON/YAML/TOML.Benchmark (vitest/jsdom on the dev box, medians of 5). This is the evidence for the cell-stepped cap. jsdom is usually slower than a browser, so these numbers are conservative.
Follow-ups: PDF (TASK-4075) and spreadsheets (TASK-4076) are separate slices. Sticky preview controls and text-arm arrow keys are TASK-4078. A CLI text preview was deferred.
Evidence: 28 of 28 named mutants were shown red at committed heads, including one for the updated E2E touch-action pin. The CONVE-190 gates passed at the final head, including
npm run check, the full vitest suite andnpm run build. Four review rounds: three covered the whole diff, and one was scoped to the E2E pin fix.E2E note: this PR changes the text card's
touch-actionfrompan-ytopan-x pan-y, so wide tables and unwrapped lines can pan sideways by touch. The IDEA-2712 spece2e/attachment-text-preview.spec.tsis updated to match. No viewer gesture collides with it: pan, pinch and double-tap arm only over a decoded bitmap. A flake seen once in CI,e2e/pane-controller.spec.ts:325, is unrelated and filed as BUG-4080.https://claude.ai/code/session_017ofcsFmgnoVDPxeHwuxCjg