Repository navigation
[#841] fix wrong column names in the DataAccess model - #842
Open
rudra337-lgtm wants to merge 1 commit into
Open
rudra337-lgtm wants to merge 1 commit into
rudra337-lgtm wants to merge 1 commit into
Conversation
The icat_key strings of the DataAccess columns 701-704 carried the
"COL_" prefix, inconsistent with DataAccess.type (700: DATA_ACCESS_TYPE)
and with the iRODS genquery1 attribute strings defined in
lib/core/include/irods/rodsGenQueryNames.h of the iRODS server
(DATA_ACCESS_NAME, DATA_TOKEN_NAMESPACE, DATA_ACCESS_USER_ID,
DATA_ACCESS_DATA_ID - the COL_ prefix belongs only to the "#" define
identifiers, not to the attribute strings). The mismatch was reported
to surface in client-side criteria and result row lookups
(Criterion('=', DataAccess.name, 'own'); row[DataAccess.name /
DataAccess.user_id]) as described in issue irods#841.
Signed-off-by: Rudra <rudramandaliya337@gmail.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #841
Problem
In
irods/models.py, columns 701–704 of theDataAccessmodel carried theiricat_keystrings with theCOL_prefix:The
COL_prefix belongs only to the#define/C-identifier names in the iRODS server sources, not to the genquery1 attribute strings.lib/core/include/irods/rodsGenQueryNames.hofirods/irodsmapsCOL_DATA_ACCESS_NAME→"DATA_ACCESS_NAME",COL_DATA_TOKEN_NAMESPACE→"DATA_TOKEN_NAMESPACE",COL_DATA_ACCESS_USER_ID→"DATA_ACCESS_USER_ID", andCOL_DATA_ACCESS_DATA_ID→"DATA_ACCESS_DATA_ID"— i.e. exactly the stringsDataAccess.type(700) already used, and attributing strings that carry noCOL_prefix. Querying withCOL_DATA_ACCESS_NAMEwas reported in #841 to fail server-side ("no column COL_DATA_ACCESS_NAME found") in some uses, and the mismatched names also surface on the client in criteria (Criterion('=', DataAccess.name, 'own')) and in the keys of result rows, whichirods/results.pybuilds fromModelBase.columns()[attriInx].icat_key(theKeyError: <Column 701 COL_DATA_ACCESS_NAME>observed in the issue thread).Fix
Strip the
COL_prefix from the four column-name strings in theDataAccessmodel, as agreed by the maintainers in the issue thread ("just change the internal column_names by stripping off 'COL_' for this milestone"):"DATA_ACCESS_NAME""DATA_TOKEN_NAMESPACE""DATA_ACCESS_USER_ID""DATA_ACCESS_DATA_ID"Per the same discussion, the column type (Integer→String) change for
user_id(theupper(bigint)error in case-insensitive queries) is deliberately out of scope here and belongs to the 4.0 milestone.Note:
CollectionAccess(710–714,"COL_COLL_ACCESS_*") shows the same family of inconsistency (COLL_ACCESS_*on the server side); left untouched here, since this PR stays scoped to theDataAccessmodel named in the issue. Happy to follow the same change there if maintainers agree.Tests
New offline regression tests in
irods/test/modules/test_dataaccess_column_names__issue_841.py(no iRODS server needed; the genquery request is built client-side and result-key mapping reproduced viaempty_gen_query_out+ResultSet):test_dataaccess_request_columns_use_irods_attribute_namestest_criteria_built_from_dataaccess_columns_use_irods_attribute_namestest_result_keys_surface_irods_attribute_namestest_no_dataaccess_column_name_carries_the_col_prefixAll four fail on current
main(verified:'COL_DATA_ACCESS_NAME' == 'DATA_ACCESS_NAME'assertion errors) and pass with this change. Registered names are pinned to the values inrodsGenQueryNames.hquoted above.Locally (Windows, no iRODS server available):
python -m pytest irods/test/modules -q: 4 passed (this PR) / 1 failed + 3 errors raised — the failures aretest_auto_close_of_data_objects__issue_456(needs a live server) and fixture-driven modules run by the repo's own harness, identical counts with the change stashed (pre-existing, unrelated).python -m pytest irods/test/test_paths.py -q: 1 passed.ruff check: 0 findings on the new test file;irods/models.pyfindings byte-identical before/after the change (39 pre-existing, proven by stashing).mypy --ignore-missing-importson the touched sources: identical 2 pre-existing errors in untouched import-closure files before/after (proven by stashing). No new type errors.