Skip to content

EDM-1497: Update API types for Application volumes and Events#308

Merged
rawagner merged 2 commits into
flightctl:mainfrom
celdrake:EDM-1497-api-types-for-application-volumes
Jun 19, 2025
Merged

EDM-1497: Update API types for Application volumes and Events#308
rawagner merged 2 commits into
flightctl:mainfrom
celdrake:EDM-1497-api-types-for-application-volumes

Conversation

@celdrake

@celdrake celdrake commented Jun 3, 2025

Copy link
Copy Markdown
Collaborator

Summary by CodeRabbit

  • New Features
    • Introduced new types and enums for managing application and image volumes, including support for specifying volume providers, statuses, and image pull policies.
  • Improvements
    • Enhanced existing types to include volume-related properties, enabling more comprehensive volume management for applications.
    • Added new device lifecycle, resource status, application health, connectivity, and content update event reasons with corresponding localized messages.

@coderabbitai

coderabbitai Bot commented Jun 3, 2025

Copy link
Copy Markdown

"""

Walkthrough

The changes introduce new type definitions and enums related to application and image volumes, and update several existing types to support volume specifications and statuses. Types are extended or intersected to include volume-related properties, and new exports are added to the central types index. Some files receive only documentation or comment updates. Additionally, new event reasons and corresponding translations for device lifecycle and status notifications are added.

Changes

File(s) Change Summary
libs/types/index.ts Exported new types and enum: ApplicationVolume, ApplicationVolumeProviderSpec, ApplicationVolumeStatus, ImagePullPolicy, ImageVolumeProviderSpec, ImageVolumeSource.
libs/types/models/ApplicationVolume.ts Added new type alias ApplicationVolume with required name and extending ImageVolumeProviderSpec.
libs/types/models/ApplicationVolumeProviderSpec.ts Added new type alias ApplicationVolumeProviderSpec with optional volumes array of ApplicationVolume.
libs/types/models/ApplicationVolumeStatus.ts Added new type alias ApplicationVolumeStatus with required name and reference string properties.
libs/types/models/DeviceApplicationStatus.ts Added optional volumes property (array of ApplicationVolumeStatus) to DeviceApplicationStatus.
libs/types/models/ImageApplicationProviderSpec.ts Updated ImageApplicationProviderSpec to be intersection of ApplicationVolumeProviderSpec and { image: string }.
libs/types/models/ImagePullPolicy.ts Added new enum ImagePullPolicy with three string literal members.
libs/types/models/ImageVolumeProviderSpec.ts Added new type alias ImageVolumeProviderSpec with property image: ImageVolumeSource.
libs/types/models/ImageVolumeSource.ts Added new type ImageVolumeSource with reference and optional pullPolicy.
libs/types/models/InlineApplicationProviderSpec.ts Updated InlineApplicationProviderSpec to be intersection of ApplicationVolumeProviderSpec and { inline: Array<ApplicationContent> }.
libs/types/models/Event.ts Extended Event.reason enum with new device lifecycle, resource status, application health, connectivity, and content update reasons.
libs/ui-components/src/components/Device/EditDeviceWizard/deviceSpecUtils.ts Added a TODO comment regarding retaining existing "volumes" in toAPIApplication function.
libs/ui-components/src/components/Events/useEvents.ts Extended getEventReasonTitles with new device-related event reason mappings to localized strings.
libs/ui-components/src/types/extraTypes.ts Updated ApplicationProviderSpecFixed to intersect with ApplicationVolumeProviderSpec; updated import.
libs/i18n/locales/en/translation.json Added new English translation strings for device lifecycle events, resource status, application health, connectivity, and update states.

Sequence Diagram(s)

sequenceDiagram
    participant User
    participant UI
    participant Types
    participant API

    User->>UI: Edit or create application/device spec
    UI->>Types: Use ApplicationProviderSpecFixed (now includes volume provider spec)
    UI->>API: Submit application/device spec (with volume info)
    API->>Types: Reference ApplicationVolume*, ImageVolume* types for validation/status
    API-->>UI: Respond with DeviceApplicationStatus (now includes volumes status)
Loading

Suggested reviewers

  • rawagner
    """

Warning

There were issues while running some tools. Please review the errors and either fix the tool's configuration or disable the tool if it's a critical failure.

🔧 ESLint

If the error stems from missing dependencies, add them to the package.json file. For unrecoverable errors (e.g., due to private dependencies), disable the tool in the CodeRabbit configuration.

npm error Exit handler never called!
npm error This is an error with npm itself. Please report this error at:
npm error https://github.com/npm/cli/issues
npm error A complete log of this run can be found in: /.npm/_logs/2025-06-18T16_44_15_365Z-debug-0.log


