Skip to content

improvement(subblocks): trust block registry over stored subblock type#5832

Merged
icecrasher321 merged 1 commit into
stagingfrom
improvement/subblock-type-heal
Jul 22, 2026
Merged

improvement(subblocks): trust block registry over stored subblock type#5832
icecrasher321 merged 1 commit into
stagingfrom
improvement/subblock-type-heal

Conversation

@icecrasher321

Copy link
Copy Markdown
Collaborator

Summary

Trust block registry over stored sub-block type. Older workflows with corrupted subblock types heal this way. Fixes imports, duplicates from removing edges.

Type of Change

  • Other: UX Improvement

Testing

Tested manually with old workflow.

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)

@vercel

vercel Bot commented Jul 22, 2026

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 22, 2026 12:57am

Request Review

@cursor

cursor Bot commented Jul 22, 2026

Copy link
Copy Markdown

PR Summary

Medium Risk
Changes affect workflow copy, duplicate, fork, import, and draft-load sanitization across many code paths; behavior is well covered by new regression tests but touches core persistence and edge wiring.

Overview
Subblock metadata now treats the block registry as the source of truth for declared fields, and copy/remap paths key condition/router row-id updates on block type + subblock key (isDynamicHandleSubblock) instead of the persisted type.

sanitizeMalformedSubBlocks overwrites a stored type that contradicts the configured one (e.g. a conditions field wrongly stamped short-input is repaired to condition-input on draft load, with persistence via migration). That closes a bug where duplicate, fork, paste, and import still remapped edge sourceHandles but skipped remapping condition row ids when the stored type had drifted—orphaning outgoing edges.

The same topology gate is applied in remapConditionIdsInSubBlocks, store remapConditionIds, and regenerateWorkflowStateIds. Copilot applyTriggerConfigToBlockSubblocks uses registry types for declared keys when synthesizing subblocks (undeclared keys still default to short-input).

Separately, the GitHub create PR review tool returns GitHub’s message on failed responses when present, with an HTTP-status fallback.

Reviewed by Cursor Bugbot for commit 363c320. Configure here.

@cursor cursor Bot left a comment

Copy link
Copy Markdown

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 363c320. Configure here.

@greptile-apps

greptile-apps Bot commented Jul 22, 2026

Copy link
Copy Markdown
Contributor

Greptile Summary

This PR makes workflow subblock metadata follow the block registry. The main changes are:

  • Repairs stored subblock types that differ from registry definitions.
  • Keeps condition and router row IDs aligned with edge handles during copies and duplicates.
  • Uses registry types when creating trigger-config subblocks.
  • Surfaces GitHub review API errors with an HTTP-status fallback.
  • Adds tests for the updated persistence and sanitization paths.

Confidence Score: 5/5

This looks safe to merge.

  • No blocking issues found in the changed code.
  • The updated remap gates are consistent across persistence and store paths.
  • Tests cover drifted metadata, edge-handle alignment, trigger fields, and malformed GitHub responses.

Important Files Changed

Filename Overview
apps/sim/lib/workflows/persistence/remap-internal-ids.ts Uses block type and canonical subblock keys when remapping condition and router row IDs.
apps/sim/lib/workflows/persistence/utils.ts Aligns workflow ID regeneration with the shared dynamic-handle topology helper.
apps/sim/lib/workflows/sanitization/subblocks.ts Repairs declared subblock types while preserving valid undeclared runtime fields.
apps/sim/stores/workflows/utils.ts Passes block types through duplication paths so row IDs and edge handles remain aligned.
apps/sim/lib/copilot/tools/server/workflow/edit-workflow/builders.ts Uses registry types for declared trigger-config fields and retains the existing fallback for dynamic fields.
apps/sim/tools/github/create_pr_review.ts Returns GitHub error messages when available and falls back to the response status.

Reviews (1): Last reviewed commit: "improvement(subblocks): trust block regi..." | Re-trigger Greptile

@icecrasher321
icecrasher321 merged commit 1b48eeb into staging Jul 22, 2026
20 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant