Skip to content

Conversation

@fenekku
Copy link
Contributor

@fenekku fenekku commented Nov 5, 2025

  • Makes DeprecationWarning log where deprecated Link is used (useful)
    rather than where the warning call is defined (not so useful). This will highlight where Link is still used in other module tests, so that move to EndpointLink/ExternalLink can be done. For example, tests of invenio-drafts-resources using this updated module will log:
.venv/lib/python3.14/site-packages/invenio_users_resources/services/users/config.py:214                                                                                      
  /<path>/<to>/invenio-drafts-resources/.venv/lib/python3.14/site-packages/invenio_users_resources/services/users/config.py:214: DeprecationWarning: Link is deprecate
d and will be removed in v14.0. Use `ExternalLink` for third-party links and `EndpointLink` for InvenioRDM links.                                                            
    "admin_moderation_html": Link(        

telling us that invenio-users-resources uses deprecated Link in users/config.py:214.

  • use EndpointLink in RecordTypeFactory: this keeps same interface, simply moves away from deprecated approach (found through above)
  • the encoding change of relying on new link generation (see feat+refactor: log call site of deprecated Link rather than definition [+] #659 (comment)) may cause test breakage in other modules, but it doesn't break browser interpretation. So this could be categorized as a major for that, else it's really just a patch. And my vote would be for patch since tests can be fixed easily and have.

@fenekku fenekku changed the title refactor: use EndpointLink in RecordTypeFactory [+] feat+refactor: log call site of deprecated Link rather than definition [+] Nov 5, 2025
return {
# to be verified if needed, since the models are dynamically created
"invenio_db.model": [
"mock_module_factory = tests.mock_module_factory.grant",
Copy link
Contributor Author

Choose a reason for hiding this comment

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

didn't exist and not needed.

assert rec_type.resource_config_cls.url_prefix == "/resourcetests"
assert rec_type.resource_config_cls.blueprint_name == "resourcetest"

# links_schema_class = rec_type.resource_config_cls.links_config["record"]
Copy link
Contributor Author

Choose a reason for hiding this comment

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

below tests that links_item and links_search setup. Then, all tests that use the service validate that the defined links work (they fail in response serialization like .data otherwise).

@fenekku fenekku added this to vNext Nov 5, 2025
"Link is deprecated and will be removed in v14.0. Use `ExternalLink` for "
"third-party links and `EndpointLink` for InvenioRDM links.",
DeprecationWarning,
stacklevel=2,
Copy link
Contributor Author

@fenekku fenekku Nov 5, 2025

Choose a reason for hiding this comment

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

This is the important bit.

- This keeps same interface, simply moves away from deprecated approach
- Makes DeprecationWarning log where deprecated Link is *used* (useful)
rather than where the warning call is defined (not so useful)
"links_search": pagination_links("{+api}" + route + "{?args*}"),
"links_search": pagination_endpoint_links(
f"{self.record_name_lower}.search"
),
Copy link
Contributor Author

Choose a reason for hiding this comment

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

This actually alters URL encoding which could cause tests in other repos to fail e.g., https://github.com/inveniosoftware/invenio-vocabularies/pull/517/files#r2556476359 . I am submitting PRs that fix those, so it will just be a matter of merging them when this one is merged and released.

@fenekku fenekku force-pushed the link_usage_warning_2 branch from 2232aee to 07a4484 Compare December 2, 2025 21:19
@fenekku
Copy link
Contributor Author

fenekku commented Dec 2, 2025

Ok this is ready for review with passing tests now.

@utnapischtim utnapischtim moved this to 👀 In review in vNext Dec 19, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: 👀 In review

Development

Successfully merging this pull request may close these issues.

1 participant