Files
alkane-toolkit/docs/adr/0003-vendoring-policy.md
T

2.9 KiB

ADR 0003: Vendoring

Status: ACCEPTED Date: 2026-09-15

Context

The operator directed that ASIC-rs and wxWidgets live vendored in this repo "so that we can handle merging updates easily". Upstream is not reachable through our suspended GitHub account, and we want reproducible offline builds and conflict-free updates.

Decision

Both dependencies are vendored under vendor/ as pristine upstream archives plus a patch queue:

vendor/          cargo-managed crate sources ONLY (regenerated by
                 `cargo vendor vendor`; it deletes unmanaged dirs - never
                 put hand-made trees here; learned the hard way)
thirdparty/
  asic-rs        the vendored crates live in vendor/ (crates.io dep,
    VERSION      cargo-vendored); this dir holds their patch queue:
    patches/       0001 whatsminer set_power_limit error propagation (#4)
    refresh-checksums.py   rewrites a vendored crate's .cargo-checksum.json
                           after a patch (cargo verifies each file's SHA256)
                 The committed vendor/ tree has the patches applied and the
                 affected .cargo-checksum.json refreshed, so builds need
                 nothing extra. On re-vendor, run
                 scripts/apply-asic-rs-patches.sh to re-apply + refresh.
  wxwidgets/
    wxWidgets-3.3.3/   pristine release tree, never edited directly
    VERSION            upstream version + tarball URL + sha256
    patches/           our changes as numbered .patch files (empty today)
  wx-rs/
    wx-rs-0.2.0-patched/  the used crate (path dep from alkane-gui)
    VERSION               upstream version + tarball URL + sha256
    patches/              0001 linux build path, 0002 rust widgets binding,
                          0003 C++ widget bridge, 0004 upstream wx3.3 fixes

Rules:

  1. Never edit a vendored pristine tree in place. Every local change is a patch in patches/, applied by the build in numeric order. This makes an upstream update: replace pristine archive, git apply surviving patches, rebase the rest.
  2. Every vendored tree records its upstream source URL and sha256 in VERSION. Updates are a diff of one version-pinning line plus the patch-queue rebase.
  3. Builds happen out-of-tree (~/.cache/wxbuild, ~/.cache/wx-3.3.3-linux) because the synced project mount is noexec; scripts/build-wx-linux.sh automates it.
  4. asic-rs is pinned per semver in Cargo.toml and materialized with cargo vendor; the build uses .cargo/config.toml's vendored-sources replacement, so builds never touch the network.
  5. wxWidgets 3.3.3 release tarball is the merge unit (wx upstream supports it); the C++ shell links the vendored tree via CMake add_subdirectory.

Consequences

  • The repo grows by the vendored sources (one-time; git-compressed).
  • Offline/reproducible builds on any machine.
  • Updating either dependency is mechanical, reviewable, and never entangles our changes with upstream files.