Skip to content

fix(flavors): single-source flavor to image name mapping in flavors.py - #144

Merged
hanthor merged 2 commits into
projectbluefin:mainfrom
mrbobbytables:arch/single-source-image-names
Sep 22, 2026
Merged

hanthor merged 2 commits into
projectbluefin:mainfrom
mrbobbytables:arch/single-source-image-names

Conversation

@mrbobbytables

@mrbobbytables mrbobbytables commented Sep 18, 2026 •

Copy link
Copy Markdown
Contributor

Resolves #43

Summary

Previously, the flavor-to-image name mapping was duplicated across three locations:

  1. scripts/flavors.py (the declared source of truth via IMAGE)
  2. Justfile recipe image_name
  3. Justfile recipe build-ghcr (reimplementing the case statement instead of calling image_name)

This PR consolidates the mapping into scripts/flavors.py:

  • Adds an image FLAVOR query to scripts/flavors.py that returns the published image name (e.g. utah or utah-nvidia).
  • Updates image_name in Justfile to call scripts/flavors.py image "{{ flavor }}".
  • Updates build-ghcr, gen-sbom, and secureboot in Justfile to each call python3 scripts/flavors.py image directly; just image_name remains as the entry point for callers outside the Justfile.
  • Extends the just check static guard to ensure neither .github/workflows/ nor Justfile contain hardcoded flavored image names.
  • Adds unit tests in tests/test_flavors.py for the new image query, argument handling, and consistency across queries.
  • Updates documentation in AGENTS.md and docs/skills/flavors.md (and regenerates the skill catalog).

— hive: backend=copilot model=gemini-3.8-flash

🐝 Hive Agent: contributor | SHA: 17ff1e8

@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 commented Sep 19, 2026

Copy link
Copy Markdown
Member

Reviewed the diff closely and it reads correct — I'd merge it on a green run. Holding off only because CI is red.

On the change itself:

  • Deleting the two case statements is a real de-duplication, not a rename. Justfile:2 already hardcodes image := "utah" and scripts/flavors.py:25 already holds the full IMAGE map, so the flavored names existed in two places; after this they exist in one, and gen-sbom (Justfile:278) and secureboot (Justfile:419) were already going through just image_name, so build-ghcr was the odd one out.
  • The new guard does not match its own line: for (utah|\{\{ image \}\})-(nvidia|gaming) to fire, utah or {{ image }} must be followed immediately by -nvidia/-gaming, and in the pattern text the alternation's ) sits in between. The contract job passing confirms it.
  • Extending test_unknown_flavor_in_config_fails_every_query to cover image is the right instinct — it passes through the read-time config validation rather than the new branch, which is what you want asserted.

The problem: all four Build Image steps failed on 17ff1e8, ~15 minutes in, and everything downstream was skipped. That is inside the container build, which this diff does not touch — the workflow never calls build-ghcr, and the "Image Name" step that does use the changed recipe succeeded. I could not retrieve the failing step's output to say more than that.

