Skip to content

Commit bb59832

Browse files
CopilotRickWinter
andcommitted
Merge branch 'main' into copilot/fix-2829 - resolve conflicts
Co-authored-by: RickWinter <4430337+RickWinter@users.noreply.github.com>
1 parent be4ba9a commit bb59832

File tree

525 files changed

+34277
-11006
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

525 files changed

+34277
-11006
lines changed

.github/CODEOWNERS

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@
5555
####################
5656

5757
# PRLabel: %Cosmos
58-
/sdk/cosmos/ @analogrelay @Pilchie @kirankumarkolli @tvaron3 @FabianMeiswinkel @kundadebdatta @nehrao1 @kushagraThapar
58+
/sdk/cosmos/ @Azure/azure-cosmos-rust-sdk
5959

6060
# ServiceLabel: %Cosmos
6161
# AzureSDKOwners: @heaths
@@ -73,6 +73,12 @@
7373
# ServiceLabel: %Storage
7474
# AzureSDKOwners: @vincenttran-msft @jalauzon-msft
7575

76+
# PRLabel: %Event Hubs
77+
/sdk/eventhubs/ @j7nw4r
78+
79+
# ServiceLabel: %Event Hubs
80+
# AzureSDKOwners: @j7nw4r
81+
7682
####################
7783
# Management Libraries
7884
####################
@@ -85,7 +91,7 @@
8591
/.github/workflows/ @Azure/azure-sdk-eng
8692
/.github/CODEOWNERS @RickWinter @ronniegeraghty @Azure/azure-sdk-eng
8793
/.config/1espt/ @benbp @weshaggard
88-
/sdk/template/ @hallipr
94+
/sdk/canary/ @hallipr
8995

9096
# Add owners for notifications for specific pipelines
9197
/eng/common/pipelines/codeowners-linter.yml @rickwinter

.github/copilot-instructions.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,8 @@ You are an expert Rust programmer. You write safe, efficient, maintainable, and
66
- Do not be overly apologetic and focus on clear guidance.
77
- If you cannot confidently generate code or other content, do not generate anything and ask for clarification.
88

9+
> **Note**: For comprehensive guidance on how AI agents should interact with this repository, including workflows, automation boundaries, and repository structure, see [AGENTS.md](https://github.com/Azure/azure-sdk-for-rust/blob/main/AGENTS.md).
10+
911
## Prerequisites
1012

1113
- To use Azure SDK MCP tool calls, the user must have PowerShell installed. Provide [PowerShell installation instructions](https://learn.microsoft.com/powershell/scripting/install/installing-powershell) if not installed, and recommend restarting the IDE to start the MCP server.
@@ -37,6 +39,7 @@ Use these instructions for test generation as well.
3739
- If you have trouble generating safe, efficient, maintainable, and lint-free code, insert a `TODO` comment describing what should happen.
3840
- All imported types, constants, functions, modules, and macros should be imported explicitly. Never import `*`.
3941
- Do not modify generated code, found in `generated` subdirectories. These files are generated by external tools and should not be edited manually.
42+
- When searching for function call chains in Rust code, be aware that rustfmt often formats method chains across multiple lines like `obj\n .foo()\n .bar()`. Use multi-line search patterns (e.g., `rg` with `-U` flag) or search for individual method names rather than complete call chains.
4043

4144
## Test Generation
4245

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ Cargo.lock
1313
.proxy/
1414
tests/data/
1515
review/
16+
results.json
1617

1718
# Dependencies.
1819
vcpkg_installed/

.vscode/cspell.json

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
"**/test-resources.json",
88
"**/test-resources-post.ps1",
99
"**/assets.json",
10+
"**/*.pfx",
1011
".config",
1112
".devcontainer/devcontainer.json",
1213
".devcontainer/Dockerfile",
@@ -35,12 +36,14 @@
3536
"bugbug",
3637
"checkpointstore",
3738
"clippy",
39+
"codeowners",
3840
"contoso",
3941
"cplusplus",
4042
"cpptools",
4143
"cppvsdbg",
4244
"datalake",
4345
"datetime",
46+
"deserializers",
4447
"devcontainers",
4548
"devicecode",
4649
"docsrs",
@@ -52,6 +55,7 @@
5255
"etag",
5356
"eventhub",
5457
"eventhubs",
58+
"headerless",
5559
"hmac",
5660
"iothub",
5761
"keyvault",
@@ -72,7 +76,10 @@
7276
"posix",
7377
"pwsh",
7478
"reqwest",
79+
"rsplit",
80+
"rustfmt",
7581
"runtimes",
82+
"rustfmt",
7683
"rustup",
7784
"schannel",
7885
"seekable",
@@ -199,7 +206,7 @@
199206
]
200207
},
201208
{
202-
"filename": "sdk/typespec/**",
209+
"filename": "sdk/core/typespec*/**",
203210
"flagWords": [
204211
"azure",
205212
"azurite"

AGENTS.md

Lines changed: 255 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,255 @@
1+
# AGENTS.md
2+
3+
This document provides guidance for AI agents (e.g., GitHub Copilot, MCP servers, or LLM-based assistants) interacting with the Azure SDK for Rust repository.
4+
5+
## Repository Overview
6+
7+
### Purpose
8+
9+
The Azure SDK for Rust provides Rust language bindings and client libraries for Azure services, following the [Azure SDK Design Guidelines for Rust](https://azure.github.io/azure-sdk/rust_introduction.html).
10+
11+
### Status
12+
13+
⚠️ Under active development. Large breaking changes may occur before 1.0 release.
14+
15+
### Primary Language
16+
17+
Rust (MSRV: 1.85)
18+
19+
### Key Technologies
20+
21+
- Rust toolchain with Cargo
22+
- TypeSpec for API specification and code generation
23+
- OpenTelemetry for distributed tracing
24+
- Test Proxy for recorded integration tests
25+
26+
## Repository Structure
27+
28+
```
29+
.
30+
├── sdk/ # Service-specific crates organized by service
31+
│ └── <service>/ # Service directory (e.g., "keyvault", "storage")
32+
│ ├── <crate>/ # Service crate (e.g., "azure_security_keyvault_secrets")
33+
│ ├── assets.json # Pointer to test recordings (may be under <crate>/)
34+
│ ├── test-resources.bicep # Test resource definitions (may be under <crate>/)
35+
│ └── tsp-location.yaml # Pointer to TypeSpec in azure-rest-api-specs (may be under <crate>/)
36+
├── eng/ # Engineering system scripts and common tooling
37+
├── doc/ # Additional documentation
38+
├── .github/
39+
│ ├── copilot-instructions.md # Copilot-specific Rust coding guidelines
40+
│ ├── instructions/ # Agent instruction files for specific tasks
41+
│ └── prompts/ # Reusable Copilot prompts
42+
├── CONTRIBUTING.md # Contribution guidelines (see for detailed workflows)
43+
└── README.md # Repository overview
44+
```
45+
46+
## Agent Capabilities
47+
48+
### Recommended Actions
49+
50+
AI agents can assist with:
51+
52+
1. **Code Generation**
53+
- Writing new Rust code following repository conventions (see `.github/copilot-instructions.md`)
54+
- Generating unit tests using `#[cfg(test)]` modules
55+
- Creating integration tests with `#[recorded::test]` attributes (see `CONTRIBUTING.md` for details)
56+
- Generating documentation tests in `.rs` files (avoid `no_run` when tests can be run)
57+
- In README markdown files, use ` ```rust no_run` for examples with placeholders
58+
- Running `rustfmt` on all generated code to ensure proper formatting
59+
60+
2. **Code Review Support**
61+
- Identifying potential bugs or safety issues
62+
- Suggesting improvements for idiomatic Rust patterns
63+
- Checking adherence to Azure SDK design guidelines
64+
- Reviewing error handling using `azure_core::Result<T>`
65+
66+
3. **Documentation**
67+
- Improving inline documentation (using `///` doc comments)
68+
- Updating README files
69+
- Creating or updating CHANGELOG entries (see `.github/instructions/changelog.instructions.md`)
70+
- Writing hero scenario examples in doc comments (avoid examples in `examples/` directories unless demonstrating primary use cases)
71+
72+
4. **Issue Triage**
73+
- Labeling issues with appropriate tags
74+
- Identifying duplicate issues
75+
- Suggesting relevant code owners based on `CODEOWNERS`
76+
- Summarizing issue discussions
77+
78+
5. **Refactoring**
79+
- Applying clippy suggestions
80+
- Improving code organization and modularity
81+
- Updating dependencies in `Cargo.toml`
82+
- Consolidating imports (e.g., `use std::{borrow::Cow, marker::PhantomData};` instead of separate lines)
83+
84+
### Restricted Actions
85+
86+
AI agents **should not**:
87+
88+
1. **Modify Generated Code**
89+
- Never edit files in `generated/` subdirectories
90+
- These are produced by TypeSpec code generators and will be overwritten
91+
- Instead, propose changes to TypeSpec specifications in [Azure/azure-rest-api-specs](https://github.com/Azure/azure-rest-api-specs)
92+
93+
2. **Break API Compatibility**
94+
- Avoid introducing breaking changes without explicit approval
95+
- Check if changes affect public APIs before proceeding
96+
- Consider deprecation process (see `doc/deprecation-process.md`)
97+
98+
3. **Bypass CI/CD Checks**
99+
- Do not suggest skipping or disabling CI checks
100+
- All code must pass `cargo build`, `cargo test`, and `cargo clippy`
101+
102+
4. **Commit Secrets**
103+
- Never include credentials, keys, or tokens in code
104+
- Use environment variables for sensitive data
105+
- Sanitize test recordings to remove secrets
106+
107+
5. **Modify Security or License Files**
108+
- Do not alter `SECURITY.md`, `LICENSE.txt`, or `CODE_OF_CONDUCT.md` without maintainer approval
109+
110+
## Key Workflows
111+
112+
### Building
113+
114+
```bash
115+
# Build a specific crate
116+
cargo build -p <crate-name>
117+
118+
# Build entire workspace (not recommended unless necessary)
119+
cargo build --workspace
120+
```
121+
122+
### Testing
123+
124+
```bash
125+
# Run tests for a specific crate
126+
cargo test -p <crate-name>
127+
128+
# Run integration tests with recordings
129+
cargo test -p <crate-name> --test <test-name>
130+
131+
# Provision test resources (see CONTRIBUTING.md for details)
132+
eng/common/TestResources/New-TestResources.ps1 -ServiceDirectory <service>
133+
134+
# Record new test sessions (requires provisioned resources)
135+
AZURE_TEST_MODE=record cargo test -p <crate-name> --test <test-name>
136+
```
137+
138+
See `CONTRIBUTING.md` for comprehensive testing guidance including debugging, Test Proxy usage, and trace logging.
139+
140+
### Linting and Formatting
141+
142+
```bash
143+
# Check for common issues
144+
cargo clippy -p <crate-name>
145+
146+
# Auto-fix some issues
147+
cargo clippy --fix -p <crate-name>
148+
149+
# Format code
150+
cargo fmt -p <crate-name>
151+
```
152+
153+
### Code Generation
154+
155+
For crates with TypeSpec specifications:
156+
157+
```bash
158+
cd sdk/<service>/<crate-name>
159+
tsp-client update
160+
```
161+
162+
### Running Examples
163+
164+
```bash
165+
cargo run --package <crate-name> --example <example-name>
166+
```
167+
168+
## Coding Standards
169+
170+
Agents should follow guidelines in `.github/copilot-instructions.md` and `CONTRIBUTING.md`, including:
171+
172+
- **Naming Conventions**:
173+
- Types/variants: `PascalCase`
174+
- Functions/fields/parameters: `snake_case`
175+
- Constants: `UPPER_SNAKE_CASE`
176+
- Crates/modules: `snake_case`
177+
178+
- **Import Style**:
179+
- Explicit imports (no `use foo::*`)
180+
- Consolidate related imports (e.g., `use std::{borrow::Cow, marker::PhantomData};`)
181+
- Prefer `crate::` for internal references
182+
183+
- **Error Handling**:
184+
- Service crate code should return `azure_core::Result<T>` (where `E` defaults to `azure_core::Error`)
185+
- Use the `?` operator for error propagation
186+
- Examples should use `Result<(), Box<dyn std::error::Error>>`
187+
188+
- **Documentation**:
189+
- All public APIs need `///` doc comments
190+
- Include runnable doc test examples where appropriate
191+
- Hero scenario examples under the `examples/` directory should have `#[tokio::main]` async main functions
192+
- Use absolute links in markdown files (e.g., `https://github.com/Azure/azure-sdk-for-rust/blob/main/AGENTS.md`) instead of relative links (e.g., `../AGENTS.md`)
193+
- Links must work both online (from github.com) and offline (when viewed in an IDE)
194+
195+
- **Testing**:
196+
- Place unit tests in `#[cfg(test)] mod tests`
197+
- Use `#[recorded::test]` for integration tests (see `CONTRIBUTING.md`)
198+
- Test names should be descriptive, not prefixed with "test"
199+
200+
## CI/CD Integration
201+
202+
All pull requests trigger:
203+
- `cargo build` - Compilation check
204+
- `cargo test` - Unit and integration tests
205+
- `cargo clippy` - Lint checks
206+
- `cargo fmt --check` - Format validation
207+
- License/CLA verification
208+
- Code coverage analysis
209+
210+
Integration tests use the Azure SDK Test Proxy for recording/playback. See `CONTRIBUTING.md` for Test Proxy setup and usage.
211+
212+
## Safety and Security
213+
214+
1. **Code Review**: All changes require review and approval from code owners
215+
2. **Static Analysis**: Must pass `cargo clippy` without warnings
216+
3. **Secret Scanning**: Automated checks prevent committing credentials
217+
4. **Dependencies**: Managed through workspace `Cargo.toml`, vetted for security
218+
5. **Vulnerability Reporting**: Via MSRC at <secure@microsoft.com>
219+
220+
## Cross-References
221+
222+
For detailed guidance, see:
223+
224+
- **Rust Coding Guidelines**: `.github/copilot-instructions.md`
225+
- **Contribution Workflows**: `CONTRIBUTING.md`
226+
- **Changelog Guidelines**: `.github/instructions/changelog.instructions.md`
227+
- **Git Commit Standards**: `doc/git-commit-instructions.md`
228+
- **Deprecation Process**: `doc/deprecation-process.md`
229+
- **Azure SDK Design Guidelines**: https://azure.github.io/azure-sdk/rust_introduction.html
230+
231+
## Agent-Specific Instructions
232+
233+
Additional specialized instructions for specific workflows can be found in:
234+
- `.github/instructions/` - Task-specific agent instructions
235+
- `.github/prompts/` - Reusable Copilot prompts (use `#prompt` in Copilot)
236+
237+
## Getting Help
238+
239+
- **Issues**: https://github.com/Azure/azure-sdk-for-rust/issues
240+
- **Discussions**: Use issue comments or StackOverflow with `azure` + `rust` tags
241+
- **Code Owners**: See `.github/CODEOWNERS` for service-specific contacts
242+
243+
## Telemetry and Privacy
244+
245+
The SDK includes telemetry via `User-Agent` headers. Follow Microsoft Privacy Statement: https://go.microsoft.com/fwlink/?LinkID=824704
246+
247+
## License
248+
249+
All contributions are licensed under the MIT License. See `LICENSE.txt`.
250+
251+
---
252+
253+
**Last Updated**: 2025-01-20
254+
**Version**: 1.0
255+
**Canonical Spec**: https://agents.md

CONTRIBUTING.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,8 @@ To generate a new performance test, for example, you might prompt with:
2929
Using #perf-test.prompt.md generate a perf test for SecretClient::get_secret.
3030
```
3131

32+
For comprehensive guidance on how AI agents should interact with this repository, including workflows, automation boundaries, and safety guidelines, see [AGENTS.md](https://github.com/Azure/azure-sdk-for-rust/blob/main/AGENTS.md).
33+
3234
## Generated code
3335

3436
If you want to contribute to a file that is generated (the file is located in a `generated` subdirectory), the best approach is to open a PR on the TypeSpec specification since we cannot replace generated code that will be replaced when regenerated.

0 commit comments

Comments
 (0)