Skip to content

[Cosmos] Add .pragentrules for PR review automation#48777

Closed
jeet1995 wants to merge 1 commit intoAzure:mainfrom
jeet1995:feat/cosmos-pragentrules
Closed

[Cosmos] Add .pragentrules for PR review automation#48777
jeet1995 wants to merge 1 commit intoAzure:mainfrom
jeet1995:feat/cosmos-pragentrules

Conversation

@jeet1995
Copy link
Copy Markdown
Member

What

Adds sdk/cosmos/.pragentrules — review rules consumed by the PR Deep Reviewer agent as mandatory constraints. These encode Cosmos-specific knowledge the agent cannot infer on its own.

Why

PR #47566 merged a new public enum (QuantizerType) and public methods on CosmosVectorIndexSpec without @Beta annotation, even though vector search is a preview feature. No existing automation caught this — not CheckStyle, not Revapi, not the PR review agent.

These rules close that gap. Modeled after the .NET Cosmos SDK precedent.

Rules Added

Category Rule Why Not Redundant with Agent
Preview API gating Check if new public APIs need @Beta — asks if service feature is GA Agent cannot know Cosmos feature GA status
Public enum extensibility Scrutinize new Java enums for closed-set risk Agent does not check Java enum extensibility patterns
Azure SDK guidelines Verify central Java design conventions for new client surface only Agent does not reference central guidelines
Java 8 compatibility No Java 9+ APIs/features in production code Agent does not enforce language baseline
Changelog (suppress) Do NOT flag missing per-PR entries Prevents false positive — Java Cosmos batches at release
API contracts (suppress) Do NOT ask for contract files Prevents false positive — uses APIView/Revapi in CI
CheckStyle (suppress) Do NOT suggest disabling lint rules Prevents bad advice
Multi-region emphasis Extra scrutiny on failover/routing for SW vs MW Domain-specific critical area
Retry emphasis Extra scrutiny on retry/timeout/exception-mapping Domain-specific critical area

Testing

Ran pragentrules-resolver against PR #47566 changed files:

  • QuantizerType.java, CosmosVectorIndexSpec.java, CHANGELOG.md, VectorIndexTest.java
  • All 4 files correctly resolve to the 9 rules from sdk/cosmos/.pragentrules

Safety

  • .pragentrules are consumed only by the PR Deep Reviewer agent — zero CI impact
  • No code changes — this is a review-time instruction file only

Add review rules for sdk/cosmos/ that the PR Deep Reviewer agent consumes
as mandatory constraints. These encode Cosmos-specific knowledge the agent
cannot infer on its own:

- @beta annotation gating for preview APIs (addresses PR Azure#47566 miss)
- Public enum extensibility scrutiny
- Azure SDK Java central guidelines check (new client surface only)
- Java 8 baseline compatibility
- Suppressions: CHANGELOG per-PR, API contract artifacts, CheckStyle disabling
- Domain emphasis: multi-region failover, retry/timeout criticality

Modeled after the .NET Cosmos SDK precedent (Azure/azure-cosmos-dotnet-v3).
Tested with pragentrules-resolver against PR Azure#47566 changed files.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@jeet1995
Copy link
Copy Markdown
Member Author

Closing — moving .pragentrules to the cosmos-sdk-copilot-toolkit repo instead of placing it in each SDK repo. The PR Deep Reviewer agent will load rules from the toolkit as a fallback.

@jeet1995 jeet1995 closed this Apr 10, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant