Skip to content

Commit 5da3a39

Browse files
committed
fix: deepcopy fields in Registry.update(), ensure installed_at exists
- Deepcopy incoming fields to prevent callers from mutating registry state, matching ExtensionRegistry/PresetRegistry pattern - Set installed_at when missing from existing entries so the registry converges to the expected shape over time
1 parent 16509cb commit 5da3a39

1 file changed

Lines changed: 4 additions & 1 deletion

File tree

src/specify_cli/workflows/catalog.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -157,9 +157,12 @@ def update(self, workflow_id: str, fields: dict[str, Any]) -> None:
157157
return
158158
installed_at = existing.get("installed_at")
159159

160-
existing.update(fields)
160+
import copy
161+
existing.update(copy.deepcopy(fields))
161162
if installed_at is not None and "installed_at" not in fields:
162163
existing["installed_at"] = installed_at
164+
if "installed_at" not in existing:
165+
existing["installed_at"] = datetime.now(timezone.utc).isoformat()
163166
existing["updated_at"] = datetime.now(timezone.utc).isoformat()
164167
self.save()
165168

0 commit comments

Comments
 (0)