Repository navigation
Conversation
jetm
force-pushed
the
feed-loop/rewrite-loopback
branch
from
November 12, 2026 15:02
4f2a711 to
fed4e68
Compare
jetm
marked this pull request as ready for review
November 12, 2026 21:18
jetm
force-pushed
the
feed-loop/rewrite-loopback
branch
from
November 12, 2026 22:59
fed4e68 to
60559c6
Compare
The host-networking detection helper currently lives privately in the runtime deploy command. The feed-serving logic needs the same check to decide how a container reaches the developer's machine, but it cannot call a private function in an unrelated command module. Duplicating the parsing would risk the two copies drifting apart on the handling of the `--network=host` and space-separated forms. Place the helper next to the host gateway alias definitions in the feeds utilities and make it public, so deploy and feed code share a single implementation. Move its unit tests along with it to keep coverage beside the code it exercises. Signed-off-by: Javier Tia <javier@peridio.com>
A package feed served from the host, such as a local repository on localhost or 127.0.0.1, cannot be reached from inside the build container because loopback there refers to the container itself. Users currently have to hand-edit the feed URL to a host-specific address, which makes the configuration non-portable between machines and CI. Add an opt-in boolean, rewrite_loopback, to the feed definition so a loopback host in the url can be mapped to an address the container can reach. Keep it opt-in so existing configurations retain their literal URLs. Reject it on the distribution feed, which is restricted to a fixed set of keys, and document that in the schema description. Cover the schema side with a validation test confirming that a value of the wrong type is reported against the exact key path, so users get a precise error location. Signed-off-by: Javier Tia <javier@peridio.com>
When a container runs with host networking it shares the host's loopback interface, so a feed at localhost is already reachable. The unconditional rewrite to the host-gateway alias turned a working URL into one that may not resolve, and also added an unneeded extra-host route to the container. Make the rewrite depend on whether the container uses host networking, detected from the SDK container args. For repository feeds, allow an explicit per-repo rewrite_loopback key to override detection, since detection cannot cover every setup. The key is rejected on the distro and built-in feeds, where no such override is meaningful. The distro repository URL follows the host-networking decision alone. Derive the repo feed decision from project configuration only and ignore command-line container args. Install and build hash the feed projection with different args in hand, and consulting them would give the two stages different baseurls and invalidate the stamp. Store the decision on each resolved feed so Connect feeds, which have no URL until the mint returns, apply the same choice later. Centralize the distro URL computation in a helper so every container run path derives it identically instead of repeating the logic. Signed-off-by: Javier Tia <javier@peridio.com>
When the SDK container args request --network=host, a localhost feed URL is kept as-is on the assumption that the container shares the developer machine's loopback. That assumption is false on Docker Desktop and under the avocado VM: the container's "host" is a VM, and the deploy path strips --network=host there. The feed URL then points at the VM's own loopback, so package fetches fail even though the configuration looks correct. Make the loopback decision depend on whether host networking is actually in effect, not only on whether it was requested. The environment probe is factored out and injectable, so feed resolution and the container run config reach the same conclusion and tests can cover both environments without Docker Desktop or a VM. The decision still reads only project configuration plus the probe, so the stamp sees its outcome solely through the base URL and install and build stages continue to agree. Extend the tests to cover both probe outcomes, confirm that neither the probe nor the decision is serialized into the stamp, and verify that the stored rewrite decision drives the base URL minted for connect feeds. Signed-off-by: Javier Tia <javier@peridio.com>
The distro feed URL decision depends on a live environment probe that detects whether host networking is isolated from the developer's loopback, as on Docker Desktop or VM-based setups. Because the helper called the probe directly, the test could only exercise the real environment. Its result depended on where the tests ran, and the combination of an isolated host with a host-network run could not be checked end to end. Add a variant of the helper that takes the probe result as a parameter, and have the public helper delegate to it. This follows the existing pattern used for the host-network check, and it lets the test drive the URL rewrite and the host-network decision with the same injected value. The test now covers the isolated case, where `--network=host` is not honoured and the loopback URL must still be rewritten, without relying on the machine running it. Signed-off-by: Javier Tia <javier@peridio.com>
A feed served from localhost is unreachable from the build container unless the loopback host is rewritten, and the rewrite is skipped when the container shares the host's loopback. Users hitting either case need to know the key exists and how detection decides. Record the option, the host-networking detection and its Docker Desktop and VM exception under Added. Signed-off-by: Javier Tia <javier@peridio.com>
…working The container run splits each sdk.container_args element on spaces before docker sees it, so a single "--network host" element is host networking. The detection compared whole elements and missed it, which rewrote a loopback feed URL to the gateway alias on a host-networked container and added an unneeded host entry. Detection now tokenizes with the same splitter the run uses. The deploy path strips host networking from the same arguments, so its stripper drops the single-element form too; otherwise the shim would see host networking it could not remove. Signed-off-by: Javier Tia <javier@peridio.com>
…lements Detection splits each container arg element on spaces, but the stripper only recognised an element that was exactly the two host-network tokens. An element such as "--privileged --network host" was detected as host networking and left in place, so on Docker Desktop the shim added a published port next to host networking. Elements that carry the flag among others are now split so it can be dropped. Other elements stay verbatim, because splitting strips quotes and would break an element like -e "A=b c" on its later re-split. Signed-off-by: Javier Tia <javier@peridio.com>
Detection flattens every container arg element, but the stripper only flattened elements it already knew held the flag, so forms such as --network="host" or a flag split across two elements were detected and then left in place. The shim then published a port beside host networking. Flatten every element in the stripper too, so both agree by construction. Splitting drops quotes and the run re-splits each element, so a token holding a space is re-quoted; without that, -e "A=b c" would break into two arguments. Signed-off-by: Javier Tia <javier@peridio.com>
jetm
force-pushed
the
feed-loop/rewrite-loopback
branch
from
November 12, 2026 23:24
60559c6 to
a24062e
Compare
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. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
A feed on
localhostwas always rewritten to the host gateway, which breaks it under--network=host, where loopback is already shared.Solution
A per-feed
rewrite_loopbackkey decides explicitly. With no key, the rewrite is skipped only where host networking really shares the developer's loopback. That excludes Docker Desktop and the avocado VM.Key changes
rewrite_loopbackboolean in the config schema, rejected on the distro and built-in feeds.sdk.container_args, so install and build agree.Reviewer notes
The decision reads project config only, not command-line arguments. Please check the Docker Desktop and VM exclusion. Tests: 2,367 passed (same single existing failure).