Skip to content

feat: export chosen samples from the By sample page - #48

Merged
AStaroverov merged 6 commits into
mainfrom
feat/sample-page-all-samples-export
Oct 20, 2026
Merged

AStaroverov merged 6 commits into
mainfrom
feat/sample-page-all-samples-export

Conversation

@AStaroverov

@AStaroverov AStaroverov commented Oct 2, 2026 •

Copy link
Copy Markdown
Contributor

Purpose

Export on the By sample page was limited to the one sample selected in the sheet. Users need to export several samples, or all of them, into one file.

Changes

  • Export dialog (ui/src/components/SampleExportModal.vue): the page's Export button opens a dialog with the current sample picked. The user can add other samples or check "All samples". The table's built-in export button is off on this page.
  • Separate export table (sampleExportTable in model/src/index.ts): the By sample table with the sample sheet replaced by an inSet filter on the selection (no sample filter for "All samples"). The page's filters, search, hidden columns and sorting carry over. It is built from primary columns, so createPlDataTableV3 adds the Sample label column and each exported row names its sample.
  • Selection in block data (sampleExport, migration Ver_2026_10_13): the model output is computed from data, so the dialog writes the selection there, waits for the output built for it, then exports.
  • Column choice (ui/src/sampleExport.ts): there is no grid behind the export table, so the block picks the columns the grid would show. A label column replaces the axis it labels; linker and hidden columns are left out. Headers come from columnsMeta. The file is written with pframe.exportPTable (CSV, TSV, Parquet, Excel).
  • The By sample table itself is unchanged from main.
  • SDK updated to 1.84.19.

Known limitation

Unlike the built-in export, there is no writePTableToFs fallback for Desktop versions without exportPTable. On those the dialog shows an error.

RetriggerView in GreptileConfidence Score: 4/5

The PR appears safe to merge, with non-blocking improvements to filename feedback and export tests.

Fix All in Claude CodeFindings

  1. P2 Export silently skips filenames ▶
  2. P2 Export rules lack tests ▶
Fix with agent prompt
### Issue 1
ui/src/sampleExport.ts:46
A confirmed filename such as `samples.CSV`, or one without an extension, fails the case-sensitive extension check. The function returns without writing a file, and `runExport` closes the dialog as if it succeeded. Add the selected extension when missing, accept supported extensions without case sensitivity, and show an error for unsupported names instead of returning silently.

### Issue 2
model/src/index.ts:450-458
The new export path has no tests for replacing the sample-sheet filter while keeping other filters, or for choosing columns from labels and visibility settings. These rules replace behavior previously owned by the grid, so later changes can silently alter exported rows or columns. Add focused tests for one sample, several samples, all samples, retained user filters, and hidden or labeled columns.

Note: If this suggestion doesn't match your team's coding style, reply to this and let me know. I'll remember it for next time!

---

For each issue above, determine whether it is valid and should be fixed. If so, fix it directly.

Summary

Adds a By sample export dialog for one, several, or all samples.

  • The By Sample page exports the current, chosen, or all samples into one file.

Important touched types:

  • SampleExportSelection: new choice between all samples and a list of sample IDs.
  • BlockData: saved browser state; now includes sampleExport.
  • StoredV3: the previous saved shape; excludes sampleExport before migration.
  • ExportColumn: new internal description of a file column's index, header, and order.
  • PlDataTableModel: SDK table description; now also carries the separate export table used by the dialog.

Acknowledged limitation: AStaroverov states that older Desktop versions without exportPTable show an error because this path has no writePTableToFs fallback. This was not reported again.

Validation: source review only. Tests and UI capture were not run because dependencies are not installed.

Diagram

sequenceDiagram
  actor User
  participant Page as By sample page
  participant Modal as Export dialog
  participant Model as Block model
  participant Files as File service
  User->>Page: Click Export
  Page->>Modal: Open with current sample
  User->>Modal: Choose samples or all
  Modal->>Model: Save sampleExport
  Model->>Model: Build sampleExportTable
  Model-->>Modal: Return selection and table
  Modal->>Files: Ask for filename
  Files-->>Modal: Return path
  Modal->>Files: Export chosen columns
