Andrea Cosentino created CAMEL-28034:
----------------------------------------

             Summary: camel-aws2-comprehend: the health check calls a billed 
inference API, and the header wins over the option unlike the sibling components
                 Key: CAMEL-28034
                 URL: https://issues.apache.org/jira/browse/CAMEL-28034
             Project: Camel
          Issue Type: Bug
          Components: camel-aws2
            Reporter: Andrea Cosentino


Found during an audit of the cloud components (camel-aws, camel-azure, 
camel-google, camel-huawei) at commit 7c0644752e17. Every item below was 
verified against the source.

h4. 1. The health check calls DetectDominantLanguage on every probe
{{Comprehend2ProducerHealthCheck}} always calls 
{{comprehendClient.detectDominantLanguage(... .text("test") ...)}}, whatever 
operation the endpoint is configured with. Two consequences: it is a billed 
Comprehend call on every probe (the pricing page states a 3 unit / 300 
character minimum charge per request), and an endpoint running for instance 
classifyDocument under a least-privilege role gets AccessDeniedException, so 
health is DOWN and a readiness probe restarts a pod whose route works. The 
other AWS health checks use a free list/describe.
Proposed change: probe with a free call, or with the configured operation's own 
permission.

h4. 2. The header wins over the option, the opposite of the sibling components
{{Comprehend2Producer.getLanguageCode}} reads the header first and falls back 
to the option. aws2-polly, aws2-textract and aws2-translate all do the 
opposite, and polly even has a test named 
{{synthesizeSpeechOptionWinsOverHeader}}. A user moving between two components 
of the same family gets silently opposite behaviour for the same URI and header.
Proposed change: pick one precedence for the family and document it.

h4. 3. classifyDocument and containsPiiEntities have no functional test
Both only appear in pojoRequest routes used by the wrong-body-type 
parameterized test, so the non-POJO builder path of classifyDocument, including 
the "endpointArn must be specified" guard, is never executed. 
{{AmazonAWSComprehendMock}} has no {{classifyDocument}} method at all (it 
implements the other eight), so no happy-path test could run today.

h4. 4. Missing operations
{{ComprehendClient}} 2.57.7 exposes {{detectTargetedSentiment}} and the whole 
{{batchDetectDominantLanguage/Entities/KeyPhrases/Sentiment/Syntax/TargetedSentiment}}
 family (verified against the jar). The batch APIs take up to 25 documents per 
call and are the normal way to cut cost in a route that aggregates messages. 
Neither is reachable even with pojoRequest, because the switch has no branch 
for them.

h4. 5. Smaller issues
{{setUseDefaultCredentialsProvider(Boolean)}} assigns to a {{private boolean}} 
field: a null throws NPE on unboxing.
{{@Metadata(required = true)}} sits on a field already initialised to 
detectDominantLanguage.
classifyDocument is listed in the adoc operations table but {{endpointArn}} / 
{{CamelAwsComprehendEndpointArn}} appears nowhere in the page.

_Claude Code on behalf of oscerd_



--
This message was sent by Atlassian Jira
(v10.3.26#10030026)

Reply via email to