Skip to content

Keep release discovery with the command that requested it

How PIG selects a Pigsty release list and keeps its mirror, version and checksum together through download.

Decision date: 2026-11-29
Status: Released in v1.12.0.
Current reference: Pigsty releases and downloads and repository regions
Scope: Network discovery for Pigsty releases, region selection and text status.

Decision

One probe returns the selected repository, inferred region, internet reachability and release list to its caller. Version selection uses that list. The selected release carries its archive URL and any published checksum into the download.

Context

A text status report needs endpoint diagnostics. A download needs release metadata. When both used process-wide variables, a status check could enable diagnostics for a later operation, and a second probe could replace the first caller’s release list.

Alternatives

A mutex could protect each variable while allowing one command to read another command’s selection. Serializing the entire probe and download would make independent requests wait for a potentially long transfer. Passing the result directly gives each caller the information it needs for its own operation.

Contract

The two repository checks and the Google reachability check share a 1.5-second deadline. A usable international repository list takes precedence. The China list is the fallback. When a repository returns a parseable non-empty release list and Google is unreachable, the inferred region is China. A caller that requests the China mirror uses that host for archive URLs and retains the checksums from the selected list.

A partial version selects the highest matching stable release at a component boundary. An explicit prerelease can be looked up by its full version. Each command applies its own offline policy. For example, sty list requires release metadata, while sty init can reuse a valid local archive.

Impact

Text status writes diagnostics after the probe determines its result. Terminal speed cannot change the selected mirror. Repository setup and configuration can use the region without enabling progress output for another command.

Verification

Transport fixtures cover concurrent probes with different mirrors, missing repositories, prerelease-only lists, cancellation and a slow diagnostic writer. Download tests check archive validation, checksum handling and preservation of an existing file after a failed replacement. Implementation and tests

Status

Implemented in source on 2026-11-29. Published versions are tracked in the release history.