MILAB-6655: use disambiguated column labels for native CSV export - #1762
Merged
Conversation
The native export path (exportPTable / writePTableToFs) derived header names from the raw column spec (pl7.app/label, else spec name). Since label disambiguation moved into the PlDataTable columnsMeta sidecar, those raw labels are no longer unique, so exporting a table with many columns could emit duplicate header names — which the native DataFusion-backed exportPTable rejects, breaking the export. Carry the disambiguated labels the UI actually shows into the export call. PlAgCsvExporter reads them from the visible grid columns via effectiveLabel(spec, columnsMeta) and passes them alongside the column indices. The driver API stays backward compatible: columnIndices is unchanged and a new optional headerNames (aligned 1:1) is added. ui-vue and the desktop-app runtime version independently, so an older runtime simply ignores headerNames and keeps deriving labels from the spec; a missing or empty name falls back to the spec-derived label.
Contributor
|
Caution The consumer version of Gemini Code Assist on GitHub has been sunset. All code review activity has officially ceased. |
🦋 Changeset detectedLatest commit: 4ec4738 The changes in this PR will be included in the next version bump. This PR includes changesets to release 22 packages
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
Collaborator
Author
vadimpiven
approved these changes
Jul 22, 2026
AStaroverov
enabled auto-merge
July 22, 2026 10:35
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #1762 +/- ##
==========================================
+ Coverage 49.57% 53.71% +4.13%
==========================================
Files 70 366 +296
Lines 3786 19679 +15893
Branches 969 4341 +3372
==========================================
+ Hits 1877 10571 +8694
- Misses 1640 7799 +6159
- Partials 269 1309 +1040 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
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.
The native export path (exportPTable / writePTableToFs) derived header names from the raw column spec (pl7.app/label, else spec name). Since label disambiguation moved into the PlDataTable columnsMeta sidecar, those raw labels are no longer unique, so exporting a table with many columns could emit duplicate header names — which the native DataFusion-backed exportPTable rejects, breaking the export.
Carry the disambiguated labels the UI actually shows into the export call. PlAgCsvExporter reads them from the visible grid columns via effectiveLabel(spec, columnsMeta) and passes them alongside the column indices.
The driver API stays backward compatible: columnIndices is unchanged and a new optional headerNames (aligned 1:1) is added. ui-vue and the desktop-app runtime version independently, so an older runtime simply ignores headerNames and keeps deriving labels from the spec; a missing or empty name falls back to the spec-derived label.
Greptile Summary
This PR fixes a native CSV export failure that occurred when a
PlDataTablecontained multiple columns whose rawpl7.app/labelannotations collide. The core driver (exportPTable/writePTableToFs) was deriving header names from the spec's intrinsic label, while the UI had already moved label disambiguation into thecolumnsMetasidecar — causing the native DataFusion export path to reject the duplicate headers.data_types.ts):ExportPTableOptionsandWritePTableToFsOptionsgain an optionalheaderNames?: string[]aligned 1:1 withcolumnIndices. Additive/backward-compatible — older runtimes silently ignore the field.driver_impl.ts): BothwritePTableToFsandexportPTableresolve headers eagerly — caller-supplied names win; a missing/empty entry falls back togetNativeColumnLabel(renamed fromcolumnLabelto clarify its scope).export-csv.ts,PlAgCsvExporter.vue,PlAgDataTableV2.vue):collectVisibleColumnIndicesis replaced bycollectVisibleColumnswhich returns[index, disambiguatedLabel][];columnsMetais threaded fromPlAgDataTableV2throughPlAgCsvExporterinto the export call so disambiguated labels are captured at the grid layer.Confidence Score: 5/5
Safe to merge — additive, backward-compatible change that fixes a real export breakage without altering existing behavior.
The change is narrowly scoped: a new optional field (headerNames) threads disambiguated labels from the UI grid layer through to the CSV streaming path, with the driver resolving each name eagerly and falling back to the existing spec-derived label when the caller omits or empties an entry. The length-mismatch guard added to streamPTableRows catches the one realistic misuse. Both exportPTable and writePTableToFs paths now have symmetric test coverage for the new field. No existing call sites are broken — older runtimes that receive headerNames in the JSON simply ignore an unrecognized field.
No files require special attention.
Important Files Changed
Sequence Diagram
sequenceDiagram participant User participant PlAgDataTableV2 participant PlAgCsvExporter participant exportCsv participant collectVisibleColumns participant PFrameDriver User->>PlAgDataTableV2: click Export PlAgDataTableV2->>PlAgCsvExporter: api, tableHandle, columnsMeta PlAgCsvExporter->>exportCsv: "ExportOptions{tableHandle, columnsMeta}" exportCsv->>PFrameDriver: getSpec(visibleTableHandle) PFrameDriver-->>exportCsv: PTableColumnSpec[] exportCsv->>collectVisibleColumns: gridApi, specs, pframeSpec, columnsMeta Note over collectVisibleColumns: effectiveLabel(spec, columnsMeta) sidecar override > pl7.app/label > spec.name collectVisibleColumns-->>exportCsv: [index, disambiguatedLabel][] exportCsv->>PFrameDriver: "exportPTable(handle, {columnIndices, headerNames})" Note over PFrameDriver: headerNames[i] win over getNativeColumnLabel() empty/missing fallback to spec label PFrameDriver-->>User: CSV file with disambiguated headersReviews (2): Last reviewed commit: "MILAB-6655: validate headerNames length;..." | Re-trigger Greptile
Context used: