feat(blocks): add block visibility gating (preview blocks + AppConfig reveals)#5526
feat(blocks): add block visibility gating (preview blocks + AppConfig reveals)#5526TheodoreSpeaks wants to merge 3 commits into
Conversation
The dependency was pinned to a direct tarball on cdn.sheetjs.com, which now returns 403 (Cloudflare bot-challenge) to automated clients, breaking bun install in CI. npm's own xlsx is frozen at 0.18.5, so switch to the @e965/xlsx mirror which republishes the identical 0.20.3 CDN build to the npm registry. No code changes needed — all imports use bare 'xlsx'.
|
The latest updates on your projects. Learn more about Vercel for GitHub. |
PR SummaryMedium Risk Overview
New Also switches the Reviewed by Cursor Bugbot for commit c61616c. Bugbot is set up for automated code reviews on this repo. Configure here. |
Greptile SummaryThis PR adds block visibility gating for preview and kill-switched blocks. The main changes are:
Confidence Score: 4/5This is close, but I would fix the copilot edit bypass before merging.
apps/sim/lib/copilot/tools/server/router.ts Important Files Changed
Reviews (3): Last reviewed commit: "fix(blocks): reset visibility to fail-cl..." | Re-trigger Greptile |
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes using default effort and found 1 potential issue.
❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.
Reviewed by Cursor Bugbot for commit e6ad905. Configure here.
|
@greptile review |
|
@greptile review |
| * (find-by-type over clones, never a discovery listing) and gating it would | ||
| * only risk leaking display projections into persisted state. | ||
| */ | ||
| const VISIBILITY_GATED_TOOLS = new Set(['get_blocks_metadata', 'get_trigger_blocks']) |
There was a problem hiding this comment.
edit_workflow runs outside withBlockVisibility, so registry reads in that tool see no active visibility state. That still hides unrevealed preview blocks, but it does not apply the disabled set for shipped blocks. When AppConfig kill-switches a shipped block with enabled: false, the filtered copilot discovery tools hide it, but the edit tool can still resolve and place it in a workflow. Existing placed blocks can keep executing, but this path still allows new placements through the agent edit flow.
There was a problem hiding this comment.
Deliberate, and documented as the placeable-by-id contract (see the /gate-block skill invariants): gating is discovery-only, and every add-by-explicit-id path behaves identically — workflow JSON import, cross-workspace duplicate, the admin API, and the agent edit flow when the user explicitly names the type. The agent cannot discover a gated block (metadata/VFS/tool listing are all filtered), so this path only fires when a user asks for the block by name — same trust model as import. Wrapping edit_workflow in withBlockVisibility would not change this anyway: its type validation resolves via pure getBlock (never gated) by design, because that same resolution path is what keeps already-placed gated blocks rendering and executing. Blocking placement would require a semantic change to the kill switch (discovery-only → placement enforcement) that we explicitly scoped out.

Summary
preview: trueon a BlockConfig hides the block from every discovery surface (toolbar, cmd+K, mentions, tool picker, mothership VFS/metadata/tools, Access Control, docs/catalog) in every environment until revealed — fail-closed, including SSRblock-visibilityAppConfig document (per-block{enabled, orgIds, userIds, adminEnabled}rules — admins/org allowlists get a(Preview)name suffix,enabled: true= GA) orPREVIEW_BLOCKSenv for self-host/dev;enabled: falseon a shipped block = discovery kill switchgetBlockstays pure, gated blocks stay ingetAllBlocks()as clones (clone-not-remove), placed instances keep runningblocks/visibility/context (client resolver + per-request server ALS, independent of the custom-block overlay), registry projection with a zero-cost fast path when no preview blocks existappconfig-rules.ts(feature-flags refactored onto it)generate-docs/check-block-registryskip preview blocks (no public docs/catalog/meta until GA); Access Control hides them from the list while keeping stored allowlists viewer-independent/gate-blockskill documents the lifecycle; infra profile landed in simstudioai/infra#262Type of Change
Testing
966 tests across touched suites (new coverage: rule parsing, visibility evaluation, registry projection, hydrate no-op, route, preview-not-exempt), tsc, lint,
check:api-validation:strict, react-query + client-boundary audits,check-block-registry— all green. Route-count baseline 919→920 (new contract-bound route).Checklist