sshiv012 opened a new pull request, #9079:
URL: https://github.com/apache/texera/pull/9079

   ### What changes were proposed in this PR?
   
   `compileWorkflowAsync` called the JWT-protected `/api/compile` 
(`@RolesAllowed(REGULAR, ADMIN)` behind `JwtAuthFilter`, since #5199 / #5404) 
with only `Content-Type`, so every agent compile returned 401. The agent 
silently proceeded without operator output schemas or compile errors.
   
   ```
   Before:  prepareStep -> POST /api/compile (no Authorization)      -> 401 -> 
null
   After:   prepareStep -> POST /api/compile (Bearer <delegate token>) -> 200 
-> schemas + operatorErrors
   ```
   
   | File | Change |
   | --- | --- |
   | `api/compile-api.ts` | optional `token` param; sends 
`createAuthHeaders(token)` when present (no-token behavior unchanged) |
   | `agent/texera-agent.ts` | `prepareStep` passes 
`this.delegateConfig?.userToken` |
   
   Audited the other agent-service HTTP calls: workflow persist/retrieve and 
execution already send the Bearer token; `/api/resources/operator-metadata` is 
public. Compile was the only gap.
   
   ### Any related issues, documentation, discussions?
   
   Closes #9078
   
   ### How was this PR tested?
   
   Regression tests written first (failed before the fix, pass after):
   
   - `compile-api.spec.ts`: sends `Authorization: Bearer <token>` when given; 
omits it for an empty token; against a mock that mirrors `JwtAuthFilter` (401 
without Bearer, 200 with), returns `null` without a token and the schemas with 
one.
   - `texera-agent.spec.ts`: in delegate mode, every compile request carries 
`Bearer <delegate token>`.
   
   ```
   cd agent-service
   bun test             # 314 pass, 0 fail (19 files)
   bun run typecheck    # tsc --noEmit, exit 0
   bun run format:check # All matched files use Prettier code style!
   ```
   
   Not verified end-to-end against a running cluster.
   
   ### Was this PR authored or co-authored using generative AI tooling?
   
   Generated-by: Claude Code (Claude Opus 5.5)
   
   🤖 Generated with [Claude Code](https://claude.com/claude-code)
   


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