Skip to content

Conversation

@github-actions
Copy link
Contributor

@github-actions github-actions bot commented Oct 7, 2025

This PR was opened by the Changesets release GitHub action. When you're ready to do a release, you can merge this and the packages will be published to npm automatically. If you're not ready to do a release yet, that's fine, whenever you add more changesets to main, this PR will be updated.

Releases

@pgflow/core@0.7.0

Minor Changes

  • 524db03: Add map step type infrastructure in SQL core

    ⚠️ This migration includes automatic data migration

    The migration will automatically update existing step_states rows to satisfy new constraints. This should complete without issues due to strict check constraints enforced in previous versions.

    💡 Recommended: Verify before deploying to production

    If you have existing production data and want to verify the migration will succeed cleanly, run this read-only check query (does not modify data) in Supabase Studio against your production database:

    1. Open Supabase Studio → SQL Editor
    2. Copy contents of pkgs/core/queries/PRE_MIGRATION_CHECK_20251006073122.sql
    3. Execute against your production database (not local dev!)
    4. Review results

    Expected output for successful migration:

    type                       | identifier                | details
    ---------------------------|---------------------------|------------------------------------------
    DATA_BACKFILL_STARTED      | run=def67890 step=process | initial_tasks will be set to 1 (...)
    DATA_BACKFILL_COMPLETED    | Found 100 completed steps | initial_tasks will be set to 1 (...)
    INFO_SUMMARY               | total_step_states=114     | created=0 started=1 completed=113 failed=0
    

    Interpretation:

    • ✅ Only DATA_BACKFILL_* and INFO_SUMMARY rows? Safe to migrate
    • ⚠️ These are expected data migrations handled automatically by the migration
    • 🆘 Unexpected rows or errors? Copy output and share on Discord for help

    📝 Note: This check identifies data that needs migration but does not modify anything. Only useful for production databases with existing runs.

    Automatic data updates:

    • Sets initial_tasks = 1 for all existing steps (correct for pre-map-step schema)
    • Sets remaining_tasks = NULL for 'created' status steps (new semantics)

    No manual intervention required.


    Changes

    This patch introduces the foundation for map step functionality in the SQL core layer:

    Schema Changes

    • Added step_type column to steps table with constraint allowing 'single' or 'map' values
    • Added initial_tasks column to step_states table (defaults to 1, stores planned task count)
    • Modified remaining_tasks column to be nullable (NULL = not started, >0 = active countdown)
    • Added constraint remaining_tasks_state_consistency to ensure remaining_tasks is only set when step has started
    • Removed only_single_task_per_step constraint from step_tasks table to allow multiple tasks per step

    Function Updates

    • add_step(): Now accepts step_type parameter (defaults to 'single') with validation that map steps can have at most 1 dependency
    • start_flow(): Sets initial_tasks = 1 for all steps (map step array handling will come in future phases)
    • start_ready_steps(): Copies initial_tasks to remaining_tasks when starting a step, maintaining proper task counting semantics

    Testing

    • Added comprehensive test coverage for map step creation and validation
    • All existing tests pass with the new schema changes
    • Tests validate the new step_type parameter and dependency constraints for map steps

    This is Phase 2a of the map step implementation, establishing the SQL infrastructure needed for parallel task execution in future phases.

Patch Changes

  • 524db03: Improve failure handling and prevent orphaned messages in queue

    • Archive all queued messages when a run fails to prevent resource waste
    • Handle type constraint violations gracefully without exceptions
    • Store output on failed tasks (including type violations) for debugging
    • Add performance index for efficient message archiving
    • Prevent retries on already-failed runs
    • Update table constraint to allow output storage on failed tasks
  • Updated dependencies [524db03]

  • Updated dependencies [524db03]

    • @pgflow/dsl@0.7.0

@pgflow/dsl@0.7.0

