jason810496 commented on code in PR #70993:
URL: https://github.com/apache/airflow/pull/70993#discussion_r3812421688
##########
ts-sdk/src/cli/pack.ts:
##########
@@ -193,7 +194,7 @@ function isBundleManifest(value: unknown): value is
BundleManifest {
}
function isTaskIdList(value: unknown): value is string[] {
- return Array.isArray(value) && value.every((item) => typeof item ===
"string" && item.length > 0);
+ return Array.isArray(value) && value.every((item) => typeof item ===
"string");
Review Comment:
Let's keep the non-empty check since`tasks: [""]` violates the bundle
schema's `minLength: 1`.
```suggestion
return Array.isArray(value) && value.every((item) => typeof item ===
"string" && item.length > 0);
```
##########
ts-sdk/src/coordinator/manifest.ts:
##########
@@ -56,10 +38,6 @@ export interface BundleManifest {
export function buildBundleManifest(registry: DagRegistry): BundleManifest {
const dags: BundleManifest["dags"] = {};
for (const { dagId, tasks } of listRegistryDags(registry)) {
Review Comment:
We should keep a type guard before object-key coercion. A numeric `dagId`
becomes `"123"` in metadata while the registry stays keyed by `123`, so runtime
lookup fails.
```suggestion
for (const { dagId, tasks } of listRegistryDags(registry)) {
if (typeof dagId !== "string") {
throw new Error("Dag ID must be a string");
}
```
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]