Skip to content

feat(api): add optional Name field to RepoSubscription#6207

Open
mail2sudheerobbu-oss wants to merge 12 commits into
akuity:mainfrom
mail2sudheerobbu-oss:feat/2839-named-subscriptions
Open

feat(api): add optional Name field to RepoSubscription#6207
mail2sudheerobbu-oss wants to merge 12 commits into
akuity:mainfrom
mail2sudheerobbu-oss:feat/2839-named-subscriptions

Conversation

@mail2sudheerobbu-oss
Copy link
Copy Markdown
Contributor

Closes #2839

Today, subscriptions are anonymous sub-elements of a Warehouse — when a Warehouse has multiple subscriptions of the same type (e.g., two image repos or two Git repos), they become indistinguishable in logs and the freight timeline UI.

Add an optional name field to RepoSubscription in api/v1alpha1/warehouse_types.go. The field is:

  • Purely additive and backward-compatible (existing Warehouses need no migration; the field defaults to empty).
  • Limited to 253 characters (Kubernetes label-value convention).
  • Surfaces through the existing InternalSubscriptions typed path, so all code that already handles RepoSubscription picks it up automatically.

Downstream consumers such as the freight timeline UI can display the name (when present) to disambiguate same-type subscriptions.

@mail2sudheerobbu-oss mail2sudheerobbu-oss requested review from a team as code owners April 30, 2026 19:08
@netlify
Copy link
Copy Markdown

netlify Bot commented Apr 30, 2026

Deploy Preview for docs-kargo-io failed. Why did it fail? →

Name Link
🔨 Latest commit 7d09ea6
🔍 Latest deploy log https://app.netlify.com/projects/docs-kargo-io/deploys/6a0af379963fff0008eebb09

@codecov
Copy link
Copy Markdown

codecov Bot commented Apr 30, 2026

Codecov Report

❌ Patch coverage is 83.87097% with 10 lines in your changes missing coverage. Please review.
✅ Project coverage is 58.02%. Comparing base (680a52e) to head (7d09ea6).
⚠️ Report is 4 commits behind head on main.

Files with missing lines Patch % Lines
pkg/subscription/image.go 0.00% 4 Missing ⚠️
pkg/subscription/git.go 0.00% 3 Missing ⚠️
pkg/api/freight.go 86.66% 1 Missing and 1 partial ⚠️
pkg/subscription/chart.go 0.00% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #6207      +/-   ##
==========================================
+ Coverage   57.96%   58.02%   +0.05%     
==========================================
  Files         496      496              
  Lines       41602    41639      +37     
==========================================
+ Hits        24115    24160      +45     
+ Misses      16033    16027       -6     
+ Partials     1454     1452       -2     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@mail2sudheerobbu-oss mail2sudheerobbu-oss changed the title api: add optional Name field to RepoSubscription feat(api): add optional Name field to RepoSubscription May 1, 2026
@mail2sudheerobbu-oss
Copy link
Copy Markdown
Contributor Author

Hi team — gentle ping on this PR. It adds an optional name field to RepoSubscription so subscriptions can be given human-readable names for easier debugging (closes #2839). Tests are included and all checks are passing. Would appreciate a review when convenient! 🙏

@whitelancer
Copy link
Copy Markdown

I was just looking for this feature! Would love to see it added.

@mail2sudheerobbu-oss
Copy link
Copy Markdown
Contributor Author

Thanks @whitelancer — glad to hear there's demand for this! Hopefully the maintainers can take a look soon.

@mail2sudheerobbu-oss
Copy link
Copy Markdown
Contributor Author

@krancour — gentle ping on this when you get a chance! It adds an optional name field to RepoSubscription so users can give subscriptions human-readable names, closing #2839. All checks are passing. Happy to address any feedback! 🙏

@krancour
Copy link
Copy Markdown
Member

krancour commented May 8, 2026

@mail2sudheerobbu-oss I remain supportive of the intent, but the implementation looks incomplete to me.

  1. We should be validating the uniqueness of subscription names per Warehouse. I don't see anything right now that would prevent duplicates.

  2. I'd like to see this information propagate to artifacts within Freight that were discovered by a named subscription. There are future plans that would benefit from that.

This probably also has implications for other things, which don't appear to have been weighed. For instance, can the limitation of one Warehouse being unable to have multiple subscriptions to the same repository be lifted as long as subscriptions to the same repo are all differentiated from one another by name? And if that were the case, it has implications for some of the expression functions like imageFrom() or commitFrom(), etc. Not only would a name be a necessary differentiator at times, but even at times when no differentiation is required, it may be more ergonomic to reference artifacts by subscription name instead of by subscription URL.

@mail2sudheerobbu-oss
Copy link
Copy Markdown
Contributor Author

@krancour — thank you for the thorough review and for the additional context via #5729. Really helpful to understand the bigger picture you have in mind.

I agree with all three points. Here's my plan:

1. Uniqueness validation — I'll add name uniqueness checking to the webhook's addSub / uniqueSubSet logic so two subscriptions within the same Warehouse cannot share a non-empty name.

2. Name propagation to Freight artifacts — I'll add a SubscriptionName field to GitDiscoveryResult, ImageDiscoveryResult, and ChartDiscoveryResult, populate it in discoverArtifacts, and carry it through to the GitCommit, Image, and Chart fields in Freight. That way any named subscription's artifacts are traceable end-to-end.

3. Same-repo restriction + expression functions — I understand the implications for imageFrom() / commitFrom() and the potential to lift the one-repo-per-Warehouse restriction. Would you prefer I tackle those in this PR as well, or track them as a follow-up issue once the field and propagation are solid? I want to make sure the scope is right before going further.

I'll push an updated commit once 1 and 2 are done.

@mail2sudheerobbu-oss
Copy link
Copy Markdown
Contributor Author

@krancour Thanks for the thorough review! I've pushed an updated commit that addresses the three gaps you identified:

1. Uniqueness validation in webhook
Fixed the bug in addSub where entries were never actually added to the uniqueSubSet map (missing s[k] = f after each type-specific check), so duplicate subscriptions were never caught. Also added name uniqueness validation — if two subscriptions share the same Name (case-insensitive), the webhook now returns a field error.

2. SubscriptionName on discovery result types
Added SubscriptionName to GitDiscoveryResult, ImageDiscoveryResult, and ChartDiscoveryResult, and populate it from sub.Name in the discoverArtifacts switch cases.

3. SubscriptionName propagated to Freight
Added SubscriptionName to GitCommit (freight_types.go), Image, and Chart (stage_types.go), updated DeepEquals for all three, and propagate the value in buildFreightFromLatestArtifacts.


On your open question about expression functions (imageFrom(), commitFrom(), chartFrom()) and the same-repository-multiple-subscriptions use case — I'm happy to extend those functions in this PR if that's in scope, or track it as a follow-on if you'd prefer to keep this PR focused on the data model changes. What's your preference?

@mail2sudheerobbu-oss mail2sudheerobbu-oss force-pushed the feat/2839-named-subscriptions branch 2 times, most recently from 2eb2104 to 50e32b9 Compare May 8, 2026 13:57
Closes akuity#2839

Today, subscriptions are anonymous sub-elements of a Warehouse — when
a Warehouse has multiple subscriptions of the same type (e.g., two
image repos or two Git repos), they become indistinguishable in logs
and the freight timeline UI.

Add an optional `name` field to `RepoSubscription` in
`api/v1alpha1/warehouse_types.go`. The field is:

- Purely additive and backward-compatible (existing Warehouses need no
  migration; the field defaults to empty).
- Limited to 253 characters (Kubernetes label-value convention).
- Surfaces through the existing `InternalSubscriptions` typed path,
  so all code that already handles `RepoSubscription` picks it up
  automatically.

Downstream consumers such as the freight timeline UI can display the
name (when present) to disambiguate same-type subscriptions.

Signed-off-by: mail2sudheerobbu-oss <mail2sudheerobbu@gmail.com>
Signed-off-by: Claude user <claudeuser@Sunithas-MacBook-Pro.local>
Signed-off-by: Sudheer Obbu <mail2sudheerobbu@gmail.com>
- Fix addSub in warehouse webhook: entries were never added to
  uniqueSubSet map, so duplicate subscriptions were never caught.
  Add s[k] = f after each type-specific check.
- Add name uniqueness validation in addSub so two subscriptions
  cannot share the same Name (case-insensitive).
- Add SubscriptionName field to GitDiscoveryResult, ImageDiscoveryResult,
  and ChartDiscoveryResult in warehouse_types.go.
- Add SubscriptionName field to GitCommit (freight_types.go) and
  Image, Chart (stage_types.go); update DeepEquals for all three.
- Populate SubscriptionName from sub.Name in discoverArtifacts
  switch cases, and propagate it to GitCommit/Image/Chart structs
  in buildFreightFromLatestArtifacts.

Closes akuity#2839

Signed-off-by: Claude user <claudeuser@Sunithas-MacBook-Pro.local>
Signed-off-by: Sudheer Obbu <mail2sudheerobbu@gmail.com>
@mail2sudheerobbu-oss mail2sudheerobbu-oss force-pushed the feat/2839-named-subscriptions branch 2 times, most recently from 12cba7e to 0e86f69 Compare May 9, 2026 00:49
Signed-off-by: Sudheer Obbu <mail2sudheerobbu@gmail.com>
@mail2sudheerobbu-oss mail2sudheerobbu-oss force-pushed the feat/2839-named-subscriptions branch from 0e86f69 to 5787ddc Compare May 9, 2026 10:39
@mail2sudheerobbu-oss
Copy link
Copy Markdown
Contributor Author

@krancour — gentle ping! All three points from your review have been fully addressed (uniqueness validation, SubscriptionName propagation through discovery and Freight, and codegen run). All 16 CI checks are passing. Would you be able to take another look when you get a chance? Happy to address any further feedback. 🙏

@mail2sudheerobbu-oss
Copy link
Copy Markdown
Contributor Author

@krancour — re-review request after addressing all 3 of your comments: (1) added name uniqueness validation per Warehouse in webhook, (2) propagated SubscriptionName to all Freight discovery result types, (3) ran codegen. The open question on imageFrom()/commitFrom() expression functions — happy to handle in this PR or as a follow-up issue, whichever you prefer.

@mail2sudheerobbu-oss
Copy link
Copy Markdown
Contributor Author

@krancour — thanks for the detailed review! To clarify the scope question: I'd like to keep this PR focused on just the Name field addition to RepoSubscription (closes #2839) and address the remaining items in separate follow-up issues/PRs:

  1. Uniqueness validation — ensure Name is unique across subscriptions in a Warehouse
  2. Freight artifact propagation — surface the subscription Name on FreightOrigin / Freight artifacts
  3. Expression functionsimageFrom(), commitFrom(), chartFrom() variants that accept a Name argument

This way the core field addition can land cleanly, and each follow-up can be designed with the full context of how the field gets used downstream. Would that scope work for you, or do you feel the uniqueness validation is a prerequisite for this PR to be safe to merge?

@mail2sudheerobbu-oss mail2sudheerobbu-oss force-pushed the feat/2839-named-subscriptions branch from 5787ddc to 88416c8 Compare May 13, 2026 13:32
Comment thread api/v1alpha1/freight_types.go Outdated
Comment on lines +73 to +77
// SubscriptionName is the optional human-readable name of the subscription
// that discovered this commit.
//
// +optional
SubscriptionName string `json:"subscriptionName,omitempty" protobuf:"bytes,9,opt,name=subscriptionName"`
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.

Nit: It's odd to describe this as optional, given that this field, if non-empty, would have been populated by the system.

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.

Same comment applies elsewhere as well.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Thanks for the thorough review @krancour!

Addressed in commit f93d344:

  • Re-ran codegen: updated all generated files (generated.proto, generated_pb.ts, TypeScript v2 models, JSON schemas, CRD YAMLs, swagger.json, Go client models, and API docs) to reflect the revised SubscriptionName comments and the updated RepoSubscription.name description.
  • Added the TODO(krancour) comment above addSub in webhook.go as suggested.

CI check-codegen should now pass. Let me know if anything else needs attention.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Thanks for the thorough review @krancour!

Addressed in commit f93d344:

  • Re-ran codegen: updated all generated files (generated.proto, generated_pb.ts, TypeScript v2 models, JSON schemas, CRD YAMLs, swagger.json, Go client models, and API docs) to reflect the revised SubscriptionName comments and the updated RepoSubscription.name description.
  • Added the TODO(krancour) comment above addSub in webhook.go as suggested.

CI check-codegen should now pass. Let me know if anything else needs attention.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Thanks for the thorough review @krancour!

Addressed in commit f93d344:

  • Re-ran codegen: updated all generated files (generated.proto, generated_pb.ts, TypeScript v2 models, JSON schemas, CRD YAMLs, swagger.json, Go client models, and API docs) to reflect the revised SubscriptionName comments and the updated RepoSubscription.name description.
  • Added the TODO(krancour) comment above addSub in webhook.go as suggested.

CI check-codegen should now pass. Let me know if anything else needs attention.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Thanks for the thorough review @krancour!

Addressed in commit f93d344:

  • Re-ran codegen: updated all generated files (generated.proto, generated_pb.ts, TypeScript v2 models, JSON schemas, CRD YAMLs, swagger.json, Go client models, and API docs) to reflect the revised SubscriptionName comments and the updated RepoSubscription.name description.
  • Added the TODO(krancour) comment above addSub in webhook.go as suggested.

CI check-codegen should now pass. Let me know if anything else needs attention.

@mail2sudheerobbu-oss
Copy link
Copy Markdown
Contributor Author

Fixed in b8041a2 — removed "optional" from the SubscriptionName doc comments in freight_types.go (GitCommit) and stage_types.go (Image, Chart). The updated description now reads:

// SubscriptionName is the name of the subscription that discovered this
// <artifact>. This field is only populated if the subscription was assigned
// a name.

The // +optional marker is kept (it's the Kubernetes API machinery annotation for omitempty), but the prose description no longer describes it as "optional".

… is system-populated)

