Skip to content

Commit cfc5790

Browse files
committed
chore: Correct errors in AGENTS.md file
1 parent ab0661d commit cfc5790

File tree

1 file changed

+42
-24
lines changed

1 file changed

+42
-24
lines changed

AGENTS.md

Lines changed: 42 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
1-
This document provides a detailed guide for AI agents to understand and contribute to the Firebase Admin DotNet SDK. Adhering to these guidelines is crucial for maintaining code quality, consistency, and idiomatic C# practices.
1+
This document provides a detailed guide for AI agents to understand and contribute to the Firebase Admin .NET SDK. Adhering to these guidelines is crucial for maintaining code quality, consistency, and idiomatic C# practices.
22

33
## High-Level Overview
44

5-
The Firebase Admin DotNet SDK provides C# developers with access to Firebase services on privileged environments. Its design emphasizes idiomatic C#, thread-safety, and a consistent, predictable API surface.
5+
The Firebase Admin .NET SDK provides C# developers with access to Firebase services on privileged environments. Its design emphasizes idiomatic C#, thread-safety, and a consistent, predictable API surface.
66

77
## Directory Structure
88

@@ -11,7 +11,7 @@ The Firebase Admin DotNet SDK provides C# developers with access to Firebase ser
1111
- **`FirebaseAdmin/FirebaseAdmin/FirebaseApp.cs`**: The main entry point and initialization class for the SDK.
1212
- **`FirebaseAdmin/FirebaseAdmin/Auth/`**: Source code for the Authentication service.
1313
- **`FirebaseAdmin/FirebaseAdmin/Messaging/`**: Source code for the Firebase Cloud Messaging (FCM) service.
14-
- **`FirebaseAdmin/FirebaseAdmin/Internal/`**: Internal utilities and classes not meant for public consumption. Direct use of this code in public APIs is strictly forbidden.
14+
- **`FirebaseAdmin/FirebaseAdmin/Util/`**: Internal helper utilities and classes used across services (e.g. Wrapping low level http exceptions as a `FirebaseException`).
1515
- **`FirebaseAdmin/FirebaseAdmin.Tests/`**: Unit tests for the SDK.
1616
- **`FirebaseAdmin/FirebaseAdmin.IntegrationTests/`**: Integration tests.
1717
- **`FirebaseAdmin/FirebaseAdmin.Snippets/`**: Code snippets used in documentation.
@@ -28,15 +28,30 @@ The Firebase Admin DotNet SDK provides C# developers with access to Firebase ser
2828

2929
- **Formatting**: Code style is enforced using `stylecop`. Run `dotnet format` to apply the rules.
3030
- **Naming**:
31-
- Classes and public methods use `PascalCase`.
32-
- Private members are not explicitly prefixed, but it is preferred to prefix them with an underscore (`_`).
33-
- Constants are `PascalCase`.
31+
- Constants, classes and public methods use `PascalCase`.
32+
- Private members are not explicitly prefixed.
3433

3534
## Testing Philosophy
3635

37-
- **Unit Tests**: Located in `FirebaseAdmin.Tests/`, with a file naming pattern of `*Test.cs`. `xunit` is the testing framework. Moq is the preferred library for mocking dependencies.
36+
- **Unit Tests**: Located in `FirebaseAdmin.Tests/`, with a file naming pattern of `*Test.cs`. `xunit` is the testing framework.
3837
- **Integration Tests**: Located in `FirebaseAdmin.IntegrationTests/`. These tests interact with live Firebase services and require a configured service account.
3938

39+
### How to Run Tests
40+
41+
The unit tests can be run using the `dotnet test` command. Ensure that the required .NET frameworks (net462 and net6.0) are installed in your environment.
42+
43+
To run the tests for a specific framework, use the `--framework` flag:
44+
```bash
45+
# Run tests for .NET 6.0
46+
dotnet test FirebaseAdmin/FirebaseAdmin.Tests --framework net6.0
47+
48+
# Run tests for .NET 4.6.2
49+
dotnet test FirebaseAdmin/FirebaseAdmin.Tests --framework net462
50+
```
51+
52+
**Note on Integration Tests:** The integration tests require a configured service account and other setup that is not available in all environments. It is recommended to rely on the CI for running integration tests.
53+
54+
4055
## Dependency Management
4156

4257
- **Manager**: Dependencies are managed using NuGet.
@@ -45,25 +60,25 @@ The Firebase Admin DotNet SDK provides C# developers with access to Firebase ser
4560

4661
## Critical Developer Journeys
4762

48-
### Journey 1: How to Add a New API Method
63+
### Journey 1: How to Add/Update a New API Method
4964

