Skip to content

refactor: single source of truth for image-name → upstream repo routing - #1045

Merged
castrojo merged 1 commit into
mainfrom
arch/refactor-image-repo-routing
Sep 7, 2026
Merged

castrojo merged 1 commit into
mainfrom
arch/refactor-image-repo-routing

Conversation

@kubestellar-hive

Copy link
Copy Markdown
Contributor

Refactor

Cluster: image-name/tag → upstream GitHub repository routing.
Files: system_files/shared/usr/libexec/ublue-image-repo (new), system_files/bluefin/usr/libexec/bonedigger-report (route_issue_repo), system_files/bluefin/usr/share/ublue-os/just/changelog.just (changelogs), tests/test_image_repo.bats (new), tests/test_bonedigger_report.bats, tests/test_changelog.bats.

common decided "which upstream repo owns this image" in two places with two different grammars:

site dakota match unknown image
bonedigger-report:route_issue_repo dakota* glob projectbluefin/common
changelog.just:changelogs == "dakota" exact projectbluefin/bluefin

They had already drifted. dakota-nvidia is a published image (docs/skills/image-registry.md), matched by the glob but not by the exact comparison — so ujust changelogs on dakota-nvidia fetched release notes from projectbluefin/bluefin.

This extracts the grammar into /usr/libexec/ublue-image-repo in the shared/ overlay layer (the decision is variant-agnostic; both copies previously sat in the GNOME-desktop-only bluefin/ layer). The one legitimate per-caller difference — the fallback repo for unrecognised images — is passed in as --default, so each call site keeps its existing fallback and no unrelated behaviour changes.

Both consumers become one-line delegations. tests/test_image_repo.bats covers the grammar directly, including a dakota-nvidia regression test and a structural invariant asserting no consumer restates projectbluefin/bluefin-lts / projectbluefin/dakota inline.

Verification: bats tests/test_image_repo.bats tests/test_bonedigger_report.bats tests/test_changelog.bats — 46/46 pass.

Overlap check: #1010 also touches bonedigger-report, but only read_boot_status (how IMAGE_NAME/IMAGE_REF are sourced); this PR touches only route_issue_repo (how they are routed) — disjoint hunks, complementary. #1042 moves 00-entry.just into shared/ and does not touch changelog.just.

Refs #1044


Filed by architect agent (ACMM L5 — hold-gated mode). Hold-gated: human review required.

— hive: agent=architect backend=copilot model=claude-opus-5

…m repo routing

The image-name/tag -> upstream GitHub repository decision was restated in
two places with two different grammars:

  * bonedigger-report:route_issue_repo  — dakota* glob,  unknown -> common
  * changelog.just:changelogs           — dakota exact,  unknown -> bluefin

The grammars had already drifted. dakota-nvidia is a published image
(docs/skills/image-registry.md), matched by bonedigger-report's dakota*
glob but not by changelog.just's exact == "dakota" comparison, so
'ujust changelogs' on dakota-nvidia fetched release notes from
projectbluefin/bluefin.

Extract the grammar into /usr/libexec/ublue-image-repo in the shared/
overlay layer so it is available to every variant, not just the GNOME
desktop layer that happened to host both copies. The only legitimate
per-caller difference — the fallback repo for unrecognised images — is
passed in via --default, preserving each call site's existing fallback.

Both consumers become one-line delegations. tests/test_image_repo.bats
covers the grammar directly and adds a structural invariant asserting no
consumer restates the routing table inline.

Refs #1044

Signed-off-by: sec-check[bot] <sec-check[bot]@users.noreply.github.com>

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

Real duplication fix: centralizes image-name/tag→upstream-repo routing into a new ublue-image-repo, used via --default by both bonedigger-report and changelog.just. Correctly identifies and fixes a dakota-nvidia drift bug (glob vs. exact-match) between the two original call sites. Structural test blocks re-inlining the grammar. CI test green; validate fails only on title-lint.


Generated by Claude Code

@castrojo
castrojo enabled auto-merge September 7, 2026 01:30
@castrojo castrojo changed the title [architect] refactor: single source of truth for image-name → upstream repo routing refactor: single source of truth for image-name → upstream repo routing Sep 7, 2026
@castrojo castrojo closed this Sep 7, 2026
auto-merge was automatically disabled September 7, 2026 01:30

Pull request was closed

