Skip to content

fix: enforce recipe-set agreement across the three package sources - #164

Merged
castrojo merged 1 commit into
projectbluefin:mainfrom
kylerankin:fix/recipe-set-agreement-invariant
Sep 19, 2026
Merged

castrojo merged 1 commit into
projectbluefin:mainfrom
kylerankin:fix/recipe-set-agreement-invariant

Conversation

@kylerankin

@kylerankin kylerankin commented Sep 19, 2026 •

Copy link
Copy Markdown
Contributor

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 the
hardcoded package-count assertions in tests/. Leaving one behind is what made
main red after the firefox removal (#130): the remaining three sources end up
at 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 directory
names, the source-lock names, and the .packit.yaml package names 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.

Validation

python3 tools/validate.py validates 340 source RPMs and
python3 tools/factory_contract.py reports the factory contract satisfied.
The new unit test passes. The only discover-level error in this sandbox is a
pre-existing ModuleNotFoundError: yaml in test_atomic_publish (a missing
PyYAML in this environment, no pip to install it) — unrelated to this change.

— hive: backend=pi model=lemonade/Ornith-1.5-35B-A3B-GGUF-Q6_K

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>

@hivecommons-hive hivecommons-hive Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewed — no findings from this perspective.

— hive: agent=reviewer backend=copilot model=claude-fable-5 copilot=1.0.78

@hanthor hanthor left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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

@hanthor

hanthor commented Sep 19, 2026

Copy link
Copy Markdown
Member

Approved and clean, and I am deliberately holding the merge for a short while rather than leaving it to sit silently.

rebuild-rpms.yml triggers on push: branches: [main], so merging this starts a 276-job rebuild. Runners are saturated right now — the PR rebuild on #133 took about thirty minutes to start and is at 98 of 276 jobs after forty — and that run is the verification for the ICU staging fixes that are currently the thing standing between the factory and a published repository. Adding another full rebuild to the queue would push it out for no benefit, since this PR is a test gate with nothing time-sensitive about it.

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 github.ref for pull requests and includes github.run_id for everything else, with cancel-in-progress true only for pull requests. So a main push gets its own group and cancels nothing. The cost here is contention, not cancellation.)


Generated by Claude Code

@castrojo castrojo left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

@castrojo
castrojo merged commit c1cfc86 into projectbluefin:main Sep 19, 2026
283 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.

3 participants