allthingssecurity opened a new pull request, #27929:
URL: https://github.com/apache/camel/pull/27929

   # Description
   
   [CAMEL-25677](https://issues.apache.org/jira/browse/CAMEL-25677)
   
   Part 3 of the camel-wasm redesign (part 1: #27678, part 2: #27793, both 
merged): remove the `wasm` expression language.
   
   Author: Shashank Mohan Jain (@allthingssecurity), working with Claude Code 
(Claude Opus 5.5).
   
   Since CAMEL-25531 the `wasm` endpoint runs WASI Preview 1 command modules: 
the message body is standard input and standard output becomes the new body. 
The `wasm` language still used the old protocol: it called a named exported 
function of the module through the `alloc`/`dealloc` exports and a JSON 
envelope of the body and headers (`WasmFunction`, `WasmSupport`).
   
   On #27793 @davsclaus decided to remove the language rather than move it to 
WASI: "remove wasm language, this module was an experiment so its fine to do 
such changes", and "the removal can be in a follow up PR" 
(https://github.com/apache/camel/pull/27793#issuecomment-6163046916). This PR 
is that follow-up.
   
   ## What is removed
   
   - camel-wasm: `org.apache.camel.language.wasm.WasmLanguage` and 
`WasmExpression`, their generated language metadata and service files, and the 
language page `wasm-language.adoc` (with its nav entry and the docs symlinks).
   - The helpers only the language used: `org.apache.camel.wasm.WasmFunction`, 
`WasmSupport`, and the constants `Wasm.FN_ALLOC` and `Wasm.FN_DEALLOC`. The 
endpoint has not used them since CAMEL-25531.
   - The Jackson dependencies of camel-wasm (only `WasmSupport` used them).
   - The language tests, the `functions.wasm` test module and its Rust sources. 
`WasmComponentTest` used `functions.wasm` as an example of a module without 
`_start`; it now builds an equivalent module from WAT.
   - Model and DSLs: `org.apache.camel.model.language.WasmExpression`, 
`WasmExpressionReifier`, `wasm(...)` in `Builder`, `ExpressionClause`, 
`ExpressionClauseSupport` and `LanguageBuilderFactory`, the Java DSL writer 
support, and the `wasm` expression of the XML and YAML DSLs (parsers, writers, 
schemas).
   - `wasm` in the language names of the `language` component, of the 
camel-jbang AI bean-reference checks and route refactorings, and of the YAML 
validator's list of script languages.
   
   ## What stays
   
   The `wasm` endpoint (`WasmComponent`, `WasmEndpoint`, `WasmProducer`, 
`WasiCommand`, `Wasm.SCHEME`, the `Wasm.Headers`) is unchanged, as is the 
`compile` option from #27793. camel-opa, which runs OPA policies with its own 
Wasm runtime, is not touched.
   
   ## Upgrade note
   
   In the existing `=== camel-wasm - the endpoint runs WASI command modules 
(Breaking change)` section of the 4.24 upgrade guide: the sentence "The `wasm` 
language is unchanged" is removed, the 4.23 note about a failed call discarding 
the instance now "no longer applies", and a new paragraph lists what is removed 
and says how to migrate: call the module with the `wasm` endpoint as a route 
step, for example `.to("wasm:classpath:transform.wasm")`, built as a WASI 
command module, and use its output (the new body) in the next steps. The 4.23 
guide is not changed.
   
   ## Generated files
   
   All generated files come from the project build; none was edited by hand.
   
   - camel-wasm, camel-core-model, camel-xml-io, camel-yaml-io, camel-java-io, 
the `language` component and the YAML DSL: regenerated by building those 
modules.
   - The catalog (`languages/wasm.json`, `models/wasm.json` and 
`docs/wasm-language.adoc` deleted; the `wasm` entries of 
`languages.properties`, `models.properties` and `docs.properties`; `wasm` in 
the `oneOf` of 29 model JSON files and in the enum of 
`components/language.json`; the copies of `camel-spring.xsd`, 
`camel-xml-io.xsd` and `camelYamlDsl-model.json`), `camel-main`'s 
`languages.properties`, the `LANGUAGES` table of `ArtifactUtils` (the `wasm` 
component entry stays), and the language enum in the javadoc of 
`LanguageEndpointBuilderFactory` and `StaticEndpointBuilders`: produced by 
building camel-catalog (`prepare-catalog` and the helper goals) and 
camel-endpointdsl (`generate-endpoint-dsl`) after the core modules, 
camel-language, camel-wasm and camel-spring-xml (for the Spring XSD) were built 
from this branch.
   - The catalog build reads every other component from its `target/classes`, 
or from the snapshot jar when the module was not built locally. I did not build 
all components, so the snapshot data of unrelated components produced unrelated 
changes in other generated files (other components' JSON, dev consoles, 
`SecurityUtils`, `SensitiveUtils`, other endpoint builders; in the YAML DSL 
schemas, an `expert` property that is not in the core model of `main`). **I 
discarded those unrelated generated changes** and kept only the hunks that 
remove `wasm`. I checked that every kept hunk only removes `wasm`, and that the 
kept model JSON, `language.json` and schema copies are byte-identical to the 
files of the modules they are copied from.
   - The branch was then rebased onto `main` after the `4.24.0-SNAPSHOT` 
version bump (#27901). The only conflicts were the three generated `wasm` 
language files that this PR deletes and that `main` changed only in their 
`version`; they stay deleted. After the rebase, the diff against `main` is the 
same as before apart from that version, every changed line of the generated 
files only removes `wasm`, and rebuilding camel-wasm, camel-language, 
camel-core-model, camel-xml-io and camel-yaml-io (with their dependencies) 
leaves no changes. The catalog was not regenerated after the rebase: there are 
no `4.24.0-SNAPSHOT` snapshot jars yet, so camel-catalog cannot be built 
without building every component.
   
   ## Tests
   
   On the rebased commit:
   
   - camel-wasm: 124 tests, 0 failures (`WasmComponentTest` 58, 
`WasmCompiledComponentTest` 58, `WasiCommandTest` 8).
   - `MainHelperTest` (camel-main, reads `languages.properties`): 9 tests, 0 
failures.
   - Language and model tests of the core: camel-core (language, model, 
`language` component and builder tests) 1345, 0 failures, 1 skipped; 
camel-xml-io 426, 0 failures, 2 skipped; camel-yaml-io 189, 0 failures; 
camel-java-io 187, 0 failures, 1 skipped; camel-core-model 10; 
camel-xml-io-util 8; camel-management 2.
   
   Before the rebase (on `4.23.0-SNAPSHOT`), camel-catalog, the whole module: 
1092 tests, 0 failures (including `CamelCatalogTest`, 
`CamelCatalogJsonSchemaTest` and the doc examples tests). I could not run it 
again after the rebase, because its test dependencies need every component at 
`4.24.0-SNAPSHOT` and no snapshot jars of that version are published yet.
   
   Not run: camel-catalog after the rebase (see above), the camel-yaml-dsl 
validator tests (that module needs a build of every component), the camel-jbang 
tests, and the full root build.
   
   # Target
   
   - [x] I checked that the commit is targeting the correct branch (Camel 4 
uses the `main` branch)
   
   # Tracking
   - [x] If this is a large change, bug fix, or code improvement, I checked 
there is a [JIRA issue](https://issues.apache.org/jira/browse/CAMEL) filed for 
the change (usually before you start working on it).
   
   # Apache Camel coding standards and style
   
   - [x] I checked that each commit in the pull request has a meaningful 
subject line and body.
   - [ ] I have run `mvn clean install -DskipTests` locally from root folder 
and I have committed all auto-generated changes.
     (I built the modules listed above, with the formatter and import-sort 
plugins, and regenerated the catalog, camel-main and endpoint DSL files as 
described. I did not run the full root build.)
   
   # AI-assisted contributions
   
   - [x] If this PR includes AI-generated code, commits have proper 
co-authorship attribution (e.g., `Co-authored-by` trailers) and the PR 
description identifies the AI tool used.
     This PR was prepared with Claude Code (Claude Opus 5.5). The commit 
carries a `Co-Authored-By` trailer.
   
   _Claude Code on behalf of allthingssecurity_
   
   🤖 Generated with [Claude Code](https://claude.com/claude-code)
   


-- 
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]

Reply via email to