Skip to content

ci: add catalog consistency rules to the Kamelet validator#2881

Merged
oscerd merged 1 commit into
apache:mainfrom
oscerd:ci-fix/validator-rules
Jun 25, 2026
Merged

ci: add catalog consistency rules to the Kamelet validator#2881
oscerd merged 1 commit into
apache:mainfrom
oscerd:ci-fix/validator-rules

Conversation

@oscerd

@oscerd oscerd commented Jun 25, 2026

Copy link
Copy Markdown
Contributor

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 to script/validator/validator.go.

New rules

  1. Reject deprecated tectonic descriptors — errors on any x-descriptors entry with the urn:alm:descriptor:com.tectonic.ui prefix (the catalog standard is urn:camel:group:credentials).
  2. Routing convention — a source Kamelet must route to kamelet:sink; a sink Kamelet must consume from kamelet:source (per the README authoring rules). Action Kamelets are unconstrained.
  3. Dependency syntax — every spec.dependencies entry must be camel:<component>, mvn:group:artifact:version, or github:apache/... (enforces the documented licensing/trust constraint).
  4. Catalog-version uniformity — every Kamelet must share the same camel.apache.org/catalog.version, catching a Kamelet added/edited without a version bump.

Verification

  • go vet / gofmt -l: clean.
  • Validator exits 0 across all 250 Kamelets with the rules enabled.
  • Each rule was verified to fire on an injected violation:
    • 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)

  • A "duplicate 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).
  • Improve verifyUsedParams bean / 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).

@oscerd oscerd requested review from apupier and squakez June 25, 2026 09:46
Comment on lines 50 to 51

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

is it normal to have 2 times the same value?

@oscerd oscerd force-pushed the ci-fix/validator-rules branch from 9bd4521 to e692c42 Compare June 25, 2026 11:19
@oscerd

oscerd commented Jun 25, 2026

Copy link
Copy Markdown
Contributor Author

@apupier re: your review comment on crypto-encrypt-action.kamelet.yaml:51 ("is it normal to have 2 times the same value?") — good catch, that was a real bug on my side.

The key property already carried urn:camel:group:credentials, and my edit was converting the deprecated urn:alm:descriptor:com.tectonic.ui:password line into urn:camel:group:credentials rather than removing it, which produced the duplicate.

Fixed by dropping the deprecated descriptor and keeping the single canonical one. A catalog-wide check turned up the same duplicate on crypto-decrypt-action and spring-rabbitmq-sink/-source (identical edit), so all four are fixed — there are now zero duplicate x-descriptors across the 250 Kamelets. The change lives in #2879 (cherry-picked here); both PRs have been updated and a full mvn clean install -DskipTests is green.

Claude Code on behalf of Andrea Cosentino (@oscerd)

@apupier

apupier commented Jun 25, 2026

Copy link
Copy Markdown
Contributor

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]>
@oscerd oscerd force-pushed the ci-fix/validator-rules branch from e692c42 to 4867564 Compare June 25, 2026 16:18
@oscerd

oscerd commented Jun 25, 2026

Copy link
Copy Markdown
Contributor Author

Update on the duplicate-descriptor fix: #2879 was merged before the dedup landed, so the correction is now a standalone PR against main#2882 (removes the redundant urn:camel:group:credentials from crypto-encrypt-action, crypto-decrypt-action, spring-rabbitmq-sink/-source; a catalog-wide check confirms zero duplicate x-descriptors).

This PR (#2881) has been rebased onto main and now contains only the validator-rule additions in script/validator/validator.go. Thanks again @apupier for catching it.

@oscerd oscerd merged commit 6b1282e into apache:main Jun 25, 2026
4 of 5 checks passed
oscerd added a commit that referenced this pull request Jun 25, 2026
#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]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants