Repository navigation
fix(publish): let the compliance check retrieve templates named by their node - #950
Merged
Merged
Conversation
Co-Authored-By: Claude Opus 5.5 <[email protected]>
…eir node
The compliance guard checks each nanopublication the form makes with
nanopub-java's TemplateComplianceChecker, which asks the resolver for a
template by the IRI the nanopublication names it with. A nanopublication
made from a template with an identity of its own names it by its node
(<np>/templateVersion), and TemplateData.RESOLVER was Utils::getNanopub,
which only takes a nanopublication URI or an artifact code. Every such
nanopublication, among them every view made from the current view
template, was therefore logged as not complying ("cannot be used:
java.lang.IllegalArgumentException: Not a well-formed trusty URI"), and
its assertion was not checked at all. Nothing visible was affected: the
guard only logs, and the form strips the node itself before it loads a
template.
The resolver now strips an IRI within a nanopublication down to the
nanopublication (Utils.stripToNanopubId) before retrieving it.
Co-Authored-By: Claude Opus 5.5 <[email protected]>
1.98.2 waits for registries that answer 429 Too Many Requests instead of giving up on them at once. The public registries rate-limit the test suite's nanopub fetches, which made a different network-dependent test fail on each CI run since about 2026-11-23. Co-Authored-By: Claude Opus 5.5 <[email protected]>
Contributor
|
🎉 This PR is included in version 5.23.2 🎉 The release is available on:
Your semantic-release bot 📦🚀 |
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.
Problem
Since 5.23.1,
TemplateComplianceGuardchecks every nanopublication the form makes against its templates, with nanopub-java'sTemplateComplianceChecker, and logs what it finds. The checker asksTemplateData.RESOLVERfor each template by the IRI the nanopublication names it with. A nanopublication made from a template with an identity of its own names the template by its node, e.g.https://w3id.org/np/RALLhFXr…/templateVersionfor the current view template.TemplateData.RESOLVERwasUtils::getNanopub, which only takes a nanopublication URI or an artifact code, so for every such nanopublication the guard logged a false error and did not check the assertion at all:Nothing visible was affected: the guard only logs, and the form itself strips the node before it loads a template (
TemplateData.getTemplate). But the log could not show disagreements between the form and the library for these nanopublications, which is what it is there for before the form moves onto the library's matching (#936). Among the 530 views mirrored by the nanopub skill, 185 name their template by its node.The same problem in nanopub-java's own default resolver was fixed in 1.98.1 (Nanopublication/nanopub-java#229). Nanodash passes its own resolver, so it needs the fix here as well.
Change
TemplateData.RESOLVERstrips an IRI within a nanopublication down to the nanopublication (Utils.stripToNanopubId) before callingUtils.getNanopub.Utils.getNanopubitself is unchanged, as other callers rely on it refusing such IRIs.429 Too Many Requestsinstead of giving up on them at once (fix(server): wait for registries that answer 429 Too Many Requests Nanopublication/nanopub-java#230). The public registries rate-limit the test suite's nanopub fetches, which made a different network-dependent test fail on each CI run since about 2026-11-23, this PR's runs included.docs/library-template-model.mdsays what the resolver does with such IRIs.Tests
TemplateComplianceGuardTest.templateNamedByItsNodeIsRetrievedThroughNanodash: a nanopublication that names its assertion template by its node, checked throughTemplateData.RESOLVER, withUtils.getNanopubstood in for by one that, like the real one, only takes a nanopublication URI or an artifact code. It fails without the change with the error above../mvnw testwith nanopub-java 1.98.2: 1,935 tests, no failures (26 skipped).np check-templateof nanopub-java 1.98.1, and noNot a well-formed trusty URIin the log.🤖 Generated with Claude Code