Skip to content

Commit 0764ea0

Browse files
Add more instructions
1 parent a0e7f15 commit 0764ea0

File tree

3 files changed

+80
-29
lines changed

3 files changed

+80
-29
lines changed

.github/code-review.md

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
# Code Reviews
2+
3+
When reviewing code, focus on:
4+
5+
## Security Critical Issues
6+
- Check for hardcoded secrets, API keys, or credentials
7+
- Check for instances of potential method call injection, dynamic code execution, symbol injection or other code injection vulnerabilities.
8+
9+
## Performance Red Flags
10+
- Spot inefficient loops and algorithmic issues.
11+
- Check for memory leaks and resource cleanup.
12+
13+
## Code Quality Essentials
14+
- Methods should be focused and appropriately sized. If a method is doing too much, suggest refactorings to split it up.
15+
- Use clear, descriptive naming conventions.
16+
- Avoid encapsulation violations and ensure proper separation of concerns.
17+
- All public classes, modules, and methods should have clear documentation in YARD format.
18+
- If `method_missing` is implemented, ensure that `respond_to_missing?` is also implemented.
19+
- Rubocop is used by this project to enforce code style. Always refer to the project's .rubocop.yml file for guidance on the project's style preferences.
20+
21+
## Driver-specific Concerns
22+
- Look for code that might cause issues in a multi-threaded (or multi-fiber) environment.
23+
24+
## Review Style
25+
- Be specific and actionable in feedback
26+
- Explain the "why" behind recommendations
27+
- Acknowledge good patterns when you see them
28+
- Ask clarifying questions when code intent is unclear
29+
- When possible, suggest that the pull request be labeled as a `bug`, a `feature`, or a `bcbreak` (a "backwards-compatibility break").
30+
- PR's with no user-visible effect do not need to be labeled.
31+
- Do not review or suggest changes to YAML files under the `spec/` directory; these are test fixtures shared between all drivers and are not owned by this repository.
32+
- Flag any new Ruby specs that appear to duplicate behavior already covered by YAML spec tests in `spec/spec_tests/data/`.
33+
34+
Always prioritize security vulnerabilities and performance issues that could impact users.
35+
36+
Always suggest changes to improve readability and testability.
37+
38+
When reviewing code, be encouraging.

AGENTS.md

Lines changed: 41 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# Project Description
22

3-
This is the Ruby driver for the MongoDB database. It provides a Ruby interface for connecting to MongoDB, performing CRUD operations, and managing database connections. The API is standardized across all MongoDB drivers, via the specifications defined in the MongoDB Specifications repository: https://github.com/mongodb/specifications.
3+
This is the Ruby driver for the MongoDB database. It provides a Ruby interface for connecting to MongoDB, performing CRUD operations, and managing database connections. The API is standardized across all MongoDB drivers, via the specifications defined in the MongoDB Specifications repository: https://github.com/mongodb/specifications. The driver targets Ruby 2.7+. Do not use syntax or stdlib features unavailable in Ruby 2.7.
44

55
# Project Structure
66

@@ -14,41 +14,53 @@ The project is organized into the following directories:
1414
- `profile/`: profiling scripts and results
1515

1616

17-
# Code Reviews
17+
# Development Workflow
18+
19+
## Running tests
20+
21+
Tests require a running MongoDB instance. Set the URI via the `MONGODB_URI` environment variable:
22+
23+
```
24+
MONGODB_URI="mongodb://localhost:27017,localhost:27018,localhost:27019/" bundle exec rspec spec/path/to/spec.rb
25+
```
26+
27+
A replica set is typically available locally at `localhost:27017,27018,27019`.
28+
29+
## Linting
30+
31+
Run RuboCop after making changes, and always before committing:
32+
33+
```
34+
bundle exec rubocop lib/mongo/changed_file.rb spec/mongo/changed_file_spec.rb
35+
```
1836

19-
When reviewing code, focus on:
37+
Pass the specific files you modified.
2038

21-
## Security Critical Issues
22-
- Check for hardcoded secrets, API keys, or credentials
23-
- Check for instances of potential method call injection, dynamic code execution, symbol injection or other code injection vulnerabilities.
39+
RuboCop is configured with performance, rake, and rspec plugins (`.rubocop.yml`).
2440

25-
## Performance Red Flags
26-
- Spot inefficient loops and algorithmic issues.
27-
- Check for memory leaks and resource cleanup.
41+
## Commit convention
2842

29-
## Code Quality Essentials
30-
- Methods should be focused and appropriately sized. If a method is doing too much, suggest refactorings to split it up.
31-
- Use clear, descriptive naming conventions.
32-
- Avoid encapsulation violations and ensure proper separation of concerns.
33-
- All public classes, modules, and methods should have clear documentation in YARD format.
34-
- If `method_missing` is implemented, ensure that `respond_to_missing?` is also implemented.
35-
- Rubocop is used by this project to enforce code style. Always refer to the project's .rubocop.yml file for guidance on the project's style preferences.
43+
Prefix commit messages with the JIRA ticket: `RUBY-#### Short description`. The ticket number is typically in the branch name (e.g., branch `3795-foo` means `RUBY-3795`).
3644

37-
## Driver-specific Concerns
38-
- Look for code that might cause issues in a multi-threaded (or multi-fiber) environment.
45+
## Prose style
3946

40-
## Review Style
41-
- Be specific and actionable in feedback
42-
- Explain the "why" behind recommendations
43-
- Acknowledge good patterns when you see them
44-
- Ask clarifying questions when code intent is unclear
45-
- When possible, suggest that the pull request be labeled as a `bug`, a `feature`, or a `bcbreak` (a "backwards-compatibility break").
46-
- PR's with no user-visible effect do not need to be labeled.
47-
- Do not review YAML files under the `spec/` directory; these are test fixtures shared between all drivers.
47+
When writing prose — commit messages, code comments, documentation — be concise, write as a human would, avoid overly complicated sentences, and use no emojis.
4848

49-
Always prioritize security vulnerabilities and performance issues that could impact users.
49+
## Definition of done
5050

51-
Always suggest changes to improve readability and testability.
51+
Always run the relevant spec file(s) against the local cluster before considering a task complete. Running tests is not optional. "Relevant" means: the spec file for each class you changed, plus any integration specs in `spec/integration/` that exercise the affected feature. If MongoDB is not reachable, report this to the user rather than trying to work around it.
5252

53-
Be encouraging.
53+
## Thread and fiber safety
54+
55+
This driver runs in multi-threaded and multi-fiber environments. When writing or modifying code that touches connection pools, server monitors, or any shared state, always consider concurrent access. Use existing synchronization primitives in the codebase rather than introducing new ones.
56+
57+
## Spec fixtures
58+
59+
Unified test format YAML fixtures live in `spec/spec_tests/data/<suite_name>/`. To add new fixtures, copy YAML files from `specifications/source/<spec-name>/tests/unified/` into that directory. The runner loads all `*.yml` files automatically — no runner changes needed.
60+
61+
Do not write Ruby specs that duplicate behavior already covered by YAML spec tests. New Ruby specs should cover behavior that cannot be expressed in the unified test format.
62+
63+
64+
# Code Reviews
5465

66+
See [.github/code-review.md](.github/code-review.md) for code review guidelines.

CLAUDE.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
@AGENTS.md

0 commit comments

Comments
 (0)