From 9f60e84075e7674c7176479ff145e92bb5fbb954 Mon Sep 17 00:00:00 2001 From: rob Date: Fri, 16 Jan 2026 20:53:26 -0400 Subject: [PATCH] Remove local hash comparison for publish state detection Simplified approach: just show the moderation status from the server without trying to detect local modifications. This eliminates the fragile hash comparison that kept breaking due to representation differences between to_dict(), raw YAML, and server-side normalization. States are now simply: local, pending, published, changes_requested, rejected Co-Authored-By: Claude Opus 4.5 --- src/cmdforge/gui/pages/tools_page.py | 26 +++----------------------- 1 file changed, 3 insertions(+), 23 deletions(-) diff --git a/src/cmdforge/gui/pages/tools_page.py b/src/cmdforge/gui/pages/tools_page.py index b74c51f..d0bf43a 100644 --- a/src/cmdforge/gui/pages/tools_page.py +++ b/src/cmdforge/gui/pages/tools_page.py @@ -20,7 +20,6 @@ from ...tool import ( get_tools_dir ) from ...config import load_config -from ...hash_utils import compute_config_hash class StatusSyncWorker(QThread): @@ -99,12 +98,11 @@ def get_tool_publish_state(tool_name: str) -> Tuple[str, Optional[str]]: Returns: Tuple of (state, registry_hash) where state is: - - "published" - approved in registry and current hash matches + - "published" - approved in registry - "pending" - submitted but awaiting moderation - "changes_requested" - admin requested changes before approval - "rejected" - rejected by admin - - "modified" - has registry_hash but current hash differs - - "local" - no registry_hash (never published/downloaded) + - "local" - no registry_hash (never published) """ config_path = get_tools_dir() / tool_name / "config.yaml" if not config_path.exists(): @@ -118,14 +116,7 @@ def get_tool_publish_state(tool_name: str) -> Tuple[str, Optional[str]]: if not registry_hash: return ("local", None) - # Compute hash from raw config, same as server does during publish - # Don't use to_dict() as it may add/remove fields (e.g., empty arguments: []) - current_hash = compute_config_hash(config) - - if current_hash != registry_hash: - return ("modified", registry_hash) - - # Hash matches - check moderation status + # Return the moderation status directly - no local hash comparison if registry_status == "approved": return ("published", registry_hash) elif registry_status == "changes_requested": @@ -133,7 +124,6 @@ def get_tool_publish_state(tool_name: str) -> Tuple[str, Optional[str]]: elif registry_status == "rejected": return ("rejected", registry_hash) else: - # pending or unknown return ("pending", registry_hash) except Exception: return ("local", None) @@ -334,10 +324,6 @@ class ToolsPage(QWidget): display_name = f"{name} ✗" tooltip = "Rejected by moderator" color = QColor(220, 38, 38) # Red - elif state == "modified": - display_name = f"{name} ●" - tooltip = "Published to registry - local modifications" - color = QColor(221, 107, 32) # Orange else: display_name = name tooltip = "Local tool - not published" @@ -556,12 +542,6 @@ class ToolsPage(QWidget): f"padding: 8px 12px; margin-bottom: 12px; font-size: 12px;'>" f"Reason:
{feedback_escaped}" ) - elif state == "modified": - lines.append( - "

" - "● Modified since last publish - republish to update registry

" - ) # Source info if tool.source: