From: Kai Moritz Date: Fri, 29 May 2026 08:21:38 +0000 (+0200) Subject: CLAUDE.md: Compacted learnings of last session X-Git-Tag: scripting--2026-06-04~63 X-Git-Url: http://juplo.de/gitweb/?a=commitdiff_plain;h=79af9762e8e89e0c9f2400ee451921ba1b57344e;p=demos%2Fkafka%2Ftraining CLAUDE.md: Compacted learnings of last session --- diff --git a/.claude/settings.local.json b/.claude/settings.local.json new file mode 100644 index 00000000..8a2cb9d8 --- /dev/null +++ b/.claude/settings.local.json @@ -0,0 +1,13 @@ +{ + "permissions": { + "allow": [ + "Bash(*)", + "Bash(./TAG.sh before-improvements *)", + "Bash(GIT_EDITOR=true git rebase --continue)", + "Bash(chmod +x /home/vagrant/workspace/training/rebase_fix3.sh)", + "Bash(bash rebase_fix3.sh)", + "Bash(awk '{print $1}')", + "Skill(update-config)" + ] + } +} diff --git a/CLAUDE.md b/CLAUDE.md index e3679bc9..4a6eb51c 100644 --- a/CLAUDE.md +++ b/CLAUDE.md @@ -108,7 +108,9 @@ where `` matches `pom.xml`'s `` (Maven) or `settings.gra ## Scripting Branch Scripts -All scripts source `BRANCHES.sh` first, which defines the full branch list and parent relationships. +All scripts are only ment to ease the work of a human, by automatic execution of a part of the work. They never work without errors and the human always has to understand the errors, that arise during the rebases and resolve them by hand before re-running the script. + +Never use these scripts and never try to build your own scripts. You may look into the scripts to understand, what has to be done. But first read the following sections, that compact knowledge, that was deduced from the scripts and our discussions in previous sessions. | Script | Purpose | |--------|---------| @@ -124,7 +126,6 @@ All scripts source `BRANCHES.sh` first, which defines the full branch list and p | `COPY.sh` | Copies branches to `../vorlagen`, `../livecoding`, `../spickzettel` directories | | `patch_gradle_for_si_nexus.sh` | Patches `build.gradle`/`settings.gradle` to use internal Nexus mirror | -Always return to `scripting` after bulk operations — scripts `git checkout scripting` at the end. ## Adding a New Exercise Branch @@ -180,6 +181,103 @@ In these cases: show the problem, explain why it matters, and make a concrete pr - Suggest backporting improvements from later to earlier branches where it makes sense - After rebasing, always return to the `scripting` branch +## Rebase Technical Reference + +This section documents recurring patterns and decisions established through the Claude-assisted rebase sessions. + +### Docker Image Build Tools by Branch Group + +| Branch group | Build tool | `pom.xml` | `build.gradle` | +|---|---|---|---| +| `grundlagen/*` | **Jib** (`jib-maven-plugin` 3.4.5) | `` explicit | `jib { container { mainClass = '...' } }` | +| `producer/*`, `consumer/*`, `springkafka/*` | **bootBuildImage** (Cloud Native Buildpacks) | `spring-boot-maven-plugin` + `build-info` goal, `juplo/...` | `bootBuildImage { imageName = "juplo/${project.name}:${project.version}" }` | + +The `Dockerfile` is **deleted** on all branches — Jib and bootBuildImage both make it obsolete. + +Image name must always match `juplo/:` (Maven) or `juplo/${project.name}:${project.version}` (Gradle). + +### Rebase Strategy by Branch Type + +All rebases follow the `git checkout -B --claude-N` + `git cherry-pick ` pattern rather than `git rebase`, because conflicts are the norm. Find the unique commits with: + +```bash +git log --oneline --reverse --claude-N ^--claude-N +``` + +**Standard solution branches:** +```bash +git checkout -B --claude-N +git cherry-pick ... +git tag --claude-N +``` + +**`--vorlage` branches** (ROOT = the corresponding solution branch, already rebased): +```bash +git checkout -B --claude-N +git cherry-pick +git tag --claude-N +``` +Vorlage commits typically delete `README.sh`, simplify Java files (removing callbacks), or remove build files for infrastructure-only setups. Accept these deletions — they are intentional. + +**`--livecoding--schritte` branches:** +Same as vorlage, but cherry-pick all step commits in order. See special rules below. + +**Infrastructure-only branches** (no Java source, no build files): +The cherry-pick correctly deletes `pom.xml`, `build.gradle`, `src/` etc. Accept these deletions — they are intentional. + +### Recurring Conflict Patterns + +**Version string conflicts** (`pom.xml` / `build.gradle`): +HEAD has `1.1-xxx-SNAPSHOT`, incoming has `1.0-xxx-SNAPSHOT`. Always take incoming. One-liner: +```bash +python3 -c " +import re +for fname in ['pom.xml', 'build.gradle']: + with open(fname) as f: content = f.read() + content = re.sub(r'<<<<<<< HEAD\n(.*?)\n=======\n(.*?)\n>>>>>>> [^\n]+\n', lambda m: m.group(2)+'\n', content, flags=re.DOTALL) + with open(fname, 'w') as f: f.write(content) + print('Fixed', fname) +" +``` + +**bootBuildImage migration commit** (e.g., commit `4213dbdf`): +- `pom.xml`: Remove Jib plugin entirely; keep `spring-boot-maven-plugin` with `juplo/...` and `build-info` execution +- `build.gradle`: Replace `jib { ... }` block with `bootBuildImage { imageName = "juplo/${project.name}:${project.version}" }` + +**`Dockerfile` delete/modify conflict:** +Always `git rm Dockerfile` — it is obsolete in all branch groups. + +**Test files deleted in HEAD, modified by incoming commit:** +Restore from the incoming commit: `git checkout -- ` + +**Cherry-pick ordering conflicts** (later comprehensive commit already applied, earlier simpler version conflicts): +When HEAD already contains the more complete version of a file and a subsequent cherry-pick tries to apply an earlier, simpler version — keep HEAD. The earlier commit only added a subset of what HEAD already has. + +### `--livecoding--schritte` Branches: Special Rules + +These branches represent step-by-step transitions for live-coding sessions. Their structure is pedagogically important: + +- **Each commit is a teaching step.** +- **If a step's content was removed by an upstream improvement**, replace it with the functionally equivalent change in the new setup. Example: the "Docker Image" step originally showed a `Dockerfile` — after the Jib migration it instead shows the `mainClass` update in `pom.xml`/`build.gradle`, because Jib requires an explicit entry point while `bootBuildImage` auto-detects it. +- Rename the commit message to accurately describe what the step now demonstrates. +- If there is no such change, the commit can be droped, but aske, before! +- The end result of all steps should approximate (but need not be 100% identical to) the solution branch introduced by the live-coding. + +### Library Branches + +When a branch converts the application to a **plain Java library** (not a Spring Boot app, e.g., `sumup-messages--vorlage`), remove all Spring Boot deployment infrastructure from the build files: +- **`pom.xml`**: Remove the `spring-boot-maven-plugin` plugin block +- **`build.gradle`**: Remove `id 'com.gorylenko.gradle-git-properties'` plugin, `springBoot { buildInfo() }` block, and `bootBuildImage { }` block + +### Session Tagging Scheme + +Each rebase session tags every completed branch as `--claude-N`. The tag generation increments per session: +- `--claude-0`: initial automated pass +- `--claude-1`: first manual correction session +- `--claude-2`: most recent session (current) + +Tags serve as restore points. `./RESET.sh claude-2` resets all branches to the `--claude-2` tags. Always tag immediately after completing each branch, before moving to the next. + ## Key Constraints - `PUSH.sh` force-pushes — it is intentional and expected for this training workflow.