diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index bb5c7453..6fb09ca7 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -62,6 +62,14 @@ jobs: - name: Every packable project declares a release train run: bash scripts/verify-package-trains.sh + # L'ordre des versions NuGet et l'analyse des plages sont la partie de la + # garde de release qui peut être fausse SUBTILEMENT — un `preview.5` jugé + # supérieur à `preview.5.11` la rendrait muette pile sur le cas qui l'a + # motivée. L'auto-test ne demande ni réseau ni paquet, donc il tourne ici + # sur chaque poussée, et pas seulement le jour d'une release. + - name: Version-range comparator self-test + run: bash scripts/verify-package-dependencies-exist.sh --self-test + - name: Enforce 90% line coverage gate # Per ADR-0006: with the heavy integration-bound adapters extracted to their # own repos, the framework's aggregate line coverage is well above 90 % and diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 420f22e9..e79ba42f 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -70,6 +70,27 @@ jobs: - name: Verify no version is being republished run: bash scripts/verify-package-not-published.sh artifacts/ + # La quatrième garde, et la seule qui regarde ce dont le paquet DÉPEND. + # + # Le 2026-09-29, `testing-v1.0.5-preview.6` a été tagué SEUL, sur un commit + # onze commits après `core-v1.0.5-preview.5`. MinVer a donc tamponné les + # dépendances du paquet en `1.0.5-preview.5.11` — jamais publiée, et qui + # sort AU-DESSUS de `preview.5` (une suite plus longue d'identifiants de + # préversion avec le même préfixe gagne), donc le `>=` qu'elle exprime + # n'était satisfait par rien. La release est passée VERTE et a produit un + # paquet que personne ne pouvait installer (`NU1102`), sur un registre qui + # n'autorise pas la suppression. + # + # Les trois gardes ci-dessus regardent toutes LE paquet : son train, sa + # provenance, sa version. Aucune ne regarde ce dont il dépend. + # + # La règle que ça grave : un train aval se tague AVEC son train amont, sur + # le même commit. Elle était déjà écrite — en prose, dans le `$comment` de + # `compendium-floor-gaps.json` côté Nexus — là où elle pouvait être, et a + # été, manquée. + - name: Verify every Compendium dependency can be resolved + run: bash scripts/verify-package-dependencies-exist.sh artifacts/ + - name: Push to nuget.org run: | dotnet nuget push "artifacts/*.nupkg" \ diff --git a/docs/operations/release-trains.md b/docs/operations/release-trains.md index 977aedc6..9e063f28 100644 --- a/docs/operations/release-trains.md +++ b/docs/operations/release-trains.md @@ -61,7 +61,44 @@ and nothing else changes version. Adding a package means adding a `` and seeding its first tag. Nothing else: the release job discovers trains from the `.csproj` files. -## The two gates +## A downstream train is tagged WITH its upstream train + +One train at a time is true of what gets *packed*. It is **not** true of what gets +*tagged*, and the difference cost a broken public package on 2026-09-29. + +`Compendium.Testing` depends on the `core-v` train. MinVer derives each dependency +version from the depended-on project's own tag **at the commit being tagged**. Tag +`testing-v` alone, on a commit that has moved past the last `core-v` tag, and +MinVer stamps the dependency with a height-suffixed version — `1.0.5-preview.5.11` +for eleven commits past `core-v1.0.5-preview.5`. That version was never published. +Worse, it sorts **above** `1.0.5-preview.5`: a longer run of prerelease identifiers +with the same prefix wins, so the `>=` it expresses is satisfied by nothing on the +feed. The release went green and produced a package that answered `NU1102` to +every consumer. + +So: + +```bash +# Compendium.Testing moves -> the core train moves with it, same commit. +git tag core-v1.0.5-preview.7 +git tag testing-v1.0.5-preview.7 +git push origin core-v1.0.5-preview.7 testing-v1.0.5-preview.7 +``` + +Publish the upstream train first and let it land on the feed; the downstream +package's own gate reads the feed, so the order matters for the gate, not for +MinVer. + +`Compendium.Abstractions.FeatureFlags` belongs to the same release unit in +practice: Nexus pins it alongside the core train, and a `featureflags-v` left +behind makes `CompendiumProvenanceRuleTests` fail there. The 2026-09-05 release +tagged `core-v`, `featureflags-v` and `testing-v` together, and that was not a +coincidence. + +**The third gate below now enforces this mechanically.** Do not rely on +remembering it. + +## The three gates Two packages are public today whose nuspec records a commit that is on no tag. Neither went through the test gate or the coverage gate, and neither can be @@ -80,7 +117,26 @@ between `Pack` and `Push`, so a failure means nothing is published: collision means a tag was moved. An unreachable feed is also a failure — not knowing is not permission. -Both take a directory or individual packages, read id, version and commit from +- **`scripts/verify-package-dependencies-exist.sh artifacts/`** — the only gate + that looks at what a package DEPENDS ON rather than at the package. For every + `Compendium.*` dependency in the packed nuspec it asks the feed whether any + published version satisfies the declared range. A dependency nothing can satisfy + means a downstream train was tagged without its upstream train — see the section + above. Only `Compendium.*` is judged: third-party dependencies came from versions + the build already restored, so the build itself proves they exist. An unreachable + feed is a failure here too. + + The range is treated as a **range**, not an equality: `1.0.5-preview.7` means + `>= 1.0.5-preview.7`, and a higher published version satisfies it. Checking for + the exact string would turn the gate red on legitimate releases, which on the + only irreversible step of a release is worse than no gate. + + Version ordering and range parsing live in + `scripts/nuget-version-satisfies.py`, which carries a `--self-test` that needs + neither network nor package. `ci.yml` runs it on every push, so the comparator + cannot rot between releases. + +All three take a directory or individual packages, read id, version and commit from the embedded nuspec rather than from the file name, and report every offending package before exiting. diff --git a/scripts/nuget-version-satisfies.py b/scripts/nuget-version-satisfies.py new file mode 100755 index 00000000..b335ec23 --- /dev/null +++ b/scripts/nuget-version-satisfies.py @@ -0,0 +1,263 @@ +#!/usr/bin/env python3 +"""Decide whether any published version satisfies a NuGet dependency range. + +Used by verify-package-dependencies-exist.sh. Kept as its own file rather than a +heredoc so that `--self-test` can exercise it without a network and without a +packed .nupkg. + +A nuspec dependency `version` is a RANGE, not an equality. `1.0.5-preview.7` +means `>= 1.0.5-preview.7`. Checking for the exact string would reject a +legitimate release the moment a higher version exists and the exact floor does +not — a false red on the only irreversible step of a release, which is worse +than no check at all. + +Reads the flat-container index JSON on stdin. + +Usage: + nuget-version-satisfies.py [--self-test] + +Exit status: + 0 at least one published version satisfies the range + 1 none does + 2 the range could not be parsed, or the index is unreadable + (not knowing is not permission — the caller must treat this as a failure) +""" +import io +import json +import re +import sys + +# --------------------------------------------------------------------------- # +# NuGet version ordering +# --------------------------------------------------------------------------- # + +_VERSION = re.compile( + r"^\s*(?P\d+(?:\.\d+){0,3})" + r"(?:-(?P
[0-9A-Za-z.-]+))?"
+    r"(?:\+(?P[0-9A-Za-z.-]+))?\s*$"
+)
+
+
+def parse(text):
+    """Return a sort key, or None when `text` is not a version."""
+    m = _VERSION.match(text or "")
+    if not m:
+        return None
+
+    release = [int(p) for p in m.group("release").split(".")]
+    # NuGet compares on four parts; a missing part is zero.
+    release += [0] * (4 - len(release))
+
+    pre = m.group("pre")
+    if pre is None:
+        # No prerelease sorts ABOVE any prerelease of the same release.
+        return (release, 1, [])
+
+    parts = []
+    for ident in pre.split("."):
+        if ident.isdigit():
+            # Numeric identifiers compare numerically and below alphanumeric ones.
+            parts.append((0, int(ident), ""))
+        else:
+            parts.append((1, 0, ident.lower()))
+    return (release, 0, parts)
+
+
+def less(a, b):
+    """a < b, on keys produced by parse()."""
+    if a[0] != b[0]:
+        return a[0] < b[0]
+    if a[1] != b[1]:
+        return a[1] < b[1]
+    # Prerelease identifiers: compare element by element; a shorter run of
+    # identifiers sorts below a longer one with the same prefix, which is why
+    # `preview.5` < `preview.5.11` — the exact trap that shipped a package
+    # nobody could install on 2026-09-29.
+    for x, y in zip(a[2], b[2]):
+        if x != y:
+            return x < y
+    return len(a[2]) < len(b[2])
+
+
+# --------------------------------------------------------------------------- #
+# Range parsing
+# --------------------------------------------------------------------------- #
+
+def bounds(spec):
+    """Return (low, low_inclusive, high, high_inclusive) or None if unparseable.
+
+    `low`/`high` are parse() keys, or None for "unbounded on that side".
+    """
+    spec = (spec or "").strip()
+    if not spec:
+        return None
+
+    if not (spec[0] in "[(" and spec[-1] in "])"):
+        # Bare version: a MINIMUM, inclusive. This is what `dotnet pack` writes.
+        key = parse(spec)
+        return None if key is None else (key, True, None, False)
+
+    low_inc = spec[0] == "["
+    high_inc = spec[-1] == "]"
+    inner = spec[1:-1]
+
+    if "," not in inner:
+        # `[1.2.3]` — an exact version. `(1.2.3)` is not legal NuGet.
+        if not (low_inc and high_inc):
+            return None
+        key = parse(inner)
+        return None if key is None else (key, True, key, True)
+
+    low_text, _, high_text = inner.partition(",")
+    low = parse(low_text) if low_text.strip() else None
+    high = parse(high_text) if high_text.strip() else None
+    if (low_text.strip() and low is None) or (high_text.strip() and high is None):
+        return None
+    return (low, low_inc, high, high_inc)
+
+
+def satisfies(key, rng):
+    low, low_inc, high, high_inc = rng
+    if low is not None:
+        if less(key, low):
+            return False
+        if not low_inc and not less(low, key):
+            return False
+    if high is not None:
+        if less(high, key):
+            return False
+        if not high_inc and not less(key, high):
+            return False
+    return True
+
+
+# --------------------------------------------------------------------------- #
+# Self-test — offline, no network, no .nupkg
+# --------------------------------------------------------------------------- #
+
+class _Stdin:
+    """Minimal stand-in for sys.stdin exposing the `.buffer` main() reads."""
+
+    def __init__(self, payload):
+        self.buffer = io.BytesIO(payload)
+
+
+
+def self_test():
+    ordering = [
+        # (lower, higher) — every pair must hold in this direction.
+        ("1.0.4", "1.0.5"),
+        ("1.0.5-preview.1", "1.0.5-preview.2"),
+        ("1.0.5-preview.2", "1.0.5-preview.10"),          # numeric, not lexical
+        ("1.0.5-preview.5", "1.0.5-preview.5.11"),        # THE 2026-09-29 trap
+        ("1.0.5-preview.7", "1.0.5"),                     # release beats prerelease
+        ("1.0.5-alpha", "1.0.5-beta"),
+        ("1.0.5-preview.5", "1.0.5-preview.5.0"),
+    ]
+    cases = [
+        # (range, published versions, expected exit)
+        ("1.0.5-preview.7", ["1.0.5-preview.7"], 0),
+        ("1.0.5-preview.7", ["1.0.5-preview.8"], 0),       # higher satisfies a minimum
+        ("1.0.5-preview.7", ["1.0.5"], 0),
+        ("1.0.5-preview.5.11", ["1.0.5-preview.5"], 1),    # the real failure, reproduced
+        ("1.0.5-preview.5.11", ["1.0.5-preview.5",
+                                "1.0.5-preview.4"], 1),
+        ("1.0.5-preview.5.11", ["1.0.5-preview.6"], 0),
+        ("1.0.5-preview.7", [], 1),
+        ("[1.0.5-preview.7]", ["1.0.5-preview.8"], 1),     # exact range, nothing matches
+        ("[1.0.5-preview.7]", ["1.0.5-preview.7"], 0),
+        ("[1.0.0,2.0.0)", ["2.0.0"], 1),
+        ("[1.0.0,2.0.0)", ["1.9.9"], 0),
+        ("(1.0.0,)", ["1.0.0"], 1),                        # exclusive lower bound
+        ("(1.0.0,)", ["1.0.1"], 0),
+        ("(,1.0.0]", ["0.9.0"], 0),                        # no lower bound
+        ("not-a-version", ["1.0.0"], 2),
+        ("", ["1.0.0"], 2),
+    ]
+
+    failures = []
+
+    for lower, higher in ordering:
+        a, b = parse(lower), parse(higher)
+        if a is None or b is None:
+            failures.append(f"ordering: unparseable pair {lower} / {higher}")
+        elif not less(a, b):
+            failures.append(f"ordering: expected {lower} < {higher}")
+        elif less(b, a):
+            failures.append(f"ordering: {higher} < {lower} must not hold")
+
+    # Exercised THROUGH main(), deliberately — not through bounds() and
+    # satisfies() directly. The first version of this self-test called the
+    # internals and passed 23/23 while main() was broken by an off-by-one on
+    # argv: every real invocation exited 2 and the guard refused every package,
+    # valid ones included. A self-test that skips the entry point does not test
+    # the thing that runs.
+    import io
+
+    for spec, published, expected in cases:
+        # stderr is captured too: two cases exercise the unparseable-range path
+        # on purpose, and their diagnostics are expected output, not a problem.
+        # A self-test that prints them on success buries its own verdict.
+        saved = (sys.stdin, sys.stdout, sys.stderr)
+        sys.stdin = _Stdin(json.dumps({"versions": published}).encode("utf-8"))
+        sys.stdout, sys.stderr = io.StringIO(), io.StringIO()
+        try:
+            got = main([spec])
+        finally:
+            sys.stdin, sys.stdout, sys.stderr = saved
+        if got != expected:
+            failures.append(
+                f"main([{spec!r}]) against {published}: expected exit {expected}, got {got}")
+
+    for problem in failures:
+        print(f"FAIL  {problem}", file=sys.stderr)
+
+    total = len(ordering) + len(cases)
+    if failures:
+        print(f"\n{len(failures)} of {total} self-test case(s) failed.", file=sys.stderr)
+        return 1
+    print(f"nuget-version-satisfies: all {total} self-test case(s) pass.")
+    return 0
+
+
+# --------------------------------------------------------------------------- #
+
+def main(argv):
+    if "--self-test" in argv:
+        return self_test()
+
+    if len(argv) != 1:
+        # Terse, not the whole docstring: this is called in a loop, and dumping
+        # the module doc per dependency buried the real verdict when it happened.
+        print("usage: nuget-version-satisfies.py  [--self-test]", file=sys.stderr)
+        return 2
+
+    rng = bounds(argv[0])
+    if rng is None:
+        print(f"unparseable version range: {argv[0]!r}", file=sys.stderr)
+        return 2
+
+    try:
+        # utf-8-sig: the flat container is served from blob storage and its
+        # bodies can carry a BOM (measured 2026-09-04) — same reason as
+        # verify-package-not-published.sh.
+        index = json.loads(sys.stdin.buffer.read().decode("utf-8-sig"))
+    except (UnicodeDecodeError, json.JSONDecodeError) as exc:
+        print(f"unreadable flat-container index: {exc}", file=sys.stderr)
+        return 2
+
+    published = index.get("versions", [])
+    if not isinstance(published, list):
+        print("flat-container index has no version list", file=sys.stderr)
+        return 2
+
+    for text in published:
+        key = parse(str(text))
+        if key is not None and satisfies(key, rng):
+            print(text)
+            return 0
+    return 1
+
+
+if __name__ == "__main__":
+    sys.exit(main(sys.argv[1:]))
diff --git a/scripts/verify-package-dependencies-exist.sh b/scripts/verify-package-dependencies-exist.sh
new file mode 100755
index 00000000..f694d396
--- /dev/null
+++ b/scripts/verify-package-dependencies-exist.sh
@@ -0,0 +1,244 @@
+#!/usr/bin/env bash
+# Verify that every Compendium dependency of a packed .nupkg can actually be
+# resolved from the feed BEFORE the package is pushed.
+#
+# WHY THIS EXISTS — measured, on 2026-09-29.
+#
+# `testing-v1.0.5-preview.6` was tagged ALONE, on a commit eleven commits past
+# `core-v1.0.5-preview.5`. MinVer therefore stamped the sibling dependencies of
+# Compendium.Testing as `1.0.5-preview.5.11` — a version that was never
+# published, and which sorts ABOVE `1.0.5-preview.5` (a longer run of prerelease
+# identifiers with the same prefix wins), so the `>=` it expresses cannot be met
+# by anything on the feed. The release went GREEN and produced a package nobody
+# can install:
+#
+#     error NU1102: Unable to find package Compendium.Abstractions
+#
+# nuget.org does not allow deletion. The bad version is still there.
+#
+# None of the three existing gates can see this: verify-package-trains.sh checks
+# that every packable project declares a train, verify-package-provenance.sh that
+# the bits come from a tagged commit, verify-package-not-published.sh that a
+# version is not being reused. All three look at the package. None looks at what
+# the package DEPENDS ON.
+#
+# The rule this encodes: a downstream train must be tagged together with its
+# upstream train, on the same commit. That constraint was already written — in the
+# `$comment` of Nexus's compendium-floor-gaps.json, dated 2026-09-05 — but only in
+# prose, where it could be, and was, missed.
+#
+# WHAT IT DOES NOT DO. It only judges `Compendium.*` dependencies: those are the
+# ones this repository's own tagging can get wrong. Third-party dependencies come
+# from versions the build already restored, so their existence is proven by the
+# build itself.
+#
+# Usage:
+#   scripts/verify-package-dependencies-exist.sh  [...]
+#   scripts/verify-package-dependencies-exist.sh --self-test
+#
+# Environment:
+#   NUGET_FLATCONTAINER_BASE  flat-container base URL.
+#                             Defaults to https://api.nuget.org/v3-flatcontainer
+#
+# Exit status: 0 when every Compendium dependency is resolvable, 1 when any is
+# not, 2 on a usage or environment problem.
+
+set -uo pipefail
+
+FLATCONTAINER_BASE=${NUGET_FLATCONTAINER_BASE:-https://api.nuget.org/v3-flatcontainer}
+SCRIPT_DIR=$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)
+SATISFIES=$SCRIPT_DIR/nuget-version-satisfies.py
+
+die() {
+  echo "verify-package-dependencies-exist: $*" >&2
+  exit 2
+}
+
+for tool in unzip curl python3; do
+  command -v "$tool" >/dev/null 2>&1 || die "'$tool' is required but not installed"
+done
+
+[[ -f $SATISFIES ]] || die "missing helper: $SATISFIES"
+
+# The self-test covers the part that can be wrong in a subtle way — version
+# ordering and range parsing. It needs no network and no package, so CI can run
+# it on every push rather than only when a release happens.
+if [[ ${1:-} == --self-test ]]; then
+  exec python3 "$SATISFIES" --self-test
+fi
+
+[[ $# -gt 0 ]] || die "usage: $0  [...] | --self-test"
+
+packages=()
+for target in "$@"; do
+  if [[ -d $target ]]; then
+    while IFS= read -r nupkg; do
+      packages+=("$nupkg")
+    done < <(find "$target" -maxdepth 1 -name '*.nupkg' ! -name '*.symbols.nupkg' | sort)
+  elif [[ -f $target ]]; then
+    packages+=("$target")
+  else
+    die "no such file or directory: $target"
+  fi
+done
+
+[[ ${#packages[@]} -gt 0 ]] || die "no .nupkg found in: $*"
+
+# Read the nuspec, not the file name: the file name is a convention, the nuspec
+# is what the feed indexes and what a consumer resolves against.
+read_nuspec() {
+  local nupkg=$1 entry
+  entry=$(unzip -Z1 "$nupkg" '*.nuspec' 2>/dev/null | head -1)
+  [[ -n $entry ]] || return 1
+  unzip -p "$nupkg" "$entry" 2>/dev/null
+}
+
+# Emits `idrange` for every Compendium dependency, deduplicated. A target
+# framework that repeats a dependency is normal; checking it twice is not.
+compendium_dependencies() {
+  python3 -c '
+import sys, xml.etree.ElementTree as ET
+try:
+    root = ET.fromstring(sys.stdin.buffer.read())
+except ET.ParseError as exc:
+    sys.stderr.write("unreadable nuspec: %s\n" % exc)
+    sys.exit(1)
+seen = set()
+for element in root.iter():
+    if element.tag.rsplit("}", 1)[-1] != "dependency":
+        continue
+    identifier = (element.get("id") or "").strip()
+    version = (element.get("version") or "").strip()
+    if not identifier.startswith("Compendium."):
+        continue
+    if (identifier, version) in seen:
+        continue
+    seen.add((identifier, version))
+    print("%s\t%s" % (identifier, version))
+'
+}
+
+package_identity() {
+  python3 -c '
+import sys, xml.etree.ElementTree as ET
+root = ET.fromstring(sys.stdin.buffer.read())
+found = {}
+for element in root.iter():
+    name = element.tag.rsplit("}", 1)[-1]
+    if name in ("id", "version") and name not in found and (element.text or "").strip():
+        found[name] = element.text.strip()
+print("%s %s" % (found.get("id", "?"), found.get("version", "?")))
+'
+}
+
+fail_count=0
+pass_count=0
+checked=0
+
+echo "Checking Compendium dependencies of ${#packages[@]} package(s) against $FLATCONTAINER_BASE"
+echo
+
+for nupkg in "${packages[@]}"; do
+  if ! nuspec=$(read_nuspec "$nupkg"); then
+    echo "FAIL  $(basename "$nupkg")"
+    echo "      no readable .nuspec inside the package"
+    fail_count=$((fail_count + 1))
+    continue
+  fi
+
+  identity=$(printf '%s' "$nuspec" | package_identity 2>/dev/null) || identity="$(basename "$nupkg")"
+
+  if ! deps=$(printf '%s' "$nuspec" | compendium_dependencies); then
+    echo "FAIL  $identity"
+    echo "      could not read the dependency list"
+    fail_count=$((fail_count + 1))
+    continue
+  fi
+
+  if [[ -z $deps ]]; then
+    echo "ok    $identity — no Compendium dependency to check"
+    pass_count=$((pass_count + 1))
+    continue
+  fi
+
+  package_ok=1
+  while IFS=$'\t' read -r dep_id dep_range; do
+    [[ -n $dep_id ]] || continue
+    checked=$((checked + 1))
+    # `${var,,}` would need bash 4; macOS still ships 3.2 and this script has to
+    # be runnable where it is written, not only on the runner.
+    id_lower=$(printf '%s' "$dep_id" | tr '[:upper:]' '[:lower:]')
+
+    response=$(curl -sS --max-time 30 --retry 3 --retry-delay 2 \
+      -w '\n%{http_code}' "$FLATCONTAINER_BASE/$id_lower/index.json" 2>/dev/null)
+    status=$(tail -n1 <<<"$response")
+    body=$(sed '$d' <<<"$response")
+
+    case $status in
+      200) ;;
+      404)
+        echo "FAIL  $identity"
+        echo "      depends on $dep_id $dep_range — that package id does not exist on this feed."
+        echo "      A train was never seeded, or the id is misspelled."
+        package_ok=0
+        continue
+        ;;
+      *)
+        # Not knowing is not permission.
+        echo "FAIL  $identity"
+        echo "      depends on $dep_id $dep_range — feed answered HTTP $status,"
+        echo "      cannot prove the dependency is resolvable. Refusing to push."
+        package_ok=0
+        continue
+        ;;
+    esac
+
+    resolved=$(printf '%s' "$body" | python3 "$SATISFIES" "$dep_range")
+    case $? in
+      0)
+        echo "ok    $identity -> $dep_id $dep_range (resolves to $resolved)"
+        ;;
+      1)
+        echo "FAIL  $identity"
+        echo "      depends on $dep_id $dep_range — NO published version satisfies it."
+        echo "      This is the 2026-09-29 failure: a downstream train tagged without its"
+        echo "      upstream train makes MinVer stamp a height-suffixed dependency version"
+        echo "      that was never published. Tag the upstream train on THIS SAME COMMIT,"
+        echo "      then tag this one again with a fresh version."
+        package_ok=0
+        ;;
+      *)
+        echo "FAIL  $identity"
+        echo "      depends on $dep_id $dep_range — the range or the feed index could not"
+        echo "      be read. Cannot prove the dependency is resolvable. Refusing to push."
+        package_ok=0
+        ;;
+    esac
+  done <<<"$deps"
+
+  if [[ $package_ok -eq 1 ]]; then
+    pass_count=$((pass_count + 1))
+  else
+    fail_count=$((fail_count + 1))
+  fi
+done
+
+echo
+if [[ $fail_count -gt 0 ]]; then
+  echo "$fail_count package(s) carry a Compendium dependency this feed cannot satisfy," \
+       "$pass_count are clear. Nothing is published." >&2
+  exit 1
+fi
+
+# A gate that evaluated nothing must not report success. Without this, an error
+# inside the loop — a shell builtin that is not portable, say — silently yields
+# `fail_count=0` and a green run, which is the very shape of failure this file
+# exists to prevent. Every package must be accounted for, one way or the other.
+accounted=$((pass_count + fail_count))
+if [[ $accounted -ne ${#packages[@]} ]]; then
+  echo "verify-package-dependencies-exist: ${#packages[@]} package(s) were given but only" \
+       "$accounted were judged. The check did not complete; refusing to report success." >&2
+  exit 2
+fi
+
+echo "All $pass_count package(s) clear: $checked Compendium dependency reference(s) resolvable."