Skip to content

Update to latest API event types#325

Merged
celdrake merged 1 commit into
flightctl:mainfrom
celdrake:new-event-types
Jul 11, 2025
Merged

Update to latest API event types#325
celdrake merged 1 commit into
flightctl:mainfrom
celdrake:new-event-types

Conversation

@celdrake

@celdrake celdrake commented Jul 9, 2025

Copy link
Copy Markdown
Collaborator

Adds the latest event reasons from main as well from the branch adding internal tasks events.

Summary by CodeRabbit

  • New Features

    • Added new event types and status messages related to device ownership, enrollment requests, internal task failures, repository accessibility, and fleet processing.
    • Enhanced event detail handling for device and fleet operations, including conflict detection and resolution.
    • Expanded event reason titles for improved clarity in event displays.
  • Bug Fixes

    • Corrected a formatting issue in a device memory warning message.

@coderabbitai

coderabbitai Bot commented Jul 9, 2025

Copy link
Copy Markdown

Walkthrough

This update introduces new event reason types, corresponding detail types, and translation entries related to device ownership, fleet operations, internal task failures, and repository status. It expands the event model, augments exported types, and updates UI mapping for event titles, with minor corrections to existing translation keys.

Changes

File(s) Change Summary
libs/i18n/locales/en/translation.json Added translation entries for new event reasons and statuses; fixed whitespace in an existing key.
libs/types/index.ts Exported new types and values for device ownership, internal task failures, and fleet selector processing.
libs/types/models/DeviceMultipleOwnersDetectedDetails.ts Added new type for device multiple owners detected event details.
libs/types/models/DeviceMultipleOwnersResolvedDetails.ts Added new type and enum for device multiple owners resolved event details.
libs/types/models/DeviceOwnershipChangedDetails.ts Added new type for device ownership changed event details.
libs/types/models/FleetSelectorProcessingCompletedDetails.ts Added new type and enum for fleet selector processing completed event details.
libs/types/models/InternalTaskFailedDetails.ts Added new type for internal task failed event details.
libs/types/models/ResourceUpdatedDetails.ts Added discriminator property detailType to resource updated event details.
libs/types/models/Event.ts Extended Event.reason enum with new event reasons for device, fleet, internal, and repository events.
libs/types/models/EventDetails.ts Expanded EventDetails type to a union of new event detail types.
libs/ui-components/src/components/Events/useEvents.ts Added mappings for new event reasons to titles; fixed whitespace in a device memory warning title.

Sequence Diagram(s)

sequenceDiagram
    participant System
    participant EventModel
    participant UI
    participant i18n

    System->>EventModel: Emit event with new reason (e.g., DEVICE_OWNERSHIP_CHANGED)
    EventModel->>UI: Pass event details (including new detail types)
    UI->>i18n: Lookup translation for event reason
    i18n-->>UI: Return localized title
    UI-->>User: Display event with correct title and details
Loading

Possibly related PRs

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-07-09T07_54_57_334Z-debug-0.log

✨ 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: 0

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

23-25: Specify the unit/format of processingDuration
processingDuration is a plain string; without a contract (e.g. ISO-8601 duration, milliseconds) consumers can’t reliably parse or sort this value. Consider tightening the type to something like DurationISO8601 or at least documenting the expected format in the comment.

📜 Review details

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

📥 Commits

Reviewing files that changed from the base of the PR and between 70a520c and 9f4e498.

📒 Files selected for processing (11)
  • libs/i18n/locales/en/translation.json (2 hunks)
  • libs/types/index.ts (3 hunks)
  • libs/types/models/DeviceMultipleOwnersDetectedDetails.ts (1 hunks)
  • libs/types/models/DeviceMultipleOwnersResolvedDetails.ts (1 hunks)
  • libs/types/models/DeviceOwnershipChangedDetails.ts (1 hunks)
  • libs/types/models/Event.ts (2 hunks)
  • libs/types/models/EventDetails.ts (1 hunks)
  • libs/types/models/FleetSelectorProcessingCompletedDetails.ts (1 hunks)
  • libs/types/models/InternalTaskFailedDetails.ts (1 hunks)
  • libs/types/models/ResourceUpdatedDetails.ts (1 hunks)
  • libs/ui-components/src/components/Events/useEvents.ts (2 hunks)
