Skip to content

feat(PL-6287): extract config to catalog#284

Merged
silphid merged 5 commits into
masterfrom
feat/PL-6287/extract-config-to-catalog
Jul 10, 2026
Merged

feat(PL-6287): extract config to catalog#284
silphid merged 5 commits into
masterfrom
feat/PL-6287/extract-config-to-catalog

Conversation

@silphid

@silphid silphid commented Jun 23, 2026

Copy link
Copy Markdown
Contributor

This PR allows joy cli (and eventually joy-generator) to read catalog chart refs from either joy.yaml or catalog.yaml. The goal is to eventually only read chart refs from catalog.yaml and remove those from joy.yaml.

NOTE: That other catalog PR must be merged first.


Note

Medium Risk
Chart resolution affects every release render/deploy; wrong merge or missing catalog.yaml could change which charts resolve until catalog PR lands, though legacy joy.yaml remains the fallback.

Overview
Introduces a Catalog v1alpha1 API (catalog.yaml) so chart refs, default chart, and optional repo/revision live in a catalog resource instead of only in joy.yaml.

Config loading now reads catalog.yaml, merges spec.charts into the in-memory catalog config via MergeCatalogResourceIntoCatalogConfig (resource refs replace the whole charts map when present; default overrides when set), then keeps validating merged charts. Stderr hints whether legacy joy.yaml or catalog resource values were used.

Scheme centralizes group/version/kind constants and adds Catalog GVK/GK; per-file kind constants were removed in favor of scheme.go.

Helm Chart / ChartFS move to internal/helm; pkg/helm type-aliases them so cache behavior stays the same.

Tests cover merge edge cases and Load with joy-only, catalog-only, combined priority, and invalid YAML.

Reviewed by Cursor Bugbot for commit ce9526c. Bugbot is set up for automated code reviews on this repo. Configure here.

Summary by CodeRabbit

  • New Features

    • Added support for a catalog.yaml resource to define chart references and a default chart.
    • Catalog chart mappings can now be merged across configuration sources, with resource-defined values taking priority when overlapping.
    • Chart repository URLs now more reliably resolve to OCI-style URLs, including when the scheme is omitted.
  • Bug Fixes

    • Improved loading and validation behavior for both the catalog and base catalog configuration, with clearer error handling for invalid inputs.
  • Tests

    • Added coverage for merging, priority behavior, empty/partial configs, and invalid configuration cases.

Comment thread api/v1alpha1/scheme.go
@davidmdm davidmdm force-pushed the feat/PL-6287/extract-config-to-catalog branch from 327c537 to 28ef879 Compare June 25, 2026 01:47
@silphid silphid force-pushed the feat/PL-6287/extract-config-to-catalog branch from 28ef879 to 2f71b0a Compare July 9, 2026 20:11
@coderabbitai

coderabbitai Bot commented Jul 9, 2026

Copy link
Copy Markdown

Review Change Stack

📝 Walkthrough

Walkthrough

Adds a Kubernetes-style Catalog API resource, centralizes API schema identifiers, extracts shared Helm chart types, and loads and merges catalog.yaml data into the existing catalog configuration.

Changes

Catalog configuration flow

Layer / File(s) Summary
Shared Helm chart types
internal/helm/helm.go, pkg/helm/cache.go
Introduces shared Chart and ChartFS types, centralizes chart URL conversion, and aliases the public Helm cache types to the internal implementations.
Catalog API and schema identities
api/v1alpha1/catalog.go, api/v1alpha1/scheme.go, api/v1alpha1/environment.go, api/v1alpha1/project.go, api/v1alpha1/release.go
Adds Catalog resource specifications and shared group, version, kind, group-kind, and group-version-kind identifiers.
Catalog resource loading and merge
internal/config/config.go, internal/config/config_test.go
Loads catalog.yaml, merges chart references and defaults into the catalog configuration, and tests merge, precedence, and invalid-input behavior.

Estimated code review effort: 3 (Moderate) | ~25 minutes

Sequence Diagram(s)

sequenceDiagram
  participant Load
  participant CatalogResource
  participant JoyConfig
  participant CatalogConfig
  Load->>CatalogResource: load catalog.yaml
  Load->>JoyConfig: load joy.yaml
  Load->>CatalogConfig: merge chart refs and default chart
  CatalogConfig-->>Load: validate merged configuration
Loading
🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title is concise and matches the main change: moving catalog-related config into a Catalog resource.
✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch feat/PL-6287/extract-config-to-catalog

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

@silphid silphid marked this pull request as ready for review July 9, 2026 21:46
@coderabbitai

coderabbitai Bot commented Jul 9, 2026

Copy link
Copy Markdown

Caution

Failed to replace (edit) comment. This is likely due to insufficient permissions or the comment being deleted.

Error details
putComment timed out

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🧹 Nitpick comments (1)
internal/config/config.go (1)

195-228: 🗄️ Data Integrity & Integration | 🔵 Trivial | ⚡ Quick win

Consider validating catalog.yaml's kind against the new schema identity.

Load never checks catalogResource.Kind (or APIVersion, once decodable — see catalog.go comment) against v1alpha1.CatalogGK/CatalogGVK before merging. A catalog.yaml with a wrong kind (e.g. a typo, or accidentally pointing at another resource type) would currently be merged silently as long as its shape happens to match CatalogSpec.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@internal/config/config.go` around lines 195 - 228, `Load` currently merges
catalog.yaml without verifying that `catalogResource` is actually a Catalog
object. Add a kind/apiVersion identity check in the `Load` flow before calling
`MergeCatalogResourceIntoCatalogConfig`, using `catalogResource.Kind` (and
`APIVersion` once available) against `v1alpha1.CatalogGK`/`CatalogGVK`, and
return a clear validation error on mismatch so malformed or wrong resource types
are not merged silently.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Nitpick comments:
In `@internal/config/config.go`:
- Around line 195-228: `Load` currently merges catalog.yaml without verifying
that `catalogResource` is actually a Catalog object. Add a kind/apiVersion
identity check in the `Load` flow before calling
`MergeCatalogResourceIntoCatalogConfig`, using `catalogResource.Kind` (and
`APIVersion` once available) against `v1alpha1.CatalogGK`/`CatalogGVK`, and
return a clear validation error on mismatch so malformed or wrong resource types
are not merged silently.

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro Plus

Run ID: 49d14033-f444-4a1a-9263-8679cbc214d8

📥 Commits

Reviewing files that changed from the base of the PR and between e29ba56 and d22b0f2.

📒 Files selected for processing (9)
  • api/v1alpha1/catalog.go
  • api/v1alpha1/environment.go
  • api/v1alpha1/project.go
  • api/v1alpha1/release.go
  • api/v1alpha1/scheme.go
  • internal/config/config.go
  • internal/config/config_test.go
  • internal/helm/helm.go
  • pkg/helm/cache.go
💤 Files with no reviewable changes (3)
  • api/v1alpha1/release.go
  • api/v1alpha1/environment.go
  • api/v1alpha1/project.go

Comment thread internal/config/config.go
Comment thread internal/config/config_test.go Outdated

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

Pre-approving but check out comments for fun!

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

@silphid silphid force-pushed the feat/PL-6287/extract-config-to-catalog branch from ce9526c to c760df6 Compare July 10, 2026 14:40
@silphid silphid merged commit 3c0c772 into master Jul 10, 2026
11 checks passed
@silphid silphid deleted the feat/PL-6287/extract-config-to-catalog branch July 10, 2026 15:24
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