Skip to content

Honor |=> captures on composite THEN / IF / LOOP nodes#163

Merged
pinodeca merged 2 commits into
mainfrom
copilot/fix-silent-drop-composite-nodes
May 26, 2026
Merged

Honor |=> captures on composite THEN / IF / LOOP nodes#163
pinodeca merged 2 commits into
mainfrom
copilot/fix-silent-drop-composite-nodes

Conversation

Copilot AI commented May 23, 2026

Copy link
Copy Markdown
Contributor

|=> / df.as() could bind to a composite node because PostgreSQL operators are left-associative, but composite executors were not writing their final value into the named-results map. That made downstream $name references fail at runtime even though the capture appeared to succeed.

  • Runtime behavior

    • Add shared named-result storage for composite executors.
    • Make THEN store the right-hand result when result_name is set.
    • Make IF store the selected branch result when result_name is set.
    • Make LOOP store its terminal result, including df.break(...) values, when result_name is set.
  • Regression coverage

    • Add an E2E case for the reported signal flow where |=> 'decision' binds to the outer THEN node and the captured value is referenced in a downstream df.if(...).
    • Add E2E coverage for naming an IF node directly and using $decision.* downstream.
    • Add E2E coverage for naming a LOOP node directly and consuming the loop’s final JSON result downstream.
  • Result

    • Composite nodes now behave like atomic nodes with respect to |=>: the final computed result is available for later substitution under the requested name.

Example:

SELECT df.start(
    'INSERT INTO test_log (msg) VALUES (''Waiting...'')'
    ~> df.wait_for_signal('test_approval', 60) |=> 'decision'
    ~> df.if(
        'SELECT ($decision::jsonb->''data''->>''approved'')::boolean',
        'INSERT INTO test_log (msg) VALUES (''APPROVED!'')',
        'INSERT INTO test_log (msg) VALUES (''REJECTED!'')'
    ),
    'signal-var-fix'
);

Copilot AI changed the title [WIP] Fix silent dropping of name in composite nodes with capture operator Honor |=> captures on composite THEN / IF / LOOP nodes May 23, 2026
Copilot AI requested a review from pinodeca May 23, 2026 12:25
@pinodeca pinodeca marked this pull request as ready for review May 23, 2026 23:34
@pinodeca pinodeca force-pushed the copilot/fix-silent-drop-composite-nodes branch from 4acff1b to 78df040 Compare May 23, 2026 23:39

pinodeca commented May 23, 2026

Copy link
Copy Markdown
Contributor

Reviewed with GPT-5.5 in GitHub Copilot.

No blocking findings. The composite-node capture change looks consistent with existing named-result handling for JOIN/RACE/HTTP/SIGNAL, and the rebase conflict in 07_signals.sql now keeps both main's plain-text signal test and this PR's composite THEN capture test.

Validated locally: cargo fmt -p pg_durable -- --check, ./scripts/test-e2e-local.sh 02_conditionals, ./scripts/test-e2e-local.sh 03_loops, and ./scripts/test-e2e-local.sh 07_signals passed. cargo clippy --features pg17 -- -D warnings was blocked by an unrelated pre-existing unused extract_host warning in src/ssrf.rs.

@pinodeca pinodeca merged commit a8186f7 into main May 26, 2026
5 checks passed
@pinodeca pinodeca deleted the copilot/fix-silent-drop-composite-nodes branch May 26, 2026 22: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.

|=> 'name' silently dropped when applied to composite nodes (THEN/JOIN/RACE/IF/LOOP)

2 participants