Flag protected nanopublications, and say when the services are restricted or unavailable - #683
Merged
Merged
Conversation
…stricted Nanopub Registry 1.12.0 and Nanopub Query 1.26.0 accept and serve nanopubs typed npx:ProtectedNanopub when configured as local/private instances, and nanopub-java 1.94.0 exposes both facts to clients. Nanodash showed neither: a protected nanopub rendered an ordinary grey "ProtectedNanopub" type tag, indistinguishable from a domain type and linking to a listing of everything else that happens to be protected, and nothing said that an instance was talking to a restricted deployment at all. Protected nanopubs now carry their own flag next to the nanopub's ID, and the type is left out of the type tags so it is not shown twice. The publication info still shows the underlying triple: the flag replaces the tag, not the RDF. ServiceMode probes both services once at startup -- the registry through RegistryInfo.isLocalInstance, the query service through its Nanopub-Query-Local-Instance response header -- and a marker in the title bar says when either is local, as that is a property of the instance rather than of a page. Not being able to reach a service reads as "not restricted": the marker is additional information, and its absence must never keep the interface from working. Verified against a local stack (registry 1.12.1 and query 1.28.0, both local/private) holding a protected nanopublication published through PublishNanopub. Closes #671 Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01LqfrG3VXH5tzWXPvYJzXML
… part by part When no query service passes the nanopub library's health check, every query-driven part of a page fails on its own with a bare "API call failed.", while the cause is a single fact about the instance: QueryCall admits an instance only when it reports READY or LOADING_UPDATES, so a service that is still loading is filtered out before any call is attempted. The same holds for a registry whose status is not ready or updating. ServiceHealth watches both and the title bar says what is wrong once. A service that is still loading and one that cannot be reached get different wording, because the reader's options differ: the first passes by itself and asks them to wait, the second is an outage. The check runs on its own scheduled thread rather than once at startup, since health changes while an instance runs; request threads only read the last answer, keeping the probes off the request path (#600). A state that could not be established stays unknown and shows nothing: not knowing must not turn into claiming an outage. Verified against a local stack: the note appeared while the query service was doing its initial load, and cleared by itself within one check interval of it becoming ready. Closes #681 Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01LqfrG3VXH5tzWXPvYJzXML
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.
Two related things a Nanodash instance never said out loud: what kind of deployment it is talking to, and when that deployment cannot answer. Both surface in the title bar, one commit each.
Protected nanopublications and restricted services (#671)
Registry 1.12.0 and Query 1.26.0 accept and serve nanopubs typed
npx:ProtectedNanopubwhen configured as local/private instances, and nanopub-java 1.94.0 exposes both facts to clients (Nanopublication/nanopub-java#143, #144, #145).NanopubUtils.getTypespicked the type up from the publication info andNanopubItemrendered it as an ordinary grey type tag — indistinguishable from a domain type, and linking to a listing of everything else that happens to be protected. The type is now left out of the tags; the publication info still shows the underlying triple, since the flag replaces the tag, not the RDF.ServiceModeprobes both services once at startup — the registry throughRegistryInfo.isLocalInstance(), the query service through itsNanopub-Query-Local-Instanceresponse header — and a🔒 restrictedmarker says when either is local. It is a property of the instance, not of a page, so it shows on all of them. A service that cannot be reached reads as "not restricted": the marker is additional information and must never keep the interface from working.A note when a service cannot answer (#681)
QueryCalladmits a query instance only when it reportsREADYorLOADING_UPDATES, andServerIteratorskips a registry that is notready/updating. When nothing is admitted, every query-driven part of a page fails separately with a bareAPI call failed.and nothing says why.ServiceHealthnow watches both and the title bar says it once.A service that is still loading and one that cannot be reached get different wording, because what the reader should do differs: the first passes by itself, the second is an outage. The check runs on its own scheduled thread, since health changes while an instance runs; request threads only read the last answer, keeping the probes off the request path (#600). A state that could not be established stays
UNKNOWNand shows nothing.Verification
Built a local/private stack for this — Registry 1.12.1 with
REGISTRY_LOCAL_INSTANCE=trueand Query 1.28.0 withNANOPUB_QUERY_LOCAL_INSTANCE=true, mirroring the public network (89,433 nanopubs) — and drove Nanodash against it:🔒 restrictedin the title bar,🔒 protectedon the nanopub, with noProtectedNanopubtype tag left.Full suite: 1285 tests, 0 failures, 0 errors. New tests cover
isProtected(including the type sitting outside the publication info, which does not count), the type-tag exclusion, the rendered flag, the mode probes, and the note wording for each state.Two findings this turned up, filed separately
NanodashSession's constructor throws inUserDataand every page 500s, the error page included — which also defeats the note in this PR, since nothing renders. Pre-existing; not filed yet.🤖 Generated with Claude Code
https://claude.ai/code/session_01LqfrG3VXH5tzWXPvYJzXML