|
1 | | -# Contributing to InferaDB Control |
| 1 | +# Contributing to InferaDB |
2 | 2 |
|
3 | | -Thank you for your interest in contributing to the InferaDB Control! This document provides guidelines and best practices for contributing to this project. |
| 3 | +Thank you for your interest in contributing to InferaDB! We welcome contributions from the community and are grateful for any help you can provide. |
4 | 4 |
|
5 | | -## Getting Started |
6 | | - |
7 | | -1. **Fork the repository** on GitHub |
8 | | -2. **Clone your fork** locally: |
9 | | - |
10 | | - ```bash |
11 | | - git clone https://github.com/YOUR_USERNAME/inferadb.git |
12 | | - cd inferadb/management |
13 | | - ``` |
14 | | - |
15 | | -3. **Set up your development environment** following the [README.md](./README.md) |
16 | | - |
17 | | -## Development Process |
18 | | - |
19 | | -### 1. Create a Feature Branch |
20 | | - |
21 | | -Always create a new branch for your work: |
22 | | - |
23 | | -```bash |
24 | | -git checkout -b feature/your-feature-name |
25 | | -``` |
26 | | - |
27 | | -Branch naming conventions: |
28 | | - |
29 | | -- `feature/` - New features |
30 | | -- `fix/` - Bug fixes |
31 | | -- `docs/` - Documentation changes |
32 | | -- `refactor/` - Code refactoring |
33 | | -- `test/` - Test additions or improvements |
34 | | -- `chore/` - Build process, dependency updates, etc. |
35 | | - |
36 | | -### 2. Follow the Implementation Plan |
37 | | - |
38 | | -Refer to [PLAN.md](./PLAN.md) for the phased implementation roadmap. Each phase has specific tasks and deliverables. |
39 | | - |
40 | | -### 3. Write Quality Code |
41 | | - |
42 | | -#### Code Style |
43 | | - |
44 | | -- Follow Rust idioms and best practices |
45 | | -- Use `rustfmt` for formatting: `cargo fmt` |
46 | | -- Address all `clippy` warnings: `cargo clippy -- -D warnings` |
47 | | -- Write clear, descriptive variable and function names |
48 | | -- Add documentation comments for public APIs |
49 | | - |
50 | | -#### Testing |
51 | | - |
52 | | -- Write unit tests for all new functionality |
53 | | -- Add integration tests for API endpoints |
54 | | -- Ensure all tests pass: `cargo test` |
55 | | -- Aim for >80% code coverage |
56 | | - |
57 | | -Example test structure: |
58 | | - |
59 | | -```rust |
60 | | -#[cfg(test)] |
61 | | -mod tests { |
62 | | - use super::*; |
63 | | - |
64 | | - #[test] |
65 | | - fn test_function_name() { |
66 | | - // Arrange |
67 | | - let input = ...; |
68 | | - |
69 | | - // Act |
70 | | - let result = function_to_test(input); |
71 | | - |
72 | | - // Assert |
73 | | - assert_eq!(result, expected); |
74 | | - } |
75 | | - |
76 | | - #[tokio::test] |
77 | | - async fn test_async_function() { |
78 | | - // ... |
79 | | - } |
80 | | -} |
81 | | -``` |
82 | | - |
83 | | -#### Error Handling |
84 | | - |
85 | | -- Use the `Result` type for operations that can fail |
86 | | -- Provide meaningful error messages |
87 | | -- Use the error types defined in `inferadb-control-core::error` |
88 | | - |
89 | | -#### Documentation |
90 | | - |
91 | | -- Add Rustdoc comments for all public APIs: |
92 | | - |
93 | | - ````rust |
94 | | - /// Brief description of the function |
95 | | - /// |
96 | | - /// # Arguments |
97 | | - /// |
98 | | - /// * `param1` - Description of param1 |
99 | | - /// |
100 | | - /// # Returns |
101 | | - /// |
102 | | - /// Description of return value |
103 | | - /// |
104 | | - /// # Errors |
105 | | - /// |
106 | | - /// Description of possible errors |
107 | | - /// |
108 | | - /// # Examples |
109 | | - /// |
110 | | - /// ``` |
111 | | - /// use crate::module::function; |
112 | | - /// let result = function(arg); |
113 | | - /// ``` |
114 | | - pub fn function(param1: Type) -> Result<ReturnType> { |
115 | | - // ... |
116 | | - } |
117 | | - ```` |
118 | | - |
119 | | -### 4. Commit Your Changes |
120 | | - |
121 | | -#### Commit Message Format |
122 | | - |
123 | | -Follow [Conventional Commits](https://www.conventionalcommits.org/): |
124 | | - |
125 | | -```text |
126 | | -<type>(<scope>): <subject> |
127 | | -
|
128 | | -<body> |
129 | | -
|
130 | | -<footer> |
131 | | -``` |
132 | | - |
133 | | -Types: |
134 | | - |
135 | | -- `feat`: New feature |
136 | | -- `fix`: Bug fix |
137 | | -- `docs`: Documentation changes |
138 | | -- `style`: Code style changes (formatting, etc.) |
139 | | -- `refactor`: Code refactoring |
140 | | -- `test`: Test additions or improvements |
141 | | -- `chore`: Build process, dependency updates |
142 | | - |
143 | | -Examples: |
144 | | - |
145 | | -```text |
146 | | -feat(auth): implement password authentication |
147 | | -
|
148 | | -Add password-based authentication with Argon2id hashing. |
149 | | -Includes rate limiting and session management. |
| 5 | +## Code of Conduct |
150 | 6 |
|
151 | | -Closes #123 |
152 | | -``` |
| 7 | +This project and everyone participating in it is governed by the [Contributor Covenant Code of Conduct](CODE_OF_CONDUCT.md). By participating, you are expected to uphold this code. Please report unacceptable behavior to [open@inferadb.com](mailto:open@inferadb.com). |
153 | 8 |
|
154 | | -```text |
155 | | -fix(storage): handle FoundationDB connection timeout |
| 9 | +## How to Contribute |
156 | 10 |
|
157 | | -Add retry logic with exponential backoff for FDB connections. |
158 | | -``` |
| 11 | +### Reporting Issues |
159 | 12 |
|
160 | | -### 5. Push and Create a Pull Request |
| 13 | +- **Bug Reports**: Search existing issues first to avoid duplicates. Include version information, steps to reproduce, expected vs actual behavior, and relevant logs. |
| 14 | +- **Feature Requests**: Describe the use case, proposed solution, and alternatives considered. |
| 15 | +- **Security Issues**: Do **not** open public issues for security vulnerabilities. Instead, email [security@inferadb.com](mailto:security@inferadb.com). |
161 | 16 |
|
162 | | -```bash |
163 | | -git push origin feature/your-feature-name |
164 | | -``` |
| 17 | +### Pull Requests |
165 | 18 |
|
166 | | -Then create a pull request on GitHub with: |
| 19 | +1. **Fork the repository** and create your branch from `main` |
| 20 | +2. **Follow the development workflow** documented in the repository's README |
| 21 | +3. **Write clear commit messages** following [Conventional Commits](https://www.conventionalcommits.org/): |
| 22 | + - `feat:` New features |
| 23 | + - `fix:` Bug fixes |
| 24 | + - `docs:` Documentation changes |
| 25 | + - `test:` Test additions or improvements |
| 26 | + - `refactor:` Code refactoring |
| 27 | + - `chore:` Maintenance tasks |
| 28 | +4. **Ensure all tests pass** before submitting |
| 29 | +5. **Update documentation** if your changes affect public APIs or user-facing behavior |
| 30 | +6. **Submit a pull request** with a clear description of your changes |
167 | 31 |
|
168 | | -- Clear title describing the change |
169 | | -- Description of what changed and why |
170 | | -- Reference to related issues (e.g., "Closes #123") |
171 | | -- Screenshots or examples if applicable |
| 32 | +### Development Setup |
172 | 33 |
|
173 | | -## Pull Request Checklist |
| 34 | +Each repository has its own development setup and workflow. Please refer to: |
174 | 35 |
|
175 | | -Before submitting a PR, ensure: |
| 36 | +- **[DEVELOPMENT.md](./DEVELOPMENT.md)** for repository-specific development and contribution guidance |
| 37 | +- **README.md** for general project information and quick start instructions |
176 | 38 |
|
177 | | -- [ ] Code follows Rust style guidelines (`cargo fmt`) |
178 | | -- [ ] All clippy warnings are addressed (`cargo clippy -- -D warnings`) |
179 | | -- [ ] All tests pass (`cargo test`) |
180 | | -- [ ] New functionality has tests |
181 | | -- [ ] Documentation is updated (if applicable) |
182 | | -- [ ] Commit messages follow Conventional Commits |
183 | | -- [ ] PR description clearly explains the changes |
| 39 | +These documents cover prerequisites, dependencies, build commands, code style guidelines, and repository-specific requirements. |
184 | 40 |
|
185 | | -## Code Review Process |
| 41 | +## Review Process |
186 | 42 |
|
187 | 43 | 1. **Automated Checks**: CI will run tests, linters, and formatters |
188 | | -2. **Peer Review**: At least one maintainer will review your code |
| 44 | +2. **Peer Review**: At least one maintainer will review your contribution |
189 | 45 | 3. **Feedback**: Address any review comments |
190 | | -4. **Approval**: Once approved, a maintainer will merge your PR |
191 | | - |
192 | | -## Development Guidelines |
193 | | - |
194 | | -### Security |
195 | | - |
196 | | -- Never commit secrets or credentials |
197 | | -- Use environment variables for sensitive configuration |
198 | | -- Follow secure coding practices (input validation, SQL injection prevention, etc.) |
199 | | -- Report security vulnerabilities privately to <security@inferadb.com> |
200 | | - |
201 | | -### Performance |
202 | | - |
203 | | -- Profile code for performance-critical paths |
204 | | -- Avoid unnecessary allocations |
205 | | -- Use async/await properly to avoid blocking |
206 | | -- Cache expensive operations when appropriate |
207 | | - |
208 | | -### Multi-Tenancy |
209 | | - |
210 | | -- Always validate organization/vault access |
211 | | -- Ensure data isolation between organizations |
212 | | -- Test cross-tenant access attempts |
213 | | - |
214 | | -### API Design |
215 | | - |
216 | | -- Follow RESTful conventions |
217 | | -- Use appropriate HTTP status codes |
218 | | -- Provide clear error messages |
219 | | -- Version APIs when making breaking changes |
220 | | - |
221 | | -## Testing |
222 | | - |
223 | | -### Running Tests |
224 | | - |
225 | | -```bash |
226 | | -# All tests |
227 | | -cargo test |
228 | | - |
229 | | -# Specific package |
230 | | -cargo test --package inferadb-control-core |
231 | | - |
232 | | -# Specific test |
233 | | -cargo test test_name |
234 | | - |
235 | | -# With output |
236 | | -cargo test -- --nocapture |
237 | | - |
238 | | -# Integration tests only |
239 | | -cargo test --test '*' |
240 | | -``` |
241 | | - |
242 | | -### Test Coverage |
243 | | - |
244 | | -```bash |
245 | | -# Install tarpaulin |
246 | | -cargo install cargo-tarpaulin |
247 | | - |
248 | | -# Generate coverage report |
249 | | -cargo tarpaulin --out Html |
250 | | -``` |
251 | | - |
252 | | -## Documentation |
253 | | - |
254 | | -### Generating Documentation |
255 | | - |
256 | | -```bash |
257 | | -# Generate and open docs |
258 | | -cargo doc --no-deps --open |
259 | | - |
260 | | -# Include private items |
261 | | -cargo doc --no-deps --document-private-items |
262 | | -``` |
263 | | - |
264 | | -### Updating Architecture Docs |
265 | | - |
266 | | -When adding new features or making architectural changes, update: |
267 | | - |
268 | | -- [OVERVIEW.md](./OVERVIEW.md) - Entity definitions and behavioral rules |
269 | | -- [AUTHENTICATION.md](./AUTHENTICATION.md) - Authentication flows |
270 | | -- [PLAN.md](./PLAN.md) - Implementation roadmap |
271 | | - |
272 | | -## Getting Help |
273 | | - |
274 | | -- **GitHub Issues**: For bugs and feature requests |
275 | | -- **Discussions**: For questions and general discussion |
276 | | -- **Documentation**: Check [README.md](./README.md) and [OVERVIEW.md](./OVERVIEW.md) |
| 46 | +4. **Approval**: Once approved, a maintainer will merge your contribution |
277 | 47 |
|
278 | 48 | ## License |
279 | 49 |
|
280 | | -By contributing to this project, you agree that your contributions will be licensed under the BSL 1.1 License. |
| 50 | +By contributing to InferaDB, you agree that your contributions will be licensed under the same license as the repository you are contributing to. See the LICENSE file in each repository for details. |
281 | 51 |
|
282 | | -## Code of Conduct |
| 52 | +## Questions? |
283 | 53 |
|
284 | | -Please be respectful and professional in all interactions. We are committed to providing a welcoming and inclusive environment for all contributors. |
| 54 | +If you have questions or need help: |
285 | 55 |
|
286 | | -## Thank You |
| 56 | +- Open a [Discussion](https://github.com/inferadb/inferadb/discussions) on GitHub |
| 57 | +- Email us at [open@inferadb.com](mailto:open@inferadb.com) |
287 | 58 |
|
288 | | -Your contributions help make InferaDB better for everyone. We appreciate your time and effort! |
| 59 | +Thank you for helping make InferaDB better! |
0 commit comments