Repository navigation
ci: llvm-collision guard (no closure holds two unprefixed LLVMs) - #1062
Conversation
`llvm` and `llvm-bootstrap` both install LLVM into /usr (usr/bin/clang,
usr/lib/clang/<N>/**, usr/lib/cmake/{llvm,clang}, usr/include/llvm*). A
path present in two closure members resolves silently (lowest spec hash
wins), so two unprefixed LLVMs in one closure blend headers, cmake exports
and the clang resource dir from different releases.
Same shape as ruby-flavor-guard: dump the catalog on both arches and fail
when a package's or collection's runtime closure, or build closure, holds
more than one unprefixed provider. Providers are `llvm`, `llvm-bootstrap`
and any package whose output globs name LLVM's /usr paths. A package named
`llvm-<N>` must keep every output under usr/lib/llvm-<N>/.
Policy: prefixed + unprefixed in one closure is ALLOWED (disjoint paths;
llvm-22 is built by llvm-bootstrap); two prefixed lines are ALLOWED.
Exit 2 (UNVERIFIED) on an empty/unparseable dump or one with no unprefixed
provider, so a blind guard cannot go green.
Passes on main and on the llvm-22/llvm-23 branch (amd64 + arm64). Negative
controls: a real dump with a stack pulling llvm + llvm-bootstrap and
llvm-23 outputs moved to usr/bin fails with both violations; disabling the
closure or prefix check turns the unit tests red.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
Warning Review limit reached
This review includes 3 billable files and costs up to $0.75.
Reviews can continue after your included limit without a manual trigger. An admin must approve usage-based billing. Or wait 53 minutes for your next included review. View limit details
|
mitodrummer
left a comment
There was a problem hiding this comment.
The runtime-closure rule and the prefix rule look right, and the workflow is tight (pull_request, contents: read, SHA-pinned checkout). One false-pass in the build-closure rule:
.github/scripts/llvm_collision_guard.py:137-141: the build closure leaves out the package's own runtime_deps. check() builds build only from build_deps and their runtime closures. A package's runtime_deps are injected into its build sandbox too (AGENTS.md, "Dependencies"), so a package with build_deps = [llvm-bootstrap] and runtime_deps = [llvm] gets both unprefixed LLVMs at build time. Its runtime closure holds 1 provider (llvm) and its computed build closure holds 1 (llvm-bootstrap), so the guard passes it.
Fix: also union the runtime closures of the package's own runtime_deps into build (not runtime_closure(name) itself, which would put the package in its own build closure and fail llvm). Add a test for exactly this shape, and update the docstring and PR body's "build deps plus their runtime closures" definition. ruby_flavor_guard.py on main has the same gap (check(), lines 103-107), so it's worth a follow-up there.
…ntime_deps (review) A build sandbox mounts a package's runtime_deps as well as its build_deps (AGENTS.md "Dependencies"), so build_deps = [llvm-bootstrap] plus runtime_deps = [llvm] put both unprefixed LLVMs in the build while each computed closure held one, and the guard passed it. Union the runtime closures of both dep lists (not runtime_closure(name), which would count the package in its own build and fail `llvm`). Tests: that exact shape now fails (it passes against the old check(), the negative control), and `llvm` itself still passes. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
@mitodrummer good catch, it's a real false-pass. In minimal's
I also merged main (dc91ac5); the branch was 199 behind. |
mitodrummer
left a comment
There was a problem hiding this comment.
The fix is right. check() now unions the runtime closures of the package's own runtime_deps into build (.github/scripts/llvm_collision_guard.py:137-145), not runtime_closure(name). The new test_own_runtime_dep_counts_in_build_closure covers exactly the build_deps = [llvm-bootstrap], runtime_deps = [llvm] shape, and test_package_is_not_in_its_own_build_closure keeps llvm passing. The docstring and body match. The guard job passed on 583810d, which runs the unit tests and the real amd64/arm64 dump.
The one open item is CI: the build-bot hasn't posted a minimal build check on 583810d yet. I'll approve once it's green.
mitodrummer
left a comment
There was a problem hiding this comment.
My point was already fixed at 583810d, and minimal build is now green on that head with every other check passing. Approving.
What
A new blocking CI guard,
llvm-collision-guard. No package or collection closure may hold two unprefixed LLVM providers.llvmandllvm-bootstrapboth install LLVM into/usr:usr/bin/clang,usr/lib/clang/<N>/**,usr/lib/cmake/{llvm,clang},usr/include/llvm*. Closure members are hardlinked into one tree, and a path present in two of them resolves silently (lowest spec hash wins). Two unprefixed LLVMs in one closure therefore mix headers, cmake exports and the clang resource dir from different releases.It has the same shape as
ruby-flavor-guard: dump the catalog on amd64 and arm64, then check each package's runtime closure and build closure.Rules
llvmandllvm-bootstrap;/usrpaths. This catches a copy under a new name, for example a prebuilt clang.llvm-<N>must keep every output underusr/lib/llvm-<N>/. If it doesn't, it also counts as a provider under rule 1.Policy:
llvm-22is itself built byllvm-bootstrap.The guard exits 2 (UNVERIFIED) on a dump that is empty or unparseable, or that contains no unprefixed provider. A guard that can't see the catalog doesn't go green.
Verified
python3 -I .github/scripts/test_llvm_collision_guard.py).llvmandllvm-bootstrap.llvmandllvm-bootstrap, plusllvm-23's bins glob moved tousr/bin/*, gives exit 1 with both violations.Independent of #1061 and can merge in either order.
🤖 Generated with Claude Code