Skip to content

v0.6.71: build error fix#4493

Merged
icecrasher321 merged 1 commit intomainfrom
staging
May 7, 2026
Merged

v0.6.71: build error fix#4493
icecrasher321 merged 1 commit intomainfrom
staging

Conversation

@icecrasher321
Copy link
Copy Markdown
Collaborator

fix(type-error): subblock migrations type error (#4492)

@vercel
Copy link
Copy Markdown

vercel Bot commented May 7, 2026

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

1 Skipped Deployment
Project Deployment Actions Updated (UTC)
docs Skipped Skipped May 7, 2026 8:17am

Request Review

@cursor
Copy link
Copy Markdown

cursor Bot commented May 7, 2026

PR Summary

Medium Risk
Touches workflow state migration logic that rewrites persisted subBlocks, so a mistake could alter migrated block values/types despite the change being small and type-focused.

Overview
Refactors migrateBlockSubblockIds in subblock-migrations.ts to eliminate a TypeScript type error by treating the pre-migration subblock entry as unknown and narrowing with isPlainRecord.

When migrating a record-shaped subblock, it now explicitly derives type and safely extracts value (defaulting to null if missing) before writing the migrated entry; non-record entries are wrapped as { id, type, value } with explicit casts.

Reviewed by Cursor Bugbot for commit 49713f8. Configure here.

@greptile-apps
Copy link
Copy Markdown
Contributor

greptile-apps Bot commented May 7, 2026

Greptile Summary

This PR fixes a TypeScript build error in subblock-migrations.ts by refining how the old subblock entry is typed and narrowed during migration. The ternary assignment is replaced with a cleaner if/else block, oldEntry is explicitly typed as unknown, and type/value fields are cast individually rather than casting the entire object.

  • Type safety improvement: Widening oldEntry to unknown and using isPlainRecord for narrowing aligns with TypeScript's strict narrowing rules — previously the implicit record type allowed direct property access that the compiler flagged.
  • Behavioral note: When the old entry is a plain record that lacks a value key, the new code explicitly assigns value: null (via Object.hasOwn check) rather than leaving the property absent; this ensures the resulting shape always satisfies BlockState['subBlocks'][string].

Confidence Score: 5/5

Safe to merge — the change is a narrow, well-scoped type-error fix with no logic regressions.

The only changed file is a migration helper, and the refactor preserves all existing branching behaviour. The one small functional delta — defaulting value to null rather than leaving it absent — makes the output shape more predictable and is intentional. No new code paths are introduced.

No files require special attention.

Important Files Changed

Filename Overview
apps/sim/lib/workflows/migrations/subblock-migrations.ts Refactors migrateBlockSubblockIds to type oldEntry as unknown and use if/else narrowing with explicit casts, eliminating the previous type error while preserving migration logic.

Flowchart

%%{init: {'theme': 'neutral'}}%%
flowchart TD
    A[migrateBlockSubblockIds called] --> B{oldId in subBlocks?}
    B -- No --> C[skip]
    B -- Yes --> D{newId already in result?}
    D -- Yes --> E[delete oldId and continue]
    D -- No --> F[oldEntry typed as unknown]
    F --> G{isPlainRecord check}
    G -- Yes --> H[Extract type from configuredType or oldEntry.type]
    H --> I[value = hasOwn check, default to null]
    I --> J[Assign spread + id + type + value to newId]
    G -- No --> K[Assign id + configuredType + oldEntry as value to newId]
    J --> L[delete oldId from result]
    K --> L
Loading

Reviews (1): Last reviewed commit: "fix(type-error): subblock migrations typ..." | Re-trigger Greptile

@icecrasher321 icecrasher321 merged commit 3cc581e into main May 7, 2026
21 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