Skip to content

Quality

This page describes how adotenv is tested and what each check covers. The current coverage figures and known gaps are in the test audit.

  • Unit tests for the parser, model, dialects, edits, encoding, formatting, sorting, comparison, portability, structure, positions, references and resolution.
  • Property tests on arbitrary UTF-8 input for parsing, dialects, edits, encoding, formatting, sorting, comparison, portability, structure, examples, references, resolution and parse_values. CI runs them with 2,000 cases each.
  • Integration tests for loading, serde, the CLI and its JSON schemas, the adapters, and the memory use of reference scanning.
  • Shared format-contract vectors for positions, text edit order, GitHub escaping, and the check and diff report schemas, with a hash manifest.
  • Doctests for the rustdoc examples, the README and every page of this site.
  • Builds for no_std, the minimum supported Rust versions and each feature set.

The gate is the CI workflow, which runs on every pull request, every push to main and every release tag. Its main steps:

Terminal window
cargo fmt --all --check
cargo fmt --manifest-path fuzz/Cargo.toml --all --check
cargo fmt --manifest-path conformance/rust/Cargo.toml --all --check
python3 scripts/check_docs.py
shellcheck scripts/*.sh
actionlint
cargo clippy --workspace --all-targets --locked -- -D warnings
cargo clippy --manifest-path conformance/rust/Cargo.toml --all-targets --locked -- -D warnings
RUSTDOCFLAGS="-D warnings" cargo doc --workspace --no-deps --all-features --locked
cargo test --workspace --locked
cargo test -p adotenv --features load,serde --locked
cargo audit --deny warnings
cargo deny check
cargo semver-checks check-release --package adotenv --package adotenv-process \
--package adotenv-config --package adotenv-figment --package adotenv-lint \
--package adotenv-lsp
cargo package -p adotenv --locked
python3 conformance/check_adotenv.py --setup

The workflow also:

  • builds and tests every feature set: default, exec, load, serde, load,serde, no default features, and no default features with serde, plus the adapters with load;
  • runs the tests on Linux, macOS and Windows;
  • builds adotenv, adotenv-process, adotenv-cli, adotenv-lint, adotenv-lsp (default features and --no-default-features) and adotenv-figment with Rust 1.81, and adotenv-config with Rust 1.88;
  • builds the core for the thumbv7em-none-eabi target without default features;
  • resolves the published workspace dependencies to their lowest compatible versions on nightly and runs their test suite (adotenv-lsp is excluded because lsp-types 0.97 declares 2018-era minimum versions that do not build under nightly -Z minimal-versions);
  • checks that every package includes its license files;
  • runs the gungraun det_parse benchmark smoke test, checks the memory regression gates with adotenv-xtask gate against both docs/benchmarks/memory.jsonl and docs/benchmarks/compact-memory.jsonl (adotenv, adotenv-compact and adotenv-compact-entries), and runs the deterministic instruction-count gate (scripts/det-perf-gate.sh).

The docs workflow also builds the mdBook site and runs a headless-browser smoke test for nested navigation, charts, sortable/filterable tables and selector help popovers.

All warnings are errors in CI, except the minimal-versions job, where dependency minimums can fail warning-clean builds.

Diagnostic codes and spans are stable; message text may change. Recovering parsers retain items and diagnostics. Strict parsing and edit verification do not build diagnostic lists they do not use.

The repository has seven bounded fuzz targets. Six have public seed corpora: parser, edits, encoding, resolve, format and differential; the limits target starts from generated inputs. The differential target compares Portable value parsing with the pinned in-memory competitors on the conservative KEY=value grammar, and runs malformed/recovery inputs through parser invariants without asserting upstream equivalence where semantics differ. The fuzz workflow runs each target for five minutes, weekly and on demand, with bounded time per input, memory and input length.

Terminal window
cargo +nightly fuzz run parser

scripts/dispatch_fuzz.sh starts one workflow run and waits for its result. Release evidence uses scheduled runs; the rule is in 1.0 readiness. Ad hoc local campaigns are development checks only.

conformance/manifest.json records pinned observations from real Node, Python, Compose and Docker env-file implementations. The corpus has 89 cases and 21 profiles. The runner checks package and source identities, hashes the inputs and compares literal observations plus a curated Compose resolution profile.

Terminal window
python3 conformance/check_adotenv.py --setup

Compose’s default parser performs interpolation. Literal comparison uses dollar-free inputs with an empty lookup; the separate compose_resolve profile compares curated Compose interpolation cases. Portable is not asserted equal to any upstream implementation.

CI produces a coverage report with cargo llvm-cov and uploads it as an artifact. There is no coverage threshold, and coverage alone does not block a release.

Mutation testing runs weekly and on demand in four shards. It targets parser diagnostics, key validation, edit verification and formatting equivalence, with a 90-second timeout and two jobs per shard. The 1.4.1 focused campaign and the subsequent 1.5.4, 1.6.0, 1.6.1, 1.7.x and 1.8.x (plus companion 0.3.x / 0.7.x) per-crate and --in-diff sweeps across all seven published crates are recorded in the test audit. Survivors are input for targeted regression tests, not an automatic release blocker.

Full test and mutation runs are resource-heavy. Follow heavy validation; in particular, do not run cargo mutants with multiple workers on the shared development host.

Terminal window
cargo mutants --file src/parser.rs --file src/edit.rs --file src/format.rs \
--re 'in (merge_lone_cr|valid_key_in|verify_entry_region|same_meaning)' \
--shard 0/4 --timeout 90 --jobs 2 --gitignore true

The minimum supported Rust version is 1.81 across adotenv, adotenv-process, adotenv-cli, adotenv-lint, adotenv-lsp and adotenv-figment. adotenv-config follows the minimum of config, currently 1.88. A minimum version rises only in a minor release.

The public API follows semantic versioning. Enums and structs that may grow are non-exhaustive, and options are set through builders. CI runs cargo semver-checks for all six published library crates (adotenv, adotenv-process, adotenv-config, adotenv-figment, adotenv-lint and adotenv-lsp) against their latest published versions. Breaking releases list their changes and a migration guide in the changelog; see Upgrading to 1.0.

deny.toml allows only Apache-2.0, MIT and Unicode-3.0 dependencies, denies unknown registries and Git sources, and reports duplicate versions as warnings. Add a reviewed exception only when the dependency or duplicate is intentional. GitHub Actions are pinned by commit.

A successful bounded test or fuzz run is not a proof for all inputs. Callers handling untrusted source should limit its size before parsing; see Security and limits.