Skip to content

Reject plain-text helper results in composers instead of silently turning them into SQL#164

Open
Copilot wants to merge 2 commits into
mainfrom
copilot/fix-wait-for-completion-return-type
Open

Reject plain-text helper results in composers instead of silently turning them into SQL#164
Copilot wants to merge 2 commits into
mainfrom
copilot/fix-wait-for-completion-return-type

Conversation

Copy link
Copy Markdown

Copilot AI commented May 23, 2026

df.wait_for_completion() returns plain text status, but composers (df.seq, df.join, df.race, etc.) were treating that text as SQL and baking values like completed into the graph. The result was silent graph corruption and downstream syntax errors with no indication that the real problem was a non-future argument.

  • Add composer-level shape validation

    • Introduce a shared guard for composable DSL arguments.
    • Reject plain-text values that are not future envelopes and do not look like SQL statements.
    • Apply the guard across df.seq, df.as, df.loop, df.if, df.if_rows, df.join, df.join3, df.race, and df.start.
  • Fail early with actionable errors

    • Surface argument-specific errors instead of silently auto-wrapping helper output into SQL nodes.
    • Error messages now point at the misuse directly and include the intended guidance (df.sql(...) vs. a wait primitive).
  • Close the already-wrapped/operator path

    • Extend recursive graph validation to reject SQL nodes whose payload is plain text rather than a SQL statement.
    • This catches misuse even when the bad value arrives through operators or prebuilt envelopes.
  • Clarify wait_for_completion semantics

    • Update its source documentation to make explicit that it is a blocking polling helper, not a durable composable primitive.
  • Add focused coverage

    • Add unit tests for:
      • valid plain SQL arguments
      • valid future envelopes
      • rejection of plain-text status values
      • SQL-node validation for non-SQL payloads

Example of the new failure mode:

SELECT df.seq(
  df.wait_for_completion('abcd1234', 30),
  df.sql($$INSERT INTO audit(who) VALUES ('parent-post')$$)
);

Now fails at composition time with an explicit shape error instead of producing a graph that later tries to execute completed as SQL.

Agent-Logs-Url: https://github.com/microsoft/pg_durable/sessions/7623efa8-a8d8-42a0-9d49-de2df8311dda

Co-authored-by: pinodeca <32303022+pinodeca@users.noreply.github.com>
Copilot AI changed the title [WIP] Fix df.wait_for_completion to return future envelope instead of plain text Reject plain-text helper results in composers instead of silently turning them into SQL May 23, 2026
Copilot AI requested a review from pinodeca May 23, 2026 12:27
@pinodeca pinodeca marked this pull request as ready for review May 23, 2026 23:52
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.

df.wait_for_completion returns plain text and silently corrupts composers (df.seq, df.join, …)

2 participants