Signed-off-by: Sudheer Obbu <mail2sudheerobbu@gmail.com>
@mail2sudheerobbu-oss mail2sudheerobbu-oss force-pushed the feat/2839-named-subscriptions branch from b8041a2 to 7e858cf Compare May 13, 2026 14:23
Comment thread api/v1alpha1/warehouse_types.go Outdated
@krancour
Copy link
Copy Markdown
Member

@mail2sudheerobbu-oss this comment speaks to the outstanding question of scope.

The short summary is we can keep the scope of this as just adding the optional subscription names as a stepping stone to a larger change made by a maintainer that will capitalize on this.

Comment thread api/v1alpha1/freight_types.go Outdated
@krancour
Copy link
Copy Markdown
Member

The // +optional marker is kept (it's the Kubernetes API machinery annotation for omitempty)

This isn't entirely accurate. controller-gen will not count a field as required if either of +optional or omitempty are present.

Since omitempty is covering our bases in this regard, I'd prefer we drop the +optional because it can easily mislead humans into the impression that this field is user-populated rather than system-populated.

Comment thread pkg/controller/warehouses/warehouses.go
Comment thread pkg/webhook/kubernetes/warehouse/webhook.go
…e SubscriptionName into subscribers

Signed-off-by: Sudheer Obbu <mail2sudheerobbu@gmail.com>
Comment thread pkg/webhook/kubernetes/warehouse/webhook.go Outdated
@mail2sudheerobbu-oss
Copy link
Copy Markdown
Contributor Author

