From 97a868e0f9abd11b75ba6006a0416bf79cf40cb8 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Wed, 15 Apr 2026 16:31:03 +0000 Subject: [PATCH 1/4] Initial plan From 8d97184105f7025d7486a67cc6c74881c2b5b3e3 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Wed, 15 Apr 2026 16:34:56 +0000 Subject: [PATCH 2/4] Make port requirement modal check only closed ports Agent-Logs-Url: https://github.com/naturallaw777/staging_alpha/sessions/e1d94cfc-9b91-48a3-99e3-64d7609ba710 Co-authored-by: naturallaw777 <99053422+naturallaw777@users.noreply.github.com> --- .../static/js/features.js | 36 ++++++++++++++++--- 1 file changed, 32 insertions(+), 4 deletions(-) diff --git a/app/sovran_systemsos_web/static/js/features.js b/app/sovran_systemsos_web/static/js/features.js index afe6547..12fb2b4 100644 --- a/app/sovran_systemsos_web/static/js/features.js +++ b/app/sovran_systemsos_web/static/js/features.js @@ -372,13 +372,41 @@ function handleFeatureToggle(feat, newEnabled) { } function proceedAfterConflictCheck() { - // Show port requirements notification if the feature has extra port needs var ports = feat.port_requirements || []; - if (ports.length > 0) { - openPortRequirementsModal(feat.name, ports, proceedAfterPortCheck); - } else { + if (ports.length === 0) { proceedAfterPortCheck(); + return; } + + // Check which ports are actually closed before showing the modal + fetch("/api/ports/status", { + method: "POST", + headers: { "Content-Type": "application/json" }, + body: JSON.stringify({ ports: ports }), + }) + .then(function(r) { return r.json(); }) + .then(function(data) { + var portStatuses = {}; + (data.ports || []).forEach(function(p) { + portStatuses[p.port + "/" + p.protocol] = p.status; + }); + + var closedPorts = ports.filter(function(p) { + var key = p.port + "/" + p.protocol; + var status = portStatuses[key] || "unknown"; + return status !== "listening" && status !== "firewall_open"; + }); + + if (closedPorts.length === 0) { + proceedAfterPortCheck(); + } else { + openPortRequirementsModal(feat.name, closedPorts, proceedAfterPortCheck); + } + }) + .catch(function() { + // Safe fallback if status check fails + openPortRequirementsModal(feat.name, ports, proceedAfterPortCheck); + }); } if (conflictNames.length > 0) { From 05c08532b39f067c7595d88cb59c9fc3466ddd36 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Wed, 15 Apr 2026 16:36:53 +0000 Subject: [PATCH 3/4] Log port status fetch failures before fallback modal Agent-Logs-Url: https://github.com/naturallaw777/staging_alpha/sessions/e1d94cfc-9b91-48a3-99e3-64d7609ba710 Co-authored-by: naturallaw777 <99053422+naturallaw777@users.noreply.github.com> --- app/sovran_systemsos_web/static/js/features.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/app/sovran_systemsos_web/static/js/features.js b/app/sovran_systemsos_web/static/js/features.js index 12fb2b4..e0fda1f 100644 --- a/app/sovran_systemsos_web/static/js/features.js +++ b/app/sovran_systemsos_web/static/js/features.js @@ -403,7 +403,8 @@ function handleFeatureToggle(feat, newEnabled) { openPortRequirementsModal(feat.name, closedPorts, proceedAfterPortCheck); } }) - .catch(function() { + .catch(function(err) { + console.warn("Failed to fetch port status for feature enable flow:", err); // Safe fallback if status check fails openPortRequirementsModal(feat.name, ports, proceedAfterPortCheck); }); From d973fae4db26f7fefbdf643ac23dd9e46dac93eb Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Wed, 15 Apr 2026 16:38:07 +0000 Subject: [PATCH 4/4] Handle non-OK port status responses in enable flow Agent-Logs-Url: https://github.com/naturallaw777/staging_alpha/sessions/e1d94cfc-9b91-48a3-99e3-64d7609ba710 Co-authored-by: naturallaw777 <99053422+naturallaw777@users.noreply.github.com> --- app/sovran_systemsos_web/static/js/features.js | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/app/sovran_systemsos_web/static/js/features.js b/app/sovran_systemsos_web/static/js/features.js index e0fda1f..fee6ede 100644 --- a/app/sovran_systemsos_web/static/js/features.js +++ b/app/sovran_systemsos_web/static/js/features.js @@ -384,7 +384,10 @@ function handleFeatureToggle(feat, newEnabled) { headers: { "Content-Type": "application/json" }, body: JSON.stringify({ ports: ports }), }) - .then(function(r) { return r.json(); }) + .then(function(r) { + if (!r.ok) throw new Error("Port status request failed: " + r.status); + return r.json(); + }) .then(function(data) { var portStatuses = {}; (data.ports || []).forEach(function(p) {