🧰 Additional context used
🧠 Learnings (3)
libs/i18n/locales/en/translation.json (2)
Learnt from: celdrake
PR: flightctl/flightctl-ui#207
File: libs/ui-components/src/components/Device/EditDeviceWizard/steps/ReviewDeviceStep.tsx:55-55
Timestamp: 2025-02-04T09:04:36.106Z
Learning: The codebase has automated CI checks ("lint" step) that verify translation coverage for all text strings, ensuring that new or modified strings have corresponding entries in translation files.
Learnt from: celdrake
PR: flightctl/flightctl-ui#201
File: libs/i18n/locales/en/translation.json:67-67
Timestamp: 2025-01-24T11:50:31.860Z
Learning: In translation JSON files, it's valid and common to have identical key-value pairs when the text is a plain string without variables or special formatting.
libs/types/models/FleetSelectorProcessingCompletedDetails.ts (2)
Learnt from: celdrake
PR: flightctl/flightctl-ui#227
File: libs/ui-components/src/components/Device/EditDeviceWizard/EditDeviceWizard.tsx:87-87
Timestamp: 2025-03-12T09:09:44.139Z
Learning: The `getUpdatePolicyValues` function in libs/ui-components/src/components/Fleet/CreateFleet/fleetSpecUtils.ts is designed to handle undefined input through its optional parameter definition and consistent use of optional chaining.
Learnt from: celdrake
PR: flightctl/flightctl-ui#227
File: libs/ui-components/src/components/Device/EditDeviceWizard/EditDeviceWizard.tsx:87-87
Timestamp: 2025-03-12T09:09:44.139Z
Learning: The `getUpdatePolicyValues` function in libs/ui-components/src/components/Fleet/CreateFleet/fleetSpecUtils.ts is designed to safely handle undefined values for the updatePolicy parameter.
libs/types/index.ts (4)
Learnt from: celdrake
PR: flightctl/flightctl-ui#0
File: :0-0
Timestamp: 2025-02-17T08:41:57.993Z
Learning: All files in `libs/types/models` are auto-generated using OpenAPI Generator from the schema defined in https://github.com/flightctl/flightctl/blob/main/api/v1alpha1/openapi.yaml. Changes to these files should be made in the schema instead of modifying the generated files directly.
Learnt from: celdrake
PR: flightctl/flightctl-ui#240
File: libs/types/models/FileSpec.ts:8-8
Timestamp: 2025-03-20T12:34:33.199Z
Learning: Files in the types directory are autogenerated from the OpenAPI spec in the flightctl project and should not be directly modified.
Learnt from: celdrake
PR: flightctl/flightctl-ui#227
File: libs/ui-components/src/components/Device/EditDeviceWizard/EditDeviceWizard.tsx:87-87
Timestamp: 2025-03-12T09:09:44.139Z
Learning: The `getUpdatePolicyValues` function in libs/ui-components/src/components/Fleet/CreateFleet/fleetSpecUtils.ts is designed to handle undefined input through its optional parameter definition and consistent use of optional chaining.
Learnt from: celdrake
PR: flightctl/flightctl-ui#227
File: libs/ui-components/src/components/Device/EditDeviceWizard/EditDeviceWizard.tsx:87-87
Timestamp: 2025-03-12T09:09:44.139Z
Learning: The `getUpdatePolicyValues` function in libs/ui-components/src/components/Fleet/CreateFleet/fleetSpecUtils.ts is designed to safely handle undefined values for the updatePolicy parameter.
🧬 Code Graph Analysis (5)
libs/types/models/InternalTaskFailedDetails.ts (1)
libs/types/index.ts (1)
  • InternalTaskFailedDetails (103-103)
libs/types/models/EventDetails.ts (6)
libs/types/models/ResourceUpdatedDetails.ts (1)
  • ResourceUpdatedDetails (5-22)
libs/types/models/DeviceOwnershipChangedDetails.ts (1)
  • DeviceOwnershipChangedDetails (5-18)
libs/types/models/DeviceMultipleOwnersDetectedDetails.ts (1)
  • DeviceMultipleOwnersDetectedDetails (5-14)
libs/types/models/DeviceMultipleOwnersResolvedDetails.ts (1)
  • DeviceMultipleOwnersResolvedDetails (5-22)
libs/types/models/InternalTaskFailedDetails.ts (1)
  • InternalTaskFailedDetails (5-26)
libs/types/models/FleetSelectorProcessingCompletedDetails.ts (1)
  • FleetSelectorProcessingCompletedDetails (5-26)
libs/ui-components/src/components/Events/useEvents.ts (1)
libs/types/models/Event.ts (1)
  • Event (9-38)
libs/types/models/DeviceMultipleOwnersDetectedDetails.ts (1)
libs/types/index.ts (1)
  • DeviceMultipleOwnersDetectedDetails (43-43)
libs/types/models/DeviceMultipleOwnersResolvedDetails.ts (1)
libs/types/index.ts (1)
  • DeviceMultipleOwnersResolvedDetails (44-44)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (4)
  • GitHub Check: integration-tests
  • GitHub Check: Build
  • GitHub Check: Build ocp plugin
  • GitHub Check: Lint
🔇 Additional comments (20)
libs/types/models/ResourceUpdatedDetails.ts (1)

6-9: LGTM! Discriminator property added correctly.

The addition of the detailType discriminator property is well-implemented and follows TypeScript best practices for union type discrimination. The string literal type and documentation are appropriate.

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

1-16: LGTM! Well-structured type definition.

The DeviceMultipleOwnersDetectedDetails type is properly defined with:

  • Appropriate discriminator property for type safety
  • Clear documentation for each property
  • Correct TypeScript typing with Array<string> for fleet names
libs/i18n/locales/en/translation.json (3)

331-331: LGTM! New translation entry added.

The translation entry for "Git resource change detected" is appropriate and follows the established pattern.


338-338: Good cleanup of trailing space.

Minor formatting improvement by removing the trailing space from the translation key.


351-363: LGTM! Comprehensive event reason translations added.

All new translation entries are well-written and provide clear, user-friendly descriptions for the various event reasons related to:

  • Device ownership conflicts and changes
  • Device specification validation
  • Enrollment request outcomes
  • Internal task failures
  • Repository accessibility
  • Fleet reconciliation status

The translations align well with the new event detail types being introduced.

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

1-20: LGTM! Well-designed ownership change type.

The DeviceOwnershipChangedDetails type is properly structured with:

  • Appropriate discriminator property for type safety
  • Optional properties that correctly handle ownership scenarios (string | null)
  • Clear documentation explaining the purpose of each property
  • Proper handling of cases where no previous owner exists or ownership is removed
libs/types/models/InternalTaskFailedDetails.ts (1)

1-28: LGTM! Comprehensive internal task failure type.

The InternalTaskFailedDetails type is well-designed with:

  • Proper discriminator property for type safety
  • Required properties (taskType, errorMessage) for essential failure information
  • Optional properties (retryCount, taskParameters) for additional context
  • Appropriate use of Record<string, string> for task parameters
  • Clear documentation for all properties

The type provides good flexibility for representing various internal task failure scenarios.

libs/ui-components/src/components/Events/useEvents.ts (4)

46-53: Well-structured event reason mappings for resource and Git events.

The additions follow the existing pattern and provide comprehensive coverage for the new event types. The GIT_RESOURCE_CHANGE_DETECTED mapping is properly integrated with the existing resource event mappings.


54-83: Comprehensive device event mappings with good categorization.

The device-related event mappings are well-organized and cover ownership conflicts, specification validity, and enrollment scenarios. The categorization with comments enhances readability.


84-90: Complete coverage of internal task, repository, and fleet events.

The mappings for internal task failures, repository accessibility, and fleet operations provide good coverage of the new event types. The human-readable descriptions are clear and actionable.


61-61: Minor whitespace fix applied correctly.

The whitespace correction in the DEVICE_MEMORY_WARNING mapping maintains consistency with the translation structure.

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

5-14: Properly expanded EventDetails union type with comprehensive imports.

The union type expansion correctly incorporates the new event detail types, and the imports are properly structured. Since this is an auto-generated file from the OpenAPI schema, the structure follows the expected pattern for discriminated unions.

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

50-83: Comprehensive Event.reason enum extension with proper categorization.

The enum extension covers all the new event types systematically:

  • Git resource detection
  • Device ownership and specification events
  • Enrollment request events
  • Internal task failures
  • Repository accessibility states
  • Fleet operations

The values align correctly with the UI mappings in useEvents.ts, ensuring consistency across the type system and user interface.

libs/types/index.ts (3)

43-47: Proper type exports for device ownership event details.

The exports correctly expose the new device ownership-related types, with DeviceMultipleOwnersDetectedDetails and DeviceOwnershipChangedDetails as type exports, and DeviceMultipleOwnersResolvedDetails as a value export (including the enum).


84-84: Appropriate value export for fleet selector processing details.

The FleetSelectorProcessingCompletedDetails value export properly exposes the type and its associated enum for fleet processing events.


103-103: Correctly positioned internal task failure details export.

The InternalTaskFailedDetails type export is properly positioned and maintains the alphabetical ordering of the exports.

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

5-22: Well-structured discriminated union type for device ownership resolution.

The type definition properly implements the discriminated union pattern with:

  • A fixed detailType discriminator for type safety
  • Required resolutionType enum for resolution method
  • Optional nullable assignedOwner for the final owner
  • Optional previousMatchingFleets array for audit trail

This structure provides comprehensive information about ownership conflict resolution while maintaining type safety.


23-32: Comprehensive resolution type enum with clear semantics.

The resolutionType enum covers the key resolution scenarios:

  • SINGLE_MATCH: One fleet matched after conflict resolution
  • NO_MATCH: No fleets matched after resolution
  • FLEET_DELETED: Conflict resolved by fleet deletion

The enum values are self-documenting and cover the expected resolution pathways.

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

5-26: Well-structured discriminator & mandatory fields
The type cleanly follows the “discriminator + detail payload” pattern used elsewhere and covers all required attributes.


31-35: Double-check enum string literals with backend contract
The enum exports 'SelectorUpdated' | 'FleetDeleted' | 'DeviceLabelsUpdated'. Make sure these exact Pascal-case literals are emitted by the API; any mismatch (e.g. snake-case or different capitalisation) will break client-side narrow typing.

@celdrake celdrake merged commit c0df0fb into flightctl:main Jul 11, 2025
6 checks passed
@celdrake celdrake deleted the new-event-types branch July 11, 2025 09:31
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