Skip to content

members: only use base attrs in user relationship#1069

Open
egabancho wants to merge 1 commit intoinveniosoftware:masterfrom
egabancho:2198-sync-user-schemas
Open

members: only use base attrs in user relationship#1069
egabancho wants to merge 1 commit intoinveniosoftware:masterfrom
egabancho:2198-sync-user-schemas

Conversation

@egabancho
Copy link
Copy Markdown
Member

@egabancho egabancho commented Nov 10, 2023

❤️ Thank you for your contribution!

Description

Please describe briefly your pull request.

Checklist

Ticks in all boxes and 🟢 on all GitHub actions status checks are required to merge:

Third-party code

If you've added third-party code (copy/pasted or new dependencies), please reach out to an architect.

Reminder

By using GitHub, you have already agreed to the GitHub’s Terms of Service including that:

  1. You license your contribution under the same terms as the current repository’s license.
  2. You agree that you have the right to license your contribution under the current repository’s license.

@egabancho egabancho requested a review from max-moser November 10, 2023 16:12
@egabancho
Copy link
Copy Markdown
Member Author

Sorry @max-moser, you seemed to be the one who made that change on the user schema, inveniosoftware/invenio-users-resources@492f14b ☺️

@egabancho
Copy link
Copy Markdown
Member Author

I'm not sure how to write a test to verify it, I can duplicate the one on https://github.com/inveniosoftware/invenio-accounts/blob/master/tests/test_models.py#L120, but I'm not sure how useful it will be.

@egabancho egabancho requested a review from TLGINO November 10, 2023 16:42
@egabancho egabancho force-pushed the 2198-sync-user-schemas branch from 1c953b2 to af2469e Compare November 13, 2023 19:34
}
}
},
"dynamic": true
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.

I would not go with dynamic here. I just had a large mishap with a custom field that wasn't created in the mapping, then a user filling some data into and voila, had to reindex 70GB of data because you cannot change the type once added to the mapping :-(

These models are also supposed to only contain basic info, not everything, so perhaps it's just a matter to make sure we don't get the full profile when we index in members? In principle it should only index the stuff in https://github.com/inveniosoftware/invenio-communities/blob/master/invenio_communities/members/records/api.py#L70-L76

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

What you say makes a lot of sense. Now I just need to figure out how to do actually do it 😂
Thanks for the feedback!

@egabancho egabancho self-assigned this Jan 9, 2024
@egabancho egabancho force-pushed the 2198-sync-user-schemas branch from af2469e to 1f8e6ee Compare April 15, 2024 18:28
@egabancho egabancho changed the title members: sync schemas with user-resources members: only use base attrs in user relationship Apr 15, 2024
* Limits the user fields send for indexing to avoid issues when
  extending the user profile or preferences. (closes
  invenio-app-rdm#2198)
@egabancho egabancho force-pushed the 2198-sync-user-schemas branch from 1f8e6ee to 3e26f5a Compare April 15, 2024 19:22
@egabancho
Copy link
Copy Markdown
Member Author

Hey @lnielsen, I changed the approach as you suggested. I explicitly list the fields we want from the two customizable parts: profile and preferences.
The only drawback I see is that if the overlay's custom code removes those fields from their custom schemas. However, I think other parts might depend on these fields too ...
Let me know what you think.

@egabancho egabancho requested a review from lnielsen April 16, 2024 14:07
@utnapischtim utnapischtim added this to v14 Sep 12, 2025
@utnapischtim utnapischtim moved this to 👀 In review in v14 Sep 12, 2025
@egabancho
Copy link
Copy Markdown
Member Author

Since this one was opened, a different merge request has been integrated, which adds dynamic to the mappings.

The question now is whether or not we want to integrate this one and revert the changes introduced to prevent the scenario described previously.

cc-ing @slint and @max-moser

@egabancho egabancho moved this from 👀 In review to 📋 To discuss in v14 Sep 12, 2025
@max-moser
Copy link
Copy Markdown
Contributor

max-moser commented Oct 10, 2025

If I understand correctly, this only relates to how users get indexed as community members?
I.e., worst case, some custom user preference/profile fields aren't available for searching community members?
So far, we haven't had any nonstandard use cases for searching community members, and I doubt we will have any in the future.

As a bit of context:
It's been a hot minute since the referenced PR, but IIRC, the issue it solved was that our user profile/preferences customizations broke indexing of users and/or communities at the time.
The changes followed the same approach as was already used in the user mappings.

Since the dynamic mappings are always interpreted as keyword, I think the biggest pitfall (of random and potentially unwanted types for the mapping being chosen on first encounter) is avoided.

That being said, I don't have a real preference on how custom user fields are handled in the context of communities, as long as extended user properties don't break stuff again.

For searching for users directly (invenio-users-resources), I think it can be useful to query the customized extra fields, though.

@TLGINO TLGINO removed their request for review October 10, 2025 14:38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: 📋 To discuss

Development

Successfully merging this pull request may close these issues.

Invenio indexer task process_bulk_queue fails with extended user profile

4 participants