Validate main registry/query URLs against library instance list#461
Merged
Conversation
Cross-check NANODASH_MAIN_REGISTRY / NANODASH_MAIN_QUERY against the nanopub library's discovered instance list and fall back to the first known instance when the env value is unknown. Cache the resolved URLs for the JVM lifetime and warm them at startup so discovery cost is paid once, not on the first user request. Drop the now-redundant explicit registry URL passed to PublishNanopub.publish at the two call sites. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
|
🎉 This PR is included in version 4.28.0 🎉 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.
Summary
NANODASH_MAIN_REGISTRY/NANODASH_MAIN_QUERYagainst the nanopub library's discovered instance list (NanopubServerUtils.getRegistryServerList()/QueryCall.getApiInstances()) instead of trusting the env var blindly. When the env value isn't in the list, fall back to the first known instance and log a warning.Utils.initMainUrls()fromWicketApplication.init(), so the (potentially slow) discovery is paid once at boot instead of on the first user request.Utils.getMainRegistryUrl()argument passed toPublishNanopub.publish(...)inPublishFormandPreviewPage— let the library use its own default.Resolution rules
URL comparison is normalised (trim, strip trailing slash, lowercase); results are returned with a trailing slash.
Test plan
NANODASH_MAIN_*env vars; confirm logs report library-discovered URLs and the app reaches the registry.NANODASH_MAIN_REGISTRYset to a known library instance; confirm "validated against library instance list" log line.NANODASH_MAIN_REGISTRYset to a bogus URL; confirm warn log and fallback to first library instance.🤖 Generated with Claude Code