Skip to content

Contributing to Basin ​

State ​

Basin follows semantic versioning. Breaking changes ship only in a major release, while new solvers, backends, and opt-in features arrive in minor releases. Follow Maintenance and releases for backport and release procedures. Document breaking changes in a migration guide under web/src/guide/.

What this is ​

Basin is a Rust library crate for numerical optimization, inspired by argmin. It pairs a generic core (problem traits you implement, solver-owned convergence settings, and an Executor driver loop) with a set of solvers spanning first-order and quasi-Newton (gradient descent, BFGS, L-BFGS and L-BFGS-B), derivative-free (Nelder-Mead, Brent, Solis-Wets, and Powell's model-based family NEWUOA/BOBYQA/LINCOA/COBYLA), nonlinear least squares (Gauss-Newton, Levenberg-Marquardt, trust-region-reflective), global and stochastic (random search, simulated annealing, CMA-ES, a steady-state GA, memetic combinations incl. the MA-LSCh chain family), and constrained methods (projected gradient, bounded Nelder-Mead, L-BFGS-B, and CMA-ES, log-barrier, augmented Lagrangian, and COBYLA for nonlinear inequalities with optional linear constraints and box bounds). Solvers are generic over the linear-algebra backend (Vec<f64>, nalgebra, ndarray, faer). Scalar root finding lives beside this framework as a direct API because its signed function values and bracketing semantics do not fit optimization state.

Commands ​

  • cargo build: build the library.
  • cargo test: run tests.
  • cargo test <name>: run a single test by name.
  • cargo test -p basin --features problems: include tests that use the standard test-function corpus. No features are enabled by default; cargo test -p basin exercises the library without the corpus. Examples and benchmarks that use the corpus must declare required-features = ["problems"] in crates/basin/Cargo.toml and be run with --features problems.
  • cargo clippy --workspace --all-targets --all-features -- -D warnings: lint.
  • cargo doc --no-deps -p basin --features nalgebra-lapack,ndarray-blas,faer,parallel,problems,serde: build the public docs with the latest backend versions. CI runs this, and lib.rs has #![deny(rustdoc::broken_intra_doc_links)], so a broken or ambiguous intra-doc link (e.g. [Foo](super::foo) where foo is both a module and a function; link the struct super::Foo instead) fails the build. Run this before committing any rustdoc changes.
  • cargo fmt --all: format the root workspace. Pre-commit also formats shared include! sources and the separate backend fixture workspace, which Cargo's root formatting command skips. CI checks all three scopes in its fmt job.

Code coverage ​

Run task coverage to collect coverage and generate target/coverage/html/index.html. The dev environment supplies cargo-llvm-cov and the pinned toolchain's llvm-tools-preview component; reload devenv after changing the toolchain configuration. Outside devenv, install cargo-llvm-cov with cargo install cargo-llvm-cov --locked and add the LLVM tools with rustup component add llvm-tools-preview.

Coverage measures the basin crate with the latest pure-Rust nalgebra, ndarray, and faer backends, plus problems, parallel, and serde. Integration test sources, examples, and dependencies are excluded from the report. Doctest and branch coverage require nightly and are not collected. The existing CI matrix separately tests older backend versions and BLAS/LAPACK features.

The Coverage workflow preserves LCOV and HTML reports as Actions artifacts for 14 days and uploads LCOV to Codecov. Project and patch coverage checks are informational. Tests and report generation must succeed, while a Codecov upload failure leaves the reports available in Actions and does not fail the job.

For the initial Codecov setup, sign in, activate the existing jolars/basin repository, and ensure the Codecov GitHub app has access to Basin. Uploads authenticate with GitHub OIDC and do not need a CODECOV_TOKEN secret. The README badge starts showing coverage after the first successful upload from main.

The Website workflow checks the rendered HTML with lychee after each build and every Monday. It validates local pages, assets, and anchors, plus external links. Basin site URLs and versionless API links resolve against the local builds so new pages and APIs can be checked before publication.

To run the same check locally, build the site with pnpm --dir web build, run the cargo doc command above, and then run this from the repository root:

sh
lychee --config web/lychee.toml \
  --remap "^https://basin\\.rs/ file://$PWD/web/build/" \
  --remap "^https://docs\\.rs/basin/latest/basin/ file://$PWD/target/doc/basin/" \
  'web/build/**/*.html'

The checker reads HTML rather than .md sources, whose relative links name site routes. DOI links request citation metadata because some publishers block automated HTML requests. The published HTML is unchanged.

cargo test --all-features needs a BLAS/LAPACK provider ​

cargo clippy --all-features and cargo doc with acceleration features work out of the box because they only check and never link. cargo test --all-features is different: it links executables, and the versioned nalgebra LAPACK and ndarray BLAS features deliberately pull in no BLAS/LAPACK provider crate. So a bare cargo test --all-features fails at link time with undefined reference to dsyev_/dpotrf_—this is by design, not a missing system library. Installing liblapack/libblas is not enough on its own; nothing tells the linker to use them.

To actually run the LAPACK-backed tests, supply a provider at link time. With any OpenBLAS in scope (it provides both BLAS and LAPACK symbols):

fish
# NixOS example: point at an OpenBLAS in the store
set OB (ls -d /nix/store/*openblas-*/lib | head -1)
RUSTFLAGS="-L $OB -l openblas" cargo test -p basin --all-features

Outside Nix, an -L <dir> -l openblas (or -l lapack -l blas for reference netlib) pointing at your system libraries does the same. CI does not run --all-features tests; the routine local test command is the latest pure-Rust feature set: cargo test -p basin --features nalgebra,ndarray,faer,problems,parallel.

The dev environment is provided by devenv.nix (loaded automatically via direnv from .envrc). It pins Rust 1.89.0 and adds the wasm32-unknown-unknown target plus tooling: cargo-llvm-cov, cargo-flamegraph, cargo-audit, cargo-deny, cargo-msrv, samply, wasm-pack, go-task. Pre-commit hooks run clippy (with allFeatures = true) and rustfmt. Basin's package MSRV remains Rust 1.87.0; the dedicated CI job checks every feature compatible with that toolchain.

For the website, devenv supplies Node.js and pnpm. It disables pnpm's automatic version switching with pnpm_config_pm_on_fail=ignore so commands use the Nix-managed executable. Downloaded standalone pnpm binaries cannot run on NixOS. Reload devenv after changing its configuration, then run task web-dev to start the site. Outside devenv, pnpm uses the version pinned in web/package.json.

Performance tooling includes hyperfine for repeated executable timings, taskset for CPU affinity, perf, cargo-flamegraph, and samply for CPU sampling, and valgrind for allocation and instruction analysis. Criterion and native competitor libraries are already declared in the benchmark crates.

Use ordinary cargo bench builds for timing. Cargo's bench profile inherits the release optimizations. For profiling, use --profile profiling, which retains those optimizations and adds full debug information without stripping symbols. Its artifacts live under target/profiling. For frame-pointer stack sampling, also pass RUSTFLAGS="${RUSTFLAGS:+$RUSTFLAGS }-C force-frame-pointers=yes" and record with --call-graph fp; the Cargo profile does not itself enable frame pointers. The profiling guide provides the benchmark and profiler commands.

Architecture ​

A generic driver loop (Executor) iterates a Solver over a State, calling into user-provided Problem traits, until solver convergence, an execution limit, or an application stop ends the run.

  • src/lib.rs: public re-exports only.
  • src/core.rs + src/core/: the framework:
    • problem.rs: traits the user implements: CostFunction, Gradient, Residual + Jacobian (least squares), Hessian (second order).
    • numdiff.rs: the FiniteDiff wrapper: synthesizes Gradient/Jacobian/Hessian from function values via finite differences.
    • state.rs (+ state/): the State trait and concrete states: PointState<V> and FirstOrderState<V> provide shared progress storage with public record updates for external and new solvers. They retain raw evaluation counts, and category readers report only the named category; solver-owned machinery is preserved through solver-aware checkpoints. Opt-in EvaluatedState/EvaluatedGradientState, RawEvaluationState, and IncumbentState traits expose checked records and publication metadata. ObjectiveIncumbentState guarantees objective-ordered eligible selection for generic targets and stalls. Gradient descent, projected gradient descent, trust regions, BFGS, both L-BFGS modes, and derivative Brent use FirstOrderState; SGD, Solis-Wets, basin-hopping, the barrier method, and cost-only scalar and least-squares solvers use PointState. The augmented-Lagrangian outer method, COBYLA, and constrained MADS use SelectedState, whose explicit selection events preserve feasibility ordering and publication metadata. Simulated annealing uses ProposalState, which adds acceptance bookkeeping to point-and-cost progress while the solver owns its neighbor, RNG, and cooling history. Nelder-Mead uses SimplexProgress, which owns the observable vertices and costs while the solver owns scratch storage and coefficients. GBNM publishes PointState while owning its local simplex and restart history. NEWUOA, BOBYQA, and LINCOA also use PointState; their solvers own interpolation models, radius schedules, and any active-set factorization. Random search, DE, SSGA, DE injection, and global-best PSO use PopulationProgress, which preserves member order and retains a separate historical incumbent. Their solvers own RNGs and any inner solver. The PopulationState trait requires matching member/cost records without imposing an ordering. PSO owns velocities, personal bests, and live RNG state; shared progress publishes the current swarm and its global-best representative. Unbounded and box-bounded MADS use PointState; the solver owns the mesh, Halton schedule, and progressive-barrier history in every mode. SLSQP uses SelectedFirstOrderState, adding coherent objective gradients to explicit constrained selections. Its model-dependent diagnostics live on the solver. Both selected shapes implement ConstraintViolationState and store ViolationReport values with runtime measure, scaling, and transformation metadata. CMA-ES and its bounded and injection variants use PopulationProgress; their solvers own distributions, eigenpairs, and boundary penalties. Bounded CMA publishes clipped points with raw costs while retaining genotypes and penalized rankings in the solver. MA-LS also publishes PopulationProgress, with persistent solver/state chain pairs and eligibility history owned by its solver. Extension traits GradientState/SimplexState/PopulationState/AcceptanceState expose the richer shapes that convergence checks and execution controls bind on. Fields are private or pub(crate); shared states expose checked records and complete replacement operations for external solvers.
    • solver.rs: the Solver trait: init (one-time setup, e.g. seeding cost/gradient at iter 0), next_iter, plus convergence reset/check hooks and the terminate hook.
    • executor.rs: Executor owns problem + state + solver and drives the loop; run() returns an OptimizationResult<S> (final state, authoritative counts, and an owned TerminationReport<S::Float>); opt-in run_with_solver() returns an OptimizationResultWithSolver<S, So> retaining the final solver as well. Also run_loop_with_control/Stepper, solver-and-state Executor::resume/Executor::resume_from_checkpoint, and the cooperative, top-level CancellationToken.
    • checkpoint.rs: solver-aware exact checkpoints. The executor captures the solver, state, and authoritative evaluation counts at coherent iteration boundaries; consuming Stepper::into_checkpoint() and completed-result extraction require neither cloning nor serialization. The state-only observer remains a warm-start facility.
    • convergence.rs: fixed solver convergence slots and shared calculations. Optional checks add only the backend capabilities they need.
    • run_control.rs: budgets, targets, stagnation stops, and application hooks. Capability-bound builders provide raw max_evaluations budgets, target_objective, no_objective_improvement, and opt-in require_evaluated_state publication validation. Inner-executor serialization rejects capability controls instead of discarding them.
    • termination.rs: stopping reasons reported by solvers and execution controls.
    • constraint.rs (+ constraint/), barrier.rs, augmented_lagrangian.rs: canonical typed constraint sets, independent evaluation capabilities, checked validation, and explicit problem transformations (tenet 4).
    • inner.rs: InnerExecutor/WarmStart/ResumableInner for solver composition (fresh-seed tiers plus the seed + snapshot + resume tier the MA-LSCh chain family drives).
    • math.rs + math/: the backend math layer: a shared vector tier plus the linalg tier, with per-backend impls for Vec<f64> (incl. dense.rs / dense_eig.rs), nalgebra (+sparse), faer (+sparse), and ndarray (tenet 5).
    • rng.rs: RNG support for stochastic solvers.
  • src/solver.rs + src/solver/: concrete solvers spanning the families in "What this is", with pluggable line searches (Backtracking, Wolfe, MoreThuente, HagerZhang, Constant) where applicable.
  • src/root.rs + src/root/: direct scalar root-finding algorithms. These return root-specific results and errors rather than routing signed function values through the optimization State/Executor contract.

Module convention: no mod.rs: use src/foo.rs for the module file and src/foo/bar.rs for submodules.

Design tenets ​

These shape API decisions and are non-obvious from the code alone.

  1. Conventional vocabulary and shape. basin uses the established optimization-framework vocabulary (Executor, Solver, Problem traits, IterState-style State) and a generic driver-loop architecture. Familiar names lower the barrier for users arriving from existing frameworks; diverge only when another tenet demands it.
  2. Versioned backend compatibility. Each supported nalgebra, ndarray, and faer release has an exact Cargo feature; Vec<f64> needs none. The unversioned aliases select the newest supported releases. Deprecated *_latest features forward to those aliases. Every enabled version receives its implementations independently, including problem adapters and version-specific acceleration. BFGS uses the DenseBackend association to infer its solver-owned matrix from the starting vector, independently for every enabled version. Explicit solver matrix parameters allow custom storage. Test simultaneous versions using their actual dependency aliases.
  3. Solver-owned convergence. Numerical convergence settings belong on the solver, with one authoritative setting for each test and shared internal calculations. The executor owns iteration, evaluation, and time budgets, targets, stagnation stops, cooperative cancellation, and application hooks. Bind each optional check to the minimum state and backend capabilities it needs. Use explicit names such as with_absolute_gradient_tolerance and document norms, scaling, defaults, and OR/AND composition. Optional checks accept a finite nonnegative scalar or None; zero requests an exact-zero threshold. Algorithm controls and safeguards remain distinct. Fresh solves reset convergence history; exact solver-and-state checkpoints preserve it. Native convergence diagnostics record the tests at the stopping decision without additional evaluations or changes to precedence. Solver records may survive exact continuation; result readers must check the current stop reason before attributing those records to the run. Numerical safeguards remain distinct from convergence. Custom inner-stop factories create fresh history per run. Executor cancellation is checked between top-level iterations; typed problem errors remain the finer-grained hard-abort path.
  4. Optional problem-side constraints. Constraints describe the problem, so they live problem-side, never on state or as executor configuration. CostFunction, Residual, and constraint evaluation traits stand alone. Problems optionally implement Constraints, whose associated Set is a complete typed ConstraintSet. Constrained solvers require that declaration and reject unsupported blocks. Unconstrained solvers ignore it, including bounds and nonlinear callbacks; choosing such a solver optimizes only the objective. Borrowed views preserve existing storage, and statically absent blocks require no unused matrix or callback. Keep independent representations for constraint values, right-hand sides, linear matrices, and Jacobians. Validate consumed bounds, shapes, and counts before indexing, preserving user errors in ConstraintSolveError. Differentiation and robust-loss adapters forward optional declarations. Constrained::new installs its supplied set as the complete declaration, replacing any declaration on its inner objective. Barrier and penalty adapters transform only their supported blocks. Sampling domains remain distinct from mathematical bounds. RelaxedInner retains its explicit box transformation and error conversion for composed solvers. Future integer support must define which algorithms enforce integer domains; ordinary unconstrained solvers do not acquire that capability from a declaration alone.
  5. Tiered backends with full solver coverage. A small universal vector tier keeps first-order and derivative-free solvers generic over operations that every backend implements well. The richer linalg tier holds matrix operations. Solvers bound only on the capabilities they need, which Rust checks at compile time. New vector-based solvers must compile and run on all four dense backends (Vec, nalgebra, ndarray, and faer), with tests for both f32 and f64 on each. Implement any missing dense capabilities in the same change, in pure Rust, compatible with WASM, and without requiring BLAS/LAPACK or using stubs. Scalar algorithms do not require a linear-algebra backend. Sparse support is optional; document it separately and test every claimed sparse backend. The iterative-TRF API prototype demonstrates separate Jacobian-product capabilities and robust model composition without matrix entries. Keep that future operator path independent of the existing dense TRF requirements.

The built-in line-search configurations Backtracking, Wolfe, MoreThuente, and HagerZhang are non-exhaustive, with public fields, default constructors, and builders. Future controls must default to behavior compatible with existing constructors, without requiring callers to supply new settings within a major release. Document builders as the usual construction path, retain public field access and mutation, and decide serialization compatibility separately.

Enum payloads and complete values ​

Public enum variants keep their existing field lists within a major release. An enum-level #[non_exhaustive] permits new variants; existing variants remain directly constructible and support complete field patterns. Do not mark existing variants themselves non-exhaustive or add fields to them.

For ConvergenceEvidence, introduce a new variant when mathematical evidence needs a different representation. The distinction between UpperBound and FactoredUpperBound is the model for this policy. Preserve existing representations for unchanged evidence. Changing a solver to emit a new variant can send existing consumers into their fallback match arms, so document the previous and new representations and their meaning.

Optional reporting metadata belongs on enclosing non-exhaustive records such as ConvergenceCriterion or TerminationReport. Future fields must have defaults that preserve existing constructor behavior. A variant may contain such a record without fixing that record's fields.

Keep deliberately closed enums exhaustive: BoundSide, ConstraintAxis, StepOutcome, TerminationStage, and PartialResultPolicy. Complete mathematical records such as BinaryValue, Measurement, Threshold, and LossEvaluation retain struct literals and exhaustive destructuring. A different mathematical record requires a distinct representation.

Source compatibility and serialization compatibility are separate decisions. Adding enum variants or fields to an extensible record requires an explicit decision about serialized data and checkpoint compatibility.

State and lifecycle contracts ​

Stopping decisions carry owned evidence in Termination<F>. The executor publishes TerminationReport<F> with the observation stage and completed iteration count. SolverStep::completed is independent of its optional termination, and every successful step publishes counts and coherent progress. Ordinary results retain the report and authoritative evaluation counts. Exact continuation preserves convergence history and publishes a new event.

SolverStep and IncumbentRef are non-exhaustive publication records with complete public constructors. Future optional metadata must have defaults that preserve existing constructor behavior; adding fields cannot require external solver or state implementations to supply new information within a major release.

ConvergenceCriterion and ApplicationStop follow the same extension policy: their public constructors remain sufficient within a major release, and future optional metadata must default to behavior compatible with those constructors. Threshold remains exhaustive because its fields describe a complete mathematical comparison. Different comparison rules require distinct evidence representations.

ViolationReport is also a non-exhaustive publication record. Its constructor requires the value and measure, with unscaled, identity defaults; optional builders describe existing scaling and transformations. Future optional fields must preserve these defaults within a major release. Reports preserve evaluated values, including NaN and infinity, without validation or extra callbacks. Only the scalar value field is public; metadata readers borrow shared descriptors. Built-in combinations use static storage without allocations or reference-count updates. Custom descriptions use shared ownership and copy-on-write builders. The serialized representation retains the four value and metadata fields independently of this storage. SelectedState keeps its current record, incumbent, and counters in one owned allocation so transfers between solver and executor do not copy that storage at every iteration. Reset reuses the allocation; cloning a state makes an independent progress snapshot. Replacing current progress again before a pending selection is published allocates a separate snapshot of that selection, preserving its own report.

SimplexShapeError and PopulationShapeError are non-exhaustive enums with directly constructible variants and exhaustive payloads. New variants may refine diagnostics or describe new operations; they do not permit rejecting inputs accepted by the documented state contracts.

Shared progress states expose iterates, while solvers own algorithm machinery. The state API prototype records the design validation. Follow the contracts below.

  • Ownership: solvers own settings, models, history, RNGs, and working buffers. States expose progress through a few capability-based shapes. Observable simplexes and populations may live directly in state to avoid duplicate storage. Initialization inputs remain explicit.
  • Availability: construction is not evaluation. Provide checked access to missing records, and populate every advertised capability before observation. A state that never supplies a gradient must not implement GradientState.
  • Updates: external solvers can reuse shared storage through public operations that keep points, costs, derivatives, and population entries consistent. The executor owns bookkeeping. Observers see coherent boundaries without triggering evaluations. Observe<S> borrows progress, while optional ObserveSolver<S, So> hooks and Executor::observe_solver closures also borrow the solver. Both share observation boundaries, modes, and registration order. Diagnostic getters retain their documented availability and time semantics; observation does not clone workspace or transfer its ownership.
  • Incumbents: retain matching point, cost, and selection metadata across iterations. Best tracking covers published candidates, not every evaluation; timestamps record publication. Constrained selection may prefer a higher-cost feasible point, so generic objective-based controls require a capability that guarantees compatible selection semantics.
  • Constraint reporting: ConstraintViolationState borrows reports matching the checked current and incumbent records, with the same availability. Selection snapshots preserve the full report when current progress changes. reset clears both records; reset_best preserves current progress. Runtime measures remain solver-specific, including squared L2 for constrained MADS, L1 for SLSQP, L-infinity for COBYLA, and L2 for the augmented-Lagrangian method. Reporting adds no evaluations, feasibility thresholds, or convergence tests.
  • Counts: Problem owns authoritative EvalCounts; state preserves every category. Category readers and budgets must agree, with explicit names for aggregates. Counts measure callback requests at the Problem boundary. Fused requests charge each category, batches charge submitted items, and failing requests retain their charges. Internal adapter probes are excluded from these categories and their total_work sum. Keep any future opt-in probe accounting separate so it does not change existing counters or budgets. All shipped shared states report raw categories; use an explicit aggregate when budgeting their sum. Iterations count completed steps; a clean mid-step stop updates counts without adding a step.
  • Continuation: fresh runs reset evolving machinery and bookkeeping; point warm starts reevaluate their input. Model reuse requires an explicit contract. Exact continuation retains the solver/state/counts together and skips initialization and convergence reset. Executor clocks and hooks are separate. A hard error promises neither rollback nor recoverable state.
  • Results: ordinary results retain progress. Provide an opt-in path that returns the solver and counts by ownership for diagnostics and checkpoints, without requiring workspace cloning or serialization.

Current API guarantees belong in the rustdoc for state, solver, and executor.

WASM as a hard constraint ​

Basin must build for wasm32-unknown-unknown out of the box: a constraint on dependencies, not a feature. CI enforces it (cargo build --target wasm32-unknown-unknown).

  • Every default dep must be wasm-compatible. Anything that isn't (file I/O, threads, BLAS/LAPACK-linked math) sits behind a non-default feature.
  • No std::time::Instant in default paths; use web-time or feature-gate the time-based run controls. No rayon or parallelism in default features (gate behind parallel).
  • nalgebra and ndarray are wasm-fine in pure-Rust configs; pick those when both exist. LAPACK/BLAS acceleration of either is opt-in and off by default: ndarray-blas (forwards ndarray/blas) and nalgebra-lapack (swaps the nalgebra backend's Cholesky and symmetric eigendecomposition for LAPACK-backed ones). Both link a Fortran/BLAS toolchain, so neither builds for wasm and neither is in the wasm CI matrix.
  • If a solver can't realistically run on wasm, document that in a per-solver compat note rather than weakening the guarantee.

MSRV is externally constrained: do not bump casually ​

Basin's package MSRV (declared as rust-version in Cargo.toml) is set by downstream consumers, not Basin's own preferences. The development toolchain is newer so it can exercise every supported backend:

  • Primary: CRAN. A planned R-package wrapper must build under CRAN's Rust toolchain, which lags stable significantly. Bumping above CRAN's pin makes the R bindings unshippable. Do not bump rust-version without checking the current CRAN toolchain first.
  • Secondary (non-binding): Python bindings: PyO3 and maturin track recent stable, so unlikely to bind tighter than CRAN.
  • Every new dependency selected by an MSRV-compatible feature, including dev dependencies exercised by cargo publish --dry-run and CI, must compile under the MSRV. A feature may require a newer compiler when an explicitly supported dependency release does; document that exception beside the dependency and test the remaining feature set in the MSRV CI job. Prefer small, stable transitive trees over feature-rich ones with sprawling graphs.

Repo structure: workspace ​

The workspace manifest is at the repo root (shared lockfile) with three members:

  • crates/basin: the library.
  • crates/basin-wasm: wasm-bindgen JS bindings consumed by the Vue and Tailwind visualizer in web/ (deployed to Cloudflare Workers). web/ is its own node project, not a Cargo workspace member.
  • crates/competitor-bench: benchmarks against competing libraries.

Keep optional integrations as Cargo features on basin itself (nalgebra, ndarray, faer, parallel, problems), not new crates. Add a workspace member only on a concrete trigger: heavy or platform-specific deps that have no business in the core crate:

  • An observer with heavy deps (TUI, slog) -> basin-observer-foo.
  • Test problems other crates want to depend on independently → basin-testfunctions.
  • Python bindings -> basin-py.

If the only reason is "feels tidy", keep it in basin behind a feature.

Maintenance and releases ​

Supported release lines ​

Basin develops new releases on main and maintains the latest 1.x release on v1. Keep published releases available when introducing breaking changes. The 1.x line receives correctness, regression, and security fixes through at least April 19, 2027, and for at least six months after the first stable 2.0.0 release, whichever is later. We will announce the end of support in the release notes.

Only the latest 1.x patch release is maintained; earlier minor releases do not have separate maintenance branches. The v1 branch preserves its public API, convergence defaults, backend feature meanings, Rust 1.87-compatible feature set, and default WASM build. New features land on main; breaking changes require a major release. Do not backport breaking API changes.

Backporting fixes ​

Fixes normally land on main first. For a bug affecting 1.x, cherry-pick the fix and its regression test with git cherry-pick -x <commit> onto a branch based on origin/v1. Adapt the implementation if the APIs have diverged, run the relevant verification commands, and open a PR targeting v1. A fix developed on v1 should also be ported to main when applicable.

Keep the conventional fix: commit or PR title so Versionary proposes a patch release. Review the planned version before merging a release PR: Versionary does not enforce a version range from the branch name.

Backport source changes and tests. Each branch owns its versions, changelog, and .versionary-manifest.json; let Versionary generate those independently. Do not merge main into v1 or cherry-pick release bookkeeping between them.

Release automation ​

CI checks pushes and PRs targeting both base branches. Versionary runs after the CI checks pass, with one release job at a time per branch. VERSIONARY_BASE_BRANCH selects the base branch, while release-branch in that branch's versionary.jsonc names the generated release PR branch:

Base branchGenerated release PR branchPurpose
mainversionary/releasePrepare the next release.
v1versionary/release-v1Release compatible fixes for 1.x.

Merging a release PR creates its tag and GitHub Release. The existing Publish Crates workflow publishes the tagged crate to crates.io. The RELEASE_TOKEN must allow the tag and release events to trigger these downstream workflows.

The main branch sets release-latest to true; the v1 branch sets it to false. Maintenance releases therefore leave GitHub's Latest designation unchanged. The setting does not turn a release into a prerelease or prevent crates.io publication. Publishing beta or RC versions needs a separate prerelease policy.

Website deployment ​

The Website workflow builds and checks both branches. Deployment starts from a published release, after its GitHub metadata exists. Only a stable vMAJOR.MINOR.PATCH tag that is currently marked Latest may deploy to https://basin.rs/ on Cloudflare Workers. Prereleases and maintenance releases not marked Latest cannot replace the current stable documentation. Deployments are serialized and recheck Latest immediately before deploying.

The build job uploads the checked static site as an artifact. The deployment job publishes that artifact and the Worker together, using the cloudflare-workers environment. It needs the CLOUDFLARE_API_TOKEN repository secret and CLOUDFLARE_ACCOUNT_ID repository variable. See the hosting guide for local preview, credentials, and domain migration. Keep the deployment workflow and Worker configuration synchronized between main and v1.

To redeploy, manually run the Website workflow on main or v1 and set release_tag to the current stable tag. The workflow builds the tagged site's sources with the selected branch's hosting tools, then rechecks Latest before publishing. Leave the input empty to build and check the selected branch without deploying. Tags that already contain the Workers workflow can also be dispatched directly. Do not rerun older tags' GitHub Pages deployment workflows.

Basin v3.6.0