GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — improvement(custom-blocks): hardened delete with usage count + per-input required option by TheodoreSpeaks · Pull Request #5575 · simstudioai/sim

Conversation

@TheodoreSpeaks

@TheodoreSpeaks TheodoreSpeaks commented Jul 10, 2026 •
edited
Loading

Uh oh!

There was an error while loading. Please reload this page.

Copy link
Copy Markdown
Contributor

Summary

  • Deleting a custom block is hardened: the confirmation modal requires typing the block name, and shows how many workflows are still using the block (error-styled line under the confirm text). Delete audit record includes usage counts
  • New GET /api/custom-blocks/[id]/usages endpoint returning { usageCount, deployedUsageCount } — a workflow counts when the block appears in its live editor state or its ACTIVE deployment snapshot (scanned independently with a cheap text pre-filter before the jsonb parse, so a block removed in the editor but still deployed is counted). Same manage authz as delete
  • Per-input required option: a Required toggle on each custom block input (stored in the inputs overrides column, no migration). The consumer block gets the standard required asterisk + pre-deploy gate via the serializer's existing required-subBlock validation, and runs enforce it in the workflow handler against the child's live deployed Start fields — so a required override for a removed field is inert and newly added fields stay optional (schema drift never blocks a run)
  • Extracted authorizeManage into a shared module for the [id] routes

Type of Change

  • Improvement

Testing

Tested manually. Route tests for the usage-counts endpoint (401/404/403/200) and unit tests for required-input enforcement (empty/filled, stale-override, added-field, legacy name-keyed, multi-field). lint, check:api-validation:strict, check:migrations (no new migrations), and check:react-query pass; usage SQL exercised against a live database.

Checklist

  • Code follows project style guidelines
  • Self-reviewed my changes
  • Tests added/updated and passing
  • No new warnings introduced
  • I confirm that I have read and agree to the terms outlined in the Contributor License Agreement (CLA)

🤖 Generated with Claude Code

https://claude.ai/code/session_01Jc1SjzdZkiyVLqUmCS1x9H

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

greptile-apps[bot] reacted with thumbs up emoji
All reactions
  • 👍 1 reaction
@vercel

vercel Bot commented Jul 10, 2026 •
edited
Loading

Uh oh!

There was an error while loading. Please reload this page.

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

1 Skipped Deployment
Project Deployment Actions Updated (UTC)
docs Skipped Skipped Jul 10, 2026 11:56pm

Request Review

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@cursor

cursor Bot commented Jul 10, 2026 •
edited
Loading

Uh oh!

There was an error while loading. Please reload this page.

Copy link
Copy Markdown

PR Summary

Medium Risk
Touches workflow execution boundaries (required-input validation and custom-block error handling) and org-scoped delete/usage SQL; authz is reused from manage routes, but wrong usage counts or enforcement could affect runs or destructive actions.

Overview
Hardens custom block deletion and adds publisher-defined required inputs for deploy-as-block workflows.

Delete flow: Unpublish now loads org-wide usage counts via GET /api/custom-blocks/[id]/usages (same authorizeManage as PATCH/DELETE). The settings UI prefetches counts, refetches when opening delete, shows how many workflows still reference the block, and requires typing the block name to confirm. Delete audit metadata records usageCount and deployedUsageCount. authorizeManage is extracted to a shared module for [id] routes.

Required inputs: Publishers can mark each exposed Start input required (stored in existing inputs JSON overrides—no migration). That flows into generated block config (required on sub-blocks for editor/serializer) and into getCustomBlockAuthority. At run time, findMissingRequiredCustomBlockInputs validates against the child’s live deployed Start fields; missing values throw a consumer-safe error (surfaced through ChildWorkflowError instead of the generic custom-block failure). Stale overrides for removed fields are ignored.

Usage counting: getCustomBlockUsageCounts unions workflows that place the block type in live workflow_blocks or in the active deployment snapshot (with a LIKE pre-filter before jsonb parsing).

Reviewed by Cursor Bugbot for commit 093a5cf. Bugbot is set up for automated code reviews on this repo. Configure here.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

cursor[bot]
cursor Bot reviewed Jul 10, 2026
View reviewed changes
Comment thread apps/sim/ee/custom-blocks/components/custom-block-detail.tsx Resolved

Uh oh!

There was an error while loading. Please reload this page.

@greptile-apps

greptile-apps Bot commented Jul 10, 2026 •
edited
Loading

Uh oh!

There was an error while loading. Please reload this page.

Copy link
Copy Markdown
Contributor

Greptile Summary

This PR hardens custom block deletion and adds required input controls. The main changes are:

  • A new usage-count endpoint for custom blocks.
  • Delete confirmation with the block name and current usage count.
  • Delete audit metadata with live and deployed usage counts.
  • Per-input required overrides for custom block consumers.
  • Runtime validation for required custom block inputs.

Confidence Score: 5/5

This looks safe to merge.

  • No blocking issues found in the changed code.

Important Files Changed

