Skip to content

Latest commit

 

History

History
684 lines (563 loc) · 43 KB

DEVELOPMENT.md

File metadata and controls

684 lines (563 loc) · 43 KB

Development Guide

See the contribution guide for requirements to meet before beginning implementation. Follow the repository-wide development rules; this guide provides additional workflow, tooling, and design background.

Common commands

Run just to browse commands grouped by purpose, with everyday development tasks first. Use just --groups to list the groups, or filter the overview with, for example, just --list --group 'Dependencies and SBOMs'.

Release source paths

The GitHub release workflow builds gix and ein through etc/scripts/remap-release-paths.sh. It appends rustc's --remap-path-prefix flags for all target crates, including dependencies, using stable virtual roots: /gitoxide for the checkout, /cargo for Cargo sources, /rust for the selected Rust toolchain, and /generated for build output. Home, Rustup, and temporary paths are also remapped. Native host paths, canonical aliases, Windows separator variants, and cross container mounts are covered. Normal local development builds are unchanged.

To opt into the same policy locally, run these commands from the workspace root:

bash etc/scripts/remap-release-paths.sh build cargo build --release --locked -p gitoxide --bins
bash etc/scripts/remap-release-paths.sh check target/release/gix target/release/ein

Practices

  • fuzzing
    • fuzz parsers, algorithms, and other code that processes untrusted input.
    • add a regression test for every issue found before fixing it.
  • benchmarks
    • benchmark performance-sensitive changes before and after implementation.
    • use representative inputs and compare against git when applicable.
  • Adhere to the stability guide

Commit History

We use feature branches and pull requests to take advantage of CI and GitHub review tools, and merge with merge commits to make individual efforts stand out. There is no requirement to squash commits or linearize history. However, commits may be squashed when the history is too messy to review, and commit titles may receive minor edits.

Use Tix to organize topic-oriented commit stacks. See the Tix workflow for history edits and preservation of review state.

Configuration and overrides

As a general rule, respect and implement all applicable git-config by default, but allow the caller to set overrides. How overrides work depends on the goals of the particular API so it can be done on the main call path, forcing a choice, or more typically, as a side-lane where overrides can be done on demand.

Note that it should be possible to obtain the current configuration for modification by the user for selective overrides, either by calling methods or by obtaining a data structure that can be set as a whole using a get -> modify -> set cycle.

Note that without any of that, one should document that with config_snapshot_mut() any of the relevant configuration can be changed in memory before invoking a method in order to affect it.

Parameters which are not available in git or specific to gitoxide or the needs of the caller can be passed as parameters or via Options or Context structures as needed.

Software bills of materials (SBOMs)

Install the pinned Rust tools once with just sbom-install, then run just sbom to write CycloneDX 1.5 and SPDX 2.3 JSON inventories of all workspace members, with all features and platforms enabled. cargo deny remains the audit tool; it does not export these SBOM formats. cargo-cyclonedx generates the inventory and sbom-tools converts that same inventory to SPDX, reporting any metadata loss (such as CycloneDX properties) on standard error.

Use --package to select a workspace crate with its default features on the host platform. The gitoxide package builds the gix and ein binaries; the gix package is the library. For example:

just sbom --package gitoxide --no-default-features --features small
just sbom --package gitoxide --no-default-features --features max-pure
just sbom --package gix --no-default-features --features sha1
just sbom --package gix --features blocking-http-transport-reqwest-rust-tls
just sbom --package gix --no-default-features --features sha1,blocking-http-transport-curl-openssl

--features accepts comma- or space-separated named crate features and can be repeated. --all-features enables every feature of the selected crate. Use --target TRIPLE for another platform or --target all for all platforms.

Outputs default to <Cargo target directory>/sbom/<workspace-or-package>.cdx.json and .spdx.json. Use --output-dir PATH to keep inventories for different feature or target selections alongside each other. Each run replaces the existing files for that package or workspace only after both tools succeed.

Inventories include runtime and build dependencies and exclude dev-only dependencies. Every workspace member is a root in workspace mode, including internal tooling. Package mode resolves in a temporary workspace so unrelated workspace members cannot enable extra HTTP or TLS backends. Resolution uses a copy of Cargo.lock and rejects changed package versions; source manifests and lockfiles stay untouched. The selected graph comes from cargo tree, which resolves platform-specific features and host build dependencies that cargo metadata --filter-platform alone cannot isolate. These are Cargo dependency inventories, not scans of native libraries installed on the system or of the contents of a compiled binary.

