Skip to content

fix sticky ADMIN_KW - #834

Open
d-w-moore wants to merge 3 commits into
irods:mainfrom
d-w-moore:833.m
Open

d-w-moore wants to merge 3 commits into
irods:mainfrom
d-w-moore:833.m

Conversation

@d-w-moore

@d-w-moore d-w-moore commented Sep 9, 2026 •

Copy link
Copy Markdown
Collaborator

Use of ADMIN_KW carried over into subsequent metadata calls even if unwanted.

Comment thread irods/manager/metadata_manager.py Outdated
Comment thread irods/test/meta_test.py Outdated
Comment thread irods/test/meta_test.py Outdated

@korydraughn korydraughn left a comment

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.

Does the updated test reproduce the bug reported in the issue?

Comment thread irods/manager/metadata_manager.py Outdated
Comment thread irods/test/meta_test.py Outdated
Comment thread irods/test/meta_test.py
Comment thread irods/test/meta_test.py
Comment on lines +835 to +837
# This function duplicates the way in which the client API endpoint calculates iRODS option keywords
# for the underlying API call:
get_call_keywords = lambda metacoll: metacoll._manager._updated_keywords((),)

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.

Is this saying it duplicates the key-value pairs stored in the manager?

I'm struggling to understand what this does?

@d-w-moore d-w-moore Sep 18, 2026 •

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

It emulates the internal calculation of api keywords given to the iRODS api, based on the input metacoll.
So for two different such objects:

  get_call_keywords(Data.metadata(admin=False)) -> {}

and

  get_call_keywords(Data.metadata(admin=True)) -> {**ADMIN_KW:''}

is what you would expect.

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.

It emulates the internal calculation of api keywords given to the iRODS api, based on the input metacoll.

By "iRODS api", I take it you're referring to the PRC's interface and NOT the iRODS RPC interface, correct?


So, that lambda is using code that is private to the implementation to prove correctness?

Is there no way to do this without reaching behind the public API of the library?

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

We're testing what the PRC interface will be sending through the wire. I'm guessing the only other way would be to put in loggers that record the actual keywords used in a place that can be verified in a test, then call the metadata API itself to see if the keyword appears.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

The above basically says, we're testing what the client's API endpoint for metadata is doing in terms of the flags in the hand-off to the wire and thus the server. If you like, @korydraughn, I can just put in some extra comments for explanation to that effect. But I can't see anything really wrong with the approach.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

never hurts to have words explaining 'why', along with the 'what' of the code. and if the 'what' needs explanatory words too, that's fine...

@d-w-moore

d-w-moore commented Sep 18, 2026 •

Copy link
Copy Markdown
Collaborator Author

Does the updated test reproduce the bug reported in the issue?

Yes. if you revert the changes, the test fails on the line d.metadata.set('a','b') with an INSUFFICIENT_PRIVILEGE_LEVEL error, agreeing with the issue report and diagnosis.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

3 participants