Loading

Reviews (1) · Last reviewed commit: "fix: second sample export no longer wait..." · Reviewed by Greptile

Export opens a dialog with the current sample picked; the user can add
other samples or take all of them. The model builds a separate export
table with the sample sheet replaced by a filter on the selection.
Replaces the All samples / One sample switch. Updates the SDK to 1.84.19.
@AStaroverov AStaroverov changed the title feat: all-samples mode on the By sample page feat: export chosen samples from the By sample page Oct 13, 2026
The model rebuilds the export table in place, so waiting on the output
object alone missed the change. Wait on the selection and table handle
the output carries instead.
@AStaroverov
AStaroverov marked this pull request as ready for review October 19, 2026 14:23
Comment thread ui/src/sampleExport.ts Outdated
defaultFileName: `samples_${formatTimestamp(new Date())}.csv`,
filters,
});
if (canceled || path === undefined || !hasFilterExtension(path, filters)) return;

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Export silently skips filenames

A confirmed filename such as samples.CSV, or one without an extension, fails the case-sensitive extension check. The function returns without writing a file, and runExport closes the dialog as if it succeeded. Add the selected extension when missing, accept supported extensions without case sensitivity, and show an error for unsupported names instead of returning silently.

Prompt To Fix With AI
This is a comment left during a code review.
Path: ui/src/sampleExport.ts
Line: 46

Comment:
**Export silently skips filenames**

A confirmed filename such as `samples.CSV`, or one without an extension, fails the case-sensitive extension check. The function returns without writing a file, and `runExport` closes the dialog as if it succeeded. Add the selected extension when missing, accept supported extensions without case sensitivity, and show an error for unsupported names instead of returning silently.

---

For each issue above, determine whether it is valid and should be fixed. If so, fix it directly.

Fix in Claude Code

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed in 67dc85c. The extension now matches regardless of case, so samples.CSV is accepted. A name with no supported extension makes exportSampleTable throw, and the dialog stays open showing the error. The extension is not added automatically, because the save dialog returns only the path and does not say which format was picked.

Comment thread model/src/index.ts
Comment on lines +450 to +458
function dropSampleSheetFilter(
filters: null | PlDataTableFilters,
sampleAxis: AxisId,
): null | PlDataTableFilters {
if (filters === null || isSampleSheetFilter(filters, sampleAxis)) return null;
if (filters.type !== "and") return filters;
const kept = filters.filters.filter((f) => !isSampleSheetFilter(f, sampleAxis));
return kept.length === 0 ? null : { type: "and", filters: kept };
}

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Export rules lack tests

The new export path has no tests for replacing the sample-sheet filter while keeping other filters, or for choosing columns from labels and visibility settings. These rules replace behavior previously owned by the grid, so later changes can silently alter exported rows or columns. Add focused tests for one sample, several samples, all samples, retained user filters, and hidden or labeled columns.

Prompt To Fix With AI
This is a comment left during a code review.
Path: model/src/index.ts
Line: 450-458

Comment:
**Export rules lack tests**

The new export path has no tests for replacing the sample-sheet filter while keeping other filters, or for choosing columns from labels and visibility settings. These rules replace behavior previously owned by the grid, so later changes can silently alter exported rows or columns. Add focused tests for one sample, several samples, all samples, retained user filters, and hidden or labeled columns.

---

For each issue above, determine whether it is valid and should be fixed. If so, fix it directly.

Note: If this suggestion doesn't match your team's coding style, reply to this and let me know. I'll remember it for next time!

Fix in Claude Code

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Agreed these rules need tests. The block has no unit-test setup yet: neither model nor ui runs vitest, and the test package only holds a disabled workflow test. Adding them means setting up vitest in both packages and moving the export helpers out of model/src/index.ts into a module that can be tested. That will be a separate PR covering one sample, several samples, all samples, kept user filters, and hidden or labeled columns.

Match the extension case-insensitively and show an error instead of
closing the dialog without writing a file.
@AStaroverov
AStaroverov merged commit 928e669 into main Oct 20, 2026
11 checks passed
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.

1 participant