Run just sbom-test to exercise generation using an isolated offline Cargo fixture, including feature selection and matching inventories in both formats.

General

  • async

    • library client-side
      • Provide async network clients as opt-in using feature toggles, and document supported transports and runtime requirements.
    • User Interfaces
      • User interfaces can greatly benefit from using async as it's much easier to maintain a responsive UI thread that way thanks to the wonderful future combinators.
      • Offload blocking work, including pack processing in async APIs, to an execution context that tolerates blocking rather than the UI thread.
      • Ignoring a result does not stop background work or roll back filesystem changes. Inspect the operation's documented interruption outcome.
    • server-side
      • Keep async integration independent of a particular runtime where feasible; account for CPU-intensive and blocking work.
    • shared blocking and async code
      • Use async-shaped source with the keep, discard, and sync attributes from gix-macros. Alias them in a local bisync module at each integration point so both variants can coexist while being generated from one implementation that cannot drift.
  • Default trait implementations

    • These can change only if the effect is contained within the callers process. This means changing the default of a file version is a breaking change.
  • Using the Progress trait

    • When receiving a Progress implementation
      • without calling add_child(…) then use it directly to communicate progress, leaving control of the name to the caller. However, call .init(…) to configure the iteration.
      • and when calling add_child(…) don't use the parent progress instance for anything else.
  • interruption of long-running operations

    • Use gix_utils::interrupt::* to implement cooperative interruption by polling the operation's interrupt flag.
    • The process-global gix::interrupt::trigger() flag affects only operations that explicitly poll it. Reset it with gix::interrupt::reset() only after the affected work has finished, not after an arbitrary delay.
    • this is a must if…
      • …temporary resources like files might otherwise be leaked.
    • this is optional but desirable if…
      • …there is no leakage otherwise to support user interfaces. They background long-running operations and need them to be cancellable.
  • when to use interior mutability

    • Optional abstractions can manage caller-owned caches and buffers using interior mutability only if part of the mutable state has to be returned as borrow or if otherwise it wouldn't be possible to borrowcheck. Or in other words: start without interior mutability and try to do it the standard way, but switch when needed.
    • The preferred way of using it is to start out as upgradable reader, and upgrading to write if needed, keeping contention to a minimum.
    • Shared ownership alone does not require interior mutability; mutation through shared references does. Locally stored caches may still use an API requiring &mut self.
    • Types that are not thread-local must be Sync, but only if the gix-parallel/parallel is enabled due to the usage of gix_parallel::… primitives which won't be thread-safe without the feature.
  • when to use shared ownership

    • Use gix_parallel::OwnShared for resources shared by thread-local handles. It selects Arc or Rc according to the parallel feature. Measure ownership and synchronization overhead in the relevant workload.

Architecture background

For background on repository-backed platforms and caches, see this PR and this discussion.

Examples, Porcelain CLI and Plumbing CLI - which does what?

Plumbing vs Porcelain

Both terms are coming from the git implementation itself, even though it won't necessarily point out which commands are plumbing and which are porcelain. The term plumbing refers to lower-level, more rarely used commands that complement porcelain by being invoked by it or by hand for certain use cases. The term porcelain refers to commands that prioritize an approachable user experience. They are primarily designed for humans, but may also be used by scripts and agents.

In any case, both types of programs must self-document their capabilities using through the --help flag.

From there, we can derive a few rules to adhere to unless there are good reasons not to:

Plumbing

  • does not show any progress or logging output by default
  • if supported and logging is enabled, it will show timestamps in UTC
  • tracing is buffered independently of progress and written to stderr with terminal-aware colors after the command finishes
  • corpus uses the same trace display while persisting full per-run trees independently of the display level
  • repository-independent operations accept explicit inputs; repository operations may discover or open a repository

Porcelain

  • Provides progress information to stderr during long-running operations; allow it to be disabled with --quiet.
  • If timestamps are shown, they are in localtime.
  • Non-progress information goes to stdout.

Summary

