Repository navigation
fix: enforce recipe-set agreement across the three package sources - #164
Conversation
Dropping a recipe touches four places (docs/contributing.md *Removing a package*): config/upstream-sources.json, .packit.yaml, packages/<name>/, and the hardcoded counts in tests/. Leaving one behind is what made main red after the firefox removal (projectbluefin#130): the other three sources end up at different set sizes and the mismatch surfaces later as an unrelated failing integer assertion instead of "you forgot config/upstream-sources.json". Add tests/test_recipe_set_agreement.py, which compares packages/, config/upstream-sources.json and .packit.yaml against each other and reports the difference by name, so the next incomplete removal fails legibly. Point docs/contributing.md at it as the enforcement. Assisted-by: Ornith-1.5-35B-A3B-GGUF-Q6_K via GitHub Copilot Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Signed-off-by: kylerankin <kylerankin@users.noreply.github.com>
hanthor
left a comment
There was a problem hiding this comment.
Approving. This is the right shape for the problem and I verified it does the one thing it exists to do.
It fails legibly. The whole argument for this test is that an incomplete removal should say what you forgot rather than surfacing later as an unrelated integer assertion. Dropping bluez from config/upstream-sources.json and leaving the recipe in place:
AssertionError: ... packages/ and upstream-sources.json disagree
(in packages only: ['bluez']; in locks only: [])
That is exactly the message the PR promises, and it names the package and the two sources that disagree. Comparing all three pairs rather than just against one canonical source is also right — it means the diagnostic points at the specific pair that drifted instead of blaming whichever source you happened to pick as the truth.
This is timely for me personally: I have four stage edits in flight on config/upstream-sources.json in #133, and a set-level agreement gate is precisely what would catch a fat-fingered entry edit that dropped a name while I was changing stage numbers.
One suggestion, not blocking. recipe_names() takes every directory under packages/:
return {d.name for d in PACKAGES.iterdir() if d.is_dir()}so any stray directory becomes a phantom package. Reproduced:
$ mkdir packages/__pycache__ && python3 -m unittest tests.test_recipe_set_agreement
in packages only: ['__pycache__']
__pycache__ is the likely one — tools/ already accumulates it — but an editor backup directory or a half-finished git checkout would do it too. Since a recipe is defined by having a spec, filtering on that removes the whole class:
return {d.name for d in PACKAGES.iterdir() if d.is_dir() and any(d.glob("*.spec"))}That also makes the test say something slightly stronger: not merely "a directory exists" but "a recipe exists". A directory under packages/ with no spec is itself a bug this would then catch, rather than a false alarm it would raise.
Worth doing in this PR since it is one line, but I would not hold the merge for it — the current form is correct for the tree as it stands (349 recipes, 349 lock entries, agreeing), and the failure mode is a noisy false positive rather than a missed defect.
Generated by Claude Code
|
Approved and clean, and I am deliberately holding the merge for a short while rather than leaving it to sit silently.
Nothing about the change is in question. I will merge as soon as that run reports, or sooner if someone wants it in. (For the record I checked this could not simply cancel the in-flight run rather than queue behind it: the concurrency group keys on Generated by Claude Code |
castrojo
left a comment
There was a problem hiding this comment.
Reviewed and verified. The test accurately asserts that packages/, config/upstream-sources.json, and .packit.yaml describe the exact same package set, failing with clear diagnostic messages if any diverge. Passes all local validation (factory contract, validate.py, unittest suite) and all CI checks are green.
Problem
Dropping a recipe out of the rebuild set touches four places
(docs/contributing.md Removing a package):
config/upstream-sources.json,.packit.yaml,packages/<name>/, and thehardcoded package-count assertions in
tests/. Leaving one behind is what mademainred after the firefox removal (#130): the remaining three sources end upat different set sizes, and the mismatch surfaces later as an unrelated failing
integer assertion instead of as "you forgot
config/upstream-sources.json".Fix
Add
tests/test_recipe_set_agreement.py, which compares the recipe directorynames, the source-lock names, and the
.packit.yamlpackage names against eachother and reports the difference by name, so the next incomplete removal fails
legibly. Point
docs/contributing.mdat it as the enforcement.Validation
python3 tools/validate.pyvalidates 340 source RPMs andpython3 tools/factory_contract.pyreports the factory contract satisfied.The new unit test passes. The only discover-level error in this sandbox is a
pre-existing
ModuleNotFoundError: yamlintest_atomic_publish(a missingPyYAML in this environment, no
pipto install it) — unrelated to this change.— hive: backend=pi model=lemonade/Ornith-1.5-35B-A3B-GGUF-Q6_K