Skip to content

Avoid generating fields names with reserved substitution format patterns#2537

Merged
labkey-tchad merged 1 commit intorelease25.7-SNAPSHOTfrom
25.7_fb_avoidReservedFieldNamePatterns
Jul 9, 2025
Merged

Avoid generating fields names with reserved substitution format patterns#2537
labkey-tchad merged 1 commit intorelease25.7-SNAPSHOTfrom
25.7_fb_avoidReservedFieldNamePatterns

Conversation

@labkey-tchad
Copy link
Member

Rationale

As more tests are being converted to use random field names, they are failing periodically because we generate random field names that conflict with reserved formats. The reserved formats are colons followed by strings that tests often use for field names (e.g. ":Date" or ":First"). This change replaces the ':' with another random character if it generates something that might cause trouble.

Related Pull Requests

  • N/A

Changes

  • Avoid generating fields names with reserved substitution format patterns

@labkey-tchad labkey-tchad requested review from a team and labkey-danield and removed request for a team July 7, 2025 19:25
if (numStartChars > 0 && randomFieldName.charAt(numStartChars - 1) == ':' &&
StringUtils.isAlpha(part.substring(0, 4))) // The shortest pattern is four characters (see org.labkey.api.util.SubstitutionFormat.getFormatNames)
{
String regenExclusion = Objects.requireNonNullElse(exclusion, "") + ":";
Copy link
Contributor

Choose a reason for hiding this comment

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

Interesting, didn't know about this. Learn something new every day.

@labkey-tchad labkey-tchad merged commit a3968ce into release25.7-SNAPSHOT Jul 9, 2025
7 of 8 checks passed
@labkey-tchad labkey-tchad deleted the 25.7_fb_avoidReservedFieldNamePatterns branch July 9, 2025 00:36
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.

2 participants