Add ai-21-migration module: upgrading Spring AI 2.0.x to 2.1.0, measured. One probe source tree run on 2.0.0, 2.0.2, 2.0.3 and 2.1.0 (Anthropic prompt tokens with caching, auth header, discarded temperature, thinking parts, message mutability, entity() on refusals), three compile breaks, API and configuration diffs from the jars, ChatMemory to session copy, a wrapping ToolCallingManager under tool confirmation, the OpenAI Responses switch, VectorStore.upsert on real pgvector, a grep checklist and an OpenRewrite recipe. Scripted and local fake models; no provider called. Spring Boot 4.2.0, Spring AI 2.1.0, Java 25.
Co-Authored-By: Claude Sonnet 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_017ic4b7N4ZDbUtA3ofqAqRV
This commit is contained in:
Executable
+26
@@ -0,0 +1,26 @@
|
||||
#!/usr/bin/env bash
|
||||
# Copy legacy-app, compile it as it is (2.0.0), run rewrite.yml, show the diff, compile again.
|
||||
set -euo pipefail
|
||||
cd "$(dirname "$0")/.."
|
||||
work=$(mktemp -d)
|
||||
cp -r legacy-app "$work/app"; cp rewrite.yml "$work/app/"; cp -r legacy-app "$work/before"
|
||||
out=output/17-openrewrite.txt
|
||||
echo "# rewrite-maven-plugin 6.46.1 + rewrite-spring 6.37.1 with rewrite.yml on a copy of legacy-app" > "$out"
|
||||
(cd "$work/app" && mvn -B -q compile >/dev/null 2>&1) && echo "compile before (Boot 4.1.0, Spring AI 2.0.0): ok" >> "$out"
|
||||
for recipe in com.ankurm.SpringAi20To21Build com.ankurm.SpringAi20To21Code; do
|
||||
(cd "$work/app" && mvn -B org.openrewrite.maven:rewrite-maven-plugin:6.46.1:run \
|
||||
-Drewrite.recipeArtifactCoordinates=org.openrewrite.recipe:rewrite-spring:6.37.1 \
|
||||
-Drewrite.activeRecipes="$recipe" > "$work/rewrite.log" 2>&1) || { tail -40 "$work/rewrite.log"; exit 1; }
|
||||
done
|
||||
mv "$work/app/rewrite.yml" "$work/rewrite.used.yml"
|
||||
(cd "$work" && diff -ru -x target before app | sed -E 's/^(---|\+\+\+) ([^\t]+)\t.*/\1 \2/' | grep -v '^diff ') >> "$out" || true
|
||||
(cd "$work/app" && mvn -B clean compile > "$work/after.log" 2>&1) && echo "compile after (Boot 4.2.0, Spring AI 2.1.0): ok" >> "$out" \
|
||||
|| { echo "compile after: FAILED" >> "$out"; grep ERROR "$work/after.log" | head >> "$out"; }
|
||||
# The same two recipes in ONE Maven invocation: types are still those of 2.0.0.
|
||||
cp -r legacy-app "$work/one"; cp rewrite.yml "$work/one/"
|
||||
(cd "$work/one" && mvn -B org.openrewrite.maven:rewrite-maven-plugin:6.46.1:run \
|
||||
-Drewrite.recipeArtifactCoordinates=org.openrewrite.recipe:rewrite-spring:6.37.1 \
|
||||
-Drewrite.activeRecipes=com.ankurm.SpringAi20To21Build,com.ankurm.SpringAi20To21Code > "$work/one.log" 2>&1)
|
||||
{ echo; echo "both recipes in one invocation, sampling calls left in SupportBot.java:"
|
||||
grep -nE '\.(temperature|topK|topP)\(' "$work/one/src/main/java/com/ankurm/legacy/SupportBot.java" || echo " none"; } >> "$out"
|
||||
cat "$out"
|
||||
Reference in New Issue
Block a user