From ca5e1420e4ab48e3f16cdfeb972c521ebdc3653c Mon Sep 17 00:00:00 2001 From: Lance Edgar Date: Sat, 21 Mar 2026 15:03:06 -0500 Subject: [PATCH 1/3] fix: use correct uuid when processing webhook to delete record --- src/wuttafarm/cli/process_webhooks.py | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/wuttafarm/cli/process_webhooks.py b/src/wuttafarm/cli/process_webhooks.py index 9731247..9d66a70 100644 --- a/src/wuttafarm/cli/process_webhooks.py +++ b/src/wuttafarm/cli/process_webhooks.py @@ -94,8 +94,7 @@ class ChangeProcessor: return # delete corresponding record from our app - obj = importer.get_target_object((change.uuid,)) - if obj: + if obj := importer.get_target_object((change.farmos_uuid,)): importer.delete_target_object(obj) # TODO: this should live elsewhere From cc4b94a7b8c37642e4391a74dc9170c1d1ac7296 Mon Sep 17 00:00:00 2001 From: Lance Edgar Date: Sat, 21 Mar 2026 15:06:26 -0500 Subject: [PATCH 2/3] fix: improve behavior when deleting mirrored record from farmOS in some cases (maybe just dev?) the record does not exist in farmOS; if so we should silently ignore. and there seemed to be a problem with the sequence of events: - user clicks delete in WF - record is deleted from WF DB - delete request sent to farmOS API - webhook on farmOS side calls back to WF webhook URI somewhere in there, in practice things seemed to hang after user clicks delete. i suppose the thread handling user's request is "tied up" somehow, such that the webhook receiver can't process that request? that doesn't exactly make sense to me, but if we split off to a separate thread to request the farmOS deletion, things seem to work okay. so maybe that idea is more accurate than i'd expect --- src/wuttafarm/web/views/master.py | 21 +++++++++++++++++++-- 1 file changed, 19 insertions(+), 2 deletions(-) diff --git a/src/wuttafarm/web/views/master.py b/src/wuttafarm/web/views/master.py index d9fe986..ac9e2ed 100644 --- a/src/wuttafarm/web/views/master.py +++ b/src/wuttafarm/web/views/master.py @@ -23,6 +23,9 @@ Base class for WuttaFarm master views """ +import threading + +import requests from webhelpers2.html import tags from wuttaweb.views import MasterView @@ -145,10 +148,24 @@ class WuttaFarmMasterView(MasterView): # maybe delete from farmOS also if farmos_uuid: - entity_type = self.get_farmos_entity_type() - bundle = self.get_farmos_bundle() client = get_farmos_client_for_user(self.request) + # nb. must use separate thread to avoid some kind of race + # condition (?) - seems as though maybe a "boomerang" + # effect is happening; this seems to help anyway + thread = threading.Thread( + target=self.delete_from_farmos, args=(client, farmos_uuid) + ) + thread.start() + + def delete_from_farmos(self, client, farmos_uuid): + entity_type = self.get_farmos_entity_type() + bundle = self.get_farmos_bundle() + try: client.resource.delete(entity_type, bundle, farmos_uuid) + except requests.HTTPError as exc: + # ignore if record not found in farmOS + if exc.response.status_code != 404: + raise class TaxonomyMasterView(WuttaFarmMasterView): From f0fa189bcdf47b5eeeeaee2ad68bb51e861bfd50 Mon Sep 17 00:00:00 2001 From: Lance Edgar Date: Sat, 21 Mar 2026 15:11:36 -0500 Subject: [PATCH 3/3] =?UTF-8?q?bump:=20version=200.11.0=20=E2=86=92=200.11?= =?UTF-8?q?.1?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- CHANGELOG.md | 7 +++++++ pyproject.toml | 2 +- 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 4ee6b10..00ff67e 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,6 +5,13 @@ All notable changes to WuttaFarm will be documented in this file. The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/) and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.html). +## v0.11.1 (2026-03-21) + +### Fix + +- improve behavior when deleting mirrored record from farmOS +- use correct uuid when processing webhook to delete record + ## v0.11.0 (2026-03-15) ### Feat diff --git a/pyproject.toml b/pyproject.toml index c1a5cc0..e165b20 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -5,7 +5,7 @@ build-backend = "hatchling.build" [project] name = "WuttaFarm" -version = "0.11.0" +version = "0.11.1" description = "Web app to integrate with and extend farmOS" readme = "README.md" authors = [