Skip to content

Comments

chore(KFLUXUI-1072): update component model#712

Open
marcin-michal wants to merge 2 commits intokonflux-ci:mainfrom
marcin-michal:KFLUXUI-1072
Open

chore(KFLUXUI-1072): update component model#712
marcin-michal wants to merge 2 commits intokonflux-ci:mainfrom
marcin-michal:KFLUXUI-1072

Conversation

@marcin-michal
Copy link
Member

@marcin-michal marcin-michal commented Feb 18, 2026

Assisted-by: Cursor

Fixes

KFLUXUI-1072

Description

Updated the component types to reflect changes made in https://github.com/konflux-ci/application-api/blob/main/api/v1alpha1/component_types.go

Type of change

  • Feature
  • Bugfix
  • Code style update (formatting, renaming)
  • Refactoring (no functional changes, no api changes)
  • Build related changes
  • Documentation content changes
  • Other (please describe):

Screen shots / Gifs for design review

How to test or reproduce?

Browser conformance:

  • Chrome
  • Firefox
  • Safari
  • Edge

Summary by CodeRabbit

  • New Features

    • Enhanced component configuration capabilities with support for repository settings, component actions, and build pipeline customization.
    • Introduced comprehensive component versioning and status tracking for improved release management.
    • Added Dockerfile URI support for enhanced build flexibility and container management.
  • Documentation

    • Marked several configuration fields as deprecated in preparation for upcoming component model evolution.

Assisted-by: Cursor
@marcin-michal marcin-michal requested a review from a team as a code owner February 18, 2026 11:54
@marcin-michal marcin-michal requested review from rakshett and testcara and removed request for a team February 18, 2026 11:54
@snyk-io
Copy link
Contributor

snyk-io bot commented Feb 18, 2026

Snyk checks have passed. No issues have been found so far.

Status Scanner Critical High Medium Low Total (0)
Open Source Security 0 0 0 0 0 issues
Licenses 0 0 0 0 0 issues
Code Security 0 0 0 0 0 issues

💻 Catch issues earlier using the plugins for VS Code, JetBrains IDEs, Visual Studio, and Eclipse.

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Feb 18, 2026

Note

.coderabbit.yaml has unrecognized properties

CodeRabbit is using all valid settings from your configuration. Unrecognized properties (listed below) have been ignored and may indicate typos or deprecated fields that can be removed.

⚠️ Parsing warnings (1)
Validation error: Unrecognized key(s) in object: 'version', 'include', 'exclude', 'rules', 'limits'
⚙️ Configuration instructions
  • Please see the configuration documentation for more information.
  • You can also validate your configuration using the online YAML validator.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json
📝 Walkthrough

Walkthrough

Added ten new public types to model advanced component configurations (RepositorySettings, ComponentActions, ComponentCreatePipelineConfiguration, ComponentVersion, PipelineDefinition, PipelineSpecFromBundle, PipelineRefGit, ComponentBuildPipeline, ComponentVersionStatus, ComponentStatus). Extended ComponentSource, ComponentSpecs, and ComponentKind with new fields. Added deprecation annotations across related types.

Changes

Cohort / File(s) Summary
Component Type Definitions
src/types/component.ts
Added 10 new public types for component configuration modeling (RepositorySettings, ComponentActions, ComponentCreatePipelineConfiguration, ComponentVersion, PipelineDefinition, PipelineSpecFromBundle, PipelineRefGit, ComponentBuildPipeline, ComponentVersionStatus, ComponentStatus). Extended ComponentSource with dockerfileUri and versions fields. Extended ComponentSpecs with actions, repository-settings, skip-offboarding-pr, and default-build-pipeline fields. Replaced ComponentKind inline status with dedicated ComponentStatus type. Added deprecation annotations to mark removal with old component model retirement.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~12 minutes

Suggested reviewers

  • StanislavJochman
  • JoaoPedroPP
  • rrosatti
  • abhinandan13jan
  • Katka92
  • janaki29
