fix: notify when a resource is retyped to an internal type

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
This commit is contained in:
hugocasa
2026-09-24 10:08:42 +02:00
co-authored by Claude Opus 5.5
parent 564bb49b5c
commit 12b9f4fecc
2 changed files with 3 additions and 2 deletions
@@ -59,7 +59,7 @@ EXECUTE FUNCTION notify_mcp_tools_change();
CREATE TRIGGER resource_mcp_tools_update_trigger
AFTER UPDATE OF path, resource_type, description ON resource
FOR EACH ROW
WHEN (NEW.resource_type NOT IN ('cache', 'state')
WHEN ((OLD.resource_type NOT IN ('cache', 'state') OR NEW.resource_type NOT IN ('cache', 'state'))
AND (OLD.path IS DISTINCT FROM NEW.path
OR OLD.resource_type IS DISTINCT FROM NEW.resource_type
OR OLD.description IS DISTINCT FROM NEW.description))
+2 -1
View File
@@ -1075,7 +1075,8 @@ async fn check_path_conflict<'c>(
/// Resource types the platform writes on its own behalf rather than users editing them:
/// `state` backs `setState` and `cache` backs cached job results, so both are rewritten on
/// every job run. Workspace export skips them for the same reason the `record_resource_version`
/// trigger does; that trigger repeats this list in SQL, so the two have to move together.
/// trigger does; that trigger and the `notify_mcp_tools_change` resource triggers repeat this
/// list in SQL, so they have to move together.
pub const INTERNAL_RESOURCE_TYPES: [&str; 2] = ["state", "cache"];
/// Versions retained per resource path. The monitor sweep enforces it eventually; the history