Skip to content

refactor(ipa): single-source the legacy long-running operation list - #1447

Merged
julius-jogela merged 2 commits into
mainfrom
feat-ipa-132-shared-legacy-lro-list
Aug 24, 2026
Merged

julius-jogela merged 2 commits into
mainfrom
feat-ipa-132-shared-legacy-lro-list

Conversation

@julius-jogela

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

Copy link
Copy Markdown
Contributor

Proposed changes

This PR moves the hardcoded list of 17 legacy long-running operationIds out of the foascli merge tagger into a single shared file, so the upcoming IPA-132 LRO rules can consume the same list the tagger uses. Tagging behavior is unchanged.

Jira ticket: CLOUDP-438234

Why

The IPA-132 LRO rules will select on the declared 202 response so they also work on the raw per-service specs in MMS, where x-xgen-long-running-operation does not exist (it is only added at the merge step). Those rules need the same legacy exclusions the tagger applies, without maintaining the list twice.

How

  • tools/spectral/ipa/rulesets/functions/utils/legacyLongRunningOperations.json — the single source of truth. Lives inside the ruleset package so it ships to npm consumers.
  • The Go map in the merge package is now a checked-in file generated from that JSON (go generate ./internal/cli/merge, generator under internal/cli/merge/gen). go:embed cannot cross the tools/cli module boundary and the released foascli binary cannot read repo files at runtime, so generation is the mechanism.
  • A new unit test reads the JSON and asserts set-equality with the generated map, so the two cannot drift; it runs in the existing unit-test CI step.

Testing

  • go build ./..., go vet, go test -race -cover ./internal... — all pass; the existing tagLongRunningOperations tests are unchanged and green.
  • golangci-lint run (v2.10.1, the CI pin): 0 issues.
  • go generate verified idempotent; regenerated output is byte-identical to the previous hand-written map.
  • Repo-wide prettier check passes (covers the new JSON).

Checklist

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

Move the 17 legacy operationIds out of the merge tagger's hardcoded map
into legacyLongRunningOperations.json inside the IPA ruleset package,
where the upcoming 202-based IPA-132 LRO rules and the npm package
consumers can read it directly. The Go map is now generated from that
JSON via go generate, and a unit test asserts the two never drift.
Tagging behavior is unchanged.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
@julius-jogela
julius-jogela force-pushed the feat-ipa-132-shared-legacy-lro-list branch from 8cd8538 to c7c5aad Compare August 24, 2026 12:51
@julius-jogela
julius-jogela marked this pull request as ready for review August 24, 2026 12:58
@julius-jogela
julius-jogela requested a review from a team as a code owner August 24, 2026 12:58
builder.WriteString("//\n")
builder.WriteString("// Generated by this command:\n")
builder.WriteString("//\n")
builder.WriteString("//\tgo run ./gen\n\n")

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.

Q: Does this command run automatically as part of the build, or do we need to run it manually?
(If manual, it would be better if we can add it to somewhere in the contributing.md)

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.

It's manual, go generate doesn't run as part of the build. There's a unit test that compares the generated map against the JSON so the two can't drift. Also added a line to CONTRIBUTING.md for clarity.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
@julius-jogela
julius-jogela merged commit 55b4941 into main Aug 24, 2026
14 checks passed
@julius-jogela
julius-jogela deleted the feat-ipa-132-shared-legacy-lro-list branch August 24, 2026 13:37
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