Skip to content

feat: add constraints for input patterns and improve cascade skip tests#611

Open
jumski wants to merge 1 commit into02-14-fix_missing_skip_archivalfrom
02-16-test_core_cascade_skip
Open

feat: add constraints for input patterns and improve cascade skip tests#611
jumski wants to merge 1 commit into02-14-fix_missing_skip_archivalfrom
02-16-test_core_cascade_skip

Conversation

@jumski
Copy link
Contributor

@jumski jumski commented Feb 16, 2026

Add constraints and improve cascade skip functionality

This PR adds database constraints to ensure required_input_pattern and forbidden_input_pattern are always JSON objects, preventing invalid pattern types. It also enhances the _cascade_force_skip_steps function to:

  1. Return the count of skipped steps
  2. Make the function idempotent (safe to call multiple times)
  3. Improve event ordering tests with a more reliable trigger-based approach

The changes include:

  • Added CHECK constraints to the steps table to validate pattern types
  • Made _cascade_force_skip_steps return the number of steps skipped
  • Added a new test for idempotent behavior of _cascade_force_skip_steps
  • Improved event ordering tests to use a trigger-based approach instead of timestamp ordering
  • Added tests to verify rejection of invalid pattern types (arrays, strings)
  • Enhanced flow shape comparison tests to detect pattern differences

These changes improve data integrity and make the cascade skip functionality more robust and predictable.

@changeset-bot
Copy link

changeset-bot bot commented Feb 16, 2026

⚠️ No Changeset found

Latest commit: 4adfb3e

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

@nx-cloud
Copy link

nx-cloud bot commented Feb 16, 2026

View your CI Pipeline Execution ↗ for commit 4adfb3e

Command Status Duration Result
nx run core:pgtap ❌ Failed 2m 18s View ↗
nx run edge-worker:test:integration ✅ Succeeded 4m 8s View ↗
nx run client:e2e ✅ Succeeded 1m 17s View ↗
nx run edge-worker:e2e ✅ Succeeded 51s View ↗
nx run cli:e2e ✅ Succeeded 4s View ↗
nx affected -t verify-exports --base=origin/mai... ✅ Succeeded 3s View ↗
nx affected -t build --configuration=production... ✅ Succeeded 4s View ↗
nx affected -t lint typecheck test --parallel -... ✅ Succeeded 42s View ↗

☁️ Nx Cloud last updated this comment at 2026-02-16 12:55:22 UTC

20260120205547_pgflow_requeue_stalled_tasks.sql h1:4wCBBvjtETCgJf1eXmlH5wCTKDUhiLi0uzsFG1V528E=
20260124113408_pgflow_auth_secret_support.sql h1:i/s1JkBqRElN6FOYFQviJt685W08SuSo30aP25lNlLc=
20260214181656_pgflow_step_conditions.sql h1:uLPoOD/hPrerMACS6CThb7t7T5LKLpMMrdFXXi4ZQ5s=
20260216114523_pgflow_step_conditions.sql h1:TzZx6MqoNysxGaHHNSPvlRzvOJczEtv95jKM9yHy4o8=
Copy link
Contributor

Choose a reason for hiding this comment

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

This line references a migration file '20260216114523_pgflow_step_conditions.sql' that doesn't exist in the repository. Either rename the existing file '20260214181656_pgflow_step_conditions.sql' to '20260216114523_pgflow_step_conditions.sql', or update this line to reference the correct filename. Then run 'atlas migrate hash' to regenerate the checksums.

Spotted by Graphite Agent (based on CI logs)

Fix in Graphite


Is this helpful? React 👍 or 👎 to let us know.

@jumski jumski force-pushed the 02-16-test_core_cascade_skip branch from 565b7a8 to a0602c5 Compare February 16, 2026 12:15

-- Test 1: required_input_pattern as array should fail
select throws_ok(
$$ select pgflow.add_step('step_array', required_input_pattern => '[]'::jsonb) $$,
Copy link
Contributor

Choose a reason for hiding this comment

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

Missing flow_slug parameter. Change to: $$ select pgflow.add_step('invalid_pattern_test', 'step_array', required_input_pattern => '[]'::jsonb) $$

Spotted by Graphite Agent (based on CI logs)

Fix in Graphite


Is this helpful? React 👍 or 👎 to let us know.


-- Test 4: forbidden_input_pattern as string should fail
select throws_ok(
$$ select pgflow.add_step('step_forbidden_string', forbidden_input_pattern => '"invalid"'::jsonb) $$,
Copy link
Contributor

Choose a reason for hiding this comment

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

Missing flow_slug parameter. Change to: $$ select pgflow.add_step('invalid_pattern_test', 'step_forbidden_string', forbidden_input_pattern => '"invalid"'::jsonb) $$

Spotted by Graphite Agent (based on CI logs)

Fix in Graphite


Is this helpful? React 👍 or 👎 to let us know.

@jumski jumski force-pushed the 02-16-test_core_cascade_skip branch from a0602c5 to 4adfb3e Compare February 16, 2026 12:48
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