Skip to content

fix(fallback): repack only the target that provides the requested package - #460

Merged
ORESoftware merged 1 commit into
mainfrom
fix/repack-root-target-only
Sep 18, 2026
Merged

ORESoftware merged 1 commit into
mainfrom
fix/repack-root-target-only

Conversation

@ORESoftware

Copy link
Copy Markdown
Contributor

Follow-up to #379 / #458 / #459, and the last blocker for installing the ORESoftware/ores-compose graph from github.com while the registry origin is down.

Problem

A polyglot repository can declare a target rooted at generated output that its source tag cannot contain. pack_all fails on the first such target, so repacking a tag archive refused the entire repository — every package in it became unresolvable.

Live case, ORESoftware/ores-interfaces:

[targets.repository]      dir = "."
[targets.public-contracts] dir = "generated/public"   # .gitignore: generated/*

zed pack fails there too (target 'public-contracts' source root 'generated/public' is not a directory), so this is a faithful reproduction — but it has nothing to do with the root package oresoftware/ores-interfaces that the consumer actually asked for.

Change

  • pack::pack_target is the existing per-target body of pack_all, lifted into its own function. pack_all now calls it once per target, so publishing is unchanged and digests still match byte for byte.
  • The tag-archive fallback selects the single target that provides the requested package (root identity included) and packs only that one.

Evidence

Registry pointed at http://127.0.0.1:9, fresh clones in a fleet layout, zed install --adapter none --install-mode copy --target rust --allow-ecosystem-mismatch:

installed flags-2-env/flags-2-env@0.3.0
installed oresoftware/ores-clis-core@0.1.0
installed oresoftware/ores-interfaces@0.1.0
installed oresoftware/ores-locks-and-leases@0.1.1
installed ores-otel/ores-interfaces@0.1.0
installed oresoftware/ores-contracts@0.1.0
installed oresoftware/next-loggers@0.1.0        # from a local checkout via [overrides.path]

Every package except the local override came from github.com, with no registry and no CDN. cargo test --locked --lib: 619 passed.

🤖 Generated with Claude Code

…kage

A polyglot repository can declare a target rooted at generated output that
its source tag cannot contain. `pack_all` fails on the first such target,
so repacking a tag archive refused the whole repository and every package
in it became unresolvable from github.com.

Live case: `ORESoftware/ores-interfaces` declares
`[targets.public-contracts] dir = "generated/public"`, which `.gitignore`
excludes, so `zed pack` fails there too. That has nothing to do with the
root package `oresoftware/ores-interfaces` a consumer actually asked for.

`pack::pack_target` is the existing per-target body of `pack_all`, lifted
into its own function; `pack_all` now calls it per target, so publishing is
unchanged and digests still match byte for byte. The fallback selects the
one target providing the requested package and packs only that.

Verified with the registry pointed at http://127.0.0.1:9: the full
ORESoftware/ores-compose graph installs — flags-2-env, ores-clis-core,
ores-interfaces, ores-locks-and-leases, ores-otel/ores-interfaces and
ores-contracts from github.com, next-loggers from a local checkout.

cargo test --locked --lib: 619 passed.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
@ORESoftware
ORESoftware merged commit 09faacd into main Sep 18, 2026
7 of 13 checks passed
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.

1 participant