Repository navigation
feat(lifecycle): add plugin.settings.test and settings_schema.test - #3
Merged
Merged
Conversation
This was referenced Dec 5, 2026
0xJacky
added a commit
to 0xJacky/nginx-ui
that referenced
this pull request
Dec 5, 2026
Copy gen/go of nginxui/plugin-spec#3 verbatim. Spec main also carries the informational Manifest.author (nginxui/plugin-spec#2), so mirror it in protocol.Manifest to keep the alignment test green. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
A secret that lists bound_to is now kept on save only while the listed settings keep their saved values. Without bound_to saving is unchanged, while a settings test still binds the secret to every other setting. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
0xJacky
force-pushed
the
feat/settings-test-hook
branch
from
December 5, 2026 15:59
fbc35e5 to
29f2635
Compare
0xJacky
added a commit
to nginxui/plugin-sdk-go
that referenced
this pull request
Dec 5, 2026
Copy gen/go of nginxui/plugin-spec#3 rebased onto main. It brings HostSite.server_names from plugin-spec#4, so protocol.HostSite gains ServerNames, and the bound_to comments now describe that a save keeps a stored secret only while the settings its bound_to lists are unchanged. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
0xJacky
added a commit
to 0xJacky/nginx-ui
that referenced
this pull request
Dec 5, 2026
Copy gen/go of nginxui/plugin-spec#3 verbatim. Spec main also carries the informational Manifest.author (nginxui/plugin-spec#2), so mirror it in protocol.Manifest to keep the alignment test green. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
0xJacky
added a commit
to 0xJacky/nginx-ui
that referenced
this pull request
Dec 5, 2026
A save that keeps a stored secret, by the placeholder or a missing key, is refused with 55034 while a setting the secret's bound_to lists differs from its saved value (after defaults). A typed secret is always accepted and never compared with the stored one. Secrets without bound_to save as before; a settings test still binds them to every other setting. The generated settings form shows the refusal on the secret field and asks for the secret again. The pb copy is synced with nginxui/plugin-spec#3 rebased onto main. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…ently Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
0xJacky
added a commit
to 0xJacky/nginx-ui
that referenced
this pull request
Dec 5, 2026
Also sync the pb copy with nginxui/plugin-spec#3. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
0xJacky
added a commit
to nginxui/plugin-sdk-go
that referenced
this pull request
Dec 5, 2026
* feat: serve plugin.settings.test through Plugin.TestSettings Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * chore: sync the manifest author from plugin-spec plugin-spec added an informational author (Manifest.author = 34) in nginxui/plugin-spec#2. Copy the regenerated pb/manifest.pb.go and mirror the field in protocol.Manifest so pb/ stays a verbatim copy. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * chore: sync pb with plugin-spec and document the save binding Copy gen/go of nginxui/plugin-spec#3 rebased onto main. It brings HostSite.server_names from plugin-spec#4, so protocol.HostSite gains ServerNames, and the bound_to comments now describe that a save keeps a stored secret only while the settings its bound_to lists are unchanged. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * chore: sync pb with plugin-spec Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * chore: sync pb with plugin-spec Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> --------- Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
0xJacky
added a commit
to 0xJacky/nginx-ui
that referenced
this pull request
Dec 5, 2026
…#2188) * feat(plugin): let the host test candidate plugin settings A settings panel only ever holds the redaction placeholder of a stored secret, so it cannot test a connection itself. Add an opt-in host hook: POST /api/plugins/:id/settings/test runs behind the same secure session and demo guards as saving, merges the stored secrets into the candidate settings and calls plugin.settings.test on the plugin that declares settings_schema.test. The candidate is never stored or returned; the answer is a bounded { ok, message, field } scrubbed of the secret values. A stored secret is merged only while every setting it is bound to keeps its saved value (bound_to, every other setting by default), so a test cannot pair a stored secret with a new destination. Saving is unchanged. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * fix(plugin): keep the settings test slot until the plugin call ends The plugin is never told that a call was abandoned, so a caller who aborts and retries must not free the one-test-per-plugin slot early. Run the call detached from the request with the test timeout, correct the documented timeout range and cover more binding cases. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * chore(plugin): sync the contract with nginxui/plugin-spec#3 Copy gen/go of nginxui/plugin-spec#3 verbatim. Spec main also carries the informational Manifest.author (nginxui/plugin-spec#2), so mirror it in protocol.Manifest to keep the alignment test green. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * docs(plugin): translate the settings test into zh_CN and zh_TW Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * feat(plugin): enforce bound_to on save for secrets that declare it A save that keeps a stored secret, by the placeholder or a missing key, is refused with 55034 while a setting the secret's bound_to lists differs from its saved value (after defaults). A typed secret is always accepted and never compared with the stored one. Secrets without bound_to save as before; a settings test still binds them to every other setting. The generated settings form shows the refusal on the secret field and asks for the secret again. The pb copy is synced with nginxui/plugin-spec#3 rebased onto main. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * fix(plugin): test the default fallback of the save binding A bound field without a stored value counts as its schema default; add tests for it and correct the comments and docs that called an empty value a fall back to the default. Document the cluster sync case and the one-secret-at-a-time refusal, and pin the save route status. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * docs(plugin): call a secret setting 机密/機密 in the settings test docs Follow the term the zh_CN and zh_TW plugin docs use for a secret setting, where 密钥/金鑰 means a cryptographic key, make the links repeat the heading, and state the empty-secret and cluster sync cases precisely. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * docs(plugin): call the plugin HTTP endpoint 介面 in zh_TW Also sync the pb copy with nginxui/plugin-spec#3. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> --------- Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
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.
Adds the contract for a settings "test connection" hook, as implemented in nginx-ui draft 0xJacky/nginx-ui#2188.
What it adds
lifecycle.proto:rpc SettingsTestwithrpc_name = "plugin.settings.test", plusPluginSettingsTestRequest { Struct settings }andPluginSettingsTestResponse { bool ok; string message }. The host sends it only to a plugin whose manifest declaressettings_schema.test. A plugin may also answer-32003withdata.field.manifest.protoandplugin.schema.json:settings_schema.test(SettingsTest { int32 timeout_seconds }, 0 to 60, where 0 or absent means 15). If it is there, the plugin serves the hook.settings[].bound_to(list of setting keys, forsecretfields). During a test the host passes a stored secret to the plugin only while every field it is bound to still has its saved value; absent means it is bound to every other field. On save, the host keeps a stored secret only while every fieldbound_tolists keeps its saved value, otherwise it refuses the save and the person enters the secret again; absent leaves saving unrestricted. A newly entered secret is always accepted. The proto comments ofbound_to,PluginSettingsTestRequestandPluginConfigureRequestand the schema description say so.gen/: regenerated withmake generate(pinned buf 1.73.0, protoc-gen-go 1.36.12, protoc-gen-go-grpc 1.6.2).gen/methods.jsongainsplugin.settings.test.53-plugin-settings-test-valid.jsonand54-plugin-settings-test-invalid-config.json.The change is additive and
api_versionstays 1. Older hosts ignore the new manifest members, and the schema used to rejecttestandbound_to. A host that implements this refuses a save that changes a field listed inbound_towhile keeping the stored secret (maintainer decision on nginx-ui #2188); plugins that declare nobound_tosave as before.Landing order
Plugin.TestSettings) and feat: type settings tests and the settings panel props plugin-sdk-web#3 (SettingsTestResult,SettingsPanelProps).This branch is rebased onto
main, which carriesHostSite.server_namesfrom #4. nginx-ui and plugin-sdk-go keep verbatim copies ofgen/go/nginxui/plugin/v1. Their PRs copy this branch's output byte for byte, including theauthorfield from #2 that neither had synced yet, and in plugin-sdk-go alsoserver_names.Checks
make checkpasses locally: buf lint and format, the generated code and methods.json are current, and the tests of both Go modules pass.🤖 Generated with Claude Code