@castrojo castrojo reopened this Sep 7, 2026
@castrojo
castrojo enabled auto-merge September 7, 2026 01:31
@castrojo
castrojo added this pull request to the merge queue Sep 7, 2026
Merged via the queue into main with commit cbd595a Sep 7, 2026
16 of 18 checks passed
@castrojo
castrojo deleted the arch/refactor-image-repo-routing branch September 7, 2026 01:45
pull Bot pushed a commit to joshyorko/common that referenced this pull request Sep 10, 2026
…boot-key, toggle-user-motd, check-local-overrides, check-idle-power-draw, benchmark (projectbluefin#1048)

## Test Improvement

Adds `tests/test_default_just.bats` — 23 BATS tests for
`system_files/shared/usr/share/ublue-os/just/default.just`.

Before this PR, exactly one of the file's 12 recipes was under test
(`clean-system`, via `tests/test_clean_system_podman_path.bats`). The
rest had
zero coverage, including a firmware reboot and a Secure Boot MOK
enrollment.

### Recipes claimed by this PR

| Recipe | What is covered |
|---|---|
| `bios` | legacy-BIOS guard exits 1 and never reboots; EFI + confirm
issues `systemctl reboot --firmware-setup`; declined confirmation does
not reboot |
| `bios-info` | all four `dmidecode -s` fields read under `sudo bash`;
every field is labelled |
| `enroll-secure-boot-key` | `mokutil --timeout -1` precedes the import;
`akmods-ublue.der` is the imported cert; enrollment password guidance is
printed |
| `toggle-user-motd` | shim body is exactly `uwelcome toggle` |
| `check-local-overrides` | only-in-`/etc` reporting; content divergence
reporting; silence when trees match; `NO_COLOR=1` palette suppression;
palette applied when unset; identity/credential `--exclude` set |
| `check-idle-power-draw` | missing-`powerstat` guard exits 1 without
invoking it; present path runs `powerstat -a -r` |
| `benchmark` | `stress-ng` present runs the 1m matrix load without
touching brew; accept path runs `brew install`/`brew link` then the
load; decline path exits 0 with no install |

### Method

Each shebang recipe body is extracted verbatim from `default.just` and
executed
against stubbed `gum`, `sudo`, `systemctl`, `dmidecode`, `mokutil`,
`powerstat`,
`stress-ng`, `brew`, and `uwelcome`. `/sys/firmware/efi` and the
`/usr/etc /etc`
diff operands are redirected into a sandbox with `sed`, so real control
flow is
exercised instead of grepped. `sudo` execs its argv so the `sudo bash
<<EOF`
heredocs run against the same stubs.

### Incidental finding pinned, not fixed

`check-local-overrides` hardcodes `diff --color="always"`. `NO_COLOR=1`
therefore suppresses only the palette the recipe applies itself with
`sed`;
`diff`'s own ANSI escapes still reach the terminal. One test documents
that
current behaviour so a future fix is visible. No production code is
changed by
this PR.

### Disjointness

Explicitly claims only the seven recipes listed above in `default.just`,
plus
the new test file.

- `device-info` (`default.just`) — **left to PR projectbluefin#1003**, not touched or
asserted on.
- `clean-system` (`default.just`) — already owned by
`tests/test_clean_system_podman_path.bats`.
- `shared.just` — left to PR projectbluefin#1034.
- `system.just` — left to PR projectbluefin#1031.
- `apps.just` — left to PRs projectbluefin#978, projectbluefin#1007, projectbluefin#1018.
- `changelog.just` / `ublue-image-repo` — left to PR projectbluefin#1045.

`Justfile`: one line, `bats tests/test_default_just.bats`, inserted
immediately
after the existing `test_clean_system_podman_path.bats` line rather than
appended to the end of the recipe, specifically so it does not collide
with
PR projectbluefin#1031's append at the tail of the same recipe.

`.github/workflows/unit-tests.yml` is intentionally **not** modified —
the hive
App token lacks the `workflows` permission, and that wiring gap is
tracked
separately by common#968.

### Verification

```
$ bats tests/test_default_just.bats
1..23
ok 1 .. ok 23
```

## Related Issue

Refs projectbluefin#968 (the workflow-wiring half of the gap remains open).

---
*Filed by quality agent (hold-gated mode). Human review required.*

— hive: agent=quality backend=copilot model=claude-opus-5

Signed-off-by: quality <sec-check[bot]@users.noreply.github.com>
Co-authored-by: quality <sec-check[bot]@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

hold Work is intentionally paused.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants