Repository navigation
feat(ipa): allow schema-level IPA-112 is-prefix exceptions - #1548
Merged
maks-m-mongo-leaf merged 4 commits intoOct 13, 2026
Merged
maks-m-mongo-leaf merged 4 commits into
maks-m-mongo-leaf merged 4 commits into
Conversation
## Proposed changes Allow the `xgen-IPA-112-boolean-field-names-avoid-is-prefix` exception to be set on a schema as well as on an individual field. Before this change, only an exception on the field itself was accepted, so every new `is*` field on an existing schema (such as project/group settings) needed its own exception and another round of API champion approval. - Add `findExceptionInParentSchema` to `utils/exceptions.js`, modeled on `findExceptionInPathHierarchy`. It looks up the exception on the schema that directly contains the property. If both the field and its schema have the exception, it returns an unnecessary-exception error for the field. - Add `evaluateAndCollectAdoptionStatusWithInheritedException` to `collectionUtils.js`. For a field that violates the rule, it records the inherited exception (with the schema's reason) against the field's path, so schema-level exceptions are still counted in the IPA metrics. Fields that follow the rule are counted as adoptions and are not flagged as having an unnecessary exception. - Update `IPA112BooleanFieldNamesAvoidIsPrefix` to use these helpers. Field-level exceptions keep working as before. - Add the schema-level option to the rule's description (IPA-112.yaml and the generated rulesets README) and to the exceptions section of CONTRIBUTING.md. A schema-level exception applies only to the schema's direct properties. Inline nested object schemas need their own exception. _Jira ticket:_ CLOUDP-456528 ## Checklist - [ ] I have signed the [MongoDB CLA](https://www.mongodb.com/legal/contributor-agreement) - [x] I have added tests that prove my fix is effective or that my feature works ### Changes to Spectral - [x] I have read the [README](../tools/spectral/README.md) file for Spectral Updates ## Further comments Releasing a new IPA validation version, and switching the MMS group settings schema to a schema-level exception (removing the per-field exceptions), are follow-up steps outside this repository change.
Contributor
Author
|
Sage Bot can help with this pull request. Just |
- Report a schema-level IPA-112 exception as unnecessary when no field of the schema violates the rule - Report a field-level exception covered by a schema-level exception with an accurate message instead of "This component adopts the rule" - Guard findExceptionInParentSchema against undefined properties - Document that schema-level exceptions apply to direct properties only; fields in nested inline schemas or composition need their own exception
…ields - Run the schema-level exception necessity check for non-boolean properties too, so a stale exception is reported even when the schema has no direct boolean fields - Document the unnecessary-exception behavior and metrics counting in the rule description
- Merge the three unnecessary-exception error constructors into one shared helper - Simplify the IPA-112 rule flow and guard against a missing parent schema when a field has its own exception (fixes a crash for non-boolean fields with both exceptions) - Add a regression test for the non-boolean field case
lovisaberggren
approved these changes
Oct 13, 2026
maks-m-mongo-leaf
deleted the
sage-bot/coding-session/sage-coding-session-1791798071572
branch
October 13, 2026 14:46
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.
What
Allow the
xgen-IPA-112-boolean-field-names-avoid-is-prefixexception on the schema containing a field, not only on the field itself, so newis*fields on an existing settings schema no longer each need their own exception and approval round.allOf/anyOf/oneOfcomposition need their own exception.Docs updated: rule description (IPA-112.yaml + generated README) and CONTRIBUTING.md.
Jira ticket: CLOUDP-456528
Follow-ups (outside this repo)
@mongodb-js/ipa-validation-rulesetversion.GroupSettingsandGroupSettingsPreviewdeclare theiris*fields directly, so the schema-level exception covers them.Checklist