Filename Overview
apps/sim/app/api/custom-blocks/[id]/usages/route.ts Adds an authenticated usage-count endpoint that returns aggregate counts only.
apps/sim/lib/workflows/custom-blocks/operations.ts Adds live and deployed usage counting for custom block types.
apps/sim/app/api/custom-blocks/[id]/route.ts Adds usage-count audit metadata to custom block deletion.
apps/sim/executor/handlers/workflow/workflow-handler.ts Adds runtime validation for required custom block inputs.
apps/sim/ee/custom-blocks/components/custom-block-detail.tsx Adds required input toggles and a stronger delete confirmation flow.

Reviews (3): Last reviewed commit: "fix(custom-blocks): escape LIKE wildcard..." | Re-trigger Greptile

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

greptile-apps[bot]
greptile-apps Bot reviewed Jul 10, 2026
View reviewed changes
Comment thread apps/sim/app/api/custom-blocks/[id]/usages/route.ts Resolved

Uh oh!

There was an error while loading. Please reload this page.

Comment thread apps/sim/lib/workflows/custom-blocks/operations.ts Resolved

Uh oh!

There was an error while loading. Please reload this page.

@vercel
vercel Bot deployed to Preview July 10, 2026 22:35
View deployment
@vercel
vercel Bot deployed to Preview July 10, 2026 23:17
View deployment
@vercel
vercel Bot temporarily deployed to Preview July 10, 2026 23:33 Inactive
cursor[bot]
cursor Bot reviewed Jul 10, 2026
View reviewed changes
Comment thread apps/sim/ee/custom-blocks/components/custom-block-detail.tsx Resolved

Uh oh!

There was an error while loading. Please reload this page.

Comment thread apps/sim/ee/custom-blocks/components/custom-block-detail.tsx Resolved

Uh oh!

There was an error while loading. Please reload this page.

@TheodoreSpeaks
TheodoreSpeaks force-pushed the improve/delete-custom-block branch from 56b2349 to 3384be6 Compare July 10, 2026 23:38
@TheodoreSpeaks TheodoreSpeaks changed the title improvement(custom-blocks): usage visibility + type-to-confirm delete improvement(custom-blocks): hardened delete with usage count + per-input required option Jul 10, 2026
@TheodoreSpeaks

TheodoreSpeaks commented Jul 10, 2026

Copy link
Copy Markdown
Contributor Author

@greptile review

greptile-apps[bot] reacted with thumbs up emoji
All reactions
  • 👍 1 reaction

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@vercel
vercel Bot deployed to Preview July 10, 2026 23:43
View deployment
TheodoreSpeaks added 3 commits July 10, 2026 16:45
@TheodoreSpeaks
improvement(custom-blocks): usage visibility + type-to-confirm delete
704bb22
@TheodoreSpeaks
feat(custom-blocks): per-input required option
da9cb5a
@TheodoreSpeaks
improvement(custom-blocks): replace usage tab with delete-confirmatio…
416a640
…n usage count
@TheodoreSpeaks
TheodoreSpeaks force-pushed the improve/delete-custom-block branch from 3384be6 to 416a640 Compare July 10, 2026 23:46
@TheodoreSpeaks
fix(custom-blocks): escape LIKE wildcards in usage scan + fresh count…
df17670
… on delete modal
@vercel
vercel Bot temporarily deployed to Preview July 10, 2026 23:48 Inactive
@TheodoreSpeaks

TheodoreSpeaks commented Jul 10, 2026

Copy link
Copy Markdown
Contributor Author

@greptile review

greptile-apps[bot] reacted with thumbs up emoji
All reactions
  • 👍 1 reaction

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

cursor[bot]
cursor Bot reviewed Jul 10, 2026
View reviewed changes

@cursor cursor Bot left a comment

Copy link
Copy Markdown

There was a problem hiding this comment.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cursor Bugbot has reviewed your changes using default effort and found 1 potential issue.

Fix All in Cursor

❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.

Reviewed by Cursor Bugbot for commit df17670. Configure here.

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
Comment thread apps/sim/lib/workflows/custom-blocks/operations.ts Resolved

Uh oh!

There was an error while loading. Please reload this page.

@TheodoreSpeaks
fix(custom-blocks): explicit ESCAPE clause on usage-scan LIKE prefilter
093a5cf
@vercel
vercel Bot temporarily deployed to Preview July 10, 2026 23:56 Inactive
@TheodoreSpeaks
TheodoreSpeaks merged commit 7962236 into staging Jul 11, 2026
17 checks passed

Uh oh!

There was an error while loading. Please reload this page.

@TheodoreSpeaks
TheodoreSpeaks deleted the improve/delete-custom-block branch July 11, 2026 00:16
@waleedlatif1 waleedlatif1 mentioned this pull request Jul 11, 2026
v0.7.29: GLM, ui and ux improvements #5567
Merged

This branch was previously deployed

1 inactive deployment
Preview — 093a5cf9 Deployed Jul 10, 2026 by vercel[bot]
View deployment
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Reviewers

@greptile-apps greptile-apps[bot] greptile-apps[bot] left review comments
@cursor cursor[bot] cursor[bot] left review comments

Uh oh!

There was an error while loading. Please reload this page.

Assignees

No one assigned

Labels

None yet

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

Uh oh!

There was an error while loading. Please reload this page.

1 participant

@TheodoreSpeaks
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
You are visitor 01402520 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.