Skip to content

Conversation

@danielhollas
Copy link
Collaborator

@danielhollas danielhollas commented Oct 6, 2025

Small changes in other modules were necessary pre-requisite or aftermath of better types in aiida.repository module.

Some remaining type-ignores will need adjustment in the disk-objectstore package, see the corresponding PR over there: aiidateam/disk-objectstore#196 (it doesn't block this one though)

@codecov
Copy link

codecov bot commented Oct 6, 2025

Codecov Report

❌ Patch coverage is 97.26027% with 2 lines in your changes missing coverage. Please review.
✅ Project coverage is 79.30%. Comparing base (13cb318) to head (fbf9b7c).
⚠️ Report is 9 commits behind head on main.

Files with missing lines Patch % Lines
src/aiida/transports/plugins/ssh_async.py 0.00% 1 Missing ⚠️
src/aiida/transports/transport.py 0.00% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #7049      +/-   ##
==========================================
- Coverage   79.31%   79.30%   -0.00%     
==========================================
  Files         566      566              
  Lines       43874    43877       +3     
==========================================
- Hits        34794    34793       -1     
- Misses       9080     9084       +4     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

"""

@abc.abstractmethod
def maintain(self, dry_run: bool = False, live: bool = True, **kwargs) -> None:
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

This was causing liskov principle violations in the subclasses. Ultimately, the "maintain" operation will be specialized for each different backend to probably doesn't make sense to have it here.


__all__ = ('AbstractRepositoryBackend',)

InfoDictType = dict[str, Union[int, str, dict[str, int], dict[str, float]]]
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Would be nice to have a better type than this 😅

with get_progress_reporter()(total=1) as progress:
callback = create_callback(progress)
container.pack_all_loose(compress=compress, callback=callback)
container.pack_all_loose(compress=compress_mode, callback=callback) # type: ignore[arg-type]
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

This ignore needs to be solved in the disk-objecstore package, I'll open a PR there.

with get_progress_reporter()(total=1) as progress:
callback = create_callback(progress)
container.repack(callback=callback)
container.repack(callback=callback) # type: ignore[arg-type]
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Same as above, needs a fix in disk-objectstore repo

Comment on lines -83 to -84
instance = cls.__new__(cls)
instance.__init__(name, file_type, key, objects) # type: ignore[misc]
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Is there a reason why this was done in such a convoluted way??

Copy link
Member

@edan-bainglass edan-bainglass Nov 4, 2025

Choose a reason for hiding this comment

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

You'd have to ask Seb. I always work under the semi-soft assumption that he knows what he's doing 😅

@danielhollas danielhollas marked this pull request as ready for review October 16, 2025 18:36
f'Backend repository key format incompatible: {repository.key_format!r} != {key_format!r}'
)
with get_progress_reporter()(desc='Archiving files: ', total=len(all_keys)) as progress:
for key, stream in repository.iter_object_streams(all_keys): # type: ignore[arg-type]
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

This was the original motivation for this rabbithole :-D

@danielhollas
Copy link
Collaborator Author

@edan-bainglass this one could use your review in case you have a bit of time tomorrow. 🙏

Copy link
Member

@edan-bainglass edan-bainglass left a comment

Choose a reason for hiding this comment

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

LGTM! Thanks @danielhollas!

@danielhollas danielhollas merged commit 3999e84 into aiidateam:main Nov 4, 2025
31 checks passed
@danielhollas danielhollas deleted the typing-repository branch November 4, 2025 07:03
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants