Skip to content

fix(publish): let the compliance check retrieve templates named by their node - #950

Merged
tkuhn merged 3 commits into
masterfrom
fix/guard-template-node
Nov 26, 2026
Merged

tkuhn merged 3 commits into
masterfrom
fix/guard-template-node

Conversation

@tkuhn

@tkuhn tkuhn commented Nov 26, 2026 •

Copy link
Copy Markdown
Contributor

Problem

Since 5.23.1, TemplateComplianceGuard checks every nanopublication the form makes against its templates, with nanopub-java's TemplateComplianceChecker, and logs what it finds. The checker asks TemplateData.RESOLVER for 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…/templateVersion for the current view template. TemplateData.RESOLVER was Utils::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:

WARN TemplateComplianceGuard - Template compliance: <np> made by the form does not comply with its templates: The assertion template <https://w3id.org/np/RALLhFXriQjVFESflcok4WIpBW5W0Zh9horxrvcACD1Mw/templateVersion> cannot be used: java.lang.IllegalArgumentException: Not a well-formed trusty URI

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.RESOLVER strips an IRI within a nanopublication down to the nanopublication (Utils.stripToNanopubId) before calling Utils.getNanopub. Utils.getNanopub itself is unchanged, as other callers rely on it refusing such IRIs.
  • nanopub-java is updated to 1.98.1 (separate commit), and then to 1.98.2 (another commit). 1.98.2 waits for registries that answer 429 Too Many Requests instead 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.md says what the resolver does with such IRIs.

Tests

  • TemplateComplianceGuardTest.templateNamedByItsNodeIsRetrievedThroughNanodash: a nanopublication that names its assertion template by its node, checked through TemplateData.RESOLVER, with Utils.getNanopub stood 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 test with nanopub-java 1.98.2: 1,935 tests, no failures (26 skipped).
  • The guard as built here, run over the 530 views and 636 assertion templates mirrored by the nanopub skill: 1,031 comply and 135 do not, the same verdict for each of the 1,166 as np check-template of nanopub-java 1.98.1, and no Not a well-formed trusty URI in the log.

🤖 Generated with Claude Code

tkuhn and others added 2 commits November 26, 2026 10:15
…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]>
@tkuhn
tkuhn merged commit 57f8216 into master Nov 26, 2026
8 checks passed
@tkuhn
tkuhn deleted the fix/guard-template-node branch November 26, 2026 20:12
@github-actions

Copy link
Copy Markdown
Contributor

🎉 This PR is included in version 5.23.2 🎉

The release is available on:

Your semantic-release bot 📦🚀

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

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant