ci: add catalog consistency rules to the Kamelet validator#2881
Conversation
There was a problem hiding this comment.
is it normal to have 2 times the same value?
9bd4521 to
e692c42
Compare
|
@apupier re: your review comment on The Fixed by dropping the deprecated descriptor and keeping the single canonical one. A catalog-wide check turned up the same duplicate on Claude Code on behalf of Andrea Cosentino (@oscerd) |
|
there are conflicts to resolve |
Now that the validator inspects every Kamelet again, add four regression-guard rules to script/validator: - reject the deprecated "urn:alm:descriptor:com.tectonic.ui" x-descriptor prefix (use "urn:camel:group:credentials" instead); - enforce the routing convention: a source Kamelet routes to "kamelet:sink" and a sink Kamelet consumes from "kamelet:source"; - validate spec.dependencies syntax (camel: / mvn:group:artifact:version / github:apache/...); - check that every Kamelet shares the same camel.apache.org/catalog.version annotation. All four are green on the current catalog and were each verified to fire on an injected violation. Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
e692c42 to
4867564
Compare
|
Update on the duplicate-descriptor fix: #2879 was merged before the dedup landed, so the correction is now a standalone PR against This PR (#2881) has been rebased onto |
#2879 converted the deprecated urn:alm:descriptor:com.tectonic.ui:password x-descriptor to urn:camel:group:credentials on four properties that already carried the canonical urn:camel:group:credentials descriptor, leaving a duplicate entry (spotted by @apupier on #2881). Remove the redundant line so each property lists the credentials descriptor once. Affected: crypto-encrypt-action, crypto-decrypt-action, spring-rabbitmq-sink, spring-rabbitmq-source. A catalog-wide check confirms no property has duplicate x-descriptors. Co-authored-by: Claude Opus 4.8 (1M context) <[email protected]>
Summary
Adds four regression-guard rules to
script/validator, building on the validator re-arm in #2878 (merged). Each rule encodes a documented catalog convention so drift cannot silently return. With #2878 and #2879 now merged, this PR is a standalone change toscript/validator/validator.go.New rules
x-descriptorsentry with theurn:alm:descriptor:com.tectonic.uiprefix (the catalog standard isurn:camel:group:credentials).sourceKamelet must route tokamelet:sink; asinkKamelet must consume fromkamelet:source(per the README authoring rules). Action Kamelets are unconstrained.spec.dependenciesentry must becamel:<component>,mvn:group:artifact:version, orgithub:apache/...(enforces the documented licensing/trust constraint).camel.apache.org/catalog.version, catching a Kamelet added/edited without a version bump.Verification
go vet/gofmt -l: clean.0across all 250 Kamelets with the rules enabled.ERROR: property "key" in kamelet "crypto-encrypt-action" uses the deprecated x-descriptor prefix ...ERROR: source kamelet "timer-source" must route to "kamelet:sink"ERROR: kamelet "timer-source" declares dependency "bogus:timer" that is not a ...ERROR: inconsistent camel.apache.org/catalog.version across the catalog: "4.20.0" (1 kamelets), "4.21.0-SNAPSHOT" (249 kamelets)Follow-ups (not in this PR)
x-descriptors" rule would be a natural addition — it would have caught the duplicate descriptor @apupier found (fixed separately in chore: remove duplicate credentials x-descriptor #2882).verifyUsedParamsbean /ref:detection and replace the hard-coded relative-path exclusion list with an in-Kamelet opt-out annotation.AI-generated by Claude Code on behalf of Andrea Cosentino (@oscerd).