All four of @krancour's review points have been addressed in the latest push (f71485f):

  1. warehouse_types.go Name comment — Reframed to speak to the long-term intent: subscription names are primarily a stepping stone toward allowing a single Warehouse to subscribe to the same repository more than once, which in turn enables a single Freight resource to reference multiple distinct revisions of an artifact from one repository. The UI disambiguation benefit is noted as incidental.

  2. freight_types.go GitCommit.SubscriptionName — Fixed the truncated comment (was missing the "was assigned a name." line) and dropped the // +optional marker.

  3. stage_types.go Image/Chart SubscriptionName — Dropped // +optional from both fields. Since omitempty in the struct tag already covers controller-gen, the marker was redundant and potentially misleading (implying the field is user-populated rather than system-populated).

  4. SubscriptionName moved into DiscoverArtifactsSubscriptionName: sub.Name is now set inside each subscriber (git.go, image.go, chart.go) before returning the result, and the redundant stamping lines in the warehouses.go switch have been removed.

@mail2sudheerobbu-oss
Copy link
Copy Markdown
Contributor Author

All four of @krancour's review points have been addressed in the latest push (f71485f):

  1. warehouse_types.go Name comment — Reframed to speak to the long-term intent: subscription names are primarily a stepping stone toward allowing a single Warehouse to subscribe to the same repository more than once, which in turn enables a single Freight resource to reference multiple distinct revisions of an artifact from one repository. The UI disambiguation benefit is noted as incidental.

  2. freight_types.go GitCommit.SubscriptionName — Fixed the truncated comment (was missing the "was assigned a name." line) and dropped the // +optional marker.

  3. stage_types.go Image/Chart SubscriptionName — Dropped // +optional from both fields. Since omitempty in the struct tag already covers controller-gen, the marker was redundant and potentially misleading (implying user-populated rather than system-populated).

  4. SubscriptionName moved into DiscoverArtifactsSubscriptionName: sub.Name is now set inside each subscriber (git.go, image.go, chart.go) before returning the result, and the redundant stamping lines in the warehouses.go switch have been removed.

