Skip to content

fix(ipa): allow Operations endpoint paths in IPA-102 alternation check - #1406

Merged
julius-jogela merged 5 commits into
mainfrom
ipa-102-allow-operations-paths
Jul 29, 2026
Merged

fix(ipa): allow Operations endpoint paths in IPA-102 alternation check#1406
julius-jogela merged 5 commits into
mainfrom
ipa-102-allow-operations-paths

Conversation

@julius-jogela

@julius-jogela julius-jogela commented Jul 29, 2026

Copy link
Copy Markdown
Collaborator

Proposed changes

Problem: LRO standardization (IPA-132) needs read-only Operations endpoints nested under a parent resource, at both collection and instance scope:

  • <parent>/operations
  • <parent>/operations/{operationId}
  • <parent>/{resourceId}/operations
  • <parent>/{resourceId}/operations/{operationId}

xgen-IPA-102-path-alternate-resource-name-path-param rejects the two collection-scoped shapes today, because the rule expects path segments to alternate resource-name / path-param, and operations sits where a {param} is expected.

Fix: treat a trailing operations or operations/{operationId} as a parity-neutral suffix, strip it off the path first, then run the existing alternation check unchanged on what's left.

Verification: replaying the old and new rule logic over all 367 paths in openapi/.raw/v2.yaml produces zero behavior changes on existing paths, confirming the change is additive.

Jira ticket: CLOUDP-429009

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

The LRO standardization work introduces read-only Operations endpoints
nested under a parent resource:

  <parent>/operations
  <parent>/operations/{operationId}
  <parent>/{resourceId}/operations
  <parent>/{resourceId}/operations/{operationId}

xgen-IPA-102-path-alternate-resource-name-path-param rejected the
collection-scoped shapes, because `operations` sits where the rule
expects a path parameter.

Treat a trailing `operations` or `operations/{operationId}` as a
parity-neutral suffix: strip it, then run the existing alternation check
unchanged. A positional carve-out is not sufficient, since an
odd-indexed non-param segment shifts the parity of every segment after
it, so `<parent>/operations/{operationId}` would still fail.

The exemption requires a parent segment, so a bare `/operations` at the
API root is unaffected; rejecting unscoped Operations endpoints belongs
to IPA-132, not IPA-102.

Verified additive: replaying the old and new logic over all 367 paths in
openapi/.raw/v2.yaml produces zero behaviour changes.
The Operations exemption is described by its own bullet, so the existing
'must follow a pattern where resource names and path parameters strictly
alternate' line does not need softening.
…comment

The two unauth paths are collection-scoped, not instance-scoped, so they
sat under the wrong comment.
@julius-jogela
julius-jogela marked this pull request as ready for review July 29, 2026 10:36
@julius-jogela
julius-jogela requested a review from a team as a code owner July 29, 2026 10:36
Slicing an unscoped Operations path down to no segments already passes
the alternation check vacuously, so the ternary fallback and the comment
explaining it were describing a distinction with no observable effect.
An Operations path that now passes but still carries an
x-xgen-IPA-exception gets an unnecessary-exception error, which is a
direct consequence of this change and worth pinning. Drop the
customAction case, which duplicates the existing resourceName1/
resourceName2 coverage.

@yelizhenden-mdb yelizhenden-mdb left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

LGTM

@julius-jogela
julius-jogela merged commit c489f5b into main Jul 29, 2026
9 checks passed
@julius-jogela
julius-jogela deleted the ipa-102-allow-operations-paths branch July 29, 2026 13:15
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