Skip to content

[XmsClientName] Optimize rule to prevent stack overflow on large specs#846

Merged
mikeharder merged 10 commits intomainfrom
copilot/fix-xms-client-name-stack-overflow
Mar 31, 2026
Merged

[XmsClientName] Optimize rule to prevent stack overflow on large specs#846
mikeharder merged 10 commits intomainfrom
copilot/fix-xms-client-name-stack-overflow

Conversation

Copy link
Copy Markdown
Contributor

Copilot AI commented Mar 31, 2026

…ranteed by given clause)

Agent-Logs-Url: https://github.com/Azure/azure-openapi-validator/sessions/7881f5ed-00de-4fd7-ba94-e18ff7415de4

Co-authored-by: mikeharder <9459391+mikeharder@users.noreply.github.com>
@mikeharder
Copy link
Copy Markdown
Member

@copilot: fix the formatting of this file: xms-client-name.test.ts

Copy link
Copy Markdown
Contributor Author

Copilot AI commented Mar 31, 2026

@copilot: fix the formatting of this file: xms-client-name.test.ts

Fixed in 847fb66 — ran prettier to add missing trailing commas.

@mikeharder mikeharder moved this from 🤔 Triage to 🔬 Dev in PR in Azure SDK EngSys 🚀🌒🧑‍🚀 Mar 31, 2026
@mikeharder mikeharder changed the title [XmsClientName] Optimize rule to prevent excessive memory usage on large specs [XmsClientName] Optimize rule to prevent stack overflow on large specs Mar 31, 2026
@mikeharder mikeharder marked this pull request as ready for review March 31, 2026 04:46
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Updates the Spectral XmsClientName rule to avoid JSONPath traversal patterns that can trigger stack overflows on very large OpenAPI specs, while keeping the rule’s behavior the same and aligning generated artifacts/tests with the new approach.

Changes:

  • Updated the XmsClientName rule given JSONPath to filter earlier (@ != null + x-ms-client-name exists) to prevent stack overflows on large specs.
  • Simplified the xmsClientName function by removing guards now guaranteed by the given clause.
  • Refactored/expanded unit tests for edge cases (missing x-ms-client-name, null property values) and bumped rulesets version + changelog entry.

Reviewed changes

Copilot reviewed 5 out of 8 changed files in this pull request and generated 3 comments.

Show a summary per file
File Description
packages/rulesets/src/spectral/az-common.ts Updates XmsClientName.given to a safer early-filtering JSONPath pattern.
packages/rulesets/src/spectral/functions/Extensions/xms-client-name.ts Removes redundant null/object/undefined checks relying on the updated given clause.
packages/rulesets/src/spectral/test/xms-client-name.test.ts Refactors tests with a helper + adds coverage for nodes filtered by the new given clause.
packages/rulesets/generated/spectral/az-common.js Regenerates compiled ruleset with updated given and simplified function.
packages/rulesets/generated/spectral/az-arm.js Regenerates compiled ruleset with updated given and simplified function.
packages/rulesets/generated/spectral/az-dataplane.js Regenerates compiled ruleset with updated given and simplified function.
packages/rulesets/package.json Bumps package version to 2.2.6.
packages/rulesets/CHANGELOG.md Adds 2.2.6 entry describing the XmsClientName optimization.

@mikeharder mikeharder requested a review from danieljurek March 31, 2026 17:14
@mikeharder mikeharder closed this Mar 31, 2026
@github-project-automation github-project-automation bot moved this from 🔬 Dev in PR to 🎊 Closed in Azure SDK EngSys 🚀🌒🧑‍🚀 Mar 31, 2026
@mikeharder mikeharder reopened this Mar 31, 2026
@github-project-automation github-project-automation bot moved this from 🎊 Closed to 🤔 Triage in Azure SDK EngSys 🚀🌒🧑‍🚀 Mar 31, 2026
@mikeharder mikeharder merged commit 9fb5ab8 into main Mar 31, 2026
11 checks passed
@mikeharder mikeharder deleted the copilot/fix-xms-client-name-stack-overflow branch March 31, 2026 17:46
@github-project-automation github-project-automation bot moved this from 🤔 Triage to 🔬 Dev in PR in Azure SDK EngSys 🚀🌒🧑‍🚀 Mar 31, 2026
@kurtzeborn kurtzeborn moved this from 🔬 Dev in PR to 🎊 Closed in Azure SDK EngSys 🚀🌒🧑‍🚀 Mar 31, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

Development

Successfully merging this pull request may close these issues.

5 participants