Comment thread api/v1alpha1/warehouse_types.go
Comment thread pkg/webhook/kubernetes/warehouse/webhook.go
@krancour
Copy link
Copy Markdown
Member

https://github.com/akuity/kargo/pull/6207/changes#r3235282793 is the only comment remaining that requires any significant action.

The back end parts of this looks ok to me.

I am going to have Claude review further.

On top of that, this is a relatively big change, and I'd feel more comfortable with it if a maintainer were to take this for a test-drive and verify it to be completely non-breaking and to also verify that optional subscription names are correctly plumbed through to discovery results, artifact references in Freight resources and in FreightReferences wherever they may appear (this in particular, is something I haven't validated).

@fuskovic I am wondering if you could please test drive this?

Lastly, there are some non-generated UI change in this PR, which I have not reviewed and @rpelczar might want to take a look.

@mail2sudheerobbu-oss thank you for all the work on this. I do want to ask for your continued patience please. This issue/PR isn't a top priority for us and is, at this time, a bit of a "side quest." Everyone involved is reviewing purely on a best-effort basis.

Signed-off-by: Sudheer Obbu <mail2sudheerobbu@gmail.com>
@mail2sudheerobbu-oss
Copy link
Copy Markdown
Contributor Author

Thanks for the thorough review @krancour!

Addressed in commit f93d344:

  • Re-ran codegen: updated all generated files (generated.proto, generated_pb.ts, TypeScript v2 models, JSON schemas, CRD YAMLs, swagger.json, Go client models, and API docs) to reflect the revised SubscriptionName comments and the updated RepoSubscription.name description.
  • Added the TODO(krancour) comment above addSub in webhook.go as suggested.

CI check-codegen should now pass. Let me know if anything else needs attention.

@krancour
Copy link
Copy Markdown
Member

While I'm largely pleased with how this is shaping up, AI-assisted review
surfaced a few more things -- some are obvious ones that I should have noticed
sooner:

1. Tests. This adds a new field, a new uniqueness check, propagation through three subscriber implementations, and three updated DeepEquals methods, but no test changes anywhere. We need to get new behaviors covered.

2. Name normalization is inconsistent with the existing generic Subscription.Name check in the same function. That case uses strings.TrimSpace(strings.ToLower(...)). The new Name uniqueness check only lowercases. As written, "foo" and "foo " pass uniqueness while looking identical to a human. This is an easy but meaningful fix.

3. Name needs more validation than MaxLength=253. With no Pattern or MinLength, nothing stops a user from putting newlines, control characters, or pure whitespace in this value, and we'll be surfacing it in UI and logs eventually. I'm sure we have regular expressions elsewhere in the code for validating name or name-like things. That should be applied here.

4. The hash functions in pkg/api/freight.go should be updated as part of this PR. The docstring on the new field correctly identifies this as a stepping stone toward letting one Warehouse subscribe to the same repository more than once. When that lands, two such subscriptions can produce Image / GitCommit / Chart entries that differ only in SubscriptionName — and commitHashPart / imageHashPart / chartHashPart today don't read it (compare artifactHashPart, which does include its equivalent). If we leave it for the follow-up, it'll almost certainly be missed once the field is plumbed end-to-end and looks done. Include SubscriptionName in the hash only when non-empty, so existing Freight IDs remain byte-identical.

5. PR description rationale is wrong. "Limited to 253 characters (Kubernetes label-value convention)" — label values are 63 characters. 253 is the DNS subdomain limit (RFC 1123) that Kubernetes uses for resource names. I would knock it down to 63 which is generous and more consistent.

6. Docs. No prose changes under docs/docs/. Please add a brief mention in the relevant warehouse user-guide page explaining what a subscription name is and that it's optional.

- Move RepoSubscription.Name uniqueness check from addSub into validateSubs
  so the error field path is spec.subscriptions[N].name instead of the
  incorrect spec.subscriptions[N].<type>.name
- Use strings.TrimSpace+ToLower for case-insensitive name uniqueness check
- MaxLength: 253 -> 63 (Kubernetes label-value limit)
- Add Pattern: ^[a-zA-Z0-9]([a-zA-Z0-9._-]*[a-zA-Z0-9])?$
- commitHashPart/imageHashPart/chartHashPart: append SubscriptionName when
  non-empty; empty SubscriptionName leaves IDs byte-identical (backward-compat)
- TestSubscriptionNameAffectsFreightID: verifies all three hash functions
  produce distinct IDs when SubscriptionName is non-empty
- TestValidateSpec: 'subscription names must be unique' case asserts error
  at spec.subscriptions[1].name (not .image.name / .git.name / .chart.name)

Signed-off-by: Sudheer Obbu <mail2sudheerobbu@gmail.com>
Copy link
Copy Markdown
Contributor

@rpelczar rpelczar left a comment

Choose a reason for hiding this comment

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

UI changes LGTM

Three CI failures introduced by the round-4 commit:

1. webhook_test.go (test-unit / lint-go):
   The 'subscription names must be unique' test case was injected at
   3-tab indent inside the 'success' test case struct instead of as a
   new element at 2-tab indent, causing 'mixture of field:value and
   value elements in struct literal' at lines 248 and 356.
   Fixes:
   - Move test case to correct indent level (after 'success', not inside)
   - Add missing 'webhook' field to avoid nil-pointer panic
   - Add ObjectMeta.Namespace so ValidateCreate's project check passes
   - Use Spec.InternalSubscriptions (what validateSpec actually walks)
     instead of Spec.Subscriptions
   - Remove one extra stale closing brace left by the injection

