Skip to content
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

Create a generic Interpolation plugin #732

Merged
merged 35 commits into from
May 28, 2024
Merged

Create a generic Interpolation plugin #732

merged 35 commits into from
May 28, 2024

Conversation

manushak
Copy link
Contributor

@manushak manushak commented May 21, 2024

Types of changes

  • Enhancement (project structure, spelling, grammar, formatting)
  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change)
  • My code follows the code style of this project.
  • My change requires a change to the documentation.
  • I have updated the documentation accordingly.
  • I have added tests to cover my changes.
  • All new and existing tests passed.

A description of the changes proposed in the Pull Request

  • Create a generic interpolation plugin

@manushak manushak self-assigned this May 21, 2024
@manushak manushak linked an issue May 21, 2024 that may be closed by this pull request
7 tasks
Copy link
Contributor

@jmcook1186 jmcook1186 left a comment

Choose a reason for hiding this comment

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

Hi @manushak
thanks for working on this but it doesn't meet the issue spec. The plugin should be generic, by which I mean it should interpolate any arbitrary data that is passed to it in the way described in the acceptance criteria in the ticket, and not require specific parameters such as vcpus-allocated. Please check the ticket description to see how the plugin should work.

@manushak
Copy link
Contributor Author

Hi @manushak thanks for working on this but it doesn't meet the issue spec. The plugin should be generic, by which I mean it should interpolate any arbitrary data that is passed to it in the way described in the acceptance criteria in the ticket, and not require specific parameters such as vcpus-allocated. Please check the ticket description to see how the plugin should work.

@jmcook1186 I've updated, please review

Copy link
Contributor

@jmcook1186 jmcook1186 left a comment

Choose a reason for hiding this comment

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

Pushed some fixes - now satisfied this works as expected. Added some new validations and updated some error messages for clarity, and added some tests.

@jmcook1186
Copy link
Contributor

over to @narekhovhannisyan for second review

- timestamp: 2023-07-06T00:00
duration: 3600
cpu/utilization: 45
# vcpus-allocated: 4
Copy link
Member

Choose a reason for hiding this comment

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

should they stay commented?

Copy link
Contributor

Choose a reason for hiding this comment

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

no they should get deleted

Copy link
Contributor Author

@manushak manushak May 23, 2024

Choose a reason for hiding this comment

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

thanks for noticing, fixed and the manifest moved to the manifests/plugins folder

@@ -83,21 +83,22 @@ export const manifestSchema = z.object({
* Validates given `manifest` object to match pattern.
*/
export const validateManifest = (manifest: any) =>
validate(manifestSchema, manifest, ManifestValidationError);
validate(manifestSchema, manifest, undefined, ManifestValidationError);
Copy link
Member

Choose a reason for hiding this comment

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

why undefined?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

The validate function is used by the validateManifest function, which is called from plugins too. To avoid creating a new function, I assigned index to undefined here.

Copy link
Member

Choose a reason for hiding this comment

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

in that case either make it last argument, or pass all the info to validate function as a single object

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Both options are not achievable because a plugin calls this version of the validate function: validate<z.infer>(schema, input, index). If we change it to a single object, all plugins will need to be updated accordingly. If we change the order of the arguments, we would need to provide an Error class in every plugin. I hope I have described the situation :)

@jmcook1186 jmcook1186 merged commit 9427cec into main May 28, 2024
2 checks passed
@jmcook1186 jmcook1186 deleted the interpolation-plugin branch May 28, 2024 08:20
This was referenced Jun 11, 2024
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.

Design a generic interpolation plugin
3 participants