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
return self._opts['timestamps']

__kw: Dict[str, Any] = {} # default (empty) keywords
__default_kw: Dict[str, Any] = {} # default (empty) 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 still needed/used?

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.

I'll delete that . it's no longer used.

Comment thread irods/test/meta_test.py Outdated
Comment on lines +820 to +824
with new_session() as ses:
d = ses.data_objects.create(data_name:="/{adm.zone}/home/{user.name}/testfile".format(**locals()))
d.metadata(admin=True)

with new_session() as ses:

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.

Would it improve the test to use unique variable names for the with-statements (e.g. ses1 and ses2)?

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 will, yes.

Comment thread irods/test/meta_test.py
self.assertIn(kw.ADMIN_KW, get_call_keywords(md_modified))

# The modified admin setting should be reflected when reading it back from the object's
# internal options # bookkeeping.

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 the trailing # bookkeeping a leftover?

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.

no , the extra # was to be deleted if I was editing better. But I can leave the word out if it makes more sense.

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.

@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.

2 participants