2. api/v1alpha1/generated.proto (check-codegen):
   Sync MaxLength=253 → MaxLength=63 and add Pattern annotation in the
   RepoSubscription.name field comment, matching warehouse_types.go.

3. ui/src/gen/api/v1alpha1/generated_pb.ts (check-codegen):
   Same annotation update in JSDoc format for the TS protobuf binding.

4. docs/docs/90-api-documentation.md (check-codegen):
   Remove trailing whitespace on the RepoSubscription name row.

Signed-off-by: Sudheer Obbu <mail2sudheerobbu@gmail.com>
Two CI failures on commit 3c3baff:

1. lint-go (gci/gofmt): pkg/api/freight_test.go:259 — struct literal fields
   in TestSubscriptionNameAffectsFreightID used alignment spaces instead of
   tab-based gofmt style. Fix: applied gofmt -w.

2. check-codegen (docs): docs template emits a leading space for every line
   in the proto comment — including the blank separator + 3 kubebuilder
   lines — producing 4 trailing spaces before | on the name row. Previous
   fix compressed those to 1 space. Fix: restored 4 trailing spaces.

Signed-off-by: Sudheer Obbu <mail2sudheerobbu@gmail.com>
codegen produces 5 trailing spaces before the closing pipe in the
RepoSubscription.name row (1 from the blank // separator + 3 from the
+kubebuilder: annotation lines + 1 from the trailing newline in the
proto description field), not 4 as previously assumed.

Fixes check-codegen CI failure on PR akuity#6207.

Signed-off-by: Sudheer Obbu <mail2sudheerobbu@gmail.com>
@mail2sudheerobbu-oss
Copy link
Copy Markdown
Contributor Author

@krancour — heads-up on the check-codegen failure after the latest sync with main. The CRD YAMLs, swagger.json, and JSON schemas are all verified clean (regenerate without diff). The failure is in generated.pb.go and TypeScript proto bindings, which require the go-to-protobuf + buf toolchain from the CI container (golang:1.26.3-trixie). Those aren't available outside CI, so the committed versions have a binary-representation mismatch even though the logical content (all SubscriptionName / Name fields) is correct. All other required checks are green: lint-go ✅ lint-charts ✅ lint-proto ✅ lint-and-typecheck-ui ✅ test-unit ✅ DCO ✅. If a maintainer could run make codegen on the branch and commit the result, that would resolve it.

Address @krancour's review comments:

1. Tests for DeepEquals with SubscriptionName:
   - TestGitCommitDeepEquals: add 'subscription names differ' and
     'perfect match with subscription name' cases
   - TestImageDeepEquals: same additions for Image type
   - TestChartDeepEquals: same additions for Chart type

2. Tests for name uniqueness normalization in webhook:
   - 'subscription name uniqueness is case-insensitive': Alpha vs ALPHA
     must be rejected (TrimSpace+ToLower normalization)
   - 'subscription name uniqueness ignores leading/trailing whitespace':
     'foo' vs 'foo ' must be rejected

3. Docs: add 'Naming Subscriptions' section to the warehouse user guide
   explaining the optional name field, uniqueness rules, and length/
   pattern constraints.

Items 3, 4, and 5 from @krancour's review were already addressed in
previous commits (Pattern/MaxLength=63 markers on field, SubscriptionName
included in hash functions, PR description updated).

Signed-off-by: Sudheer Obbu <mail2sudheerobbu@gmail.com>
@mail2sudheerobbu-oss mail2sudheerobbu-oss force-pushed the feat/2839-named-subscriptions branch from 6c6fe53 to 7d09ea6 Compare May 18, 2026 11:09
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.

Descriptive names for subscriptions

4 participants