Thank you for your interest in contributing to libvctrl! This document outlines the rules, workflows, and standards we follow to keep the project consistent and maintainable. Please read it carefully before opening an issue or a pull request.
- Code of Conduct
- Project Philosophy
- How Can I Contribute?
- Development Setup
- Development Workflow
- Code Style
- Testing Guidelines
- Release Process
- Security
- Recognition
We follow the Contributor Covenant Code of Conduct. By participating, you are expected to uphold this code. Please report unacceptable behavior to the maintainers.
libvctrl is a precision toolkit for building custom version control systems. It provides the fundamental contracts (types, traits) and reference implementations, enabling you to construct a VCS that fits your needs exactly – whether it's for an embedded system, a game engine, or a document store.
We value:
- Correctness over convenience
- Safety (no
unsafeunless absolutely necessary and well‑justified) - Explicit interfaces (traits are the primary abstraction)
- Testability (every feature must be testable with minimal setup)
- Documentation (every public item must have a docstring)
- Check the issue tracker to see if the bug has already been reported.
- If not, open a new issue and include:
- A clear, descriptive title.
- Steps to reproduce the bug.
- Expected behaviour vs. actual behaviour.
- Rust version (
rustc --version), platform, and relevant crate versions. - A minimal code example or test case, if possible.
- Open an issue with the label
enhancement. - Explain the use case, why it is important, and how it fits into the project philosophy.
- If you already have a design in mind, describe it – but be open to discussion.
- Look for issues labelled
good first issueorhelp wanted. - Comment on the issue to indicate you are working on it, or ask for guidance.
- Follow the Development Setup and Workflow sections below.
- Rust stable (install via
rustup) cargo,rustfmt, andclippy(included withrustup)jqandcurl(for the publish script, optional)ghCLI (optional, for GitHub Actions)
git clone https://github.com/mroczect/libvctrl.git
cd libvctrl
make ci # runs format check, clippy, and all testsThe workspace contains several crates:
| Crate | Description |
|---|---|
libvctrl_handler |
Contracts – types, traits, errors |
libvctrl_core |
Reference implementations (store, codec, hasher) |
libvctrl_sha512 |
Pure-Rust SHA-512 / HMAC / HKDF |
libvctrl |
Re-export umbrella crate |
libvctrl_plumbing |
Plumbing commands (e.g., cat-file) |
libvctrl_porcelain |
Porcelain commands (future) |
make test-verbose # runs all tests with RUST_BACKTRACE=1Target a single crate:
cargo test -p libvctrl_handlermake fmt # formats all crates
make handler # checks & lints libvctrl_handler specifically
make core # checks & lints libvctrl_core specifically
make plumbing # checks & lints libvctrl_plumbing specifically
make ci # run everythingmaster(ormain) is the stable branch. All releases are tagged from here.- Create feature branches from
master:
git checkout -b feature/my-feature- For fixes:
git checkout -b fix/my-fix- Keep branches small and focused. Merge back via pull request.
Use Conventional Commits format:
<type>(<scope>): <short summary>
[optional body]
[optional footer(s)]
Examples:
feat(handler): add fallible Hasher traitfix(core): update Sha512Hasher to new Hasher signaturedocs(libvctrl): update root-level examples
Allowed types: feat, fix, docs, style, refactor, test, chore, ci, build.
Scopes are optional but encouraged (crate name, module, etc.).
- Push your branch.
- Open a PR against
master. - Fill in the PR template (title, description, related issues).
- Ensure CI passes (format, clippy, tests).
- Assign one or more reviewers.
- Once approved, the PR will be merged (squash‑merged by default).
Important: Due to branch protection rules, merging is blocked until all required status checks are green.
- Be respectful and constructive.
- Focus on correctness, safety, and testability.
- If you need more time, use the "draft" state.
- Address feedback promptly.
- Follow the Rust API Guidelines.
- Use
forbid(unsafe_code)– anyunsafemust be explicitly justified and reviewed. - Adhere to the strict Clippy rules enforced in each crate (see
Cargo.tomllint sections). - No
unwrap()orexpect()outside of doctests and examples unless the invariant is guaranteed by context (useResultpropagation instead). - Run
cargo fmtbefore every commit.
- Every public item (module, struct, enum, trait, function) must have a doc comment (
///or//!). - Use
# Examplessections that compile as doctests. - Link to relevant types, traits, and modules with intra‑doc links (
[Type]). - Document error conditions, panics, and safety invariants.
- The unified error type is
VctrlError(defined inlibvctrl_handler). - All fallible functions return
Result<T, VctrlError>. - Do not panic on recoverable errors.
- When adding a new error variant that carries a
String, update thestring_payload_variants!macro invocation inPartialEq.
- Place
#[cfg(test)] mod tests { ... }inside the same file. - Test private functions where appropriate.
- Mock traits using simple structs rather than heavy frameworks.
- Located in
tests/directories of each crate. - Test public APIs end‑to‑end.
- Use the in‑memory store (
MemoryStore) andBinaryEncoder/BinaryDecoderfor fast, deterministic tests.
- Every code block in documentation is compiled and run.
- Ensure doctests do not panic; return
Resultor handle errors gracefully. - Use
#hidden lines to set up test context without showing it in the docs.
- We use
proptestfor round‑trip and fuzz tests. - See
libvctrl_core/tests/proptest_codec.rsfor examples. - Add proptest for any new encoder/decoder or serialization logic.
All crates follow Semantic Versioning:
- Major – breaking API change.
- Minor – new feature, backward‑compatible.
- Patch – bug fix, no API change.
Version numbers are set in each crate’s Cargo.toml.
- Local verification: Run
make ciand ensure everything passes. - Prepare the release: Use the script
scripts/publish_crates.sh(or create tags manually in the formatcrate@version, e.g.,libvctrl_handler@4.1.0). - Push the tag – the CI workflow
.github/workflows/publish.ymlwill automatically:- Verify the version matches
Cargo.toml. - Run
cargo testandcargo clippy. - Publish to crates.io.
- Create a GitHub release.
- Verify the version matches
Only maintainers with publishing rights should trigger releases.
- All crates use
#![forbid(unsafe_code)]. - Path‑traversal vulnerabilities are prevented at the handler level (
validate_tree_entry_name). - Do not introduce unsafe dependencies without prior discussion.
- If you discover a security issue, please do not open a public issue. Instead, email the maintainer directly.
All contributors will be acknowledged in the project’s documentation and release notes. Significant contributions may also be mentioned in the project’s README.
Thank you for helping make libvctrl better!