Skip to content

fix: Fix wrong package name in domain ids#4973

Merged
keon94 merged 1 commit intoapache:mainfrom
merico-ai:4970_Wrong_package_name_in_domain_ids
Apr 19, 2023
Merged

fix: Fix wrong package name in domain ids#4973
keon94 merged 1 commit intoapache:mainfrom
merico-ai:4970_Wrong_package_name_in_domain_ids

Conversation

@CamilleTeruel
Copy link
Copy Markdown
Contributor

Summary

Fix remotePluginImpl.RootPkgPath that caused the domain id generator to generate wrong plugin names in domain ids..

Does this close any open issues?

Closes #4970

RootPkgPath is used by DomainIdGenerator to find the name of the plugin that defines a given type.
While remote plugins do not use the DomainIdGenerator, we still need to implement this function.
Indeed, DomainIdGenerator uses FindPluginNameBySubPkgPath that returns the name of the first plugin
whose RootPkgPath is a prefix of the type package path.
So remote plugin must not return an empty string as RootPkgPath, but a string that is not a prefix
of any go plugin package path.
// This in turn is only used by DomainIdGenerator.
// Remote plugins define tool layer types in another language,
// so the reflective implementation of NewDomainIdGenerator cannot work.
return ""
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

how was this causing wrong plugin-names to end up in the domain ID?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

DomainIdGenerator uses FindPluginNameBySubPkgPath that returns the name of the first plugin whose RootPkgPath is a prefix of the type package path. So this empty string makes FindPluginNameBySubPkgPath believe all types belong to any remote plugin.

@keon94 keon94 added this to the v0.17.0 milestone Apr 19, 2023
@keon94 keon94 added component/framework This issue or PR relates to the framework component/plugins This issue or PR relates to plugins labels Apr 19, 2023
@keon94
Copy link
Copy Markdown
Contributor

keon94 commented Apr 19, 2023

Lgtm

@keon94 keon94 merged commit 9cb522b into apache:main Apr 19, 2023
@keon94 keon94 deleted the 4970_Wrong_package_name_in_domain_ids branch April 19, 2023 18:43
chenggui53 pushed a commit to chenggui53/incubator-devlake that referenced this pull request May 5, 2023
RootPkgPath is used by DomainIdGenerator to find the name of the plugin that defines a given type.
While remote plugins do not use the DomainIdGenerator, we still need to implement this function.
Indeed, DomainIdGenerator uses FindPluginNameBySubPkgPath that returns the name of the first plugin
whose RootPkgPath is a prefix of the type package path.
So remote plugin must not return an empty string as RootPkgPath, but a string that is not a prefix
of any go plugin package path.

Co-authored-by: Camille Teruel <camille.teruel@meri.co>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

component/framework This issue or PR relates to the framework component/plugins This issue or PR relates to plugins

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug][Azure] Table cicd_tasks have records with id like 'github%' and cicd_scope_id like 'azure%'

2 participants