From 07f0dd068ca1d190fc50d092346cba3809d14d00 Mon Sep 17 00:00:00 2001 From: Emily Ragan Date: Wed, 30 Sep 2026 16:52:17 -0600 Subject: [PATCH 1/5] fix(plugins): report modified_diff failures instead of no conflicts Co-Authored-By: Claude --- .../spec/controllers/plugins_controller_spec.rb | 9 +++++++++ openc3/lib/openc3/models/plugin_model.rb | 4 +--- openc3/spec/models/plugin_model_spec.rb | 5 ++--- 3 files changed, 12 insertions(+), 6 deletions(-) diff --git a/openc3-cosmos-cmd-tlm-api/spec/controllers/plugins_controller_spec.rb b/openc3-cosmos-cmd-tlm-api/spec/controllers/plugins_controller_spec.rb index 1e6c33470c..ba78261e53 100644 --- a/openc3-cosmos-cmd-tlm-api/spec/controllers/plugins_controller_spec.rb +++ b/openc3-cosmos-cmd-tlm-api/spec/controllers/plugins_controller_spec.rb @@ -98,6 +98,15 @@ expect(json["files"]).to eq(["INST/screen.txt"]) end + it "returns internal_server_error when the diff fails" do + allow(OpenC3::PluginModel).to receive(:modified_diff).and_raise("boom") + + post :modified_diff, params: {scope: "DEFAULT", plugin_hash: '{"name":"x"}'} + expect(response).to have_http_status(:internal_server_error) + json = JSON.parse(response.body) + expect(json["message"]).to eq("boom") + end + it "returns bad_request on invalid plugin_hash JSON" do post :modified_diff, params: {scope: "DEFAULT", plugin_hash: "not json"} expect(response).to have_http_status(:bad_request) diff --git a/openc3/lib/openc3/models/plugin_model.rb b/openc3/lib/openc3/models/plugin_model.rb index c5b1fce410..b66f7ef59c 100644 --- a/openc3/lib/openc3/models/plugin_model.rb +++ b/openc3/lib/openc3/models/plugin_model.rb @@ -428,11 +428,9 @@ def self.install_phase2(plugin_hash, scope:, gem_file_path: nil, validate_only: # Dry run: which modified files would this plugin's install supersede? # Returns a list of "TARGET/path" names whose live (modified) content # differs from the rendered plugin content. Read-only; no side effects. + # Errors propagate so callers can tell a failed check from an empty diff. def self.modified_diff(plugin_hash, scope:) install_phase2(plugin_hash, scope: scope, diff_only: true) - rescue => e - Logger.warn("PluginModel.modified_diff failed: #{e.message}") - [] end def initialize( diff --git a/openc3/spec/models/plugin_model_spec.rb b/openc3/spec/models/plugin_model_spec.rb index 8c621b94fd..d0f9b8368a 100644 --- a/openc3/spec/models/plugin_model_spec.rb +++ b/openc3/spec/models/plugin_model_spec.rb @@ -381,10 +381,9 @@ module OpenC3 expect(PluginModel.modified_diff({"name" => "name"}, scope: "DEFAULT")).to eql(["TGT/screen.txt"]) end - it "returns an empty array and logs when install_phase2 raises" do + it "raises when install_phase2 raises rather than reporting no differences" do expect(PluginModel).to receive(:install_phase2).and_raise("boom") - expect(Logger).to receive(:warn).with(/modified_diff failed: boom/) - expect(PluginModel.modified_diff({"name" => "name"}, scope: "DEFAULT")).to eql([]) + expect { PluginModel.modified_diff({"name" => "name"}, scope: "DEFAULT") }.to raise_error("boom") end end From 4a16877f4087bf8e0621aae2a9f6cd8e5eb3a3b3 Mon Sep 17 00:00:00 2001 From: Emily Ragan Date: Wed, 30 Sep 2026 16:52:23 -0600 Subject: [PATCH 2/5] fix(admin): offer modified file deletion on upgrade without version history - Show the delete-modified checkbox on upgrade when Version History is disabled, since kept modified files override the new plugin - Show modified_diff failures in the dialog instead of reporting that no modified files conflict - Check the delete box in the upgrade playwright test when it is shown Co-Authored-By: Claude --- .../src/tools/admin/ModifiedPluginDialog.vue | 46 ++++++++++++++----- .../src/tools/admin/tabs/PluginsTab.vue | 1 + playwright/tests/admin/plugins.p.spec.ts | 11 +++-- 3 files changed, 44 insertions(+), 14 deletions(-) diff --git a/openc3-cosmos-init/plugins/packages/openc3-vue-common/src/tools/admin/ModifiedPluginDialog.vue b/openc3-cosmos-init/plugins/packages/openc3-vue-common/src/tools/admin/ModifiedPluginDialog.vue index c7425dae17..a204e43426 100644 --- a/openc3-cosmos-init/plugins/packages/openc3-vue-common/src/tools/admin/ModifiedPluginDialog.vue +++ b/openc3-cosmos-init/plugins/packages/openc3-vue-common/src/tools/admin/ModifiedPluginDialog.vue @@ -20,13 +20,18 @@ - -