Repository navigation
camel-keycloak: deprecate 11 documented headers that nothing reads - #29955
Conversation
KeycloakProducer reads every header it honours explicitly by constant, and 11 of the 66 headers KeycloakConstants publishes appear nowhere in the main sources - not read, not written, not even in a test. They are not arbitrary: each sits next to one that does work, so the docs read as if a whole set were supported. * CamelKeycloakRoleId - the role operations take CamelKeycloakRoleName * CamelKeycloakIdpId - the identity provider operations take CamelKeycloakIdpAlias * CamelKeycloakResourceName/Type/Uri, CamelKeycloakPolicyName/Type, CamelKeycloakPermissionName, CamelKeycloakScopeName, CamelKeycloakCredentialType - the authorization-services and credential operations take a representation as the POJO request body; createResource for instance throws "Create resource requires POJO request with ResourceRepresentation" when pojoRequest is off, and never looks at the headers * CamelKeycloakBatchSize - the bulk operations iterate the whole list one element at a time; there is no batching to size Each is deprecated with a deprecationNote naming what to use instead, the way influxdb2's camelInfluxDB.RetentionPolicy was handled. The constants stay, so nothing stops compiling.
|
🌟 Thank you for your contribution to the Apache Camel project! 🌟 🐫 Apache Camel Committers, please review the following items:
|
✅ Generated files are up to dateAn earlier CI run reported uncommitted generated changes; the latest run no longer does. |
davsclaus
left a comment
There was a problem hiding this comment.
Thanks for the careful table. I grepped all 11 constants and their strings: only the declarations and the generated endpoint DSL refer to them, so the deprecation is justified. keycloak-producer.adoc already documents the POJO body for createResource, createResourcePolicy and createResourcePermission. A few notes are not quite accurate, though:
PERMISSION_NAME(KeycloakConstants.java:149):createResourcePermissiontakes aResourcePermissionRepresentation; onlyupdateResourcePermissiontakes aPolicyRepresentation. The PR table says the same.SCOPE_NAME(:155): there are no authorization-scope operations at all. The client scope operations work withoutpojoRequestand takeCamelKeycloakClientScopeName(seecreateClientScope), so the note could point there.CREDENTIAL_TYPE(:172): no credential operation takes aCredentialRepresentationbody.getUserCredentialslists them,deleteUserCredentialusesCamelKeycloakCredentialId, andresetUserPasswordalways builds a PASSWORD credential fromCamelKeycloakUserPassword.KeycloakEndpointBuilderFactory(dsl/camel-endpointdsl/src/generated/...) needs regenerating so the 11 header methods get@Deprecated, as in #29709.- Please add an entry to
camel-4x-upgrade-guide-4_24.adoc. - [Nit] The PR description cites #29667 for the influxdb precedent; that one is the kafka exactlyOnce PR. The influxdb2 deprecation was #29709.
Claude Code on behalf of davsclaus. This review was generated by an AI agent and may contain inaccuracies; please verify all suggestions before applying.
gnodet-bot
left a comment
There was a problem hiding this comment.
The deprecation notes added to PERMISSION_NAME, SCOPE_NAME, and CREDENTIAL_TYPE contain inaccurate descriptions of how the component uses (or doesn't use) these headers. See inline comments for details.
Additionally, 11 headers are deprecated in this PR but no entry has been added to the upgrade guide (docs/user-manual/modules/ROOT/pages/camel-4x-upgrade-guide-4_24.adoc or whichever is the current upgrade guide for the target release). Users of these headers need guidance on the migration path.
This review was generated by an AI agent, Hermès on behalf of @gnodet.
|
🧪 CI tested the following changed modules:
🔁 1 test passed only after a retry on JDK 21 (1 retried attempt) Recovered flaky tests on JDK 21 (1)
🔬 Scalpel shadow comparison — Scalpel: 9 of 726 tested, 24 compile-only — current: 9 all testedMaveniverse Scalpel detected 9 affected modules (current approach: 9). Skip-tests mode would test 9 modules (4 direct + 8 downstream), skip tests for 24 (generated code, meta-modules) Modules Scalpel would test (9)
Modules with tests skipped (24)
All tested modules (36 modules, 6m 5s total)Total reactor time: 6m 5s
Top 20 slowest modules:
|
davsclaus
left a comment
There was a problem hiding this comment.
Thanks, the Regen commit added @Deprecated to the 11 header methods in KeycloakEndpointBuilderFactory, so that point is done, and CI is green. The three notes and the upgrade guide from my earlier review are still open:
KeycloakConstants.java:149-150(PERMISSION_NAME):createResourcePermissiontakes aResourcePermissionRepresentation; onlyupdateResourcePermissiontakes aPolicyRepresentation.KeycloakConstants.java:155-156(SCOPE_NAME): there are no authorization-scope operations. The client scope operations useCamelKeycloakClientScopeName, so the note could point there.KeycloakConstants.java:172-173(CREDENTIAL_TYPE): no credential operation takes aCredentialRepresentationbody.deleteUserCredentialusesCamelKeycloakCredentialId, andresetUserPasswordbuilds a password credential fromCamelKeycloakUserPassword. After changing the notes,keycloak.json(component and catalog copy) andKeycloakEndpointBuilderFactoryneed regenerating once more.- Please add an entry for the 11 deprecated headers to
docs/user-manual/modules/ROOT/pages/camel-4x-upgrade-guide-4_24.adoc. - [Nit] The PR description still cites #29667 for the influxdb precedent; that one was #29709.
Claude Code on behalf of davsclaus. This review was generated by an AI agent and may contain inaccuracies; please verify all suggestions before applying.
…e entry The three notes named the wrong reason: - PERMISSION_NAME: createResourcePermission takes a ResourcePermissionRepresentation, not a PolicyRepresentation; only updatePermission and getPermissionById use that one, and they are keyed on PERMISSION_ID. - SCOPE_NAME: there are no authorization-scope operations at all. The client scope operations read CLIENT_SCOPE_NAME. - CREDENTIAL_TYPE: no credential operation takes a CredentialRepresentation body. getUserCredentials returns them, deleteUserCredential uses CREDENTIAL_ID, and resetUserPassword builds the representation itself from USER_PASSWORD. Added a section to the 4.24 upgrade guide listing all eleven headers with where each value belongs instead. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
|
All five done, thanks — the three notes were wrong as you and gnodet-bot describe.
Regenerated the two |
gnodet-bot
left a comment
There was a problem hiding this comment.
Following up on my earlier review — all previous findings have been addressed.
PERMISSION_NAMEdeprecation note — ✅ corrected: now accurately namesResourcePermissionRepresentationandCamelKeycloakPermissionIdSCOPE_NAMEdeprecation note — ✅ corrected: now says there are no authorization-scope operations and points toCamelKeycloakClientScopeNameCREDENTIAL_TYPEdeprecation note — ✅ corrected: now explains that no credential operation takes aCredentialRepresentationbody, and names the actual headers used- Upgrade guide entry — ✅ added:
camel-4x-upgrade-guide-4_24.adocnow has a=== camel-keycloaksection with a two-column table of all 11 deprecated headers and their replacements - PR description citation — ✅ corrected: now references #29709 (the influxdb2 deprecation), not #29667
The generated files (keycloak.json × 2, KeycloakEndpointBuilderFactory.java) are consistent with the deprecations. LGTM.
This review was generated by an AI agent, Hermès on behalf of @gnodet.
# Conflicts: # docs/user-manual/modules/ROOT/pages/camel-4x-upgrade-guide-4_24.adoc
davsclaus
left a comment
There was a problem hiding this comment.
Thanks @Dhairya-007, all the open points are in:
- The three notes (
PERMISSION_NAME,SCOPE_NAME,CREDENTIAL_TYPE) are now accurate, andkeycloak.json(component and catalog copy) andKeycloakEndpointBuilderFactoryare regenerated to match. - The upgrade guide has a table with all 11 headers and what to use instead. On this head, nothing outside
KeycloakConstantsand the generated files refers to any of the 11 constants. - The PR description now cites #29709.
- [Nit, optional]
KeycloakConstants.java:150-151andcamel-4x-upgrade-guide-4_24.adoc:8919-8920: "the other permission operations identify the permission with CamelKeycloakPermissionId" holds for get, update and deleteResourcePermission. It does not hold forlistResourcePermissionsorevaluatePermission(which usesCamelKeycloakPermissionAudience,...ResourceNamesand...Scopes). "get, update and deleteResourcePermission identify it with CamelKeycloakPermissionId" would be exact.
LGTM.
Claude Code on behalf of davsclaus. This review was generated by an AI agent and may contain inaccuracies; please verify all suggestions before applying.
|
Thanks @Dhairya-007, this is approved and ready to merge, but it now conflicts with main. #29954 (camel-docker deprecations) was merged and also adds a section at the end of Claude Code on behalf of davsclaus |
|
Thanks, this is approved and green, but it now conflicts with main in Claude Code on behalf of davsclaus |
|
@Dhairya-007 thanks, this one is approved, but it now conflicts with Claude Code on behalf of davsclaus |
gnodet-bot
left a comment
There was a problem hiding this comment.
Following up on my earlier review — all prior findings are addressed.
Previous findings status:
- Inaccurate
deprecationNotefor PERMISSION_NAME: ✅ Fixed (now correctly referencesResourcePermissionRepresentation) - Inaccurate
deprecationNotefor SCOPE_NAME: ✅ Fixed (now correctly referencesClientScopeNameand no auth-scope ops) - Inaccurate
deprecationNotefor CREDENTIAL_TYPE: ✅ Fixed (correctly states noCredentialRepresentationbody) - Missing upgrade guide: ✅ Comprehensive table added to
camel-4x-upgrade-guide-4_24.adoc
All 11 headers verified unused: KeycloakProducer.java reads none of them from exchange headers. @Deprecated annotations, deprecationNote values, and "deprecated": true in both catalog JSON copies are consistent for all 11 constants.
The optional PERMISSION_NAME nit from davsclaus (mentioning specific operations) is non-blocking and already noted by the maintainer who has APPROVED the PR. Ready to merge after rebase (merge conflict in the upgrade guide file).
This review was generated by an AI agent, Hermès on behalf of @gnodet.
oscerd
left a comment
There was a problem hiding this comment.
This is the largest of the set, so I spot-checked the claim rather than take the table on faith, and it stands up.
KeycloakProducer reads each header it honours by its constant, and the 11 flagged here are not among those reads. I checked ROLE_ID specifically: its only appearance in the main sources outside KeycloakConstants is the unrelated MISSING_ROLE_ID error-message string in the producer, not a getHeader(KeycloakConstants.ROLE_ID, ...), so the role operations really do take their id through the header the table names instead. The pattern the PR describes, a dead header sitting beside a working one so the table looks more complete than the component is, is the right thing to correct.
Each of the 11 is marked @Deprecated with a deprecationNote pointing at the header that actually carries the value, and there is an upgrade-guide entry, which is the correct path for public documented headers: keep them a cycle, mark them inert, name the replacement. The catalog, component JSON and endpoint-DSL regen are all included and CI is green, so the metadata is consistent. Good, careful cleanup.
Claude Code on behalf of oscerd
Resolves the conflict with main in the 4.24 upgrade guide (both entries kept). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Signed-off-by: Claus Ibsen <claus.ibsen@gmail.com>
Problem
KeycloakProducerreads every header it honours explicitly by constant -exchange.getIn().getHeader(KeycloakConstants.REALM_NAME, String.class)and so on. Of the 66 headersKeycloakConstantspublishes with@Metadata, 11 appear nowhere in the main sources at all: not read, not written, not referenced from a test.They are not obscure corners. Each sits beside one that does work, so the component docs read as if a whole set were supported when only part of it is:
CamelKeycloakRoleIdCamelKeycloakRoleNameCamelKeycloakIdpIdCamelKeycloakIdpAliasCamelKeycloakResourceName,CamelKeycloakResourceType,CamelKeycloakResourceUriResourceRepresentationas the POJO request bodyCamelKeycloakPolicyName,CamelKeycloakPolicyTypePolicyRepresentationas the POJO request bodyCamelKeycloakPermissionNamePolicyRepresentationas the POJO request bodyCamelKeycloakScopeNameCamelKeycloakCredentialTypeCredentialRepresentationas the POJO request bodyCamelKeycloakBatchSizecreateResourceis the clearest case. The docs offerCamelKeycloakResourceName,...ResourceTypeand...ResourceUri, and the producer does this:So setting the three headers and sending the exchange fails with a message about a POJO request, with nothing to connect that to the headers the docs told you to use.
CamelKeycloakBatchSizeis documented as "Batch size for bulk operations", but the bulk operations have no batching to size -bulkCreateUsersand its siblings walk the list and issue one call per element:Fix
Deprecate the 11 constants, each with a
deprecationNotenaming what to use instead, the same treatmentretentionPolicygot in #29709. The catalog then marks them deprecated and shows the note rather than advertising them as supported, and the constants themselves stay, so nothing stops compiling.The alternative would be to implement them - make the create operations fall back to building the representation from headers when
pojoRequestis off. That is a feature rather than a fix and I did not want to guess at the intended shape, but I am happy to do it instead if you would rather have the headers work than see them deprecated.The regenerated
keycloak.jsonfiles are included.