Skip to content

Fix network-dependent test failures from upstream linkml-model changes#3215

Closed
turbomam wants to merge 2 commits intomainfrom
fix-stale-network-snapshots
Closed

Fix network-dependent test failures from upstream linkml-model changes#3215
turbomam wants to merge 2 commits intomainfrom
fix-stale-network-snapshots

Conversation

@turbomam
Copy link
Copy Markdown
Member

Summary

  • Update stale snapshots for 4 tests that compare against the upstream linkml-model schema (fetched from w3id.org/linkml/)
  • Adjust 2 RDF test assertions where URI-typed slots now serialize as Literal(xsd:anyURI) instead of URIRef

The upstream linkml-model changed whitespace in type descriptions and how URI-typed slots are represented in RDF. These 6 @pytest.mark.network tests fail on all branches.

Test plan

  • All 6 previously-failing tests pass locally with --with-network

Fixes #3214

The upstream linkml-model (served from w3id.org/linkml/) changed in two ways:

1. Whitespace normalization in type descriptions (double space to single)
2. URI-typed slots now serialize as Literal(xsd:anyURI) instead of URIRef

Update stale snapshots and adjust two test assertions to compare string
values rather than relying on rdflib node type identity.

Fixes #3214
Copilot AI review requested due to automatic review settings February 26, 2026 14:40
@codecov
Copy link
Copy Markdown

codecov bot commented Feb 26, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 83.84%. Comparing base (d9c1e39) to head (53e89d0).
⚠️ Report is 1 commits behind head on main.

Additional details and impacted files
@@             Coverage Diff             @@
##             main    #3215       +/-   ##
===========================================
+ Coverage   18.84%   83.84%   +65.00%     
===========================================
  Files         147      148        +1     
  Lines       16724    16973      +249     
  Branches     3474     3504       +30     
===========================================
+ Hits         3151    14231    +11080     
+ Misses      13556     1954    -11602     
- Partials       17      788      +771     
Flag Coverage Δ
linkml 80.08% <ø> (+61.25%) ⬆️
runtime 80.08% <ø> (?)

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Updates network-dependent LinkML tests/snapshots to match upstream linkml-model serialization changes (whitespace tweaks in schema text and URI-typed values appearing as Literal(xsd:anyURI) in RDF output), unblocking currently failing @pytest.mark.network tests.

Changes:

  • Refreshed multiple RDF/Turtle and JSON snapshot fixtures to align with the current upstream linkml-model schema/serialization.
  • Adjusted RDF assertions in test_issue_3 to compare URI values by lexical form (string) rather than strict RDF term type.
  • Relaxed test_rdfgen’s linkml:tag assertion to tolerate URIRef-vs-typed-Literal differences.

Reviewed changes

Copilot reviewed 6 out of 7 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
tests/linkml/test_utils/snapshots/import_test_1.json Snapshot update for upstream whitespace change in type notes.
tests/linkml/test_issues/test_issue_3.py Loosens RDF term comparison for XSD date/datetime URIs.
tests/linkml/test_issues/snapshots/linkml_issue_388.ttl Updates expected TTL output reflecting URI-typed literals and other upstream formatting changes.
tests/linkml/test_issues/snapshots/linkml_issue_388.owl Snapshot update for restriction serialization ordering/structure changes.
tests/linkml/test_issues/snapshots/linkml_issue_384.ttl Updates expected personinfo TTL snapshot for upstream URI literal behavior and ordering.
tests/linkml/test_issues/snapshots/issue_163d.ttl Updates expected TTL snapshot for upstream URI literal behavior and ordering.
tests/linkml/test_generators/test_rdfgen.py Adjusts annotation extension assertions to handle upstream URI serialization changes.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines +78 to +80
# tag may be a URIRef or a Literal with xsd:anyURI datatype,
# depending on the upstream linkml-model serialization
assert str(tag).startswith("my_tag")
Copy link

Copilot AI Feb 26, 2026

Choose a reason for hiding this comment

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

The new assertion str(tag).startswith("my_tag") no longer verifies that linkml:tag is serialized as a URI node (either a URIRef or a Literal typed as xsd:anyURI). As written, the test would also pass if the tag were incorrectly serialized as a plain string literal, which weakens the protection this test provides for RDF serialization behavior. Consider asserting (1) the term type is URIRef OR a Literal with datatype xsd:anyURI, and (2) its value is exactly one of the expected tags (my_tag1 / my_tag2).

Copilot uses AI. Check for mistakes.
Comment on lines +15 to +16
assert str(XSD.date) == str(g.value(LINKML.date, LINKML.uri))
assert str(XSD.dateTime) == str(g.value(LINKML.datetime, LINKML.uri))
Copy link

Copilot AI Feb 26, 2026

Choose a reason for hiding this comment

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

Casting RDF terms to str makes the assertion insensitive to whether linkml:uri is a proper URI node vs an incorrectly-typed literal (e.g., an xsd:string literal that happens to contain the same lexical form). To keep the test resilient to the upstream URIRef vs Literal(xsd:anyURI) change while still validating RDF typing, consider asserting the object is either a URIRef equal to XSD.date/XSD.dateTime or a Literal with datatype xsd:anyURI whose lexical value matches.

Copilot uses AI. Check for mistakes.
Copy link
Copy Markdown
Member

@cmungall cmungall left a comment

Choose a reason for hiding this comment

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

Thanks @turbomam

This is logical, however, I think we should modify the behavior of the rdf serializer such that curies and uris are represented as RDF nodes rather than literals. We can introduce behavior where people can customize this.

This does require an unusual reading of what is in types.yaml, but let's take that conversation here: #2213

Copy link
Copy Markdown
Contributor

@amc-corey-cox amc-corey-cox left a comment

Choose a reason for hiding this comment

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

This looks like a good spot-fix to get main working again until we agree on implementation in #3221. I'm going to try to skip this and merge the more comprehensive PR instead but I may fall back to this one.

@amc-corey-cox
Copy link
Copy Markdown
Contributor

I'm closing this as superseded by #3221

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Network-dependent tests fail due to upstream linkml-model changes

4 participants