50-
1. **Public Method**: Define the new public method in the relevant service class (e.g., `FirebaseAuth.cs`).
51-
2. **Internal Logic**: Implement the core logic as a private method.
52-
3. **HTTP Client**: Use the internal `HttpClient` to make the API call.
65+
1. **Public Method**: Define the new public method or changes in the relevant service class (e.g., `FirebaseAuth.cs`).
66+
2. **Internal Logic**: Implement the core logic as a private method.
67+
3. **HTTP Client**: Use the existing HTTP Client implementation for that service to make the API call.
5368
4. **Error Handling**: Wrap API calls in `try-catch` blocks and throw appropriate `FirebaseException` subtypes.
54-
5. **Testing**: Add a unit test in the corresponding `*Test.cs` file and an integration test in `FirebaseAdmin.IntegrationTests/`.
55-
6. **Snippet**: Add a code snippet in `FirebaseAdmin.Snippets/` to demonstrate the new feature.
69+
5. **Testing**: Add a unit test in the corresponding `*Test.cs` file and an integration test in `FirebaseAdmin.IntegrationTests/` where appropriate. This should be thorough and update any tests where the new changes would affect.
70+
6. **Snippet**: Add or update code snippet in `FirebaseAdmin.Snippets/` to demonstrate the new feature.
5671

57-
### Journey 2: How to Add a New Field to an Existing API Response
72+
### Journey 2: How to Deprecate a Field/Method in an Existing API
5873

59-
1. **Data Model**: Locate and modify the relevant data model class in the service's directory.
60-
2. **Testing**: Update unit and integration tests to verify the presence and correctness of the new field.
74+
1. **Add Deprecation Note**: Locate where the deprecated object is defined and add a deprecation warning with a note (e.g. [Obsolete("Use X instead")]).
75+
2. **Remove Releted Tests and Update Snippets**: Because `Obsolete` warnings result in build errors, tests and snippets where the object is used should be removed or updated not no longer used the deprecated object.
6176

6277
## Critical Do's and Don'ts
6378

6479
- **DO**: Use the centralized `HttpClient` for all API calls.
6580
- **DO**: Follow the established `async`/`await` patterns for asynchronous code.
66-
- **DON'T**: Expose types from the `FirebaseAdmin/FirebaseAdmin/Internal/` directory in any public API.
81+
- **DON'T**: Expose types from the `FirebaseAdmin/FirebaseAdmin/Utils/` directory in any public API.
6782
- **DON'T**: Introduce new third-party dependencies without a compelling reason and discussion with the maintainers.
6883

6984
## Commit and Pull Request Generation
@@ -72,7 +87,7 @@ After implementing and testing a change, you must create a commit and Pull Reque
7287

7388
**1. Commit Message Format**: The commit message is critical and is used to generate the Pull Request. It MUST follow this structure:
7489
- **Title**: Use the [Conventional Commits](https://www.conventionalcommits.org/en/v1.0.0/) specification: `type(scope): subject`.
75-
- `scope` should be the service package changed (e.g., `auth`, `db`, `deps`).
90+
- `scope` should be the service package changed (e.g., `auth`, `rtdb`, `deps`).
7691
- **Note on Scopes**: Some services use specific abbreviations. Use the abbreviation if one exists. Common abbreviations include:
7792
- `messaging` -> `fcm`
7893
- `dataconnect` -> `fdc`
@@ -83,19 +98,22 @@ After implementing and testing a change, you must create a commit and Pull Reque
8398
- **Body**: The body is separated from the title by a blank line and MUST contain the following, in order:
8499
1. A brief explanation of the problem and the solution.
85100
2. A summary of the testing strategy (e.g., "Added a new unit test to verify the fix.").
86-
3. A **Context Sources** section that lists the `id` and repository path of every `AGENTS.md` file you used.
101+
3. A **Context Sources** section that lists the `id` and repository path of every `AGENTS.md` file you used to verify context usage.
87102

88103
**2. Example Commit Message**:
89104
```
90105
feat(fcm): Add support for multicast messages
91106
92-
This change introduces a new `SendMulticast` method to the messaging client, allowing developers to send a single message to multiple tokens efficiently.
107+
This change introduces a new `SendEachForMulticastAsync` method to the messaging client, allowing developers to send a single message to multiple tokens efficiently.
93108
94-
Testing: Added unit tests in `messaging_test.cs` with a mock server and an integration test in `integration/messaging_test.cs`.
109+
Testing: Added unit tests with a mock server and an integration test in `FirebaseAdmin.IntegrationTests/MessagingTest.cs`.
95110
96111
Context Sources Used:
97-
- id: firebase-admin-dotnet (`/AGENTS.md`)
98-
- id: firebase-admin-dotnet-messaging (`/messaging/AGENTS.md`)
112+
- id: firebase-admin-dotnet
113+
- id: firebase-admin-dotnet-messaging
99114
```
100115

101-
**3. Pull Request**: The Pull Request title and description should be populated directly from the commit message's title and body.
116+
**3. Pull Request**: The Pull Request title and description should be populated directly from the commit message's title and body.
117+
118+
## Metadata:
119+
- id: firebase-admin-dotnet

0 commit comments

Comments
 (0)