The GitHub Actions job "Required Checks" on texera.git/main has failed. Run started by GitHub user github-merge-queue[bot] (triggered by github-merge-queue[bot]).
Head commit for run: 95e2748b97e0cdd29069971fe74349ac5f28134b / Tanishq Gandhi <[email protected]> fix(amber): store anonymous hub views with a NULL uid (#9226) ### What changes were proposed in this PR? A logged-out viewer's page sends `POST /api/hub/view` with `userId: 0`. `postView` incremented the view count, then inserted a `user_action` row with `uid = 0`. That breaks the foreign key to `user(uid)`, since no user has uid 0, so the request returned 500 and the view was never recorded, though the count had already gone up. - `postView` now records the view with a `NULL` uid when `userId` is `0` or missing. `user_action.uid` is nullable, and migration `13.sql` already stored the old anonymous views as `NULL`. - `recordUserAction` now takes `userId: Option[Integer] = None` and sets the uid only when one is given, so the default can't hit the same foreign key. - `postView` bumps the count and inserts the `user_action` row in one transaction, so a view that can't be recorded (for example, a uid whose account was deleted) no longer raises the count. Before and after, sending the logged-out request (`{"entityId":8,"userId":0,"entityType":"workflow"}`) three times: | | Responses | view_count (from 42) | user_action view rows | |---|---|---|---| | Before | 500, 500, 500 | 45 | 0 | | After | 200, 200, 200 | 45 | 3, uid NULL | ### Any related issues, documentation, discussions? Closes #9225. ### How was this PR tested? New `HubResourceSpec` tests: - a view with `userId: 0` and one with no `userId` both return the next count and are recorded with a `NULL` uid; - a view whose uid has no user row fails and leaves the count unchanged. Each fails without its part of the fix. `HubResourceSpec` passes (75/75), and `scalafmtCheckAll` and `scalafixAll --check` are clean. The before/after table above came from running the requests against a local server. ### Was this PR authored or co-authored using generative AI tooling? Generated-by: Claude Code (Claude Opus 5.5) Report URL: https://github.com/apache/texera/actions/runs/45065477939 With regards, GitHub Actions via GitBox