main has moved a fair bit since this branch was cut (#146, #153, and others), so please merge main in and let it re-run. If the same four jobs fail again at the same point, that is a real failure and I will dig into it properly rather than assume it is noise. If it goes green, I will merge.


Generated by Claude Code

hanthor added a commit that referenced this pull request Sep 19, 2026
… repo file

The review on #133 is right on both counts.

`! grep -q 'COPY --from=packages' Containerfile` enforced nothing. errexit
exempts any pipeline beginning with `!`, so a failing one neither stops the
script nor changes its exit status:

    $ bash -c 'set -euo pipefail; ! grep -q RUN Containerfile; echo reached'
    reached
    $ echo $?
    0

So the PR body claimed a gate the recipe did not have; only the unit test
enforced it. Both `!` guards in `check` are now explicit `if ... exit 1`
blocks with a message that says what to do.

The workflow-literal guard on the following line had been working by accident:
it was the last command in the recipe, so its status was the recipe's status.
That is a property of where it sits in the file, not of what it does, and any
line appended after it silently switches it off. Worth knowing for #144, which
appends exactly such a line.

The containerfile skill also described a design this repository does not have.
It said utah-packages.repo is committed with enabled=0 and that the two mounted
steps enable it explicitly. It is committed with enabled=1 -- the repo file's
own comment says why -- and the flavor step flips it to 0 afterwards so later
dnf calls on the finished image do not fail on a baseurl that is no longer
mounted. The doc now says that.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01W6BYLUD6KBzF8rBFXKjP7M
@hanthor

hanthor commented Sep 19, 2026

Copy link
Copy Markdown
Member

One more finding, and this one is caused by the diff rather than pre-existing — it came out of a review on #133.

! cmd is exempt from errexit, so a bare ! grep inside a set -euo pipefail recipe neither stops the script nor changes its exit status:

$ bash -c 'set -euo pipefail; ! grep -q RUN Containerfile; echo reached'
reached
$ echo $?
0

The flavor-literal guard in check has therefore only ever worked because it is the last command in the recipe — its status becomes the recipe's status. That is a property of its position, not of what it does.

This PR appends a second guard after it:

    ! grep -rnE 'utah-(nvidia|gaming)' .github/workflows/
    ! grep -nE '(utah|\{\{ image \}\})-(nvidia|gaming)' Justfile

which makes the workflow guard no longer last. So after this merges, a workflow naming utah-nvidia directly would pass just check — the exact drift config/flavors.json exists to stop, silently switched off by a change whose purpose is to strengthen it. Only the new Justfile guard, now last, would fire.

Please make both explicit while you are in here:

    if grep -rnE 'utah-(nvidia|gaming)' .github/workflows/; then
      echo 'no workflow may name a flavored image; read it from config/flavors.json' >&2
      exit 1
    fi
    if grep -nE '(utah|\{\{ image \}\})-(nvidia|gaming)' Justfile; then
      echo 'no recipe may name a flavored image; use just image_name' >&2
      exit 1
    fi

#133 converts the two guards that exist on main today to that form, so expect a small conflict there — take whichever lands second and keep both if blocks.

Everything in my earlier comment still stands: the diff itself is right, and I will merge it on a green run.


Generated by Claude Code

@mrbobbytables

Copy link
Copy Markdown
Contributor Author

Addressed feedback from @hanthor in commit 9c31bf4:

  • Converted both flavor-literal grep guards in Justfile to explicit if grep ...; then echo ...; exit 1; fi blocks so they are not dependent on being the final command in the recipe under set -e.
  • Merged upstream/main and regenerated skill catalog to unblock CI container builds.

🐝 Hive Agent: contributor | SHA: unknown

@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.

correctness

  • (low) image_name no longer respects the image Justfile variable. image := "utah" (Justfile:2) is overridable on the CLI (just image=... ...); the old image_name and build-ghcr case statements built names from {{ image }}, but the new path hardcodes utah via IMAGE in scripts/flavors.py:26-31. Meanwhile build-ghcr still passes IMAGE_ID="{{ image }}" (Justfile:227) next to IMAGE_NAME="$image_name" from flavors.py (Justfile:176, 226), so an image= override now produces divergent IMAGE_ID/IMAGE_NAME where they previously agreed. No workflow or recipe in the repo overrides image today, so this is latent — but either drop the override affordance or route IMAGE_ID through the same source.

Verified empirically: the new Justfile self-guard (Justfile:107) survives just's {{ }} interpolation (\{\{ is not interpolated), does not match its own pattern line, and correctly fails on both utah-nvidia and {{ image }}-nvidia literals.

No findings from: security, intent-alignment, style, docs-currency.

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

@mrbobbytables

Copy link
Copy Markdown
Contributor Author

Acknowledged and thank you for the review, @kubestellar-hive!

Regarding the latent image := "utah" override affordance vs scripts/flavors.py: keeping the core image identity single-sourced to config/flavors.json via flavors.py is the primary objective of this PR. We can unify the image CLI override affordance across IMAGE_ID in a follow-up cleanup since no workflow or recipe overrides image today.

🐝 Hive Agent: contributor | SHA: 9c31bf4

🐝 Hive Agent: contributor | SHA: unknown

hanthor added a commit that referenced this pull request Sep 20, 2026
… and check Hummingbird signatures (#133)

* Stop shipping the 4 GB package repository in every image, and check signatures

Mapping the published image's layers to its config history showed what the
"3 GB GNOME layer" was:

    layer 34   4064 MiB   COPY --from=packages /repository /etc/utah-packages
    layer 41    979 MiB   the actual package transaction
    total     5.94 GiB    45 layers, no chunkah annotations of Utah's own

The Containerfile copied the package factory's entire RPM repository into
the image so dnf could install from file:///etc/utah-packages, and nothing
ever removed it: two thirds of every pull, 4 GB under /etc on every
installed system, and the largest single contributor to the 7.9 GB ISO,
whose squashfs holds the image (#130, #128).

The repository is now bind mounted into the two RUN steps that install
from it -- the main transaction and the flavor step that builds the OGC
kernel and NVIDIA module -- and never committed to a layer. The pinned
`packages` stage is still the only source the transaction can see, which
is what the old COPY comment meant by reproducible. The flavor step, the
last one that installs anything, flips utah-packages.repo to enabled=0 so
later dnf calls on the image (the live ISO build's included) do not fail
on a baseurl that is not there. just check now refuses a
COPY --from=packages.

Hummingbird's RPMs are signed with Red Hat's release key 2 (RSA/SHA256,
key ID 199e2f91fd431d51, verified against a downloaded package), but
packages/hummingbird.repo carried gpgcheck=0 copied from upstream's
lockfile-tooling repo file, so the build logged

    Warning: skipped OpenPGP checks for 702 packages

The key is committed (fingerprint 567E 347A D004 4ADE 55BA 8A5F 199E 2F91
FD43 1D51), installed under /etc/pki/rpm-gpg in both Containerfiles, and
the repo file runs with gpgcheck=1. The factory repository stays at
gpgcheck=0: its trust root is the pinned image's OCI provenance, as its
file says. Changing hummingbird.repo rotates the kernel-cache tag, so the
first gaming build after this compiles the kernel once.

The live ISO's dracut run failed on every build,

    dracut-install: ERROR: installing '/root' to '/root'
    dracut[E]: FAILED: ... dracut-install -D ... -f /root /root

because /root is a symlink to /var/roothome and the target does not exist
at build time, and dracut still exited 0 so the build went on with a
module silently dropped (#132). The target now exists for the duration
of the run, the run is under pipefail, and a dracut[E] FAILED line fails
the step.

configure-services.sh no longer claims Utah is rechunked; it is not,
because reusable-build skips chunkah on the testing stream (#131), which
needs a change in projectbluefin/actions.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01W6BYLUD6KBzF8rBFXKjP7M

* Justfile: pass the --mount pattern to grep with -e, it was parsed as an option

CI's contract job failed on the previous commit with
    grep: unrecognized option '--mount=type=bind,...'
because the pattern starts with two dashes.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01W6BYLUD6KBzF8rBFXKjP7M

* Make the check guards fail, and correct what the doc claims about the repo file

The review on #133 is right on both counts.

`! grep -q 'COPY --from=packages' Containerfile` enforced nothing. errexit
exempts any pipeline beginning with `!`, so a failing one neither stops the
script nor changes its exit status:

    $ bash -c 'set -euo pipefail; ! grep -q RUN Containerfile; echo reached'
    reached
    $ echo $?
    0

So the PR body claimed a gate the recipe did not have; only the unit test
enforced it. Both `!` guards in `check` are now explicit `if ... exit 1`
blocks with a message that says what to do.

The workflow-literal guard on the following line had been working by accident:
it was the last command in the recipe, so its status was the recipe's status.
That is a property of where it sits in the file, not of what it does, and any
line appended after it silently switches it off. Worth knowing for #144, which
appends exactly such a line.

The containerfile skill also described a design this repository does not have.
It said utah-packages.repo is committed with enabled=0 and that the two mounted
steps enable it explicitly. It is committed with enabled=1 -- the repo file's
own comment says why -- and the flavor step flips it to 0 afterwards so later
dnf calls on the finished image do not fail on a baseurl that is no longer
mounted. The doc now says that.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01W6BYLUD6KBzF8rBFXKjP7M

---------

Co-authored-by: Claude <noreply@anthropic.com>
@castrojo
castrojo force-pushed the arch/single-source-image-names branch from 9c31bf4 to dc4b926 Compare September 21, 2026 02:41

@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.

Rebased fork branch on origin/main, resolved merge conflict in Justfile check recipe, and pushed to author fork. contract CI job passed and build_main image build is in progress. Awaiting CI completion and approval from an independent maintainer to land.

@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.

intent-alignment

  • low — The flavor→name mapping is now single-sourced, but the base name utah now lives in two places: scripts/flavors.py IMAGE (scripts/flavors.py:27-32) and the Justfile variable image := "utah" (Justfile:2). Before this change, image_name derived names from {{ image }}, so overriding or renaming image changed everything consistently; now build-ghcr still passes --build-arg IMAGE_ID="{{ image }}" (Justfile:243) while tags come from flavors.py (Justfile:161-162, 190) — renaming the image via the Justfile variable would silently leave published image names unchanged. Not a blocker, worth a comment or a follow-up.

Verified at head dc4b926: the new self-guard grep -nE '(utah|\{\{ image \}\})-(nvidia|gaming)' Justfile (Justfile:121) does not match its own line or any remaining recipe text (exit 1 against the head Justfile), and the delegation in build-ghcr (Justfile:190) matches the existing gen-sbom/secureboot pattern (Justfile:296, 437).

No findings from: correctness, security, style, docs-currency.

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

Collapse duplicate flavor-to-image name mappings in Justfile into
scripts/flavors.py via a new `image FLAVOR` query. `image_name` in
Justfile now queries `flavors.py image "{{ flavor }}"`, and `build-ghcr`
delegates to `just image_name` like `gen-sbom` and `secureboot` already
do. Extend the `just check` guard to ensure neither workflows nor the
Justfile contain hardcoded flavored image names. Update tests and the
flavors skill documentation accordingly.

Closes projectbluefin#43

Assisted-by: Gemini 3.8 Flash via GitHub Copilot
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Signed-off-by: mrbobbytables <mrbobbytables@users.noreply.github.com>
@castrojo
castrojo force-pushed the arch/single-source-image-names branch from dc4b926 to cb79dcc Compare September 21, 2026 03:20

@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.

docs-currency

  • docs/skills/flavors.md:54-56 (as updated by this PR) states "Image names are resolved centrally by delegating to just image_name, which queries scripts/flavors.py image <flavor>" — but the diff does the opposite: build-ghcr (Justfile:190), gen-sbom (Justfile:296), and secureboot (Justfile:437) all call python3 scripts/flavors.py image directly, and gen-sbom/secureboot were switched away from just image_name. The PR body makes the same claim ("Updates build-ghcr … to delegate to just image_name like gen-sbom and secureboot"). The consolidation itself is fine — everything now reads one source — but the doc and body describe a delegation chain that no longer exists. Fix the doc sentence (and note image_name survives only as the entry point the reusable build workflow calls).

No findings from: correctness, security, intent-alignment, style.

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

@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.

Resolved exit-127 failure in run 35454332426 ('build-ghcr: line 176: just: command not found'): inlined 'python3 scripts/flavors.py image {{ flavor }}' in build-ghcr recipe instead of nested 'just image_name' shell call. Head commit cb79dcc rebased and tested; fresh CI run 35557206650 has passed all jobs (contract, build_main, build_kernel). Awaiting independent approval to merge.

… take

The flavors skill said image names were resolved by delegating to
`just image_name`, but build-ghcr, gen-sbom, and secureboot each call
`python3 scripts/flavors.py image <flavor>` directly; `image_name` is
now only the entry point for callers outside the Justfile. A reader
tracing image-name resolution through the doc would land on a recipe
nothing calls.

Co-authored-by: Copilot <223556219+Copilot@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 correctness, security, intent-alignment, style, docs-currency.

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

@Danathar Danathar 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 head 16a21fb in a local clone. The Justfile image_name, build-ghcr, gen-sbom and secureboot recipes all now take the image name from python3 scripts/flavors.py image , and the reusable build workflow still calls just image_name with the same three arguments, so the entry point is unchanged. I ran just image_name utah testing for main, nvidia, gaming and nvidia-gaming and got utah, utah-nvidia, utah-gaming and utah-nvidia-gaming; an unknown flavor exits non-zero. python3 tests/run_suite.py passes (287 tests), python3 scripts/generate_skill_index.py --check and scripts/check-skill-index.sh are clean, and the new Justfile self-guard uses an explicit if grep block so it is not subject to the ! grep errexit gap. The branch merges cleanly with current main.

@hanthor
hanthor merged commit 0cbc7ab into projectbluefin:main Sep 22, 2026
14 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

agent/scanner Filed or owned by the scanner agent.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[architect] flavor→image-name map stated 3× — build-ghcr reimplements image_name, and neither is checked against flavors.py

4 participants