This is an automated email from the ASF dual-hosted git repository.
xuang7 pushed a commit to branch release/v1.2
in repository https://gitbox.apache.org/repos/asf/texera.git
The following commit(s) were added to refs/heads/release/v1.2 by this push:
new 1908ccdd9b fix(frontend, v1.2): reject null payloads in dashboard type
predicates (#7010)
1908ccdd9b is described below
commit 1908ccdd9b9764567bef87be8156b2eaa1327cdc
Author: Yicong Huang <[email protected]>
AuthorDate: Wed Jul 29 14:20:13 2026 -0400
fix(frontend, v1.2): reject null payloads in dashboard type predicates
(#7010)
### What changes were proposed in this PR?
Backport of #6443 to `release/v1.2`, cherry-picked from
a4e03e441d1a50feb51b8a6845da0691bbcfee72.
**Source fix only.** Test changes from #6443 were omitted (the touched
specs do not exist on `release/v1.2` or depend on main-only test
infrastructure); only the source fix is carried over, per maintainer
guidance.
### Any related issues, documentation, discussions?
Backport of #6443. Originally linked #6439.
### How was this PR tested?
Release-branch CI runs on this PR. Source change cherry-picked cleanly;
test changes intentionally dropped.
### Was this PR authored or co-authored using generative AI tooling?
Yes — backport prepared with Claude Code (mechanical cherry-pick +
conflict resolution; the change itself is #6443 by its original author).
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-authored-by: Eugene Gu <[email protected]>
Co-authored-by: Claude Opus 4.8 <[email protected]>
---
frontend/src/app/common/util/predicate.ts | 10 ++++++++++
frontend/src/app/dashboard/type/type-predicates.ts | 11 ++++++-----
2 files changed, 16 insertions(+), 5 deletions(-)
diff --git a/frontend/src/app/common/util/predicate.ts
b/frontend/src/app/common/util/predicate.ts
index 981a1c7ff6..044417a738 100644
--- a/frontend/src/app/common/util/predicate.ts
+++ b/frontend/src/app/common/util/predicate.ts
@@ -25,3 +25,13 @@
export function isDefined<T>(val: T | undefined | null): val is T {
return val !== undefined && val != null;
}
+
+/**
+ * checks that the given value is a non-null object in the `typeof` sense,
+ * guarding against the JavaScript quirk that `typeof null === "object"`.
+ * @param x
+ * @returns {boolean}
+ */
+export function isNonNullObject(x: unknown): x is object {
+ return typeof x === "object" && x !== null;
+}
diff --git a/frontend/src/app/dashboard/type/type-predicates.ts
b/frontend/src/app/dashboard/type/type-predicates.ts
index ae4217d79e..8c128b2c11 100644
--- a/frontend/src/app/dashboard/type/type-predicates.ts
+++ b/frontend/src/app/dashboard/type/type-predicates.ts
@@ -22,23 +22,24 @@ import { DashboardProject } from
"./dashboard-project.interface";
import { DashboardFile } from "./dashboard-file.interface";
import { DashboardDataset } from "./dashboard-dataset.interface";
import { DashboardWorkflowComputingUnit } from
"../../common/type/workflow-computing-unit";
+import { isNonNullObject } from "../../common/util/predicate";
export function isDashboardWorkflow(value: any): value is DashboardWorkflow {
- return value && typeof value.workflow === "object";
+ return !!value && isNonNullObject(value.workflow);
}
export function isDashboardProject(value: any): value is DashboardProject {
- return value && typeof value.name === "string" && !value.workflow;
+ return !!value && typeof value.name === "string" && !value.workflow;
}
export function isDashboardFile(value: any): value is DashboardFile {
- return value && typeof value.ownerEmail === "string" && typeof value.file
=== "object";
+ return !!value && typeof value.ownerEmail === "string" &&
isNonNullObject(value.file);
}
export function isDashboardDataset(value: any): value is DashboardDataset {
- return value && typeof value.dataset === "object";
+ return !!value && isNonNullObject(value.dataset);
}
export function isDashboardWorkflowComputingUnit(value: any): value is
DashboardWorkflowComputingUnit {
- return value && typeof value.computingUnit === "object";
+ return !!value && isNonNullObject(value.computingUnit);
}