🚥 Pre-merge checks | ✅ 3
✅ Passed checks (3 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title 'chore(KFLUXUI-1072): update component model' directly describes the main change: updating component model types in src/types/component.ts to reflect API changes.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
  • 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment

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.

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

🧹 Nitpick comments (2)
src/types/component.ts (2)

16-27: Inconsistent annotation style for future-requirement notes.

Lines 16 and 27 use plain // comments while all other annotations in this file use /** ... */ JSDoc style. Plain inline comments don't surface in IDE tooltips on hover, which reduces discoverability for future maintainers.

🔧 Proposed consistency fix
 export type ComponentSource = {
-  url?: string; // Will be required when we remove old component model
+  /** `@todo` Will be required when we remove old component model */
+  url?: string;
   /** `@deprecated` Will be removed when we remove old component model */
   git?: { ... };

-  dockerfileUri?: string;
-  versions?: ComponentVersion[]; // Will be required when we remove old component model
+  dockerfileUri?: string;
+  /** `@todo` Will be required when we remove old component model */
+  versions?: ComponentVersion[];
 };

The same pattern applies to the plain // comment on line 144 inside ComponentStatus.

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@src/types/component.ts` around lines 16 - 27, Replace the plain inline `//`
annotations with JSDoc-style block comments so they appear in IDE hovers:
convert the comment on the `url` property and the comment on the `versions?:
ComponentVersion[]` property to `/** ... */` JSDoc form (preserving the existing
text "Will be required when we remove old component model"), and do the same for
the plain `//` comment inside `ComponentStatus` (around the property at the
position noted on line ~144); ensure you only change the comment syntax, not the
property names or wording.

56-60: PipelineDefinition doesn't enforce mutual exclusivity of its three pipeline ref options.

All three fields are independently optional, so TypeScript won't catch cases where zero or multiple refs are provided simultaneously. A discriminated union would make invalid states unrepresentable.

♻️ Proposed stricter type (optional)
-export type PipelineDefinition = {
-  'pipelineref-by-git-resolver'?: PipelineRefGit;
-  'pipelineref-by-name'?: string;
-  'pipelinespec-from-bundle'?: PipelineSpecFromBundle;
-};
+export type PipelineDefinition =
+  | { 'pipelineref-by-git-resolver': PipelineRefGit; 'pipelineref-by-name'?: never; 'pipelinespec-from-bundle'?: never }
+  | { 'pipelineref-by-name': string; 'pipelineref-by-git-resolver'?: never; 'pipelinespec-from-bundle'?: never }
+  | { 'pipelinespec-from-bundle': PipelineSpecFromBundle; 'pipelineref-by-git-resolver'?: never; 'pipelineref-by-name'?: never };
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@src/types/component.ts` around lines 56 - 60, PipelineDefinition currently
allows zero or multiple refs because all three properties are optional; replace
it with a discriminated union so exactly one ref is provided. Define
PipelineDefinition as a union of three object types: one with
'pipelineref-by-git-resolver': PipelineRefGit (and the other two keys absent or
typed as never), one with 'pipelineref-by-name': string (others absent/never),
and one with 'pipelinespec-from-bundle': PipelineSpecFromBundle (others
absent/never); update any callers that construct PipelineDefinition to use the
single correct variant and adjust type checks to narrow the union when reading
the property.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Nitpick comments:
In `@src/types/component.ts`:
- Around line 16-27: Replace the plain inline `//` annotations with JSDoc-style
block comments so they appear in IDE hovers: convert the comment on the `url`
property and the comment on the `versions?: ComponentVersion[]` property to `/**
... */` JSDoc form (preserving the existing text "Will be required when we
remove old component model"), and do the same for the plain `//` comment inside
`ComponentStatus` (around the property at the position noted on line ~144);
ensure you only change the comment syntax, not the property names or wording.
- Around line 56-60: PipelineDefinition currently allows zero or multiple refs
because all three properties are optional; replace it with a discriminated union
so exactly one ref is provided. Define PipelineDefinition as a union of three
object types: one with 'pipelineref-by-git-resolver': PipelineRefGit (and the
other two keys absent or typed as never), one with 'pipelineref-by-name': string
(others absent/never), and one with 'pipelinespec-from-bundle':
PipelineSpecFromBundle (others absent/never); update any callers that construct
PipelineDefinition to use the single correct variant and adjust type checks to
narrow the union when reading the property.

@codecov
Copy link

codecov bot commented Feb 18, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 86.65%. Comparing base (d8a8dde) to head (0fae599).

Additional details and impacted files

Impacted file tree graph

@@            Coverage Diff             @@
##             main     #712      +/-   ##
==========================================
- Coverage   87.12%   86.65%   -0.47%     
==========================================
  Files         764      764              
  Lines       58225    58313      +88     
  Branches     5658     5658              
==========================================
- Hits        50727    50531     -196     
- Misses       7430     7605     +175     
- Partials       68      177     +109     
Flag Coverage Δ
e2e 43.24% <ø> (-0.93%) ⬇️
unittests 85.82% <100.00%> (+0.02%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

Files with missing lines Coverage Δ
src/types/component.ts 100.00% <100.00%> (ø)

... and 90 files with indirect coverage changes


Continue to review full report in Codecov by Sentry.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update d8a8dde...0fae599. Read the comment docs.

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

Comment on lines +117 to 145
export type ComponentVersionStatus = {
'configuration-merge-url'?: string;
message?: string;
name?: string;
'onboarding-status'?: string;
'onboarding-time'?: string;
revision?: string;
'skip-builds'?: boolean;
};

export type ComponentStatus = {
/** @deprecated Will be removed when we remove old component model */
lastPromotedImage?: string;
containerImage?: string;
conditions?: ResourceStatusCondition[];
/** @deprecated Will be removed when we remove old component model */
devfile?: string;
/** @deprecated Will be removed when we remove old component model */
gitops?: { repositoryURL?: string; branch?: string; context?: string; commitID?: string };
/** @deprecated Will be removed when we remove old component model */
webhook?: string;
/** @deprecated Will be removed when we remove old component model */
[NudgeStats.NUDGED_BY]?: string[];

'repository-settings'?: RepositorySettings;
message?: string;
'pac-repository'?: string;
versions?: ComponentVersionStatus[]; // When version is removed from the spec, remove it from the status.
};
Copy link
Member

Choose a reason for hiding this comment

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

Shouldn't all properties here be required? Also ComponentStatus differs from go file, I'm not sure where these properties came from

Copy link
Member

Choose a reason for hiding this comment

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

Otherwise LGTM

Copy link
Member Author

Choose a reason for hiding this comment

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

These properties have omitempty option next to them, so I don't think they should be required.

I mostly just moved the existing status properies into a separate type for better readability, adding just the last four on lines 141-144. However, comparing it against the ComponentStatus in the go file, it seems to match, apart from missing one prop LastBuildCommit, is that what you meant? I think it's fine to leave it out as we apparently didn't use it before and it set to be removed in the future.

Copy link
Member

@rrosatti rrosatti left a comment

Choose a reason for hiding this comment

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

LGTM

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