First off, thank you for considering contributing to Molock! It's people like you who make Molock such a great tool for the high-performance testing community.
By contributing, you agree to abide by our standards and follow the development workflow outlined below.
Molock is built on three core pillars:
- Extreme Performance: Every microsecond counts. We aim for zero-allocation in the hot path.
- Native Observability: OpenTelemetry is a first-class citizen, not an afterthought.
- Rigorous Quality: We rely on strict TDD and high test coverage to ensure reliability.
To get started with Molock development, you will need:
- Rust: Version 1.70 or higher.
- Docker & Docker Compose: For running the observability stack (Jaeger, Prometheus, Grafana).
- Make: (Optional) For using the provided shortcuts in the
Makefile.
You can start the local development environment (OTel collector and dashboards) using:
docker-compose -f deployment/docker-compose.yml up -dMolock strictly follows Test-Driven Development (TDD). No feature should be implemented, and no bug should be fixed, without first having a failing test case that demonstrates the need for the change.
- Red: Write a test that fails (e.g., in
tests/integration_test.rsor a new unit test). - Green: Write the minimum amount of code to make the test pass.
- Refactor: Clean up the code while ensuring the tests remain green.
When testing features that involve observability, ensure you use the --features otel flag.
cargo test --features otelWe maintain a "Zero Warning" policy. Your Pull Request will not be accepted if it contains lint warnings or fails quality gates.
Before pushing your changes, run the following commands to ensure everything is in order:
- Formatting: Must adhere to standard Rust formatting.
cargo fmt -- --check
- Clippy: Must pass without any warnings.
cargo clippy --all-targets --all-features -- -D warnings
- Tests: Run unit and integration tests.
cargo test --all-features - Test Coverage: We maintain a minimum of 80% line and branch coverage.
cargo tarpaulin --all-features --ignore-tests
We use pre-commit to automate these checks. To set it up:
- Install pre-commit:
pip install pre-commit - Install the hooks:
pre-commit install
The hooks will run formatting, clippy, and our custom find_code_smells.sh script (which includes pedantic and nursery lints) on every commit.
Integration tests verify the end-to-end behavior of Molock, including its interaction with the observability stack (OTel collector, Jaeger, Prometheus).
- Start the stack:
docker-compose -f deployment/docker-compose.yml up -d
- Run integration tests:
cargo test --features otel --test integration_test - Validate Observability:
Use the provided script to verify that spans and metrics are correctly reaching the collector:
./tests/validate_observability.sh
- Dependency Audit: Run
cargo auditto check for known vulnerabilities in dependencies. - Secrets Detection: We use
trufflehogin CI to prevent accidental commits of secrets. - SLSA: We follow SLSA (Supply-chain Levels for Software Artifacts) guidelines to ensure the integrity of our builds.
We use beads (bd) for internal task tracking.
- Understand the workflow: Run
bd primeto see the full workflow context and available commands. - Find work: Run
bd readyto see available tasks. - Claim a task: Run
bd update <id> --claim. - Complete a task: When your work is finished, run
bd close <id>.
We follow a strict separation between application and library errors:
- Application Logic: Use
anyhowfor high-level error context and propagation. - Library/Core Logic: Use
thiserrorto define structured, domain-specific error types.
Always provide meaningful context when propagating errors:
use anyhow::Context;
let config = ConfigLoader::from_file(&path).with_context(|| "Failed to load configuration")?;Every new feature or endpoint must be observable.
- Spans: Wrap significant operations in
tracing::span!. - Logs: Use
tracingmacros (info!,warn!,error!,debug!) for structured logging. - Metrics: Register and update relevant metrics (e.g., request counters, latency histograms) in
src/telemetry/metrics.rs.
- Zero-Allocation: Avoid unnecessary heap allocations in the hot path (request matching and response generation).
- Async/Await: Use non-blocking I/O and avoid holding mutexes across
.awaitpoints.
When ending a work session, you MUST:
- File issues for any remaining work.
- Run quality gates (tests, linter, coverage).
- Update issue status in
bd. - Push to remote: Ensure your branch is pushed and up to date with origin.
Caution
No Direct Commits to main: Direct commits or pushes to the main branch are strictly prohibited and will be blocked by branch protection rules. All changes must go through a feature branch and a Pull Request.
- Feature Branches: Use descriptive names like
feature/your-feature-nameorfix/issue-description. - Conventional Commits: We follow the Conventional Commits specification for our commit messages (e.g.,
feat: add regex matching,fix: resolve memory leak in tracer).
- Ensure all tests pass and there are no clippy warnings.
- Update the documentation (including ADRs if architectural choices were made).
- Link your PR to the relevant issue (e.g.,
Closes #123). - Once the PR is merged, the associated task should be marked as closed in
bd.
If you discover a security vulnerability, please do not open a public issue. Instead, follow the instructions in our SECURITY.md (to be implemented) or contact the maintainers directly.
Molock Team - 2026