Contributing
The toolchain, the just recipes, the code and commit conventions, the repository skills and what CI runs.
candding is a small repository with strict conventions, because the thing it promises, vectors that match the reference, only survives if every change is verified the same way. This page is what you need before the first commit; porting a model and testing cover the two workflows that have more to them than a recipe.
Toolchain
- Stable Rust, at or above the
rust-versionfield in the workspaceCargo.toml. - A nightly toolchain for the formatter only: the repository's
rustfmt.tomluses unstable options, so formatting is alwayscargo +nightly fmt. justas the command runner; every workflow in this repository is a recipe.uvfor the Python reference scripts, which run throughuv run --project scriptsand never need a manual virtual environment.- The
hfCLI for downloads, frompip install huggingface_huboruv tool install huggingface_hub. - Bun for this documentation site.
Recipes
| Recipe | What it does |
|---|---|
just fmt | formats the workspace with the nightly formatter |
just clippy | clippy over all targets with the model-test feature, warnings denied |
just test | the workspace unit suite, offline and without weights |
just test-models | the golden tests on CPU, with the model-tests feature |
just test-metal | the same suite on the compiled accelerator |
just parity | CPU against the accelerator, model by model |
just ci | the format check, clippy and the unit suite, as the CI lint job runs them |
just fetch <id> | downloads one model through the CLI and the include patterns |
just fetch-phase <n> | downloads every registry model of a phase |
just golden <id> | regenerates one model's golden reference from sentence-transformers |
just inputs | rewrites the shared fixture inputs |
just sts-fixture | rebuilds the STS-B subset used by the smoke test |
just docs-dev | runs the documentation site locally |
just docs-build | production build of the site |
just docs-models | regenerates the site catalog data and the README table from the registry |
just docs-audit | runs the documentation audit |
just docs-check | everything the site must pass: catalog check, MDX lint, audit, typecheck and build |
Conventions
- Commit subjects are
<type>: <imperative subject>with no scope and no trailing period, one logical change per commit, and no trailers of any kind. - Rust files stay under three hundred lines, and
main.rsholds onlymain; a file that grows past that becomes submodules rather than a longer file. - Comments are doc comments plus the rare short note about why something is done a particular way. No banner comments, no restating the code, no commented-out code.
- The library never prints: diagnostics go through
tracing, andprintln!belongs to the CLI. - Model code has no
#[cfg]and no device checks; the one backend branch lives in the shared attention function. - Everything is written in English, and Markdown is not hard-wrapped: one paragraph is one line.
Skills
The repository carries six skills that encode the workflows an agent or a new contributor would otherwise have to rediscover.
porting-embedding-model: the repository files to read before a port, the family checklist and the numerical pitfalls. The porting guide is its public form.golden-vector-testing: the fixture layout, the generator, the tolerance policy and how to bisect a mismatch layer by layer.hf-model-download: the download commands and include patterns, the cache layout, revisions, gated repositories and tokens.device-compat: the feature matrix, default dtypes, where a backend branch is allowed, known accelerator gaps and how to run parity.commit-workflow: what must pass before a commit, the message format, and what never goes into one.docs-writing: the frontmatter contract, the shape of each page type and the checks this site is held to.
CI
| Workflow | When | What it runs |
|---|---|---|
ci | every push to the default branch and every pull request | the format check and clippy, then the workspace unit suite and the golden tests for two small models against a cached download |
metal | manually, or on a release tag | the same two models on an Apple runner with the Metal backend |
docs | when documentation-related paths change | the site checks: catalog data, MDX lint, audit, typecheck and build |
The two golden models in CI are the small English bge model and MiniLM, which keeps the cached download small; the rest of the catalog is verified locally before a model commit lands.