📜 Recent review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 285d257 and 800ff64.

📒 Files selected for processing (15)
  • libs/i18n/locales/en/translation.json (1 hunks)
  • libs/types/index.ts (2 hunks)
  • libs/types/models/ApplicationVolume.ts (1 hunks)
  • libs/types/models/ApplicationVolumeProviderSpec.ts (1 hunks)
  • libs/types/models/ApplicationVolumeStatus.ts (1 hunks)
  • libs/types/models/DeviceApplicationStatus.ts (2 hunks)
  • libs/types/models/Event.ts (1 hunks)
  • libs/types/models/ImageApplicationProviderSpec.ts (1 hunks)
  • libs/types/models/ImagePullPolicy.ts (1 hunks)
  • libs/types/models/ImageVolumeProviderSpec.ts (1 hunks)
  • libs/types/models/ImageVolumeSource.ts (1 hunks)
  • libs/types/models/InlineApplicationProviderSpec.ts (1 hunks)
  • libs/ui-components/src/components/Device/EditDeviceWizard/deviceSpecUtils.ts (1 hunks)
  • libs/ui-components/src/components/Events/useEvents.ts (1 hunks)
  • libs/ui-components/src/types/extraTypes.ts (2 hunks)
🚧 Files skipped from review as they are similar to previous changes (15)
  • libs/ui-components/src/components/Device/EditDeviceWizard/deviceSpecUtils.ts
  • libs/types/models/ApplicationVolumeProviderSpec.ts
  • libs/types/models/ImageVolumeProviderSpec.ts
  • libs/types/models/DeviceApplicationStatus.ts
  • libs/types/models/ImageApplicationProviderSpec.ts
  • libs/types/models/ApplicationVolumeStatus.ts
  • libs/types/models/ApplicationVolume.ts
  • libs/i18n/locales/en/translation.json
  • libs/types/models/ImageVolumeSource.ts
  • libs/ui-components/src/components/Events/useEvents.ts
  • libs/types/index.ts
  • libs/types/models/Event.ts
  • libs/types/models/ImagePullPolicy.ts
  • libs/types/models/InlineApplicationProviderSpec.ts
  • libs/ui-components/src/types/extraTypes.ts
⏰ Context from checks skipped due to timeout of 90000ms (4)
  • GitHub Check: integration-tests
  • GitHub Check: Build
  • GitHub Check: Build ocp plugin
  • GitHub Check: Lint
✨ Finishing Touches
  • 📝 Generate Docstrings

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
🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Explain this complex logic.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai explain this code block.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and explain its main purpose.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Support

Need help? Create a ticket on our support page for assistance with any issues or questions.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (Invoked using PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai generate docstrings to generate docstrings for this PR.
  • @coderabbitai generate sequence diagram to generate a sequence diagram of the changes in this PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • 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

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

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

Actionable comments posted: 1

🧹 Nitpick comments (1)
libs/types/models/ApplicationVolumeStatus.ts (1)

8-13: Consider if additional status fields will be needed.

The ApplicationVolumeStatus type currently only includes a name field. For a status type, you might want to consider if additional fields will be needed such as:

  • Volume state/phase (e.g., "pending", "bound", "available")
  • Error messages for failed volumes
  • Capacity information
  • Mount status

Since this is auto-generated code, any additions would need to be made in the OpenAPI specification.

📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between baf55b8 and 62dc126.

📒 Files selected for processing (12)
  • libs/types/index.ts (2 hunks)
  • libs/types/models/ApplicationVolume.ts (1 hunks)
  • libs/types/models/ApplicationVolumeProviderSpec.ts (1 hunks)
  • libs/types/models/ApplicationVolumeStatus.ts (1 hunks)
  • libs/types/models/DeviceApplicationStatus.ts (2 hunks)
  • libs/types/models/ImageApplicationProviderSpec.ts (1 hunks)
  • libs/types/models/ImagePullPolicy.ts (1 hunks)
  • libs/types/models/ImageVolumeProviderSpec.ts (1 hunks)
  • libs/types/models/ImageVolumeSource.ts (1 hunks)
  • libs/types/models/InlineApplicationProviderSpec.ts (1 hunks)
  • libs/ui-components/src/components/Device/EditDeviceWizard/deviceSpecUtils.ts (1 hunks)
  • libs/ui-components/src/types/extraTypes.ts (2 hunks)
🧰 Additional context used
🧬 Code Graph Analysis (7)
libs/types/models/ApplicationVolumeProviderSpec.ts (1)
libs/types/models/ApplicationVolume.ts (1)
  • ApplicationVolume (6-11)
libs/types/models/ImageApplicationProviderSpec.ts (1)
libs/types/models/ApplicationVolumeProviderSpec.ts (1)
  • ApplicationVolumeProviderSpec (6-11)
libs/types/models/ApplicationVolume.ts (2)
libs/types/index.ts (2)
  • ApplicationVolume (12-12)
  • ImageVolumeProviderSpec (95-95)
libs/types/models/ImageVolumeProviderSpec.ts (1)
  • ImageVolumeProviderSpec (6-12)
libs/ui-components/src/types/extraTypes.ts (2)
libs/types/models/ApplicationVolumeProviderSpec.ts (1)
  • ApplicationVolumeProviderSpec (6-11)
libs/types/models/ImageApplicationProviderSpec.ts (1)
  • ImageApplicationProviderSpec (6-11)
libs/types/models/InlineApplicationProviderSpec.ts (2)
libs/types/models/ApplicationVolumeProviderSpec.ts (1)
  • ApplicationVolumeProviderSpec (6-11)
libs/types/models/ApplicationContent.ts (1)
  • ApplicationContent (7-7)
libs/types/models/ImageVolumeProviderSpec.ts (2)
libs/types/index.ts (2)
  • ImageVolumeProviderSpec (95-95)
  • ImageVolumeSource (96-96)
libs/types/models/ImageVolumeSource.ts (1)
  • ImageVolumeSource (9-15)
libs/types/models/DeviceApplicationStatus.ts (1)
libs/types/models/ApplicationVolumeStatus.ts (1)
  • ApplicationVolumeStatus (8-13)
⏰ Context from checks skipped due to timeout of 90000ms (1)
  • GitHub Check: integration-tests
🔇 Additional comments (14)
libs/types/models/DeviceApplicationStatus.ts (2)

6-6: LGTM! Clean import addition.

The import statement is correctly added to support the new volumes property.


21-24: LGTM! Well-designed optional property.

The addition of the optional volumes property is well-implemented:

  • Uses optional syntax for backward compatibility
  • Proper TypeScript array typing
  • Clear documentation comments
libs/types/models/ApplicationVolumeProviderSpec.ts (1)

5-11: LGTM! Well-structured provider spec type.

The ApplicationVolumeProviderSpec type is well-implemented:

  • Proper import of the ApplicationVolume dependency
  • Optional array property for backward compatibility
  • Clear documentation
  • Follows the established pattern for provider specifications

The type correctly references ApplicationVolume which extends ImageVolumeProviderSpec (as shown in the relevant code snippets), maintaining a clean type hierarchy.

libs/types/models/ApplicationVolume.ts (1)

6-11: LGTM! Well-structured type definition.

The ApplicationVolume type correctly uses intersection to extend ImageVolumeProviderSpec with an optional name property. The type design provides flexibility for volume naming while inheriting all image volume provider capabilities.

libs/types/models/ImageVolumeProviderSpec.ts (1)

6-12: LGTM! Clear and well-documented type definition.

The ImageVolumeProviderSpec type is properly structured with required image and name properties. The JSDoc comment clearly explains the purpose of the name field, and the type design appropriately models a volume populated by image contents.

libs/types/models/ImageVolumeSource.ts (1)

6-15: LGTM! Excellent type definition with comprehensive documentation.

The ImageVolumeSource type is well-designed with clear documentation explaining OCI compliance requirements. The combination of required reference and optional pullPolicy provides the right balance of mandatory and flexible configuration options for image sources.

libs/types/models/ImageApplicationProviderSpec.ts (1)

5-11: LGTM! Proper integration of volume capabilities.

The modification correctly extends ImageApplicationProviderSpec by intersecting with ApplicationVolumeProviderSpec, which adds volume support while preserving the existing image property. This change aligns perfectly with the PR objectives to integrate application volumes into provider specifications.

libs/types/models/ImagePullPolicy.ts (1)

8-12: LGTM! Well-structured enum definition.

The ImagePullPolicy enum follows standard Kubernetes conventions with clear documentation. The three values (Always, IfNotPresent, Never) align with expected image pull behaviors, and the JSDoc comment properly explains the default policy and each option's behavior.

libs/types/models/InlineApplicationProviderSpec.ts (2)

6-6: Proper import addition for type extension.

The import of ApplicationVolumeProviderSpec is correctly added to support the intersection type definition.


7-12:

Details

✅ Verification successful

LGTM! Clean intersection type extension.

The change from a simple object type to an intersection type that combines ApplicationVolumeProviderSpec with the existing inline content specification is well-designed. This approach:

  • Maintains backward compatibility for existing inline usage
  • Adds volume support through the intersection with ApplicationVolumeProviderSpec
  • Follows the consistent pattern used in other provider specs

Verify that existing usage of InlineApplicationProviderSpec across the codebase continues to work with this intersection type:


🏁 Script executed:

#!/bin/bash
# Description: Check usage of InlineApplicationProviderSpec to ensure compatibility with intersection type change

# Search for usages of InlineApplicationProviderSpec
rg -A 5 "InlineApplicationProviderSpec" --type ts

# Look for any type assertions or casts that might be affected
rg -A 3 "as InlineApplicationProviderSpec|<InlineApplicationProviderSpec>" --type ts

Length of output: 4372


✅ InlineApplicationProviderSpec usage verified

I searched the codebase for all references to InlineApplicationProviderSpec and confirmed:

  • References in
    libs/ui-components/src/types/deviceSpec.ts
    libs/ui-components/src/components/Device/EditDeviceWizard/deviceSpecUtils.ts
    libs/types/index.ts
    libs/types/models/ApplicationProviderSpec.ts
  • No type assertions or casts (as InlineApplicationProviderSpec or <InlineApplicationProviderSpec>) were found.

The intersection change maintains full compatibility with existing usages. LGTM!

libs/ui-components/src/types/extraTypes.ts (2)

4-4: Proper import addition.

The import of ApplicationVolumeProviderSpec is correctly added to support the extended type definition.


71-75: LGTM! Consistent type extension for volume support.

The extension of ApplicationProviderSpecFixed to include ApplicationVolumeProviderSpec in the intersection is well-implemented. This change:

  • Maintains all existing properties (ApplicationEnvVars, name, appType)
  • Adds volume support through ApplicationVolumeProviderSpec
  • Preserves the union with ImageApplicationProviderSpec or inline files
  • Follows the consistent pattern used across other provider spec types

The intersection type approach ensures backward compatibility while adding the new volume functionality.

libs/types/index.ts (2)

12-14: LGTM! Properly added application volume type exports.

The new exports for ApplicationVolume, ApplicationVolumeProviderSpec, and ApplicationVolumeStatus are correctly added with proper export type syntax and maintain alphabetical ordering.


94-96:

Details

✅ Verification successful

LGTM! Correctly added image volume exports.

The exports for ImagePullPolicy (enum), ImageVolumeProviderSpec, and ImageVolumeSource are properly structured:

  • ImagePullPolicy correctly uses export (not export type) since it's an enum
  • Type exports use appropriate export type syntax
  • Maintains alphabetical ordering within the section

Verify that all newly exported types have corresponding implementation files:


🏁 Script executed:

#!/bin/bash
# Description: Verify that all newly exported volume-related types have corresponding model files

# Check for the existence of model files for new exports
echo "Checking for model files..."
for type in "ApplicationVolume" "ApplicationVolumeProviderSpec" "ApplicationVolumeStatus" "ImagePullPolicy" "ImageVolumeProviderSpec" "ImageVolumeSource"; do
  if [ -f "libs/types/models/${type}.ts" ]; then
    echo "${type}.ts exists"
  else
    echo "${type}.ts missing"
  fi
done

Length of output: 1792


✅ All new exports verified and correctly implemented

  • Confirmed that the following model files exist under libs/types/models:
    • ImagePullPolicy.ts
    • ImageVolumeProviderSpec.ts
    • ImageVolumeSource.ts
  • Export syntax (export for enum, export type for types) and alphabetical ordering are correct.

LGTM!

@celdrake celdrake force-pushed the EDM-1497-api-types-for-application-volumes branch from 62dc126 to 4248f46 Compare June 4, 2025 06:39
@celdrake celdrake force-pushed the EDM-1497-api-types-for-application-volumes branch 4 times, most recently from 1b14c05 to 285d257 Compare June 17, 2025 06:41
@celdrake celdrake changed the title EDM-1497: Update API types for Application volumes EDM-1497: Update API types for Application volumes and Events Jun 17, 2025
@celdrake celdrake requested a review from rawagner June 17, 2025 06:42
@celdrake celdrake force-pushed the EDM-1497-api-types-for-application-volumes branch from 285d257 to 800ff64 Compare June 18, 2025 16:43
@rawagner rawagner merged commit 5718672 into flightctl:main Jun 19, 2025
6 checks passed
@celdrake celdrake deleted the EDM-1497-api-types-for-application-volumes branch June 19, 2025 08:16
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.

2 participants