Here is the hierarchy of programs - each level requires more polish and generally work to be done. Examples are materialized ideas that others can learn from but that don't quite have the polish (or the potential) to move up to plumbing or porcelain. Plumbing prioritizes composition, whereas porcelain prioritizes an approachable user experience.

  • Examples
    • An implementation of ideas for actual occasional use and the first step towards getting integrated into Porcelain or Plumbing CLIs.
    • Proper command-line parsing with Clap.
    • Examples must compile; add focused tests where behavior or correctness warrants them. Elaborate test suites are not required.
    • No progress.
    • High quality Rust code along with idiomatic gitoxide usage so people can learn from it.
  • Plumbing CLI (like gix)
    • Use Clap for command-line parsing, including small builds.
    • Journey tests only if it's proven valuable
    • Progress can be turned on using the --verbose flag, quiet by default.
    • Examples can be turned into plumbing by adding journey tests and optional progress.
  • Porcelain CLI (like ein)
    • Use Clap for command-line parsing for the best quality CLI experience - it's for the user.
    • Journey tests
    • Support for --quiet; line progress is shown by default for long-running operations.
    • Verbose by default.
    • Examples can be turned into porcelain by adding journey tests and progress.

Maintenance Guide

Run just --list --group 'Maintenance' to browse maintenance tasks. The Makefile retains specific build and fixture-generation targets used by CI.

QA locally and in CI

just qa runs every selected quality-assurance check that can run on your host. CI uses the same task catalogue and commands, distributing them across jobs and additional platforms. Use fast mode while developing, and exhaustive mode to reproduce the checks used after integration:

just qa                             # fast: affected work, plus mandatory policy checks
just qa --base stable-gix            # compare a stacked PR against its own base branch
just qa --mode exhaustive            # every applicable configuration on this host
just test                           # alias for exhaustive QA
just qa --dry-run                    # inspect commands without executing checks
just qa --agent                      # compact progress, with detailed task logs
just qa --help                       # list options and available stage selectors
just qa --stage tests,doctests        # union of stages; overlapping selectors run once
just qa-plan                         # JSON selection, reasons, tasks and job assignments
just qa-plan --all-platforms          # CI's assignments, including other platforms
just qa-plan --platform windows-x86_64 --mode exhaustive

When CODEX_THREAD_ID is present, QA automatically enables agent output. Each task shows basic progress; failures name a retained log containing its commands, working directory, diagnostics, stdout, and stderr. The logs are in the printed temporary directory. --agent enables this output explicitly. JSON plans and --dry-run command listings remain available for detailed inspection.

When tix is installed, a successful complete local run records a checks-pass message on the tested commit's tree: the selected QA profile passed with the recorded scope. Its gutter emoji distinguishes fast (⚡) and thorough (🔬, exhaustive mode) coverage, including automatic exhaustive fallbacks. Fast runs that omit tests include coverage selection in the title. The title shows the elapsed run time; the body records the host, comparison base, selected package count, selection reasons, package/configuration planning time and elapsed time for each task, including setup. Coverage reports include the effective mode, observed test execution and omission counts, and index reuse, collection or fallback. Inventory and per-test selection timings are a breakdown of task times, not additional elapsed time. Timing starts inside the QA runner, after any compilation needed to launch it. Recording requires the same clean HEAD at the start and end of the run. Dirty runs, task failures (including nonblocking failures), stage subsets, saved plans, dry runs and CI jobs do not receive a checks-pass message. A missing tix or unavailable initial Git state skips recording; other Tix errors are reported separately from passing QA.

Fast mode compares against the merge base with origin/main by default, including staged, unstaged and untracked changes. Fetch your intended base before comparing. Selection includes owning crates and reverse normal/build workspace dependencies, including optional and platform-specific dependencies. Their dev consumers are selected too, without propagating further through those dev-only edges. Known root prose files and Markdown documents under etc/plan/ select no Rust work; crate documentation is a crate input because it can appear in rustdoc. Manifests, lockfiles, fuzzers, shared tests, CI/build configuration, unclassified paths and a missing base conservatively select exhaustive coverage. The plan explains each fallback. An unchanged checkout still checks licenses, dependency policy, advisories, workflow policy, script modes and the MSRV badge.

Fast mode also checks declared feature and WASM configurations with Cargo (cargo tree --locked --offline --target all). It omits a configuration only when its normal, build and applicable dev dependencies exclude every directly changed package. Direct edits retain all of that package's configurations; shared fixture consumers count as directly changed inputs. Cargo resolves optional dependencies, renamed dependencies and feature unification, including self dev-dependencies. Queries include all targets so the same plan remains conservative on other CI platforms, and configurations sharing a dependency selection reuse the query.

