feat(background): auto-sync subscribed toolsets on deployment complete#2850
feat(background): auto-sync subscribed toolsets on deployment complete#2850simplesagar wants to merge 1 commit into
Conversation
Adds the AutoSyncToolsets Temporal activity that runs after a successful function-runner deploy. For each toolset whose auto_sync_sources array overlaps a function source touched by the deployment, the activity appends any new tool URNs as a new toolset_versions row and emits a toolset:tools_auto_added audit event. Never deletes URNs. Each toolset extension runs in its own transaction with SELECT ... FOR UPDATE on the toolset row so concurrent deployment-completed runs can't race past the unique (toolset_id, version) constraint. A failure on one toolset doesn't block extension of the others. Activity is best-effort relative to the deployment: a failure logs but does not transition the deployment to "failed" -- subscribers can still be reconciled on the next push. Supporting plumbing: - toolsets.LockToolsetForAutoSync row-lock query. - functions.ListFunctionToolURNsByDeployment query (joins function_tool_definitions with deployments_functions to surface the source slug needed for bucketing). - audit.ActionToolsetToolsAutoAdded action + LogToolsetToolsAutoAdded event with deployment_id, sources, and added_urns in metadata. - Wired into ProcessDeploymentWorkflow after DeployFunctionRunners. - Registered with the Temporal worker. Tests cover: empty deployment no-op, subscribed-toolset extension with audit log, idempotent replay, no-subscribers no-op, subscribed-to-wrong- source no-op. Stacks on #2848. Refs AGE-1377. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
There was a problem hiding this comment.
Claude Code Review
This repository is configured for manual code reviews. Comment @claude review to trigger a review and subscribe this PR to future pushes, or @claude review once for a one-time review.
Tip: disable this comment in your organization's Code Review settings.
|
Summary
The engine for AGE-1377. When a deployment finishes processing, the new
AutoSyncToolsetsTemporal activity finds every toolset whoseauto_sync_sourcessubscription overlaps the deployment's function sources, and appends any new tool URNs as a newtoolset_versionsrow.Stacks on the RPC PR (#2848); rebases to
mainonce #2834 and #2848 land. Design: #2833.What's in here
AutoSyncToolsetsactivity (server/internal/background/activities/auto_sync_toolsets.go):urn.Source(the function slug).ListToolsetsByAutoSyncSource(introduced in feat(toolsets): expose auto_sync_sources on UpdateToolset RPC #2848).server/internal/background/deployments.go): activity runs after `DeployFunctionRunners` succeeds, best-effort — a failure logs but does not fail the deployment.Test plan
🤖 Generated with Claude Code