oscerd commented on PR #29841: URL: https://github.com/apache/camel/pull/29841#issuecomment-7095818271
Pushed `CAMEL-26844: A cancelled authorization leaves the exchange to the cancelling thread, and the executor tests live in camel-support` (91ed4690177c): 1. **Interrupted synchronous caller.** You were right: the await manager records the `InterruptedException` on the exchange and returns, `process(Exchange)` cancelled the task, and the completion still ran later on the continuation pool, where the policy callback replaced the exception with a `CamelAuthorizationException` and set the header on an exchange the caller was already routing. `AuthorizationAsyncExecutor.cancel(...)` now returns whether it claimed a pending task, and a claimed task is left to the canceller: the failure is written on the cancelling thread (an `InterruptedException` already on the exchange is kept), the continuation pool only cancels the SDK request, interrupts the worker and releases the capacity, and the callback is not invoked. `OpaSecurityProcessor` and `OpenFgaSecurityProcessor` record the denied decision (`CamelAuthorizationException` with the interrupt as cause, plus the policy header) on the calling thread when their cancel claims the task. The pro ducers keep the interrupt as the exchange's exception, as before. `processFuture` cancellation uses the same path. Tests: `claimedCancellationLeavesTheExchangeAndItsCallbackToTheCanceller` and `cancellationWritesItsFailureBeforeReturning` in the executor suite; `interruptedSynchronousCallerGetsTheDecisionOnItsOwnThread` in `OpaAsyncSecurityPolicyTest` and `OpenFgaAsyncSecurityPolicyTest` interrupt a thread blocked in `process(Exchange)` and check the decision is on the exchange when it returns, that downstream never runs, and that the next exchange is guarded normally. 2. **Executor tests in camel-support.** `OpaAsyncExecutorTest` moved to `core/camel-support` as `AuthorizationAsyncExecutorTest`. camel-support cannot use `DefaultCamelContext` or Mockito, even in test scope (camel-core-engine depends on camel-support, so the reactor would be cyclic), so the suite runs on a small stub: a `CamelContext` proxy whose executor service manager creates real pools through `DefaultThreadPoolFactory`, honours `addThreadFactoryListener` and `setThreadPoolFactory`, and shuts the pools down with the context. All ten tests are ported unchanged in what they assert; the `UnitOfWork` mock became a proxy that counts `done`. The executor's public members have Javadoc now. 3. **Observation wiring.** `OpenFgaAuthorizer.prepareCheckAsync` (and the OPA/SPIFFE async paths) will go through `AuthorizationObservation` once #29837 is on main; this PR gets that in the rebase you suggested, after #29840 and #29837 land. 4. The `prepareServerBatchCheck` Javadoc describes the server-side BatchCheck now (gnodet-bot's thread). The FQCNs in `OpaAsyncProducerTest`, `OpenFgaAsyncProducerTest`, `OpenFgaAsyncSecurityPolicyTest`, `SpiffeAsyncProducerTest` and the moved executor test are imports. `SpiffeProducer` has main's comment above `HEALTH_CHECK_IDS` again, and `OpaSecurityProcessor` reports a stopped policy with a `CamelAuthorizationException`, like OpenFGA. Locally: `AuthorizationAsyncExecutorTest` (12 tests) in camel-support, 177 camel-opa, 213 camel-openfga and 99 camel-spiffe unit tests, and the 16 `OpaWasmIT` tests pass. Formatter and import sorting clean. The DSL factories follow from the CI regen step if the description regeneration touches them. _Claude Code on behalf of oscerd_ -- 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]
