Skip to content

GH Issue 1867: Reject ragged importRows requests and keep values under mixed key casing - #8336

Merged
labkey-jeckels merged 10 commits into
release26.11-SNAPSHOTfrom
26.11_fb_di_importrows_first_row_cols_1867
Nov 17, 2026
Merged

labkey-jeckels merged 10 commits into
release26.11-SNAPSHOTfrom
26.11_fb_di_importrows_first_row_cols_1867

Conversation

@labkey-jeckels

@labkey-jeckels labkey-jeckels commented Nov 13, 2026 •

Copy link
Copy Markdown
Contributor

Rationale

This PR stops saveRows commands from silently losing data when rows in one request differ in which fields they supply or how they spell a field name (GH Issue 1867). importRows built its columns from the first row, so fields that only later rows supplied were dropped, and on any command a later row spelling a key in different case blanked that field in earlier rows, all while the request reported success.

Behavior change for reviewers: an importRows request whose rows don't all supply the same fields now fails, naming the first mismatched row and its missing and unexpected fields. The new deprecated feature "Allow importRows rows with differing fields" accepts such requests again, storing NULL for any field a row omits. Insert, update, and delete still accept rows with differing fields.

Changes

  • importRows rejects requests whose rows don't all supply the same fields.
  • A deprecated feature flag restores acceptance of such requests, storing NULL for omitted fields instead of dropping later rows' extra fields.
  • Keys that differ only in case across rows are stored under the first spelling, so no row loses its value.

@labkey-matthewb

labkey-matthewb commented Nov 13, 2026 •

Copy link
Copy Markdown
Contributor

I haven't done the CR yet, but just based on the PR comment: IMHO this is not the expected behavior for import. We should be documenting that import expects "square" data rows. I would like to say the same for insert as well, but that's open for discussion.

This statement is a little ambiguous "On every list-of-maps insert path, a column that a row omits gets its database default, including multi-choice columns; an explicit null still stores NULL." Just clarifying that multi-choice columns are always NOT NULL and default to empty array. null/empty conversion should handle this (MultiChoice.Converter)

@labkey-jeckels

Copy link
Copy Markdown
Contributor Author

I haven't done the CR yet, but just based on the PR comment: IMHO this is not the expected behavior for import. We should be documenting that import expects "square" data rows. I would like to say the same for insert as well, but that's open for discussion.

This statement is a little ambiguous "On every list-of-maps insert path, a column that a row omits gets its database default, including multi-choice columns; an explicit null still stores NULL." Just clarifying that multi-choice columns are always NOT NULL and default to empty array. null/empty conversion should handle this (MultiChoice.Converter)

OK. I've pushed changes that reject ragged rows, gated by a deprecated feature flag in case someone is relying on the current behavior.

