Skip to content

feat(bakery): FCOS sysext catalog client for fedora-sysexts/community#736

Open
clubanderson wants to merge 1 commit into
projectbluefin:mainfrom
clubanderson:feat/fcos-sysext-catalog-client
Open

feat(bakery): FCOS sysext catalog client for fedora-sysexts/community#736
clubanderson wants to merge 1 commit into
projectbluefin:mainfrom
clubanderson:feat/fcos-sysext-catalog-client

Conversation

@clubanderson
Copy link
Copy Markdown
Contributor

Closes #641.

What this PR does

Implements the FCOS sysext catalog client described in issue #641, fetching extensions from the fedora-sysexts/community GitHub Releases API.

New files

internal/fcos/streams.go (new package)

  • FetchStreamFedoraVersion(ctx, stream) (int, error) — queries FCOS stream metadata JSON to derive the current Fedora major version (e.g. 44 from 44.20260510.3.1). Prefers x86_64, falls back to aarch64.
  • Injectable HTTP client; 100% statement coverage.

internal/bakery/fcos_tag.go

  • ParseFCOSTagName(tag) (name, version, fedoraVersion, arch, error) — parses tags in the form <name>-<version_components>-<fedoraVersion>-<arch>.
  • Handles RPM epoch prefixes, multi-word names, digit-starting names; rejects bare pointer tags.
  • 30+ real catalog tags as test cases.

internal/bakery/fcos.go

  • FCOSCatalogURL, FetchCatalogFCOS on *HTTPClient, FCOSClient implementing Client.
  • Paginated (up to fcosMaxCatalogPages=20), deduplicating, with SHA256 verification and curated metadata. Page cap is a hard error, not silent truncation.

internal/bakery/fcos_descriptions.go

  • FCOSLookup and fcosCatalog with 10 curated entries: docker-ce, tailscale, vscode, vscodium, cilium-cli, 1password-gui, kubernetes, netbird, cloud-hypervisor, glab.

Justfile

  • Added [fcos]=100 to cover-check targets.

Design notes

  • Asset URLs: verified 2025-06-04 — all browser_download_url values point to github.com (not extensions.fcos.fr). Existing maxSysextURLLen and HTTPS enforcement are sufficient.
  • Wiring to wizard/headless: scoped to issue feat(install): OS-dispatching installer and bakery client wiring #638.
  • 100% coverage: both internal/bakery and internal/fcos hit 100% statement coverage.

Implements issue projectbluefin#641. Adds a complete FCOS sysext catalog client that
fetches extensions from the fedora-sysexts/community GitHub Releases API,
with Fedora version filtering, tag name parsing, curated descriptions, and
full test coverage.

New packages and files:
- internal/fcos/streams.go: FetchStreamFedoraVersion — queries the FCOS
  stream metadata JSON (builds.coreos.fedoraproject.org) to derive the
  current Fedora major version (e.g. 44) for the given stream. Prefers
  x86_64, falls back to aarch64. Injectable HTTP client for 100% test
  coverage.
- internal/fcos/streams_test.go: 100% statement coverage with httptest
  servers, error injection (invalid URL, hijacked connection), context
  cancellation, and table-driven JSON parsing tests.
- internal/bakery/fcos_tag.go: ParseFCOSTagName — parses tags in the
  format '<name>-<version>-<fedoraVersion>-<arch>' including RPM epoch
  prefixes (tailscale-0-1.98.3-1), multi-word names (docker-ce), and
  digit-starting names (1password-gui). Bare pointer tags are rejected.
- internal/bakery/fcos_tag_test.go: 30+ table-driven test cases with real
  catalog tags sampled from the live API.
- internal/bakery/fcos.go: FCOSCatalogURL, fcosMaxCatalogPages=20,
  FetchCatalogFCOS (paginated, deduplicating, with SHA256 verification),
  FCOSClient (implements Client), NewFCOSClient/NewFCOSClientWithURL.
- internal/bakery/fcos_test.go: 100% coverage — success, arch/version
  filtering, deduplication, pagination, page-cap error, SHA256 fetch,
  soft-fail SHA256, curated descriptions, bad tags, URL length limits,
  invalid JSON, read errors, and 5MB response size limit.
- internal/bakery/fcos_descriptions.go: FCOSLookup and fcosCatalog with
  10 curated entries (docker-ce, tailscale, vscode, vscodium, cilium-cli,
  1password-gui, kubernetes, netbird, cloud-hypervisor, glab).
- internal/bakery/fcos_descriptions_test.go: catalog size gate (≥6),
  known-extension assertions, unknown-extension fallback.
- Justfile: [fcos]=100 added to cover-check targets.

Design decisions:
- FCOSClient wraps *http.Client + FedoraVersion int and implements Client.
  Delegates to HTTPClient.FetchCatalogFCOS for the actual fetch.
- Asset URLs in fedora-sysexts/community are all github.com URLs (not the
  extensions.fcos.fr CDN). Existing maxSysextURLLen and HTTPS enforcement
  in ignition.go are sufficient.
- fcosMaxCatalogPages=20 covers 2000 releases (catalog had 1583+ as of
  2025-06-04). Cap is a hard error, not silent truncation.
- Wiring into wizard/headless (FetchSysexts) is scoped to issue projectbluefin#638.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@dosubot dosubot Bot added the size:XL This PR changes 500-999 lines, ignoring generated files. label Jun 4, 2026
@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented Jun 4, 2026

Warning

Review limit reached

@clubanderson, we couldn't start this review because you've reached your PR review rate limit.

More reviews will be available in 1 minute and 46 seconds. Learn how PR review limits work.

Your organization has run out of usage credits. Purchase more in the billing tab.

⌛ How to resolve this issue?

After more reviews become available, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

We recommend that you space out your commits to avoid hitting the rate limit.

🚦 How do rate limits work?

CodeRabbit enforces hourly rate limits for each developer per organization.

Our paid plans include higher PR review limits than trial, open-source, and free plans. In all cases, reviews become available again over time. During sustained high-volume PR review activity, CodeRabbit may temporarily slow when the next review becomes available.

Please see our Fair Usage Limits Policy for further information.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro Plus

Run ID: b7c47b39-080d-41e5-aafb-ec89465e77de

📥 Commits

Reviewing files that changed from the base of the PR and between d4cfb3b and e955dd8.

📒 Files selected for processing (9)
  • Justfile
  • internal/bakery/fcos.go
  • internal/bakery/fcos_descriptions.go
  • internal/bakery/fcos_descriptions_test.go
  • internal/bakery/fcos_tag.go
  • internal/bakery/fcos_tag_test.go
  • internal/bakery/fcos_test.go
  • internal/fcos/streams.go
  • internal/fcos/streams_test.go
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@dosubot dosubot Bot added domain:bakery Sysext catalog and Flatcar release fetching domain:sysext System extensions / bakery kind/feature New feature or enhancement labels Jun 4, 2026
@castrojo castrojo enabled auto-merge June 4, 2026 21:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

domain:bakery Sysext catalog and Flatcar release fetching domain:sysext System extensions / bakery kind/feature New feature or enhancement size:XL This PR changes 500-999 lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

feat(bakery): FCOS sysext catalog client for fedora-sysexts/community

2 participants