Skip to content

use iacFileType from core schema #728

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Apr 21, 2025
Merged

Conversation

mrmerlin320
Copy link
Contributor

Description

This PR fixes #

Notes for Reviewers

Signed commits

  • Yes, I signed my commits.

Copy link
Contributor

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

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

Hello @mrmerlin320, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!

Summary of Changes

This pull request addresses an issue related to file identification by updating the Type field in the IdentifiedFile struct and the keys in the identificationErrorsTrace map to use the IaCFileTypes enum from the coreV1 schema. This change ensures consistency and leverages the core schema for defining Infrastructure-as-Code file types.

Highlights

  • File Identification: The pull request modifies the IdentifiedFile struct to use coreV1.IaCFileTypes for the Type field, providing a standardized way to represent file types.
  • Error Tracking: The identificationErrorsTrace map is updated to use coreV1.IaCFileTypes as keys, ensuring that file identification errors are tracked using the core schema's enum.
  • Dependency Update: The go.mod and go.sum files are updated to reflect the new version of meshery/schemas and other dependencies.

Changelog

Click here to see the changelog
  • files/error.go
    • Imported coreV1 from github.com/meshery/schemas/models/v1alpha1/core.
    • Updated the identificationTrace parameter type in ErrFailedToIdentifyFile to use map[coreV1.IaCFileTypes]error.
  • files/identification.go
    • Imported coreV1 from github.com/meshery/schemas/models/v1alpha1/core.
    • Changed the type of Type field in IdentifiedFile struct to coreV1.IaCFileTypes.
    • Updated the identificationErrorsTrace map to use map[coreV1.IaCFileTypes]error.
    • Replaced string literals for file types with corresponding coreV1.IaCFileTypes enum values (e.g., core.IacFileTypes.MESHERY_DESIGN to coreV1.MesheryDesign).
  • files/tests/sanitization_test.go
    • Imported coreV1 from github.com/meshery/schemas/models/v1alpha1/core.
    • Changed the type of expectedType field in test cases to coreV1.IaCFileTypes.
    • Updated the expected file types in test cases to use coreV1.IaCFileTypes enum values.
  • go.mod
    • Updated github.com/meshery/schemas dependency from v0.8.11 to v0.8.14.
    • Updated golang.org/x/sync from v0.11.0 to v0.12.0.
    • Updated golang.org/x/text from v0.22.0 to v0.23.0.
    • Updated golang.org/x/crypto from v0.35.0 to v0.36.0.
    • Updated golang.org/x/net from v0.36.0 to v0.38.0.
    • Updated golang.org/x/sys from v0.30.0 to v0.31.0.
    • Updated golang.org/x/term from v0.29.0 to v0.30.0.
  • go.sum
    • Updated checksums for the dependencies.
Using Gemini Code Assist

The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.

Invoking Gemini

You can request assistance from Gemini at any point in your pull request via creating an issue comment (i.e. comment on the pull request page) using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in issue comments and review comments.
Help /gemini help Displays a list of available commands.

Customization

To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.

Limitations & Feedback

Gemini Code Assist is currently in preview and may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments to provide feedback.

You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension.


A schema's embrace,
Types align, code finds its place,
Consistency blooms.

Footnotes

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

Copy link
Contributor

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

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

Code Review

This PR aims to use iacFileType from the core schema, enhancing type safety and consistency across the codebase. The changes look good overall, but there are a few areas where improvements can be made to ensure correctness and maintainability.

Summary of Findings

  • Incorrect Kubernetes Manifest Type: In the TestSanitizeFile function, the expectedType for Kubernetes manifests is incorrectly set to coreV1.MesheryDesign. This needs to be corrected to coreV1.K8sManifest to ensure the tests accurately reflect the expected behavior.
  • Dependency Updates: The go.mod and go.sum files have been updated with new versions of dependencies. It's important to ensure that these updates don't introduce any breaking changes or security vulnerabilities.

Merge Readiness

The pull request is almost ready for merging. However, the incorrect Kubernetes manifest type in the test cases needs to be addressed to ensure the tests are accurate. Additionally, it's crucial to verify that the dependency updates don't introduce any issues. I am unable to approve this pull request, and users should have others review and approve this code before merging. I would recommend addressing these before merging.

aabidsofi19 and others added 2 commits April 21, 2025 14:17
Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com>
Signed-off-by: aabidsofi19 <[email protected]>
Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com>
Signed-off-by: aabidsofi19 <[email protected]>
@aabidsofi19 aabidsofi19 merged commit 9c4653c into meshery:master Apr 21, 2025
2 of 4 checks passed
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