Skip to content

Conversation

Copy link

Copilot AI commented Nov 5, 2025

Backend workflow activities contained repetitive state extraction boilerplate—each value required 6-8 lines of manual type assertions and error handling.

Changes

  • Centralized state helper: Extracted existing getFromState[T] generic from deployer_activities.go into shared state_helpers.go
  • Refactored activities: Applied helper to 15 step functions across user_activities.go (11 functions) and node_activities.go (4 functions)
  • Net impact: -96 lines of repetitive code

Example

Before:

emailVal, ok := state["email"]
if !ok {
    return fmt.Errorf("missing 'email' in state")
}
email, ok := emailVal.(string)
if !ok {
    return fmt.Errorf("'email' in state is not a string")
}

After:

email, err := getFromState[string](state, "email")
if err != nil {
    return err
}

The helper handles both direct type assertions and JSON marshaling/unmarshaling for persisted workflow state.

Original prompt

revise the dataflow in the backend


✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.

Copilot AI changed the title [WIP] Revise dataflow in the backend Refactor workflow state extraction to use generic helper Nov 5, 2025
Copilot AI requested a review from xmonader November 5, 2025 14:16
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.

2 participants