labkey-jeckels added a commit to LabKey/OConnorLabModules that referenced this pull request Nov 16, 2026
…of() (#222)

## Rationale
This PR removes the deprecated `ListofMapsDataIterator` and moves its
remaining callers to `MapDataIterator.of()`, as suggested in review of
LabKey/platform#8336. Keeping two ways to build
an iterator from a list of maps invites fixes that land in only one of
them.

## Related Pull Requests
- LabKey/platform#8343
- LabKey/clientModules#155
- LabKey/customModules#294
- LabKey/premiumModules#866
- LabKey/snprcEHRModules#1041
- LabKey/wnprc-modules#1086

## Changes
- `ListofMapsDataIterator` is deleted from platform.
- Callers in platform and six module repos now use
`MapDataIterator.of()`. The iterator is built on the context of the
import that uses it, rather than on a throwaway context.
labkey-jeckels added a commit to LabKey/customModules that referenced this pull request Nov 16, 2026
…of() (#294)

## Rationale
This PR removes the deprecated `ListofMapsDataIterator` and moves its
remaining callers to `MapDataIterator.of()`, as suggested in review of
LabKey/platform#8336. Keeping two ways to build
an iterator from a list of maps invites fixes that land in only one of
them.

## Related Pull Requests
- LabKey/platform#8343
- LabKey/clientModules#155
- LabKey/premiumModules#866
- LabKey/OConnorLabModules#222
- LabKey/snprcEHRModules#1041
- LabKey/wnprc-modules#1086

## Changes
- `ListofMapsDataIterator` is deleted from platform.
- Callers in platform and six module repos now use
`MapDataIterator.of()`. The iterator is built on the context of the
import that uses it, rather than on a throwaway context.
labkey-jeckels added a commit to LabKey/snprcEHRModules that referenced this pull request Nov 16, 2026
…of() (#1041)

## Rationale
This PR removes the deprecated `ListofMapsDataIterator` and moves its
remaining callers to `MapDataIterator.of()`, as suggested in review of
LabKey/platform#8336. Keeping two ways to build
an iterator from a list of maps invites fixes that land in only one of
them.

## Related Pull Requests
- LabKey/platform#8343
- LabKey/clientModules#155
- LabKey/customModules#294
- LabKey/premiumModules#866
- LabKey/OConnorLabModules#222
- LabKey/wnprc-modules#1086

## Changes
- `ListofMapsDataIterator` is deleted from platform.
- Callers in platform and six module repos now use
`MapDataIterator.of()`. The iterator is built on the context of the
import that uses it, rather than on a throwaway context.
labkey-jeckels added a commit to LabKey/wnprc-modules that referenced this pull request Nov 16, 2026
…of() (#1086)

## Rationale
This PR removes the deprecated `ListofMapsDataIterator` and moves its
remaining callers to `MapDataIterator.of()`, as suggested in review of
LabKey/platform#8336. Keeping two ways to build
an iterator from a list of maps invites fixes that land in only one of
them.

## Related Pull Requests
- LabKey/platform#8343
- LabKey/clientModules#155
- LabKey/customModules#294
- LabKey/premiumModules#866
- LabKey/OConnorLabModules#222
- LabKey/snprcEHRModules#1041

## Changes
- `ListofMapsDataIterator` is deleted from platform.
- Callers in platform and six module repos now use
`MapDataIterator.of()`. The iterator is built on the context of the
import that uses it, rather than on a throwaway context.
labkey-jeckels added a commit that referenced this pull request Nov 16, 2026
…of() (#8343)

## Rationale
This PR removes the deprecated `ListofMapsDataIterator` and moves its
remaining callers to `MapDataIterator.of()`, as suggested in review of
#8336. Keeping two ways to build
an iterator from a list of maps invites fixes that land in only one of
them.

## Related Pull Requests
- LabKey/clientModules#155
- LabKey/customModules#294
- LabKey/premiumModules#866
- LabKey/OConnorLabModules#222
- LabKey/snprcEHRModules#1041
- LabKey/wnprc-modules#1086

## Changes
- `ListofMapsDataIterator` is deleted from platform.
- Callers in platform and six module repos now use
`MapDataIterator.of()`. The iterator is built on the context of the
import that uses it, rather than on a throwaway context.

## Tasks
- [x] Claude Code Review
- [x] Manual Testing - N/A
- [x] Test Automation - N/A
f = new RowMapFactory<>();
CaseInsensitiveHashMap<Object> referenceCasing = new CaseInsensitiveHashMap<>();
// GH Issue 1867: row maps share casing state, so a later row's spelling of a key would hide earlier rows' values
CaseInsensitiveHashMap<String> keySpellings = new CaseInsensitiveHashMap<>();

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Manual testing: Bug. The square-rows check runs before addRowAttachments. @labkey/api's bindSaveRowsCommand deletes File values from each row and sends them as separate multipart parts. So in a list with an attachment field, if row 0 has a File and row 1 sends Attachment: null, the server sees row 0 without the key and row 1 with it. The request gets rejected even though the user sent the same fields in every row.

I wrote up a regression test and it was able to reproduce this problem. Attached is a patch with the test and a suggested fix. Feel free to revise and/or move the test to a different test since it sits in a different repo.

1867FileAttachments.patch

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.

I moved the test into ImportRowsTestCase to keep this in one PR. A little clunky in terms of the multipart submission but I confirmed it fails without the fix and passes with it.

@labkey-jeckels
labkey-jeckels merged commit 55b0e79 into release26.11-SNAPSHOT Nov 17, 2026
9 checks passed
@labkey-jeckels
labkey-jeckels deleted the 26.11_fb_di_importrows_first_row_cols_1867 branch November 17, 2026 00:40
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.

3 participants