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

Refactors #555 to allow for backward compatibility #577

Merged
merged 5 commits into from
Aug 30, 2024

Conversation

chris-allan
Copy link
Member

There were certain downstream omero-web plugins which were using _marshal_image(). This refactors the changes of #555 such that the prototype of _marshal_image() is maintained and a new _marshal_image_map() is added to give us options going forward for scalability.

Alternative to #575.

/cc @Tom-TBT

@chris-allan
Copy link
Member Author

I've opened this as a draft so we don't end up with build conflicts with #575 and can use this for discussion.

Copy link
Member

@sbesson sbesson left a comment

Choose a reason for hiding this comment

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

A couple of comments. From an API construction, I think this proposal gets us into a good place:

  • a new _marshal_image_map is introduced that takes a dictionary rather than an array of fixed length. This means new properties can be introduced in a backwards-compatible way in the future
  • the signature of the existing _marshal_image is restored and its implementation is forwarded to the new _marshal_image_map. This should fix the behavior of existing downstream apps that were using this internal method
  • I assume the high-level marshal_images and marshal_tagged API should use the _marshal_image_map API moving forward?

In terms of testing, I expect the changes introduced in ome/openmicroscopy#6389 should be unchanged as the omeroweb.webclient.tree.marshal_images API should create a dictionary including the archived key.
Should the legacy _marshal_image API be tested and/or deprecated?

omeroweb/webclient/tree.py Outdated Show resolved Hide resolved
omeroweb/webclient/tree.py Outdated Show resolved Hide resolved
omeroweb/webclient/tree.py Outdated Show resolved Hide resolved
omeroweb/webclient/tree.py Outdated Show resolved Hide resolved
@chris-allan chris-allan force-pushed the archive-status branch 2 times, most recently from 4d35164 to 6ce1c1a Compare August 28, 2024 08:20
omeroweb/webclient/tree.py Outdated Show resolved Hide resolved
@sbesson
Copy link
Member

sbesson commented Aug 28, 2024

With OMERO.web 5.27.0 and OMERO.autotag 4.0.1, I can reproduce the original issue as toggling the Auto-tag from the centre panel triggers a 500 error.

I deployed a local build of this PR with the additional change proposed in #577 (comment), I can confirm that the auto-tag server issue is fixed. Setting the archived flag to true via the CLI also produces the expected behavior as per #555 i.e. an archived icon and Archived: True in the right-hand panel.

I would be in favor of closing #575 and moving this out of draft for inclusion in the nightly CI builds in preparation of a round of functional testing.

There were certain downstream omero-web plugins which were using
`_marshal_image()`.  This refactors the changes of ome#555 such that the
prototype of `_marshal_image()` is maintained and a new
`_marshal_image_map()` is added to give us options going forward for
scalability.
@knabar
Copy link
Member

knabar commented Aug 28, 2024

Do we also want to address the issue of the "underscore" method that indicates it is private, since we know it is not used as such?

For example, remove the leading underscore from the methods, but keep the underscore reference for compatibility:

def marshal_image(...):
    ...

_marshal_image = marshal_image

def marshal_image_map(...):
    ...

This is admittedly a bit redundant, but might deter future signature changes.

@chris-allan
Copy link
Member Author

Should the legacy _marshal_image API be tested and/or deprecated?

I think at least tested. Once the current integration tests are passing I'll add some more unit tests to this project on this PR.

@chris-allan
Copy link
Member Author

Do we also want to address the issue of the "underscore" method that indicates it is private, since we know it is not used as such?

For example, remove the leading underscore from the methods, but keep the underscore reference for compatibility:

def marshal_image(...):
    ...

_marshal_image = marshal_image

def marshal_image_map(...):
    ...

This is admittedly a bit redundant, but might deter future signature changes.

I don't think so. Or at least not here. What was clear from #575, especially ome/omero-mapr#84, is that almost every leading underscore marshal method from the tree package is used in that plugin and has been for nearly a decade. The whole module needs review and an assessment of what we we want to do with it as there are clearly critical plugins that are tightly coupled to nearly its entire API.

Copy link
Member

@will-moore will-moore left a comment

Choose a reason for hiding this comment

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

Changes look good and make sense, preserving previous API. Auto-tag working locally and the archived status is shown in webclient correctly.

@chris-allan
Copy link
Member Author

Unit tests have been added to cover both _marshal_image() and _marshal_image_map().

omeroweb/webclient/tree.py Outdated Show resolved Hide resolved
Copy link
Member

@sbesson sbesson left a comment

Choose a reason for hiding this comment

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

Retested the last commit in a deployment with the current versions of OMERO.autotag and OMERO.mapr. Confirmed that the archived status is still displayed as expected in the webclient (left and right hand panels) and both applications work as expected.

The nightly CI integration tests have been passing and the new collection of unit tests add coverage for all supported arguments of the internal _marshal_image and _marshal_image_map APIs.

Proposing to get this released asap to reduce the impact on people who upgraded their version of OMERO.web in a deployment with any of the impacted applications. Given these APIs are marked as internal, either 5.27.1 or 5.28.0 would be acceptable version increment from my side

@knabar knabar added this to the 5.27.1 milestone Aug 30, 2024
@knabar knabar merged commit 7d59df3 into ome:master Aug 30, 2024
10 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.

4 participants