eugenegujing opened a new issue, #8646:
URL: https://github.com/apache/texera/issues/8646

   ### What happened?
   
   `WorkflowResource.mapWorkflowEntries` 
(`amber/src/main/scala/org/apache/texera/web/resource/dashboard/user/workflow/WorkflowResource.scala:270-273`):
   
   ```scala
   DashboardWorkflow(
     if (uid != null)
       workflowRecord.into(WORKFLOW_OF_USER).getUid.eq(uid)   // AnyRef.eq on 
java.lang.Integer
     else false,
   ```
   
   `eq` on `java.lang.Integer` is identity comparison. jOOQ and the session 
produce separate boxes, which are identical only inside the `Integer` cache 
(-128…127). So `GET /workflow/list` (`:391-410`) and the hub `getTops` path 
(`HubResource.scala:256-277`) report `isOwner = false` for the owner of any 
workflow once uids leave the cache. The search path computes the same flag with 
value equality (`WorkflowSearchQueryBuilder.scala:235`, `getUid == uid`), so 
the two listings disagree for the same user.
   
   No frontend code reads `isOwner` from either of these two paths today: the 
dashboard listing that gates owner-only affordances on the flag, such as 
cover-image editing (`card-item.component.ts:144`), is served by `GET 
/dashboard/search`, which computes the same flag with value equality and is 
already correct, and the hub landing page renders its own card that never reads 
it. The defect is in the response itself, and in three code paths answering the 
same question two different ways.
   
   The behaviour is already documented in a test comment but pinned in neither 
direction — `HubResourceSpec.scala:1140-1146`: "`isOwner == true` is 
deliberately not asserted anywhere. WorkflowResource's mapWorkflowEntries 
compares the two uids with `AnyRef.eq` … the owner's own request reports false 
today".
   
   **Expected:** `isOwner` is true for the owner regardless of uid magnitude 
(`==` / `.equals`).
   
   ### How to reproduce?
   
   1. Create a user whose uid is ≥ 128 (or seed one) and let them create 
workflow W.
   2. As that user, `GET /api/workflow/list`.
   
   Observed: W has `isOwner: false` while `ownerId` equals the caller's uid. On 
a fresh DB with small uids the same request returns `true`.
   Expected: `isOwner: true`.
   
   ### Version/Branch
   
   1.4.0-incubating-SNAPSHOT (main)
   
   ### Commit Hash (Optional)
   
   _No response_
   
   ### What browsers are you seeing the problem on?
   
   _No response_
   
   ### Relevant log output
   
   ```shell
   
   ```


-- 
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]

Reply via email to