Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
53 changes: 53 additions & 0 deletions AGENTS.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
# AGENTS.md - CSharpDriver

## Overview
The C# driver for MongoDB.

## Tech Stack
- .NET library projects producing NuGet packages
- Multi-targeted to various .NET versions from .NET Framework 4.7.2 up
- xUnit + FluentAssertions for testing
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

This part about FluentAssertions.. I think we need to discuss about it in the team. Sometime ago we had a discussion about using the basic assertions against the fluent ones.

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.

I have added FluentAssertions to my list of things to bring up in retrospective. For now, I think we should leave it--Claude explicitly called out that it was useful.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Hm... just to leave the record: I do remember discussion about FluentAssertion turned to be commercial, and we should either stop using it, or pin the version and never bump it until it possible. But I do not remember if we really made any decisions. We also discussed possibility to switch to Shouldly.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Exactly what you said. I also think that at the time we didn't decide which direction to take though.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

I think this is the only more "contentious point". Should we leave it out and let the AI check the follow the conventions that are already in the file? Or check similar tests/tests for similar classes.


## Project Structure
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Something that I found useful was also to give the path to the specification repo that I have locally. It's super useful for certain kind of feature implementation.

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.

Interesting. I think we would have to standardize on the location to put that here, but it could be a good candidate for each of our user-specific agents file.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

I agree, for sure we should not standardize the location, but it's a good add.

- `src/MongoDB.Bson/` - BSON for MongoDB
- `src/MongoDB.Driver/` - C# driver for MongoDB
- `src/MongoDB.Driver.Encryption/` - Client encryption (CSFLE with KMS).
- `src/MongoDB.Driver.Authentication.AWS/` - AWS IAM authentication
- `tests/MongoDB.Driver.Tests/` - Main C# driver tests
- `tests/MongoDB.Bson.Tests/` - BSON handling tests
- `tests/*/TestHelpers` - Common test utilities
- `tests/*` - Specialized tests; less common
- `tests/MongoDB.Driver.Tests/Specifications/` are JSON-driven tests using a common runner.

## Editing
- Be careful to preserve file BOMs.

## Commands
- Build: `dotnet build CSharpDriver.sln`
- Run all tests: `dotnet test tests/MongoDB.Driver.Tests/MongoDB.Driver.Tests.csproj -f net10.0`
- Run a single test class: `dotnet test tests/MongoDB.Driver.Tests/MongoDB.Driver.Tests.csproj -f net10.0 --filter "FullyQualifiedName~ClassName"`
Comment thread
ajcvickers marked this conversation as resolved.

## Testing
- Tests cannot be run in parallel.
- A MongoDB connection is always available locally, so "integration" tests can be run as well as unit tests. Some test suites also require additional environment variables — if you need to run those tests and the variables are not set, stop and tell the user which variables are needed rather than working around it.

| Feature area | Required environment variables |
|---|---|
| Atlas Search | `ATLAS_SEARCH_TESTS_ENABLED`, `ATLAS_SEARCH_URI` |
| Atlas Search index helpers | `ATLAS_SEARCH_INDEX_HELPERS_TESTS_ENABLED`, `ATLAS_SEARCH_URI` |
| CSFLE / auto-encryption | `CRYPT_SHARED_LIB_PATH` |
Comment thread
ajcvickers marked this conversation as resolved.
| CSFLE with KMS mock servers | `KMS_MOCK_SERVERS_ENABLED` |
| CSFLE with AWS KMS | `CSFLE_AWS_TEMPORARY_CREDS_ENABLED` |
| CSFLE with Azure KMS | `CSFLE_AZURE_KMS_TESTS_ENABLED` |
| CSFLE with GCP KMS | `CSFLE_GCP_KMS_TESTS_ENABLED` |
| AWS authentication | `AWS_TESTS_ENABLED` |
| GSSAPI / Kerberos | `GSSAPI_TESTS_ENABLED`, `AUTH_HOST`, `AUTH_GSSAPI` |
| OIDC authentication | `OIDC_ENV` |
| X.509 authentication | `MONGO_X509_CLIENT_CERTIFICATE_PATH`, `MONGO_X509_CLIENT_CERTIFICATE_PASSWORD` |
| PLAIN authentication | `PLAIN_AUTH_TESTS_ENABLED` |
| SOCKS5 proxy | `SOCKS5_PROXY_SERVERS_ENABLED` |

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Another line I have:

"Do not strip BOMs: Source files may have a UTF-8 BOM (U+FEFF). Prefer using the Edit tool over Write to avoid accidentally removing it."

(not sure if it's still an issue)

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.

What issues have we had with BOMs?

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

On some files both Claude and OpenCode were removing BOMs, so I was getting a change on the first line of some files.

## Commit and PR Conventions

- The first commit message and the PR message start with a JIRA number: `CSHARP-1234: Description`
- The branch name will usually match the JIRA number: `CSHARP-1234`
1 change: 1 addition & 0 deletions CLAUDE.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
@AGENTS.md