Skip to content

feat(ipa): IPA-112 excempt trailing abbreviations - #1473

Draft
maks-m-mongo-leaf wants to merge 1 commit into
mainfrom
feat-ipa-112-allow-uom-abbreviation
Draft

feat(ipa): IPA-112 excempt trailing abbreviations#1473
maks-m-mongo-leaf wants to merge 1 commit into
mainfrom
feat-ipa-112-allow-uom-abbreviation

Conversation

@maks-m-mongo-leaf

@maks-m-mongo-leaf maks-m-mongo-leaf commented Sep 4, 2026

Copy link
Copy Markdown
Collaborator

Proposed changes

Jira ticket: CLOUDP-442116

The xgen-IPA-112-field-names-are-camel-case rule incorrectly flagged field names that include units-of-measure (UoM) abbreviations such as GB, MB, KB, TB, PB, GHz, MHz, KHz, Mbps, Kbps, Gbps, Tbps. These abbreviations are legitimately uppercase in camelCase field names (e.g. diskGB, memoryMB, cpuGHz) but the underlying casing() function treated each uppercase letter as a separate word, causing false-positive violations.

The fix normalises known UoM abbreviations before the camelCase check by lowercasing their trailing letters (e.g. diskGBdiskGb for validation purposes only; the original name is preserved in any error message). The normalisation only applies when the abbreviation is preceded by a lowercase letter or digit and is followed by an uppercase letter or end-of-string — so invalid cases like GBSize, DISKGB, diskGBs, and diskGBMB still correctly fail.

As a result, the two per-field spectral overrides for AdvancedAutoScalingSettings/properties/diskGB and AutoScalingSettings/properties/diskGB in ipa-spectral.yaml are also removed, as they are no longer needed.

Checklist

  • I have signed the MongoDB CLA
  • I have added tests that prove my fix is effective or that my feature works

Changes to Spectral

  • I have read the README file for Spectral Updates

Further comments

The normalisation is a pre-processing step only — the original field name is always used in the violation message. Known tradeoff: UoM abbreviations that coincide with other acronyms (e.g. GB = Great Britain, MB = Message Bus) will be incorrectly allowed. This is considered acceptable given the domain context of the Atlas API.

@maks-m-mongo-leaf maks-m-mongo-leaf self-assigned this Sep 4, 2026
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