diff --git a/.last-branch b/.last-branch index dc149a9..3cc2163 100644 --- a/.last-branch +++ b/.last-branch @@ -1 +1 @@ -v20260203-02-autotask-resolve-button-enabled +v20260203-03-autotask-resolve-note-verify diff --git a/containers/backupchecks/src/backend/app/main/routes_run_checks.py b/containers/backupchecks/src/backend/app/main/routes_run_checks.py index 6e67d72..200fa5a 100644 --- a/containers/backupchecks/src/backend/app/main/routes_run_checks.py +++ b/containers/backupchecks/src/backend/app/main/routes_run_checks.py @@ -1893,7 +1893,23 @@ def api_run_checks_autotask_resolve_note(): except Exception as exc: return jsonify({"status": "error", "message": f"Autotask ticket update failed: {exc}"}), 400 - return jsonify({"status": "ok"}) + # Verify the update actually persisted (some tenants can return success while ignoring fields). + try: + t2 = client.get_ticket(ticket_id) + except Exception as exc: + return jsonify({"status": "error", "message": f"Autotask ticket updated but verification failed: {exc}"}), 400 + + persisted_desc = str((t2 or {}).get("description") or "") + if marker not in persisted_desc: + return jsonify( + { + "status": "error", + "message": "Autotask accepted the update request, but the marker text was not found after reloading the ticket. " + "This tenant may not allow updating the ticket description via the API.", + } + ), 400 + + return jsonify({"status": "ok", "message": "Update posted and verified."}) @main_bp.post("/api/run-checks/mark-reviewed") diff --git a/containers/backupchecks/src/templates/main/run_checks.html b/containers/backupchecks/src/templates/main/run_checks.html index 1039a44..111dfdb 100644 --- a/containers/backupchecks/src/templates/main/run_checks.html +++ b/containers/backupchecks/src/templates/main/run_checks.html @@ -1200,22 +1200,7 @@ table.addEventListener('change', function (e) { }) .then(function (j) { if (!j || j.status !== 'ok') throw new Error((j && j.message) || 'Failed.'); - if (atStatus) atStatus.textContent = 'Update posted.'; - // Keep UI consistent (button visibility depends on run state). - var keepRunId = currentRunId; - if (currentJobId) { - return fetch('/api/run-checks/details?job_id=' + encodeURIComponent(currentJobId)) - .then(function (r) { return r.json(); }) - .then(function (payload) { - currentPayload = payload; - var idx = 0; - var runs = (payload && payload.runs) || []; - for (var i = 0; i < runs.length; i++) { - if (String(runs[i].id) === String(keepRunId)) { idx = i; break; } - } - renderRun(payload, idx); - }); - } + if (atStatus) atStatus.textContent = (j && j.message) ? String(j.message) : 'Update posted.'; }) .catch(function (e) { if (atStatus) atStatus.textContent = e.message || 'Failed.'; diff --git a/docs/changelog.md b/docs/changelog.md index 3ea71dd..34a59c2 100644 --- a/docs/changelog.md +++ b/docs/changelog.md @@ -471,6 +471,14 @@ Changes: - Updated UI disable logic so only the Create action is disabled when an active Autotask ticket exists. - Ensured the Resolve button remains clickable for existing linked Autotask tickets. +## v20260203-03-autotask-resolve-note-verify + +- Fixed download issue by re-packaging the changed files. +- Improved Resolve action feedback so status messages remain visible until completion. +- Added backend verification step to confirm the Autotask update is actually persisted. +- Return a clear error when Autotask accepts the request but does not store the update. +- Prevented false-positive “resolved” messages when no ticket update exists. + *** ## v0.1.21