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

AEA-1610 fix: add check consistency of package versions (#2459) #2550

Merged
merged 1 commit into from Jun 8, 2021

Conversation

marcofavorito
Copy link
Contributor

Proposed changes

Add consistency of package versions in MAM.

MAM should track all versions of packages and raise an exception when incompatible versions of any packages are added. Otherwise, this can lead to problems at runtime (with whatever version being loaded last being in memory).

This PR addresses the above issue.

Fixes

Fix #2459

Types of changes

What types of changes does your code introduce to agents-aea?
Put an x in the boxes that apply

  • Bugfix (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 not work as expected)

Checklist

Put an x in the boxes that apply.

  • I have read the CONTRIBUTING doc
  • I am making a pull request against the develop branch (left side). Also you should start your branch off our develop.
  • Lint and unit tests pass locally with my changes and CI passes too
  • I have added tests that prove my fix is effective or that my feature works
  • I have checked that code coverage does not decrease.
  • I have added necessary documentation (if appropriate)
  • Any dependent changes have been merged and published in downstream modules

Further comments

n/a

@marcofavorito marcofavorito requested review from DavidMinarsch and solarw and removed request for DavidMinarsch June 7, 2021 15:54
@@ -202,6 +202,9 @@ def __str__(self) -> str:
return str(self.value)


PackageIdPrefix = Tuple[ComponentType, str, str]
Copy link
Contributor Author

Choose a reason for hiding this comment

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

helper type, more readable, and does not affect much code (it replaces Tuple[ComponentType, str, str])

Copy link
Contributor

Choose a reason for hiding this comment

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

Yeah is backward compatible too I guess.

self.conflicting_packages = conflicting_packages
super().__init__(self._build_error_message())

def _build_error_message(self) -> str:
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Comment on lines +639 to +647
self.manager.start_manager()
weather_station_id = PublicId.from_str("fetchai/weather_station:0.27.0")
self.manager.add_project(weather_station_id)
weather_client_id = PublicId.from_str("fetchai/weather_client:0.27.0")
with pytest.raises(
ProjectPackageConsistencyCheckError,
match=re.escape(self.EXPECTED_ERROR_MESSAGE),
):
self.manager.add_project(weather_client_id)
Copy link
Contributor Author

Choose a reason for hiding this comment

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

this is the code to reproduce issue #2459

Copy link
Contributor

@DavidMinarsch DavidMinarsch left a comment

Choose a reason for hiding this comment

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

LGTM

self._prefix_to_components = (
{}
) # type: Dict[Tuple[ComponentType, str, str], Set[ComponentId]]
self._prefix_to_components = {} # type: Dict[PackageIdPrefix, Set[ComponentId]]
Copy link
Contributor

Choose a reason for hiding this comment

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

I assume this is just refactoring of typing, i.e. no material change?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

yes

@@ -202,6 +202,9 @@ def __str__(self) -> str:
return str(self.value)


PackageIdPrefix = Tuple[ComponentType, str, str]
Copy link
Contributor

Choose a reason for hiding this comment

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

Yeah is backward compatible too I guess.

Copy link
Contributor

@solarw solarw left a comment

Choose a reason for hiding this comment

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

LGTM

@DavidMinarsch DavidMinarsch merged commit 34307e9 into develop Jun 8, 2021
DavidMinarsch added a commit that referenced this pull request Jun 8, 2021
Fill coverage gap in manager.py (due to #2550)
@DavidMinarsch DavidMinarsch deleted the fix/2459 branch June 28, 2021 10:51
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.

None yet

3 participants