The GitHub Actions job "Required Checks" on texera.git/backport/6443-reject-null-payloads-in-dashboard-type-p-v1.2 has succeeded. Run started by GitHub user Yicong-Huang (triggered by Yicong-Huang).
Head commit for run: d374c984f585c4cfbdea5218617dc24f22619762 / Eugene Gu <[email protected]> fix(frontend): reject null payloads in dashboard type predicates (#6443) ### What changes were proposed in this PR? The five type guards in `dashboard/type/type-predicates.ts` checked their nested payload with `typeof value.<field> === "object"`, which also accepts null because `typeof null === "object"` in JavaScript, so an entry like `{workflow: null}` passed `isDashboardWorkflow` and the `DashboardEntry` constructor then crashed with an unrelated `TypeError: Cannot read properties of null` while dereferencing the payload, instead of reaching its intentional `"Unexpected type in DashboardEntry."` error path. The guards also returned the falsy input itself rather than `false` for null/undefined input, violating their declared boolean type-guard signatures. This PR adds an `isNonNullObject` type guard (`typeof x === "object" && x !== null`) to the shared predicate utility (`common/util/predicate.ts`, next to `isDefined`) so the correct non-null object check is discoverable and reusable, uses it in the four object-payload guards, and switches all five guards to `!!value && ...` so they return strict booleans in every path. `isDashboardProject`'s `!value.workflow` exclusion is deliberately unchanged: a null `workflow` field means "no workflow data", so an object with a string `name` still classifies as a project and no valid entry changes classification. ### Any related issues, documentation, discussions? Fixes #6439. The buggy behavior was pinned by the five "(current behavior)" tests added in #6425 (issue #6400), which this PR flips to assert the corrected behavior. ### How was this PR tested? Added `predicate.spec.ts` (8 tests) covering `isNonNullObject` and the previously untested `isDefined`. Updated `type-predicates.spec.ts`: the four null-payload pins now assert `toBe(false)`, the null/undefined input cases are tightened from `toBeFalsy()` to `toBe(false)`, and the `isDashboardProject` null-workflow case keeps asserting `true` with a comment marking it as an intentional decision; the 5x5 cross-classification matrix and all of its 25 expected values are untouched, confirming that classification of realistic entries is unaffected. Ran locally via `yarn ng test --watch=false --include='**/common/util/predicate.spec.ts' --include='**/dashboard/type/type-predicates.spec.ts'` (61/61 pass), plus the full frontend suite whose failure set is identical to the unmodified main baseline (pre-existing, environment-related failures only), and `tsc --noEmit` with zero errors. ### Was this PR authored or co-authored using generative AI tooling? Co-authored using Claude Code(Fable 5). --------- (backported from commit a4e03e441d1a50feb51b8a6845da0691bbcfee72) Co-authored-by: Claude Opus 4.8 <[email protected]> Report URL: https://github.com/apache/texera/actions/runs/30431387988 With regards, GitHub Actions via GitBox
