feat: add config apply action#39
Merged
Merged
Conversation
There was a problem hiding this comment.
Pull request overview
Adds an optional “Apply changes” action to config-form admin tool contributions (gated by metadata.apply_path) and hardens config-form endpoint calls by enforcing same-origin /api/admin... routing plus stricter JSON parsing/handling. It also ensures validation is run (when available) before apply, disables form controls during requests, and clears write-only secret inputs after a successful apply.
Changes:
- Introduces
resolveAdminEndpoint()+fetchAdminJSON()to enforce same-origin admin API routing and strict-ish JSON/error handling for config-form endpoints. - Adds optional “Apply changes” flow with pre-apply validation (when
validate_pathexists), busy/disabled UI state, and secret-field clearing after successful apply. - Extends embedded-asset regression tests to assert presence of the new UI/action strings and helpers.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
| internal/ui_dist/index.html | Adds apply action + validation gating, same-origin admin endpoint resolution, strict JSON handling, busy-state UI disabling, and secret-field clearing. |
| internal/assets_test.go | Updates embedded admin shell assertions to include new strings/helpers introduced in the UI. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
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
Apply changesaction for config-form contributions that advertisemetadata.apply_path./api/admin...routes with strict JSON handling.validate_pathis present, fail closed on invalid/malformed validation, disable controls during requests, and clear write-only secret fields after successful apply.Verification
go test ./...git diff --checkReview Notes
apply_path, weak error handling, duplicate submits, stale validation caching, non-JSON fail-open behavior, and retained secret input values.