Skip to content

Fail fast when a feed repository is unreachable - #387

Closed
jetm wants to merge 8 commits into
feed-loop/init-minimalfrom
feed-loop/feed-preflight
Closed

jetm wants to merge 8 commits into
feed-loop/init-minimalfrom
feed-loop/feed-preflight

Conversation

@jetm

@jetm jetm commented Nov 12, 2026

Copy link
Copy Markdown
Contributor

Problem

An unreachable feed repository surfaced as a dnf error from inside the container, without naming the feed.

Solution

install and sdk install probe each URL feed's metadata, and the extension repository when a sourced extension needs one, before downloading. A not-found or a refused connection fails naming the feed.

Key changes

  • Directory feeds are checked on disk. Other statuses (5xx, 401, 403, 429) warn and let dnf proceed.
  • Probes run once per target and are skipped under --runs-on.
  • A local extension with no package source does not trigger the extension-repository probe.

Reviewer notes

This reverses today's warn-only tolerance for unreachable URL feeds, so I would like opinions on that. Tests: 2,392 passed (same single existing failure).

@jetm
jetm added this pull request to stack #388 November 12, 2026 13:54
Comment thread src/utils/feeds.rs Fixed
@jetm
jetm force-pushed the feed-loop/feed-preflight branch from 3e75b44 to 6afe501 Compare November 12, 2026 15:03
@jetm
jetm marked this pull request as ready for review November 12, 2026 21:18
@jetm
jetm force-pushed the feed-loop/feed-preflight branch from e4a1512 to ca3031c Compare November 12, 2026 22:59
jetm added 8 commits November 12, 2026 17:24
When a feed repository is unreachable or serves no metadata, the
failure currently surfaces only after the install has started, as a
dnf error inside the container. By then the message rarely says which
configured feed is at fault, and time has already been spent on
downloads that cannot succeed.

Probe the repodata index of each URL feed, and of the extension
repository when the caller needs one, before anything is fetched. Each
error names the feed and the reason: connection failure, missing
metadata, or an unexpected HTTP status. A path feed is verified on disk
instead, since it is never served over the network.

Probe from the host using the locator as configured, because the
container's rewritten loopback address is not reachable from the host.
Use a per-feed client so each feed keeps its own CA, TLS verification
and credential. Probe the extension repository only when an extension
needs it, so a minimal project is not required to run one.

Unlike the addon check, which only warns about an unreadable index,
treat an unreachable feed as an error. dnf would fail on it anyway,
just later and with less context.

The function is not called yet; the install and SDK install commands
will wire it in separately.

Signed-off-by: Javier Tia <javier@peridio.com>
Currently an unreachable feed repository is only noticed once dnf runs
inside the container, well after the install has started pulling
content. The failure then carries little information about which feed
is at fault, and the user has already waited through earlier steps.

Call the existing feed preflight from both `install` and `sdk install`
before anything is downloaded. Because `install` also runs the SDK
install, the probes are recorded per target and executed only once per
process, so the feeds are not asked twice. Extensions marked
`enabled: false` are still fetched, so they count when deciding whether
the extension repository must be reachable.

Resolution is repeated in the hook instead of being shared with
`materialize_feeds`, since that runs later and depends on a mint that
this check has to precede. Only a successful probe is remembered, as a
failure terminates the command anyway.

The preflight function is now used, so drop its dead-code allowance.

Signed-off-by: Javier Tia <javier@peridio.com>
The feed preflight introduced for the first-build loop refuses to run
in several cases where dnf would have succeeded. A minimal project with
only local extensions was rejected when the feed had no extension
repository, even though nothing would be fetched from it. With
--runs-on, dnf runs on a remote runner that may reach feeds this host
cannot, so a local probe says nothing useful. Any non-404 error status,
such as a rate limit or proxy rejection, aborted the command although
the feed was reachable. Add-on feeds were probed ahead of the add-on
check, hiding its did-you-mean message behind a bare metadata error.
The extension repository URL was also guessed without a releasever,
where the container falls back to the image's os-release, which the
host cannot see.

Require the extension repository only when an active extension
declares a package source, since git, path and local extensions never
touch it. Skip the probes under --runs-on. Treat only a definite
missing-metadata answer (404 or 410) or an unreachable server as fatal,
and warn on other statuses so dnf reports a genuinely unusable feed.
Leave add-on feeds to the index-based check when an index is known, and
skip the extension repository probe when no releasever is configured.

Record whether the extension repository was probed in the once-per-
target cache. A later caller that needs it after a narrower pass runs
the probe instead of inheriting a pass that never covered it.

Signed-off-by: Javier Tia <javier@peridio.com>
Installs now fail before any download when a feed is unreachable or has
no metadata. Users who used to see a dnf error from inside the
container need to know where the new error comes from and when it is
skipped.

Record the preflight under Added, including the once-per-target probe
and the --runs-on skip.

Signed-off-by: Javier Tia <javier@peridio.com>
The probe parsed the configured CA with from_pem, which reads one
certificate, so a bundle whose signing root was not first made the
preflight fail with a TLS error on a feed dnf would reach. The snapshot
client already adds each certificate of a bundle; the probe now does the
same, and the extension-repository probe shares the path.

Signed-off-by: Javier Tia <javier@peridio.com>
…nally

Two preflight tests returned early when an ambient release variable
supplied a releasever or an add-on index, so on such a machine they
passed having checked nothing. Clear the release and channel variables
under the module's serial guard and assert the precondition, so the
test either exercises the path or fails.

Signed-off-by: Javier Tia <javier@peridio.com>
from_pem_bundle returns an empty list for an empty or DER-encoded file
instead of an error, so a misconfigured ca: setting added no trust
anchor and the probe quietly used the system roots. Fail with the feed
name and the path so the mistake surfaces at the preflight.

Signed-off-by: Javier Tia <javier@peridio.com>
… off

The probe built its client with certificate verification disabled
whenever a feed set tls_verify to false, so the preflight itself sent
requests, credentials included, to a server it had not authenticated.
That is the one thing a verification setting should never be bent into.

A feed that opts out is now not probed at all and a warning says why,
leaving dnf, which honours the setting, to report an unusable feed. A
verifying probe still fails naming the feed when it cannot trust the
server.

Signed-off-by: Javier Tia <javier@peridio.com>
@jetm

jetm commented Nov 12, 2026

Copy link
Copy Markdown
Contributor Author

Consolidated into #394, which carries this layer's commits together with the rest of the feed-first stack. Closing so review happens in one place.

@jetm jetm closed this Nov 12, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants