Skip to content

feat(ipa): require long-running operations to expose an Operations endpoint - #1461

Merged
julius-jogela merged 1 commit into
mainfrom
feat-ipa-132-operations-endpoint-existence
Aug 28, 2026
Merged

julius-jogela merged 1 commit into
mainfrom
feat-ipa-132-operations-endpoint-existence

Conversation

@julius-jogela

@julius-jogela julius-jogela commented Aug 28, 2026 •

Copy link
Copy Markdown
Contributor

Proposed changes

This PR adds the last IPA-132 rule: a long-running operation must expose the Operations endpoint clients poll for status.

Jira ticket: CLOUDP-435359

Rule added

At warn severity, given $.paths[*][post,put,patch,delete]:

Rule Checks
xgen-IPA-132-lros-must-expose-an-operations-endpoint Both the Operations collection (.../operations) and the single Operation endpoint (.../operations/{operationId}) are defined under the resource path of the long-running operation

Resource path resolution: custom method suffixes are stripped before deriving the resource path. A mutation of a collection must expose the endpoints under the collection path (/resource/operations), and a mutation of a single resource under the resource instance path (/resource/{resourceId}/operations).

How long-running operations are selected

Through the shared isNonLegacyLongRunningOperation helper introduced in #1448 — selection is on the declared 202 response, with legacy operations excluded both by the legacy: true marking and by the shared legacy operationId list. No new selection logic.

Testing

Valid cases for the collection-level, instance-level and custom-method shapes; invalid cases for a missing Operations endpoint, for a collection defined without the single Operation endpoint, and for an instance-level operation whose Operations endpoints sit only at the parent collection; violation-with-exception (suppressed) and compliant-with-exception (flagged as unnecessary); selection cases covering untagged operations declaring a 202 (valid and violating), synchronous operations, operations tagged without a 202, and legacy exclusion via both the legacy: true marking and the shared operationId list.

Full suite: 131 suites / 861 tests pass. Prettier clean.

Checklist

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

Base automatically changed from feat-ipa-132-lro-initiation to main August 28, 2026 12:48
const basePath = isCustomMethodIdentifier(resourcePath) ? stripCustomMethodName(resourcePath) : resourcePath;

const candidatePaths = [basePath];
if (isSingleResourceIdentifier(basePath)) {

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.

if the path is collection identifier -> check resource/operations and resource/operations/{operationId} exists
if the path is single resource identifier -> check resource/{resourceId}/operations and resource/{resourceId}/operations/{operationId} exists

How does it sound?

@julius-jogela julius-jogela Aug 28, 2026 •

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Sounds right — done in 938a514.

I had allowed a mutation of a single resource to satisfy the rule with the Operations endpoints at the parent collection as well, on the assumption that both levels were acceptable. That fallback is gone; the check is now exactly as you describe: the Operations endpoints must sit under the resource path of the mutation itself, collection or instance

Also rebased: #1448 has merged, so this is now a single commit on main and the stacked-PR note is dropped. Test updated to cover the parent-collection shape as a violation instead of a pass; full IPA suite green (861 tests).

@julius-jogela
julius-jogela force-pushed the feat-ipa-132-operations-endpoint-existence branch 2 times, most recently from 938a514 to 72aa08e Compare August 28, 2026 13:04
@julius-jogela
julius-jogela marked this pull request as ready for review August 28, 2026 13:07
@julius-jogela
julius-jogela requested a review from a team as a code owner August 28, 2026 13:07
step, so the rule behaves identically on merged and per-service specs
- Legacy operations that predate IPA-132 are excluded from validation, whether marked
`legacy: true` during the merge step or matched by the shared legacy operationId list
- Both the Operations collection (`.../operations`) and the single Operation endpoint

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.

Only Get and List methods must be defined. Tests follow this, however I couldn't see it in the rule implementation and we can update the documentation accordingly

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Good catch — you're right, that was only enforced by accident in the tests. Fixed in 7d2bb80.

The implementation checked that the two path keys existed and never looked at the methods they defined. Every test happened to write get: {} on those paths, so the suite read as if the requirement were enforced, but a spec defining /resource/operations with only post would have passed the rule.

The rule now requires the get method on both endpoints — List on the Operations collection, Get on the single Operation — and the message ends with "each with a get method". Two new invalid cases cover it: a collection defined with only post, and a single Operation defined with only delete. Both passed before, both flag now.

On the "only" half: I've left "no method other than get" to xgen-IPA-132-operation-must-be-a-read-only-resource, which already rejects it on Operations endpoints. So this rule requires get to be present and that one forbids everything else — they compose without overlapping. Happy to pull the exclusivity check in here too if you'd rather have it in one place.

Documentation updated in IPA-132.yaml with the new bullet, README regenerated from it. Suite green at 863 tests.

…dpoint

Add xgen-IPA-132-lros-must-expose-an-operations-endpoint: a mutating
method tagged as a compliant long-running operation must define both
the Operations collection and the single Operation endpoint, nested
under its resource path. A mutation of a collection exposes them under
the collection path, a mutation of a single resource under the resource
instance path; custom method suffixes are stripped when deriving the
resource path.
@julius-jogela
julius-jogela force-pushed the feat-ipa-132-operations-endpoint-existence branch from 72aa08e to 7d2bb80 Compare August 28, 2026 13:27

@andreaangiolillo andreaangiolillo 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. Thanks for all the great contributions during your internship! 💯 🫡

@julius-jogela
julius-jogela merged commit 3216132 into main Aug 28, 2026
9 checks passed
@julius-jogela
julius-jogela deleted the feat-ipa-132-operations-endpoint-existence branch August 28, 2026 14:02
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