This is an automated email from the ASF dual-hosted git repository.
jason810496 pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/airflow.git
The following commit(s) were added to refs/heads/main by this push:
new c6c75c748be TS SDK: Stop logging a false "then" warning for approval
and hitl tasks (#77587)
c6c75c748be is described below
commit c6c75c748be4ecbd90388762ee77cd8b6de2b2d2
Author: Joel Emmanuel <[email protected]>
AuthorDate: Thu Nov 26 03:03:07 2026 +0000
TS SDK: Stop logging a false "then" warning for approval and hitl tasks
(#77587)
* TS SDK: Stop logging a false "then" warning for approval and hitl tasks
resolveArgs on the operator context returned the arguments proxy from an
async function, so JavaScript read its then property and the proxy logged it as
an argument the call did not pass. Return the proxy inside BoundArgs instead.
* TS SDK: Skip then and toJSON misses in the arguments proxy
The check in the proxy also covers handlers that return or stringify their
arguments, so the wrapper in the operator context is no longer needed.
---
ts-sdk/src/coordinator/arg-binding.ts | 3 +++
ts-sdk/tests/coordinator/arg-binding.test.ts | 16 ++++++++++++++++
ts-sdk/tests/coordinator/integration.test.ts | 1 +
3 files changed, 20 insertions(+)
diff --git a/ts-sdk/src/coordinator/arg-binding.ts
b/ts-sdk/src/coordinator/arg-binding.ts
index 044c9f05282..0f100d73c19 100644
--- a/ts-sdk/src/coordinator/arg-binding.ts
+++ b/ts-sdk/src/coordinator/arg-binding.ts
@@ -41,6 +41,8 @@ import type { JsonValue } from "../sdk/client-types.js";
/** What Airflow stamps on an argument the Dag declared as a Python `int`. */
const INT64_FORMAT = "int64";
+const PROTOCOL_PROBES = new Set(["then", "toJSON"]);
+
/**
* Fold a name to the token both sides are matched on.
*
@@ -249,6 +251,7 @@ function makeArgsProxy(
if (typeof property !== "string") return undefined;
const name = resolve(property);
if (name !== undefined) return values.get(name);
+ if (PROTOCOL_PROBES.has(property)) return undefined;
// Logged, never thrown: a destructuring default such as
// `{ runId = "manual" }` is a legitimate miss, and nothing here can tell
// one from a typo.
diff --git a/ts-sdk/tests/coordinator/arg-binding.test.ts
b/ts-sdk/tests/coordinator/arg-binding.test.ts
index 6a0cfa189f2..2fa814c30ed 100644
--- a/ts-sdk/tests/coordinator/arg-binding.test.ts
+++ b/ts-sdk/tests/coordinator/arg-binding.test.ts
@@ -217,6 +217,22 @@ describe("resolveArgs", () => {
expect(warning).not.toHaveBeenCalled();
});
+ it("does not log awaiting or stringifying the arguments as an unbound
argument", async () => {
+ const { args, warning } = await bind([literal("rows", 7)]);
+
+ expect(await Promise.resolve(args)).toBe(args);
+ expect(JSON.stringify(args)).toBe('{"rows":7}');
+ expect(warning).not.toHaveBeenCalled();
+ });
+
+ it("binds arguments named then and toJSON", async () => {
+ const { args, warning } = await bind([literal("then", 1),
literal("to_json", 2)]);
+
+ const { then, toJSON } = args as { then: number; toJSON: number };
+ expect([then, toJSON]).toEqual([1, 2]);
+ expect(warning).not.toHaveBeenCalled();
+ });
+
it("folds `in` like a read", async () => {
const { args } = await bind([literal("region_code", "uk")]);
diff --git a/ts-sdk/tests/coordinator/integration.test.ts
b/ts-sdk/tests/coordinator/integration.test.ts
index 0e713209632..04197acc8c7 100644
--- a/ts-sdk/tests/coordinator/integration.test.ts
+++ b/ts-sdk/tests/coordinator/integration.test.ts
@@ -1455,6 +1455,7 @@ describe("coordinator runtime integration", () => {
next_method: "execute_complete",
next_kwargs: {},
});
+ expect(result.logRecords.filter((r) => r.level ===
"warning")).toEqual([]);
expect(requestsOf(result, "SetXCom")).toEqual([]);
});