From ebe5165782d735a454b7e1cdea253c001e5dba71 Mon Sep 17 00:00:00 2001
From: XingY
Date: Tue, 15 Jul 2025 16:01:17 -0700
Subject: [PATCH 1/3] Issue 53419: Aliquot parent with number like names that
starts with leading zeroes aren't resolved during import
---
.../api/query/AbstractQueryImportAction.java | 2 ++
.../test/integration/SampleTypeCrud.ispec.ts | 16 +++++++++++-----
2 files changed, 13 insertions(+), 5 deletions(-)
diff --git a/api/src/org/labkey/api/query/AbstractQueryImportAction.java b/api/src/org/labkey/api/query/AbstractQueryImportAction.java
index e5ada4d6baa..5a4e3d0df97 100644
--- a/api/src/org/labkey/api/query/AbstractQueryImportAction.java
+++ b/api/src/org/labkey/api/query/AbstractQueryImportAction.java
@@ -40,6 +40,7 @@
import org.labkey.api.dataiterator.DataIterator;
import org.labkey.api.dataiterator.DataIteratorContext;
import org.labkey.api.dataiterator.DetailedAuditLogDataIterator;
+import org.labkey.api.exp.api.ExpMaterial;
import org.labkey.api.exp.api.ExperimentService;
import org.labkey.api.gwt.client.AuditBehaviorType;
import org.labkey.api.module.Module;
@@ -702,6 +703,7 @@ public static void configureLoader(DataLoader loader, @Nullable TableInfo target
String name = col.name.toLowerCase();
if (ExperimentService.isInputOutputColumn(col.name) ||
name.equalsIgnoreCase("Name") || /* Issue 50710: Treat "Name" column as a string value for sample or data class import */
+ name.equalsIgnoreCase(ExpMaterial.ALIQUOTED_FROM_INPUT) || /* Issue 53419: Aliquot parent with number like names that starts with leading zeroes aren't resolved during import */
(lineageAliasNames != null && lineageAliasNames.contains(name)) )
{
col.clazz = String.class;
diff --git a/experiment/src/client/test/integration/SampleTypeCrud.ispec.ts b/experiment/src/client/test/integration/SampleTypeCrud.ispec.ts
index fc216383297..b070697b182 100644
--- a/experiment/src/client/test/integration/SampleTypeCrud.ispec.ts
+++ b/experiment/src/client/test/integration/SampleTypeCrud.ispec.ts
@@ -1,4 +1,4 @@
-import { ExperimentCRUDUtils, hookServer, RequestOptions, successfulResponse } from '@labkey/test';
+import { ExperimentCRUDUtils, hookServer, RequestOptions, selectRandomN, successfulResponse } from '@labkey/test';
import mock from 'mock-fs';
import {
checkDomainName,
@@ -394,6 +394,7 @@ describe('Aliquot crud', () => {
const aliquotQueryCols = 'name, rowid, lsid, description, str, int, isAliquot, AliquotedFromLsid/name, rootmaterialrowid, Myparentcol, Myaliquotcol, Myindependentcol';
async function verifyImportingWithNameValue(parentSampleName: string, sampleType: string) {
+ console.log('Selected parentSampleName: ' + parentSampleName);
const parentInsertRow = {
name: parentSampleName,
description: 'testImportingWithNameValue parent'
@@ -559,14 +560,19 @@ describe('Aliquot crud', () => {
* An aliquot with the name formatted as an aliquot (SAI_1-101).
* And have an aliquot w/o a name set.
* Validate that the names are as expected.
+ * Issue 53419: Aliquot parent with number like names that starts with leading zeroes aren't resolved during import
*
* Because importing is batched the imported aliquot without an explicit name set it should have the next
* index (default behavior).
*
*/
- it('testImportingWithNameValue - with naming patten', async () => {
+
+ const parentSampleName = ['S-1', '123', '0001', '0002', 'With Space', '+ -_.&)(:'];
+
+
+ it('(Fuzz Test) testImportingWithNameValue - with naming patten ', async () => {
// also include scenarios from testImportWithUpdate
- await verifyImportingWithNameValue('withNameValueParent', SAMPLE_ALIQUOT_IMPORT_TYPE_NAME);
+ await verifyImportingWithNameValue(selectRandomN(parentSampleName, 1)[0], SAMPLE_ALIQUOT_IMPORT_TYPE_NAME);
});
/**
@@ -583,8 +589,8 @@ describe('Aliquot crud', () => {
*
*
*/
- it('testImportingWithNameValue - without naming patten', async () => {
- await verifyImportingWithNameValue('withNameValueParentNoPattern', SAMPLE_ALIQUOT_IMPORT_NO_NAME_PATTERN_NAME);
+ it('(Fuzz Test) testImportingWithNameValue - without naming patten', async () => {
+ await verifyImportingWithNameValue(selectRandomN(parentSampleName, 1)[0], SAMPLE_ALIQUOT_IMPORT_NO_NAME_PATTERN_NAME);
});
async function verifyMultipleRootsAndAliquots(parentSampleName1: string, parentSampleName2: string, sampleType: string) {
From 00d4e819d65b50ad11f0704ec59e36fa82591a3f Mon Sep 17 00:00:00 2001
From: XingY
Date: Wed, 16 Jul 2025 12:36:23 -0700
Subject: [PATCH 2/3] limit change to sample import only
---
.../labkey/api/query/AbstractQueryImportAction.java | 1 -
.../controllers/exp/ExperimentController.java | 10 +++++-----
2 files changed, 5 insertions(+), 6 deletions(-)
diff --git a/api/src/org/labkey/api/query/AbstractQueryImportAction.java b/api/src/org/labkey/api/query/AbstractQueryImportAction.java
index 5a4e3d0df97..a01610f199d 100644
--- a/api/src/org/labkey/api/query/AbstractQueryImportAction.java
+++ b/api/src/org/labkey/api/query/AbstractQueryImportAction.java
@@ -703,7 +703,6 @@ public static void configureLoader(DataLoader loader, @Nullable TableInfo target
String name = col.name.toLowerCase();
if (ExperimentService.isInputOutputColumn(col.name) ||
name.equalsIgnoreCase("Name") || /* Issue 50710: Treat "Name" column as a string value for sample or data class import */
- name.equalsIgnoreCase(ExpMaterial.ALIQUOTED_FROM_INPUT) || /* Issue 53419: Aliquot parent with number like names that starts with leading zeroes aren't resolved during import */
(lineageAliasNames != null && lineageAliasNames.contains(name)) )
{
col.clazz = String.class;
diff --git a/experiment/src/org/labkey/experiment/controllers/exp/ExperimentController.java b/experiment/src/org/labkey/experiment/controllers/exp/ExperimentController.java
index 0086c905888..710cb334ff2 100644
--- a/experiment/src/org/labkey/experiment/controllers/exp/ExperimentController.java
+++ b/experiment/src/org/labkey/experiment/controllers/exp/ExperimentController.java
@@ -4413,6 +4413,9 @@ protected Map getRenamedColumns()
@Override
protected @Nullable Set getLineageImportAliases() throws IOException
{
+ Set aliases = new CaseInsensitiveHashSet();
+ // Issue 53419: Aliquot parent with number like names that starts with leading zeroes aren't resolved during import
+ aliases.add(ExpMaterial.ALIQUOTED_FROM_INPUT);
boolean crossTypeImport = getOptionParamValue(AbstractQueryImportAction.Params.crossTypeImport);
// Issue 51894: We need to stop conversion to numbers for alias fields for all type
// If there are aliases defined for one type that are number fields in another type, this will prevent
@@ -4421,18 +4424,15 @@ protected Map getRenamedColumns()
if (crossTypeImport)
{
List sampleTypes = SampleTypeServiceImpl.get().getSampleTypes(getContainer(), getUser(), true);
- Set aliases = new CaseInsensitiveHashSet();
for (ExpSampleTypeImpl sampleType : sampleTypes)
- {
aliases.addAll(sampleType.getImportAliases().keySet());
- }
- return aliases;
}
else
{
ExpSampleTypeImpl sampleType = SampleTypeServiceImpl.get().getSampleType(getContainer(), getUser(), _form.getQueryName());
- return new CaseInsensitiveHashSet(sampleType.getImportAliases().keySet());
+ aliases.addAll(sampleType.getImportAliases().keySet());
}
+ return aliases;
}
@Override
From 6aee0471d531424e6e216893abaee780804657ba Mon Sep 17 00:00:00 2001
From: XingY
Date: Wed, 16 Jul 2025 12:54:26 -0700
Subject: [PATCH 3/3] clean
---
api/src/org/labkey/api/query/AbstractQueryImportAction.java | 1 -
1 file changed, 1 deletion(-)
diff --git a/api/src/org/labkey/api/query/AbstractQueryImportAction.java b/api/src/org/labkey/api/query/AbstractQueryImportAction.java
index a01610f199d..e5ada4d6baa 100644
--- a/api/src/org/labkey/api/query/AbstractQueryImportAction.java
+++ b/api/src/org/labkey/api/query/AbstractQueryImportAction.java
@@ -40,7 +40,6 @@
import org.labkey.api.dataiterator.DataIterator;
import org.labkey.api.dataiterator.DataIteratorContext;
import org.labkey.api.dataiterator.DetailedAuditLogDataIterator;
-import org.labkey.api.exp.api.ExpMaterial;
import org.labkey.api.exp.api.ExperimentService;
import org.labkey.api.gwt.client.AuditBehaviorType;
import org.labkey.api.module.Module;