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):
platformis the lockfile/manifest token"macos"/"windows"—platform_token()inlib.rs(ToolPlatform::MacOS => "macos").archis the toolchain cache-key token"arm64"/"x86_64"—arch_token()inlib.rsandwindows_arch_token()inwindows.rs. NOT the vendor-download alias"amd64"(vendor_arch()is documented as a download-URL-only mapping for the prebuilt resolvers).
Structs§
- Coverage
Entry - One tool’s entry inside a
CoverageMap. - Coverage
Map - A per-arch coverage map as served by the
RepoSourcesPages artifact (coverage/{platform}_{arch}.json):{metadata: {...}, tools: {...}}. - Coverage
Record - One coverage row: how provisioning
toolwent on(platform, arch).
Enums§
- Coverage
Status - 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
seedcommand 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
RepoSourcesPages 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 existingchronodep (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.