Minor Changes

  • 524db03: Add .array() method for type-safe array step creation

    Introduces a new .array() method that provides compile-time type safety for array-returning handlers with zero runtime overhead.

    • Enforces array return types at compile time
    • Pure delegation to existing .step() method
    • Full support for dependencies and runtime options
    • Backward compatible
    flow.array({ slug: 'items' }, () => [1, 2, 3]); // ✅ Valid
    flow.array({ slug: 'invalid' }, () => 42); // ❌ Compile error
  • 524db03: Add .map() method to Flow DSL for defining map-type steps

    The new .map() method enables defining steps that process arrays element-by-element, complementing the existing SQL Core map infrastructure. Key features:

    • Root maps: Process flow input arrays directly by omitting the array property
    • Dependent maps: Process another step's array output using array: 'stepSlug'
    • Type-safe: Enforces Json-compatible types with full TypeScript inference
    • Compile-time duplicate slug detection: TypeScript now prevents duplicate step slugs at compile-time
    • Different handler signature: Receives individual items (item, context) instead of full input object
    • Always returns arrays: Return type is HandlerReturnType[]
    • SQL generation: Correctly adds step_type => 'map' parameter to pgflow.add_step()

    Example usage:

    // Root map - processes array input
    new Flow<string[]>({ slug: 'process' }).map({ slug: 'uppercase' }, (item) =>
      item.toUpperCase()
    );
    
    // Dependent map - processes another step's output
    new Flow<{}>({ slug: 'workflow' })
      .array({ slug: 'items' }, () => [1, 2, 3])
      .map({ slug: 'double', array: 'items' }, (n) => n * 2);

pgflow@0.7.0

Patch Changes

  • 9553bfd: Fix: Use --config instead of --import-map for Deno compilation

    The compile command now uses Deno's --config flag instead of --import-map, enabling full deno.json support including nodeModulesDir, compilerOptions, unstable features, and other configuration options. Previously, these options would cause "Invalid top-level key" warnings.

    This is a backward-compatible bug fix. Existing deno.json files with only "imports" continue to work as before.

  • 28252d9: Fix config.toml corruption when updating minimal configurations (issue CLI install command have troubles with config.toml which is very minimal #143)

  • 0d4623e: Fix config.toml corruption with minimal configs while preserving comments. Switch to @decimalturn/toml-patch 0.3.7 (maintained fork) which fixes issue CLI install command have troubles with config.toml which is very minimal #143 and preserves TOML comments and formatting. Thanks to @DecimalTurn for maintaining the fork and contributing this fix.

  • Updated dependencies [524db03]

  • Updated dependencies [524db03]

    • @pgflow/core@0.7.0

@pgflow/client@0.7.0

Patch Changes

  • Updated dependencies [524db03]
  • Updated dependencies [524db03]
  • Updated dependencies [524db03]
  • Updated dependencies [524db03]
    • @pgflow/dsl@0.7.0
    • @pgflow/core@0.7.0

@pgflow/edge-worker@0.7.0

Patch Changes

  • Updated dependencies [524db03]
  • Updated dependencies [524db03]
  • Updated dependencies [524db03]
  • Updated dependencies [524db03]
    • @pgflow/dsl@0.7.0
    • @pgflow/core@0.7.0

@pgflow/example-flows@0.7.0

Patch Changes

  • Updated dependencies [524db03]
  • Updated dependencies [524db03]
  • Updated dependencies [524db03]
  • Updated dependencies [524db03]
    • @pgflow/dsl@0.7.0
    • @pgflow/core@0.7.0

@pgflow/website@0.7.0

@graphite-app
Copy link
Contributor

graphite-app bot commented Oct 7, 2025

How to use the Graphite Merge Queue

Add either label to this PR to merge it via the merge queue:

  • merge:queue - adds this PR to the back of the merge queue
  • hotfix:queue - for urgent hot fixes, skip the queue and merge this PR next

You must have a Graphite account in order to use the merge queue. Sign up using this link.

An organization admin has enabled the Graphite Merge Queue in this repository.

Please do not merge from GitHub as this will restart CI on PRs being processed by the merge queue.

@github-actions github-actions bot force-pushed the changeset-release/main branch 13 times, most recently from 55efaa7 to 9fd6c83 Compare October 10, 2025 19:26
@github-actions github-actions bot force-pushed the changeset-release/main branch from 9fd6c83 to ded0941 Compare October 14, 2025 08:46
@jumski jumski merged commit c2070cb into main Oct 14, 2025
@github-actions
Copy link
Contributor Author

🚀 Production Deployment: Website

Successfully deployed to production!

🔗 Production URL: https://pgflow.dev

📝 Details:

  • Commit: c2070cb7f74c0c7770380eae68cc98e6aad9a45c
  • View Logs

Deployed at: 2025-10-14T16:50:19+02:00

@github-actions
Copy link
Contributor Author

🚀 Production Deployment: Playground

Successfully deployed to production!

🔗 Production URL: https://playground.pgflow.dev

📝 Details:

  • Commit: c2070cb7f74c0c7770380eae68cc98e6aad9a45c
  • View Logs

Deployed at: 2025-10-14T16:50:19+02:00

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