An investigation of LSP-based test selection measured finer selection with rust-analyzer. Missing call edges and mismatched feature configurations currently prevent using those results to omit individual tests safely.

Fast QA automatically uses LLVM coverage selection for native, isolated and feature tests when stable Rust's matching LLVM tools are available. It uses a compatible local index to select individual tests. If the configuration has no usable index, it runs the full selected case with per-test coverage collection and saves the result for later QA invocations. This first run pays for collection and analysis; subsequent runs can reuse the index. New or unrecorded tests always run.

just qa                             # use coverage when available; otherwise collect for later runs
just qa --coverage off              # use only package/configuration selection

The tools can be installed with rustup component add llvm-tools-preview --toolchain stable. Local QA does not install them automatically. Missing tools or unsupported configuration retain ordinary QA. Unknown changed paths and non-Rust changes retain the full test case; unavailable or invalid coverage cannot cause tests to be omitted. Exhaustive mode keeps ordinary execution without automatic collection; use --coverage collect to seed those configurations explicitly. Actual test failures still fail QA. Automatic runs use the same separate, reusable instrumented build cache whether collecting or pruning. A workspace compiler wrapper preserves configured Rust flags and does not replace existing custom compiler wrappers.

If a valid index cannot classify changed inputs, automatic mode runs the full case and refreshes it when source contents differ from its last capture. A source-content hash avoids repeated collection for the same unknown or disabled inputs; it never permits test omission. Newly added tests run until a refreshed index records their coverage. Partial coverage, including unmapped functions from child executables, leaves that individual test unrecorded so it always runs.

Coverage records executed source files. Constants, type layouts and other compile-time inputs can affect tests without executing those files. Checks-pass records success of the selected profile and reports test omissions. The layer does not prune compilation, clippy, doctests or shell journeys. See the measurements and limits.

Tix QA sweeps retain automatic coverage selection unless explicitly disabled by the user and preserve the runner's checks-pass artifact with its coverage and timing report.

The coverage modes can also be selected explicitly:

just qa --coverage collect           # run all selected tests and measure per-test file coverage
just qa --coverage shadow            # compare the historical selection while running all tests
just qa --coverage prune             # reuse saved indexes without collecting missing configurations

Collection uses stable Rust's -C instrument-coverage and the matching LLVM tools; no nightly compiler is required. Missing/corrupt indexes and unsupported custom Nextest scripts/profiles retain ordinary QA.

Automatic collection and collect write indexes under target/qa-coverage/indexes, never committed. They are published only after the whole QA run succeeds with unchanged checkout contents and HEAD. Automatic collection from a dirty checkout records its HEAD and dirty paths; those paths remain part of subsequent selection even if the edits are later reverted. Raw profiles are discarded after each case; compiler build caches remain reusable. Explicit collect still requires a clean checkout for publication. Each index records the exact Cargo package batch, features, compiler, inherited Cargo configuration, fixture mode and runtime hash. Exhaustive native workspace builds therefore cannot supply an index for a differently batched PR build; matching per-package feature cases can reuse their own indexes. An older index must name an ancestor of HEAD; selection includes the entire diff from that ancestor, the QA comparison base, recorded dirty paths, and current staged, unstaged and untracked inputs. New/unrecorded tests always run, and unknown changed paths or non-Rust inputs retain the complete case. Exhaustive mode never omits tests.

Use shadow to compare selections while retaining complete execution. Collecting coverage runs the tests being measured; reuse is what can make later runs faster.

CI enables collection and reuse by default for native, isolated and feature tests. Main jobs attempt to install LLVM tools, collect complete configuration indexes and publish 14-day Actions artifacts. PR jobs attempt to download the matching job's artifact from a successful run at their base commit and use prune; a missing index retains ordinary execution without collecting an unused PR index. Unavailable tools, artifact services, GitHub CLI or baseline runs retain ordinary QA. Set the repository variable QA_COVERAGE to shadow to report PR selections while running all tests, or off to disable CI coverage. No repository variable is needed for the default behavior. Locally, GIX_QA_COVERAGE selects the mode, and an explicit --coverage takes precedence. Downloaded JSON indexes can also be placed in target/qa-coverage/indexes for local reuse without Git LFS.

