This document describes the workflow, branch strategy, coding standards, and
quality gates for contributing to the
datex Rust crate.
| Purpose | Naming Pattern | Example |
|---|---|---|
| Permanent default branch | main |
- |
| Milestone / release branch | release/<MAJOR>.<MINOR>.<PATCH> |
release/0.0.4 |
| Feature branch | feature/<slug> |
feature/tcp-interface |
| Bug-fix branch | fix/<slug> |
fix/handshake-timeout |
| Maintenance / chore branch | chore/<slug> |
chore/update-deps |
| Hotfix branch | hotfix/<slug> |
hotfix/crash-on-start |
Use lowercase letters and hyphens (
-) in branch names. Avoid spaces, underscores (_), or other special characters.
- The default branch
mainis protected – direct pushes are disabled. - All work happens via Pull Requests (PRs).
- Target branch for every PR is the currently-active release branch (e.g.
release/0.0.4). - After review & CI success, the feature branch is merged into the release branch.
- Release branches are merged back to
mainonly by a maintainer at version cut-time.
Do not branch from or target
mainfor new work. All development must branch from the latest release branch (e.g.,release/0.0.4). Themainbranch reflects only published, production-ready code and is not used for active development.
-
Edition: Rust 2024.
-
Formatting:
cargo clippy-debug
CI will fail if any file is not properly formatted.
-
Linting:
cargo clippy --features debug
We plan to treat more Clippy warnings as errors in the future. Suppress a lint only with a line-level
#[allow(lint_name)]and an explanatory comment. -
Idioms & Practices:
- Prefer explicit
usepaths; group imports by crate. - Enable useful nightly lints in
#![deny(clippy::pedantic, clippy::nursery)]where feasible. - No
unsafeunless unavoidable – must include a safety comment explaining invariants. - Public items require rustdoc comments (
///) with examples where possible. - Follow snake_case for variables/functions, CamelCase for types/traits, SCREAMING_SNAKE_CASE for constants.
- Prefer explicit
-
Each module declares its own unit tests inside an internal
testssub-module:#[cfg(test)] mod tests { use super::*; // … }
-
Every public function or logically-independent unit must have at least one positive and one negative test.
-
Mirror the
src/tree undertests/:src/ crypto/ mod.rs random.rs tests/ crypto/ random.rs -
Name the file after the feature being exercised (
network.rs,persistence.rs, etc.). -
Integration tests may use the public API only (no
pub(crate)work-arounds).
- Place Criterion benchmarks in
benches/. - Benchmarks must compile and run (CI executes them with
--benchbut does not time-gate results). - Performance regressions > 10 % should be called out in the PR description.
A pull request is merge-ready only when:
- All unit tests pass:
cargo test --all --features debug. - All integration tests pass:
cargo test --all --tests --features debug. - All benchmarks build:
cargo bench --no-run. - Clippy passes with no errors.
- Rustfmt check passes.
- Checks complete on all supported toolchains (currently stable, beta).
Note: CI pipelines are automatically triggered for all PRs targeting release branches. PRs to
mainwill be rejected unless explicitly opened by a maintainer.
Before requesting review, ensure you have:
- Followed the branch naming convention.
- Rebased onto the latest active release branch.
- Added/updated unit tests and, if applicable, integration tests.
- Confirmed
cargo fmt,cargo clippy-debug, and all tests/benches succeed locally. - Updated documentation & examples.
- Written a clear PR title and description (what, why, how).
-
Always base your work on the latest release branch, not on
main. Themainbranch only tracks finalized releases - new development happens in the currently activerelease/x.y.zbranch. -
Creating your branch:
git fetch origin git checkout origin/release/<MAJOR>.<MINOR>.<PATCH> -b feature/<slug>
-
When your feature or fix is ready:
- Open a Pull Request (PR) targeting the same release branch you based your work on.
- Select the "DATEX" project for the PR in GitHub.
- The maintainers will assign it to the appropriate release milestone.
-
If your PR cannot be merged cleanly (e.g., due to version conflicts), it may be retargeted to a later release branch by maintainers.
-
Once approved, your change will be merged into the active release branch; the release branch will later be merged back into
mainduring version cut.
- Use Conventional Commits style (e.g.
feat: add TCP interface,fix: handle timeout). - Keep commit history clean; squash or amend while the PR is open.
- Reference issues in the PR body (e.g.
fix #42).
- Small changes (< 30 LoC) may be approved by one maintainer; larger or architectural changes require two approvals.
- Discuss API-breaking changes in a GitHub Issue or Discussion before coding.
- Feel free to draft a PR early (
[WIP]) and mark as draft to get feedback on direction.
git clone https://github.com/unyt-org/datex.git
cd datex/crates/datex
rustup override set nightly
cargo test-debug
cargo clippy --features debugYou are now ready to create your feature branch and start contributing. Thank you for helping us shape the future of the unyt.org ecosystem!