Skip to main content

Module coverage

Module coverage 

Source
Expand description

Toolchain build-coverage recording (writes) + advisory coverage-map reads.

Writes go to the package index: POST {base}/v1/coverage (base = ZLAYER_PACKAGE_INDEX_URL, default https://packages.zlayer.dev), where the body is a single JSON CoverageRecord signed with the same reposync HMAC scheme as every other index write — x-reposync-signature: sha256=<hex> over the exact raw body bytes, via crate::package_index::sign. The server upserts keyed (tool, platform, arch) and batch-pushes per-arch maps to RepoSources.

Reads never hit the worker: consumers GET the static Pages artifact https://zachhandley.github.io/RepoSources/coverage/{platform}_{arch}.json (fetch_coverage_map), which lags writes by a Pages build. Coverage is purely advisory — the toolchain always retains its build-it-yourself fallback, so a stale/missing map is never an error for provisioning itself.

Recording (record) is best-effort by construction: it returns (), not a Result, so a caller physically cannot fail a resolve on it. A missing secret, transport error, or non-2xx response produces exactly one warn! and nothing else.

Token conventions (kept consistent with the rest of the crate):

  • platform is the lockfile/manifest token "macos" / "windows"platform_token() in lib.rs (ToolPlatform::MacOS => "macos").
  • arch is the toolchain cache-key token "arm64" / "x86_64"arch_token() in lib.rs and windows_arch_token() in windows.rs. NOT the vendor-download alias "amd64" (vendor_arch() is documented as a download-URL-only mapping for the prebuilt resolvers).

Structs§

CoverageEntry
One tool’s entry inside a CoverageMap.
CoverageMap
A per-arch coverage map as served by the RepoSources Pages artifact (coverage/{platform}_{arch}.json): {metadata: {...}, tools: {...}}.
CoverageRecord
One coverage row: how provisioning tool went on (platform, arch).

Enums§

CoverageStatus
Outcome of a toolchain provisioning attempt, as recorded in coverage.

Constants§

REPOSYNC_HMAC_SECRET_ENV
Runtime environment variable carrying the reposync HMAC secret. Takes precedence over the compile-time option_env! bake so the secret can be rotated without rebuilding the binary.
SEED_TOOLS
The default tool set the seed command builds coverage for: the C-toolchain substrate most Homebrew source builds bottom out on.

Functions§

fetch_coverage_map
Fetch the advisory per-arch coverage map from the RepoSources Pages artifact ({pages}/coverage/{platform}_{arch}.json).
now_rfc3339
Current UTC time as an RFC3339 string — the value for CoverageRecord::recorded_at. Uses the crate’s existing chrono dep (the same idiom every manifest/lockfile timestamp in this crate uses).
record
Best-effort coverage write: POST rec (single JSON record) to {index}/v1/coverage, HMAC-signed over the exact raw body bytes.