Repository navigation
refactor(publish): make each nanopublication with nanopub-java too, and log where they differ (#936) - #952
Merged
Conversation
…nd log where they differ (#936) Before the form makes its nanopublications with the library's filler, this makes each one a second time that way, on publishing and on preview, and logs whether the two come out the same ("Template fill:"). The form's own nanopublication is still the one that is signed and published. - FormRequest turns the form's models into a FillRequest: values under their param_ names with language tags, fill mode and source, space and namespace, looked-up labels, agent names, creator and site. A field that still holds the template's default is left out, as the library takes the default itself and drops it with an optional statement. - TemplateFillGuard fills that request with TemplateFiller and compares the result triple by triple per graph, relative to each nanopublication, without head, creation time and signature. Failures are only logged. - TemplateContext.getPrefixBase(token) and PublishForm.toFillRequest(). - nanopub 1.99.0. 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.
Part of #936. The publishing form is to make its nanopublications with the filler of nanopub-java instead of its own code. Before it does, this release makes each one a second time that way and logs where the two come out differently. That shows any differences on what people actually fill in, before the library's version is the one published.
Nothing changes for the user. The form's own nanopublication is still the one that is signed and published, and a failure of the comparison is only logged. Look for
Template fill:in the log.Change
template/FormRequestturns what is filled in on a form into nanopub-java'sFillRequest:param_link parameter, with its language tag;A field that still holds the template's default is left out. The library takes the default by itself, and leaves it out with an optional statement that lacks other values, as the form does. Passing such defaults as given values made the library refuse to leave them out with their statement, for instance in the view template's untouched action group.
template/TemplateFillGuardfills that request withTemplateFillerand compares the result with the form's nanopublication.PublishFormruns the guard on publishing and on preview, right before signing. It getstoFillRequest(), andTemplateContextgetsgetPrefixBase(token).nanopub 1.99.0, which takes labels and the site in a request and makes the repetition rule public (feat(templates): give the filler what a form knows, and the repetition rule Nanopublication/nanopub-java#233).
docs/library-template-model.md: a section on the fill guard.Testing
PublishFormFillGuardTest(4 tests) opens real forms and checks that the library makes the same nanopublication:supersede.With the default rule switched off, three of them fail with the message the library gave on real nanopublications.
TemplateFillGuardTest(3 tests): the comparison, what the library cannot fill, and that failures are swallowed../mvnw testwith nanopub 1.99.0: 1,942 tests, no failures (26 skipped).The nanopub skill's mirrors and local nanopublications, compared with a scratch harness that is not part of this PR. For each one it opened the form, built the nanopublication both ways, and compared:
supersede, and 370 withderiveand withuse.supersede.assertionname), cases the form cannot build itself, or unsigned files.🤖 Generated with Claude Code