test(cf11): prove official registry fallback remains fail-closed on DNS failure
Scope
Add deterministic offline negative and positive tests of the existing CF11 official-origin selection contract, associated with issue #221 (historical GitHub Actions DNS outage) and the already merged origin diagnostics from PR #236.
Extract the unchanged primary/secondary attempt loop into a shared local helper used by both registry metadata and archive retrieval. Preserve the default primary-then-secondary order, allowlisted endpoints, explicit single-origin behavior, original error strings, and actual raw digest verification. No workflow, Cargo manifest/lockfile, AF-02 verifier, source-pinning, or DNS configuration changes.
Four actual offline tests simulate transport unavailability and assert (1) primary success never contacts secondary, (2) automatic mode tries secondary once after primary failure, (3) explicit primary or secondary never falls through to the other origin, and (4) dual failure retains both origin-specific diagnostics instead of inventing a semantic lock conflict. Simulated DNS text is intentionally not represented as a real DNS outage reproduction.
Actual qualification, Mac only, pinned Rust 1.97.1
- cargo test --locked -p commandf-pkg --lib registry::tests --quiet: 20 passed, 2 intentionally ignored network tests, 0 failed.
- cargo clippy --locked -p commandf-pkg --lib -- -D warnings: PASS.
- cargo test --locked -p commandf-pkg --test resolution --quiet: 9/9 PASS.
- cargo test --locked -p commandf --test registry_origin_behavior --quiet: 4/4 PASS.
- cargo fmt --all -- --check; git diff --check: PASS.
- Commit SSH-signed against registered signing identity and DCO Signed-off-by verified locally; only crates/commandf-pkg/src/registry.rs changed.
Important boundaries
This is a bounded fail-closed regression, not a repair of the external GitHub Actions DNS service failure recorded under #221, and not retroactive proof of historic runner origin selection. Do not close #221 from these simulated tests. Protected CI/AF-02 gates remain unchanged, no retry-to-green, and merge only after exact-head CI plus normal guarded merge. Alibaba OCR/TypeSafe Jev LLM review is NOT_RUN unless supported by actual zero-cost provider evidence; no fake review ratings.
Summary by cubic
Centralizes registry metadata and archive origin attempts while preserving primary-first fallback and explicit-origin behavior. Adds offline tests to verify the fail-closed behavior when origins are unavailable.
- Confirms successful primary requests never contact the secondary origin, and explicit origins never fall back.
- Confirms failures retain diagnostics for each attempted origin without implying a lock conflict.
- The tests simulate transport failures; they do not reproduce or fix the external GitHub Actions DNS outage.