Skip to content

fix: resolve #1166 — when a node receives specific properties from one node and * properties from another node a race condition is caused - #8431

Open
andoan16 wants to merge 4 commits into
breadboard-ai:mainfrom
andoan16:contribai/improve/quality/add-support-for-required-wire-semantics-
Open

andoan16 wants to merge 4 commits into
breadboard-ai:mainfrom
andoan16:contribai/improve/quality/add-support-for-required-wire-semantics-

Conversation

@andoan16

Copy link
Copy Markdown

Summary

fix: resolve #1166 — when a node receives specific properties from one node and * properties from another node a race condition is caused

Problem

Severity: High | File: packages/breadboard/src/node.ts

The to method currently creates wires that don't block the target node from executing if other inputs are present. Need to add a way to mark wires as "required" (analogous to regex + vs *) so that the target node waits for at least one value from the source node before executing. This involves adding a new method like requiredTo() or an options parameter to to() that marks the wire as required, and updating the wire metadata to distinguish between optional (*) and required (+) wires.

Solution

Add a requiredTo() method to the Node class that creates a wire with required: true metadata. Alternatively, modify to(target, options?) to accept { required: boolean }. Update the Wire or Edge structure to include a required flag that indicates this node must receive at least one property from the source before the target can execute.

Changes

  • packages/breadboard/src/node.ts (new)
  • packages/breadboard/src/runtime/traversal.ts (new)
  • packages/breadboard/src/types.ts (new)
  • packages/breadboard/src/board.ts (new)

Testing

  • Existing tests pass
  • Manual review completed
  • No new warnings/errors introduced
…rties from one node and `*` properties from another node a race condition is caused

Fixes breadboard-ai#1166

Signed-off-by: Ân Đoàn <33853760+andoan16@users.noreply.github.com>
…rties from one node and `*` properties from another node a race condition is caused

Fixes breadboard-ai#1166

Signed-off-by: Ân Đoàn <33853760+andoan16@users.noreply.github.com>
…rties from one node and `*` properties from another node a race condition is caused

Fixes breadboard-ai#1166

Signed-off-by: Ân Đoàn <33853760+andoan16@users.noreply.github.com>
…rties from one node and `*` properties from another node a race condition is caused

Fixes breadboard-ai#1166

Signed-off-by: Ân Đoàn <33853760+andoan16@users.noreply.github.com>

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

1 participant