Unavailable cached dependencies and unfamiliar arguments retain the original checks. Saved plans carry the exclusions, capped at 12 KiB to leave room for job metadata in Windows' environment variables; excess configurations remain selected. CI fetches the lockfile's dependencies into its planning cache so offline queries also work there. Local planning does not fetch dependencies. Exhaustive mode retains every configuration.

All PRs request fast mode. Pushes to main or run-ci/**, and manual workflow dispatch, request exhaustive mode. Exhaustive checks on landed commits provide feedback for forward fixes when fast selection misses an undeclared dependency. CI cancels obsolete PR runs but keeps landed-commit runs. The Tests pass gate requires the planner and all required jobs. Advisory, package-size and WASM failures remain informational, locally and in CI.

What runs where

Portable checks run locally on Linux, macOS or Windows. CI assigns them once to Linux x86-64 instead of repeating them on every OS. Native tests run on Linux, macOS and Windows in fast mode; exhaustive CI adds Linux ARM64, Linux 32-bit x86/ARM, and Windows ARM64. Local Intel macOS is also supported. Only Windows runs the no-Git and 32-bit Windows cases; only Linux x86-64 runs the constrained pure-Rust Docker check. Journey tests require Unix. CI also retains Windows baseline doctests and MSRV builds. --all-platforms shows these exact assignments; a local run never attempts another host's native checks. Isolated package tests and Windows binary checks have their own CI jobs to run concurrently with native tests, retaining their Cargo feature selections.

FreeBSD x86-64 runs baseline Cargo tests for packages that opt in with qa.extra-platforms. Both fast and exhaustive plans restrict this job to opted-in packages; fast plans also require them to be affected. gix-notify opts in to exercise its notify kqueue backend. The job runs the shared QA runner inside a FreeBSD VM, with sources copied onto its local filesystem. Its result participates in the ordinary Tests pass gate.

Linux feature compilation checks and feature tests run in separate jobs, retaining every selected configuration.

Local and CI builds use debug = 0 and strip = "debuginfo" in the workspace's dev profile, also inherited by test and qa. This reduces object files, libraries and linked debug information while retaining debug assertions and overflow checks, including in dependencies with an optimized development profile. Panic messages and gix-error source locations remain available, but stack backtraces lose file/line information and debuggers cannot inspect local variables or types. MSVC builds still emit smaller PDBs for symbols. CI applies the same artifact settings to downstream workspaces through Cargo profile environment variables.

For debugging, set CARGO_PROFILE_DEV_DEBUG=2 and CARGO_PROFILE_DEV_STRIP=none before running Cargo or QA; use line-tables-only instead of 2 when only file/line backtraces are needed. Unset both variables to return to the smaller defaults. Release and benchmark profiles retain their separate settings.

Local incremental compilation remains enabled to speed up rebuilds. Set CARGO_INCREMENTAL=0 for builds where disk space matters more than recompilation speed; CI's Rust cache action already does this. Profile changes affect newly built artifacts and do not remove old artifacts or other toolchain/feature variants from target.

Rust caches are saved by main runs and restored by PRs. They retain downloaded dependencies and their build artifacts; workspace crates are rebuilt. Job caches compete for the repository's storage allowance, so a correct key can still miss after eviction. Changes to the Cargo profile environment produce new cache keys that need a main run to populate.

Stage Checks
self-test Lightweight planner/runner tests; CI runs these once in the planning gate
policy, advisories, audit Dependency licenses, bans and sources; advisory reporting; audit selects both
housekeeping Workflow credentials/gate policy, executable script modes and MSRV badge
lint, check Formatting and Clippy; check also compiles selected manifest configurations; exhaustive adds machete and workspace feature contracts
tests, default-tests Native nextest, isolated package tests, and supported Windows checks; tests also includes declared feature/hash variants
doctests, docs Cargo doctests and rustdoc, including declared doctest variants
journey CLI journeys: affected small in fast mode; all four configurations in exhaustive mode
api Ignored API checker integration tests, on Rust 1.99.0
msrv Minimal dependency resolution and declared MSRV builds, in an isolated source copy
auditable, size Auditable build and package-size reporting
wasm Affected supported packages/configurations for the three WASM targets
pure-rust Linux x86-64 Docker build with constrained C/C++ tooling

Independent tasks continue after failures; the command fails if any required task failed. Within a task, prerequisites remain ordered: a failed journey build cannot run a stale CLI. Missing tools produce visible failures. Use --stage to reproduce a subset without installing unrelated tools. just unit-tests, just doc-tests, just check, just qa-test and etc/scripts/ci-check-local.sh --fast|--thorough delegate to the shared runner. The script's profiles now mean the same fast/exhaustive modes; it no longer cleans fixtures. Complete local profiles use the same Tix checks-pass recording described above. The legacy ci, ci-plan, ci-test and ci-journey-tests recipes remain aliases for their qa counterparts.

Local prerequisites and isolation

Each task declares the tools, Rust components/toolchains/targets and system dependencies it needs. Inspect the requirements of your selected work before installing tools:

just qa-plan | jq '.tasks[].task | {id, requirements}'
just qa-plan | jq '.jobs[] | {id, tools, rust_components, rust_toolchains, rust_targets, just, diet, xz}'

The tool versions live in [workspace.metadata.qa.tool-versions] in the root manifest. CI provisions the requirements collected from its assigned tasks; the same requirements appear in the local plan. Component and target requirements retain their toolchain, for example {"toolchain":"stable","component":"clippy"} or {"toolchain":"1.99.0","target":"wasm32-wasip1"}. Pass that toolchain to rustup component add --toolchain or rustup target add --toolchain, after installing it. The following commands install the tools used across exhaustive QA.

Install Git, Bash, just 1.58.0, jq, and a C toolchain, plus platform libraries required by the selected features (OpenSSL/pkg-config and liblzma where applicable). The shared runner selects stable Rust for ordinary tasks and Rust 1.99.0 for API tasks. Stable should match CI's current stable version; Git and system libraries also need compatible versions. MSRV uses the declaring package's rust-version and nightly Cargo for minimal-version resolution:

rustup toolchain install stable 1.99.0 nightly "$(just msrv)"
rustup component add --toolchain stable clippy rustfmt
rustup target add --toolchain stable wasm32-unknown-unknown wasm32-wasip1 wasm32-wasip2
# Windows x86-64 also needs:
# rustup target add --toolchain stable i686-pc-windows-msvc
cargo install --locked cargo-nextest --version 0.9.122
cargo install --locked cargo-deny --version 0.20.0
cargo install --locked cargo-machete --version 0.9.1
cargo install --locked cargo-semver-checks --version 0.51.0
cargo install --locked cargo-auditable --version 0.7.6
cargo install --locked cargo-diet --version 1.2.7

Housekeeping parses workflow YAML directly in Rust. The same parser is available as cargo run --locked -p internal-tools -- yaml-to-json FILE; omit FILE or use - to read stdin. It emits JSON on stdout and rejects duplicate keys, non-string mapping keys, non-finite numbers, and multiple YAML documents.

The pure-Rust check needs Docker; it uses a disposable Debian container, a read-only source mount, and the persistent Docker volume gitoxide-ci-pure-rust for Rust/download/build caches. Ordinary checks reuse target.

The runner sets CI=true locally too, including journey assertions and Git-version checks. It disables snapshot/baseline updates and overrides inherited fixture-selection variables. Native fast tests on Windows reuse valid checked-in fixture archives, falling back to generation when an archive is absent or stale. This avoids repeated expensive Git subprocesses on Windows; comparisons against freshly generated Git baselines still run in exhaustive QA. Linux and macOS fast tests use freshly generated fixtures. Exhaustive native tests compile/list once, then reuse the same nextest binaries for archived and generated fixtures in separate temporary source copies. Native passes and feature/hash or isolated test variants within one QA run share a fresh cache of generated read-only scripted fixtures, locally and within each CI job. When no archive is available, the archived pass can generate a fixture once for both passes; the shared cache never substitutes extracted archives for generated fixtures. Fixtures that write archives or require execution in a writable destination keep their existing behavior. The cache and its source copies remain alive until the run finishes, and are retained together if a source copy changes. Changes to source files between stages prevent cache reuse. Feature/hash variants also run in an isolated copy and continue after individual failures. Separate runs and CI jobs never reuse each other's generated fixtures or extracted archives. Archive changes cause a failure and retain the changed copy for inspection. Explicit archive-only fixtures keep their normal semantics.

Source copies include current tracked and visible untracked files, preserving local edits, deletions, permissions and safe relative symlinks. Native copies use an intent-to-add index to track paths without storing duplicate Git blobs; source checks hash the copied files directly. MSRV resolution changes only its copied lockfile. The runner never restores, cleans or stages your checkout. Native tests also check the original source for unexpected changes because compile-time Rust paths may still point there. Avoid editing while those checks run; concurrent edits are reported as changes too.

Maintaining QA selection

The qa binary in internal-tools (tests/it) owns planning, the task catalogue, platform assignment and execution. Each task exposes its requirements, inferred from direct Cargo commands or declared alongside opaque scripts, recipes and internal operations. Job requirements are their task requirements combined, so the workflow does not maintain a second list of which checks need each tool. .github/workflows/ci.yml provisions those requirements and schedules the plan. Its gate builds with --no-default-features, requiring only Clap, JSON parsing and the dependency-free gix-error; the existing it binary retains the default tools feature.

Launchers use the qa Cargo profile, which inherits dev, so workspace builds cannot replace the running executable on Windows. The checks retain their existing profiles and target directory, including CARGO_TARGET_DIR overrides. Use that profile for manual invocations too:

cargo run --profile qa --locked -p internal-tools --no-default-features --bin qa -- plan
cargo test --locked -p internal-tools --no-default-features --bin qa
just qa-plan > /tmp/qa-plan.json
just qa --plan /tmp/qa-plan.json --dry-run

Plans use cargo metadata --no-deps, without resolving all external dependencies. Saved plans preserve selection; regenerate them after changing the checkout. A CI job can be reproduced with --plan FILE --job ID on its matching platform. Stage selection and normal local execution use the same tasks. Add custom automation in tests/it/src/qa or tests/it/qa; workflow command bodies only provision the declared prerequisites.

Crate-specific variants live beside their features in Cargo.toml:

[package.metadata.qa]
checks = [{ args = ["--features", "serde"] }]
tests = [
    { args = ["--features", "serde"] },
    { args = ["--features", "sha256"], env = { GIX_TEST_FIXTURE_HASH = "sha256" } },
]
doctests = [{ args = ["--features", "blocking-io"] }]
extra-inputs = ["another-crate/tests/fixtures"]

checks compiles the declared configurations with cargo check; tests runs nextest and doctests runs Cargo doctests. The owner package is implicit. Grouped cases can specify packages = ["owner", "other"] and run when any member is affected. Arguments go directly to Cargo/nextest; the runner supplies package selection and the appropriate locked/test options. Use requires = ["xz"] on a case that needs an extra system capability. Keep feature combinations separate when Cargo unification changes dependency features. Declare external crate input paths in extra-inputs (repository-relative files/directories, without globs).

Opt into baseline tests on an additional platform by its catalogue label:

[package.metadata.qa]
extra-platforms = ["freebsd-x86_64"]

Currently only freebsd-x86_64 is supported here. Its runner and FreeBSD release are pinned centrally in tests/it/src/qa/catalog.rs. These jobs run cargo test --locked --no-fail-fast for the selected packages with default features; feature variants retain their usual assignments.

For a small set of independent features, opt in to checking each declared feature separately. For example, a package such as gix-parallel can use:

[package.metadata.qa.each-feature]
args = ["--no-default-features"]
exclude = ["default", "document-features"]

The policy checks the baseline, then adds each non-excluded feature to it once. New features automatically gain a check. base = ["sha1"] can supply a required baseline for a package that declares that feature; args = ["--no-default-features", "--tests"] also compiles its tests. Use exclude for unsupported combinations, aggregate features or redundant configurations, and explicit checks for combinations that matter together. The policy does not enumerate a cross product. Exact repeated cases are removed; meaningful combinations remain explicit. The same each-feature policy is available under qa.wasm. Fast mode runs these checks for affected packages. Exhaustive mode also runs the shared feature contracts, including expected compilation failures and separate fuzz workspaces.

gix and gix-utils use this linear policy. Common serde, parallel and hash cases keep small explicit configurations: feature names alone do not establish compatible combinations, and dev-dependency feature unification can hide missing feature edges. Runtime combinations stay explicit, including their fixture settings; adding a compile check does not add a test run.

WASM support is declared by each package. List the targets it supports and any required feature configurations; without checks or each-feature, the package builds with its default features:

[package.metadata.qa.wasm]
targets = ["wasm32-unknown-unknown", "wasm32-wasip1", "wasm32-wasip2"]
checks = [{ args = ["--features", "sha1"] }]

MSRV builds use the declaring package's rust-version and an explicit list of configurations:

[package.metadata.qa.msrv]
checks = [
    { args = [] },
    { args = ["--no-default-features", "--features", "async-network-client,max-performance,sha1"] },
]

In [package.metadata.qa], packages whose tests require separate feature resolution set isolated = true; the workspace baseline excludes them and their declared cases run separately. without-git = true requests the supported Windows check without Git on PATH. CLI owners declare journey = true and auditable = true for their corresponding tasks. These roles keep crate selection beside the crate's other QA settings. The API checker declares api-checker = true and its api-toolchain. Nextest retains the settings in .config/nextest.toml. Cargo package selection saves compilation as well as execution, which nextest test filters alone cannot do.

Explicit feature and hash variants complement the native baselines. Three equivalent gix-hash variants were combined after comparing their resolved feature graphs, as were two gix-zlib compile checks already covered by its tests. Clippy covers default compilation; rustdoc's former second command had the same effective documented crate features and was removed. Journey builds remain adjacent to their runs because later configurations overwrite the same binary paths.

Downstream compatibility (CI only)

GitHub Actions separately checks ten major external gix consumers from their current default branches in twelve package-specific jobs. These jobs are not part of local QA, including exhaustive runs. In fast mode they run only when the existing dependency selection includes gix; exhaustive CI runs select all twelve jobs. This is conservative: changes to any workspace dependency that can affect gix select every consumer, without downloading and resolving upstream projects in the planner.

The declarations live in gix/Cargo.toml under package.metadata.qa.downstream. They enable each consumer's Git backend explicitly instead of enabling all unrelated features. The first five entries use total downloads from the crates.io reverse dependencies API on 2026-11-01, excluding this repository and grouping crates by upstream project:

Consumer Total downloads Enabled consumer features
built 76,145,348 gix
rustsec 15,074,921 gix-reqwest, osv-export
crates-index 9,182,813 git
cargo 8,196,198 defaults
cargo-generate 2,616,134 git
jj (jj-cli, testutils) — defaults
GitButler (but, but-gpui) — defaults
Starship — defaults
vergen-gix — defaults
Onefetch — defaults

Download counts include versions and builds where gix is disabled. Refresh this reviewed list from the paginated API when needed; jobs discover each repository's default branch at checkout. jj and GitButler extend coverage to version-control applications. Their CLI, test-support, and GUI packages each run in a separate job, preserving default features. GitButler jobs install their Linux development libraries; the GPUI job also installs Zig for its terminal dependency. Starship and Onefetch cover repository inspection in CLI applications; vergen-gix covers Git information emitted by build scripts.

The internal-tools runner replaces direct Gitoxide library dependencies in the disposable consumer workspace with paths into the checkout under test, preserving requested features and default-feature settings. This also keeps explicitly used plumbing crates on the same source tree. It verifies that the selected build actually compiles local gix, so Cargo cannot silently check a published version or skip a disabled optional dependency. Consumer API errors, removed features, and other failures remain visible as advisory warnings while gix is pre-1.0. The jobs print the upstream revision and use separate Rust caches for each consumer.

The original main CI run on 2026-10-31 took 28m23s; Windows ARM fixture regeneration and Linux feature tests dominated. Fast mode avoids unaffected packages and additional architecture/fixture configurations. Actual savings depend on the selected dependency closure and cache state; no new wall-clock CI speedup has yet been measured for this restructuring.

Creating a release

Use just release to publish crates with the repository's release defaults. Additional release-tool arguments can be passed to this recipe.

just roll-release <cargo-smart-release-args> runs the release command and then triggers the GitHub binary workflow for the unique v* tag at HEAD. To trigger only that workflow, use just run-release-workflow. Workflow commands require an authenticated gh CLI.

Git compatibility checks

Git-version detection and fixture support live in gix-testtools. should_skip_as_git_version_is_smaller_than() lets tests skip locally when the installed Git is too old, but deliberately never skips on CI. Check a failing test's required Git version when reproducing CI-only failures.

For fixtures requiring a particular Git version, scripted_fixture_read_only_with_git_version() and its writable counterpart run the fixture script only with a compatible Git. Otherwise they use a matching archive, or return None if none is available.