Skip to content

v0.3.29: copilot fixes, remove block from subflow, code cleanups#1004

Merged
icecrasher321 merged 7 commits into
mainfrom
staging
Aug 18, 2025
Merged

v0.3.29: copilot fixes, remove block from subflow, code cleanups#1004
icecrasher321 merged 7 commits into
mainfrom
staging

Conversation

@icecrasher321
Copy link
Copy Markdown
Collaborator

Summary

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)

Sg312 and others added 7 commits August 16, 2025 11:10
…#994)

* improvement(db): remove deprecated  column from workflow table

* removed extraneous logs

* update sockets envvar
* Fix abort

* Cred updates

* Updates

* Fix sheet id showing up in diff view

* Update diff view

* Text overflow

* Optimistic accept

* Serialization catching

* Depth 0 fix

* Fix icons

* Updates

* Lint
…figs/state (#1000)

* fix(workflow-error): allow users to delete workflows with invalid configs/state

* cleanup
…o consolidate subflow code (#983)

* added logic to remove blocks from subflows

* refactored logic into just subflow-node

* bun run lint

* added subflow test

* added a safety check for data.parentId

* added state update logic

* bun run lint

* removed old logic

* removed any

* added tests

* added type safety

* removed test script

* type safety

---------

Co-authored-by: Adam Gough <adamgough@Mac.attlocal.net>
Co-authored-by: waleedlatif1 <walif6@gmail.com>
@vercel
Copy link
Copy Markdown

vercel Bot commented Aug 18, 2025

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

Project Deployment Preview Comments Updated (UTC)
sim (staging) Ready Ready Comment Aug 18, 2025 7:17am
1 Skipped Deployment
Project Deployment Preview Comments Updated (UTC)
docs Skipped Skipped Aug 18, 2025 7:17am

@icecrasher321 icecrasher321 changed the title v0.3.29: v0.3.29: copilot fixes, remove block from subflow, code cleanups Aug 18, 2025
@icecrasher321 icecrasher321 merged commit 570c07b into main Aug 18, 2025
7 checks passed
Copy link
Copy Markdown
Contributor

@greptile-apps greptile-apps Bot left a comment

Choose a reason for hiding this comment

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

Greptile Summary

This PR represents a significant architectural evolution for the workflow management system, consolidating multiple improvements across database schema, UI components, and the copilot feature. The most substantial change is the removal of the deprecated 'state' column from the workflow table, completing a migration from storing workflow data as JSON blobs to a normalized relational structure using separate tables (workflow_blocks, workflow_edges, workflow_subflows). This change affects numerous API endpoints, migration scripts, and database operations throughout the codebase.

The subflow consolidation (#983) is another major refactoring that merges previously separate LoopNodeComponent and ParallelNodeComponent into a unified SubflowNodeComponent. This new component uses a kind property to differentiate between 'loop' and 'parallel' types, reducing code duplication and improving maintainability. The consolidation includes updates to type definitions, CSS selectors, utility functions, and component mappings throughout the workflow editor.

The copilot diff improvements (#1002) introduce sophisticated workflow comparison capabilities. New type definitions in lib/workflows/diff/types.ts support tracking field-level changes, while components like WorkflowBlock and SubBlock now support diff mode with visual highlighting and interactive controls that don't modify the underlying workflow state. The diff system includes validation using serializer round-trip testing to prevent invalid configurations from reaching the canvas.

Additional improvements include logs cleanup (#999) with restructured workflow_execution_logs table that consolidates cost tracking into JSONB columns, OAuth credential refresh functionality for better copilot reliability, and various UI enhancements including improved text wrapping and terminology changes.

Confidence score: 3/5

  • This PR introduces several breaking changes that could affect workflows not yet migrated to normalized tables, with multiple endpoints now returning 400 errors instead of fallback data
  • Score reflects the significant architectural changes and removal of comprehensive test coverage for loop/parallel components, despite the improvements in code organization
  • Pay close attention to migration files 0075 and 0076, API endpoints removing JSON blob fallbacks, and the new SubflowNodeComponent implementation

40 files reviewed, 10 comments

Edit Code Review Bot Settings | Greptile

field_diffs?: Record<string, { changed_fields: string[]; unchanged_fields: string[] }>
}

export function hasDiffStatus(block: any): block is BlockWithDiff {
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

style: Consider using a more specific parameter type instead of any for better type safety

Suggested change
export function hasDiffStatus(block: any): block is BlockWithDiff {
export function hasDiffStatus(block: unknown): block is BlockWithDiff {

Context Used: Context - Avoid using type assertions to 'any' in TypeScript. Instead, ensure proper type definitions are used to maintain type safety. (link)

return NextResponse.json({ data: finalWorkflowData }, { status: 200 })
return NextResponse.json({ data: finalWorkflowData }, { status: 200 })
}
return NextResponse.json({ error: 'Workflow has no normalized data' }, { status: 400 })
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

logic: Breaking change: workflows without normalized data now return 400 error instead of falling back to JSON blob state. Ensure all workflows are migrated before deploying this change.

Comment on lines +103 to +104
acc as any,
acc.id
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

style: The type assertion acc as any bypasses TypeScript safety. Consider defining proper types for the credential parameter.

Context Used: Context - Avoid using type assertions to 'any' in TypeScript. Instead, ensure proper type definitions are used to maintain type safety. (link)

Comment on lines +107 to +109
} catch (_error) {
// If refresh fails, we still return whatever we had (may be null)
}
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

style: Empty catch block silently ignores refresh errors. Consider logging the error for debugging purposes.

Comment on lines +167 to +168
totalCost: (log.cost as any)?.total ?? null,
totalTokens: (log.cost as any)?.tokens?.total ?? null,
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

style: The type assertions to 'any' should be replaced with proper type definitions for the cost object structure

Context Used: Context - Avoid using type assertions to 'any' in TypeScript. Instead, ensure proper type definitions are used to maintain type safety. (link)

Comment on lines +108 to +110
it.concurrent('should be a memoized component', () => {
expect(SubflowNodeComponent).toBeDefined()
})
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

style: Test doesn't verify memoization - it only checks if component exists

Comment on lines +243 to +255
it.concurrent('should handle delete button click logic (simulated)', () => {
const mockEvent = { stopPropagation: vi.fn() }

const handleDelete = (e: any, nodeId: string) => {
e.stopPropagation()
mockRemoveBlock(nodeId)
}

handleDelete(mockEvent, 'test-id')

expect(mockEvent.stopPropagation).toHaveBeenCalled()
expect(mockRemoveBlock).toHaveBeenCalledWith('test-id')
})
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

style: Testing implementation details rather than actual component behavior - consider using render testing instead

const fieldDiff =
currentWorkflow.isDiffMode && currentBlock ? (currentBlock as any).field_diffs : undefined
currentWorkflow.isDiffMode && currentBlock && hasDiffStatus(currentBlock)
? currentBlock.field_diffs?.[id]
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

logic: Field diff access uses block ID as key, but the logic suggests field_diffs should be keyed by field name, not block ID. Verify the data structure matches this access pattern.

Comment on lines +440 to +441
const effectiveAdvanced = currentWorkflow.isDiffMode ? displayAdvancedMode : isAdvancedMode
const effectiveTrigger = currentWorkflow.isDiffMode ? displayTriggerMode : isTriggerMode
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

style: Consider extracting display mode calculations into a helper function to reduce code duplication and improve maintainability.

Context Used: Context - If a switch statement is large and handles multiple cases, extract each case into separate functions for better maintainability. (link)

subBlockValues={
data.subBlockValues ||
(currentWorkflow.isDiffMode && currentBlock
? (currentBlock as any).subBlocks
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

syntax: Type assertion (currentBlock as any).subBlocks bypasses TypeScript safety. Define proper types for diff-enhanced blocks.

Context Used: Context - Avoid using type assertions to 'any' in TypeScript. Instead, ensure proper type definitions are used to maintain type safety. (link)

arenadeveloper02 pushed a commit to arenadeveloper02/p2-sim that referenced this pull request Sep 19, 2025
v0.3.29: copilot fixes, remove block from subflow, code cleanups
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.

4 participants