Save and use registry_owner for rating lookups on flat-dir tools

Tools in flat directories (no owner subdir) had no way to resolve the
registry owner for rating API calls. This affected both own-published
tools and admin-published official tools.

- Publish dialog: save registry_owner from the publish response
- Status sync worker: backfill registry_owner from hash-based lookup
- get_tool_registry_info: check registry_owner before fallback_owner

Existing tools get backfilled on next background sync.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
rob 2026-01-30 02:59:46 -04:00
parent 9a284d7d04
commit 5ff108cdb3
2 changed files with 23 additions and 5 deletions

View File

@ -658,6 +658,10 @@ class PublishDialog(QDialog):
config_data = self._published_config.copy()
config_data["registry_hash"] = config_hash
config_data["registry_status"] = moderation_status
# Save the registry owner so rating lookups work
registry_owner = result.get("owner")
if registry_owner:
config_data["registry_owner"] = registry_owner
# Clear any old feedback
config_data.pop("registry_feedback", None)
config_path.write_text(yaml.dump(config_data, default_flow_style=False, sort_keys=False))

View File

@ -89,6 +89,7 @@ class StatusSyncWorker(QThread):
new_status = status_data.get("status", "pending")
new_feedback = status_data.get("feedback")
new_owner = status_data.get("owner")
old_status = config_data.get("registry_status", "pending")
old_feedback = config_data.get("registry_feedback")
@ -103,6 +104,10 @@ class StatusSyncWorker(QThread):
elif "registry_feedback" in config_data:
del config_data["registry_feedback"]
changed = True
# Backfill registry_owner from sync data
if new_owner and config_data.get("registry_owner") != new_owner:
config_data["registry_owner"] = new_owner
changed = True
if changed:
config_path.write_text(yaml.dump(config_data, default_flow_style=False, sort_keys=False))
@ -182,7 +187,12 @@ def get_tool_registry_info(tool_name: str, fallback_owner: Optional[str] = None)
owner, name = tool_name.split("/", 1)
return (owner, name)
# Flat dir: check source.author or installed_from in config
# Flat dir: check registry_owner (saved at publish time)
registry_owner = config_data.get("registry_owner")
if registry_owner:
return (registry_owner, tool_name)
# Check source.author or installed_from in config
source = config_data.get("source", {})
if isinstance(source, dict) and source.get("author"):
return (source["author"], tool_name)
@ -809,6 +819,10 @@ class ToolsPage(QWidget):
self.info_text.setHtml("\n".join(lines))
# Ensure slug is available for own published tools (fallback owner).
if not self._my_slug_fetched:
self._fetch_my_slug()
# Update rating bar below the detail text
self._update_rating_bar(qname)
@ -1011,14 +1025,14 @@ class ToolsPage(QWidget):
def _fetch_rating_if_needed(self, tool_name: str):
"""Fetch rating data for a registry tool if not cached."""
registry_info = get_tool_registry_info(tool_name, self._my_slug)
if not registry_info:
return
# Ensure we have the user slug (non-blocking first time; runs in main thread once)
if not self._my_slug_fetched:
self._fetch_my_slug()
registry_info = get_tool_registry_info(tool_name, self._my_slug)
if not registry_info:
return
if tool_name in self._rating_cache:
# Already cached - just update buttons
self._update_rate_button()