From 53c5a41218d4486e1ddb6a69e7b5c4efdb45847d Mon Sep 17 00:00:00 2001 From: Oleksandr Liemiahov Date: Wed, 18 Nov 2026 10:51:27 +0100 Subject: [PATCH 1/2] Remove the dead JetBrains Space Maven repository maven.pkg.jetbrains.space no longer resolves: JetBrains Space package hosting is shut down. Gradle asks repositories in declaration order, and this one came before the IntelliJ Platform and Marketplace repositories, so every artifact that was not cached yet failed on it instead of falling through to the next repository. The new Rust plugin build for 263 (263.7307.313) broke `:intellij-plugin:hs-Rust:compileKotlin` this way, and any build against a new IDE version would too. The only artifact taken from it, kotlin-css-jvm 2026.8.4, is on Maven Central. --- buildSrc/src/main/kotlin/common-conventions.gradle.kts | 1 - 1 file changed, 1 deletion(-) diff --git a/buildSrc/src/main/kotlin/common-conventions.gradle.kts b/buildSrc/src/main/kotlin/common-conventions.gradle.kts index f668325d3..2f389b31c 100644 --- a/buildSrc/src/main/kotlin/common-conventions.gradle.kts +++ b/buildSrc/src/main/kotlin/common-conventions.gradle.kts @@ -41,7 +41,6 @@ kotlin { repositories { mavenCentral() maven("https://cache-redirector.jetbrains.com/intellij-dependencies") - maven("https://maven.pkg.jetbrains.space/kotlin/p/kotlin/kotlin-js-wrappers") maven("https://packages.jetbrains.team/maven/p/edu/maven") maven("https://packages.jetbrains.team/maven/p/edu/educational-ml-library") maven("https://packages.jetbrains.team/maven/p/grazi/grazie-platform-public") From b67e39521ce67cbc2a8ccfd1b1b57467907c0370 Mon Sep 17 00:00:00 2001 From: Oleksandr Liemiahov Date: Wed, 18 Nov 2026 10:51:34 +0100 Subject: [PATCH 2/2] Add Claude Code skills for the IDE update loop Two user-invoked project skills turn updating the IDE versions in gradle-.properties into a repeatable loop: - /ide-update-loop checks the IntelliJ Maven repository for newer releases of every supported platform branch, builds the plugin against them the way CI does (compile, test, verify), classifies the failures and writes a report. It edits nothing: the versions reach Gradle as -P overrides and all evidence goes to build/ide-update-loop//. - /ide-update-fix applies the items accepted from that report on a branch and rebuilds until the affected platforms are green, then compiles the other platforms because common code is shared. The scripts (Python 3, standard library) check versions, run the build stages, analyze logs and JUnit/Plugin Verifier output, and diff the product-info.json of two IDEs to predict classes that moved out of the core classpath. reference/platform-breakage.md collects the causes this repo has met during platform updates and how they were fixed. .gitignore now ignores local Claude Code worktrees, personal settings and Python bytecode, so .claude/skills can be committed. --- .claude/skills/ide-update-fix/SKILL.md | 62 +++ .claude/skills/ide-update-loop/SKILL.md | 86 +++++ .../reference/platform-breakage.md | 73 ++++ .../skills/ide-update-loop/scripts/_common.py | 48 +++ .../ide-update-loop/scripts/analyze_build.py | 360 ++++++++++++++++++ .../scripts/check_ide_updates.py | 234 ++++++++++++ .../ide-update-loop/scripts/diff_platform.py | 86 +++++ .../ide-update-loop/scripts/run_build.py | 204 ++++++++++ .gitignore | 5 + CLAUDE.md | 4 + 10 files changed, 1162 insertions(+) create mode 100644 .claude/skills/ide-update-fix/SKILL.md create mode 100644 .claude/skills/ide-update-loop/SKILL.md create mode 100644 .claude/skills/ide-update-loop/reference/platform-breakage.md create mode 100644 .claude/skills/ide-update-loop/scripts/_common.py create mode 100644 .claude/skills/ide-update-loop/scripts/analyze_build.py create mode 100644 .claude/skills/ide-update-loop/scripts/check_ide_updates.py create mode 100644 .claude/skills/ide-update-loop/scripts/diff_platform.py create mode 100644 .claude/skills/ide-update-loop/scripts/run_build.py diff --git a/.claude/skills/ide-update-fix/SKILL.md b/.claude/skills/ide-update-fix/SKILL.md new file mode 100644 index 000000000..ccea3cb3a --- /dev/null +++ b/.claude/skills/ide-update-fix/SKILL.md @@ -0,0 +1,62 @@ +--- +name: ide-update-fix +description: Apply the IDE version bumps and fixes accepted from an /ide-update-loop report, proving each one with a rebuild until the affected platforms are green. +disable-model-invocation: true +--- + +# IDE update fix: apply accepted items under control + +Input: item numbers from the latest `/ide-update-loop` report (`$ARGUMENTS`, e.g. `1 3 4`). The run is the +one named in `build/ide-update-loop/LATEST` unless the user names another. Scripts are those of the loop: +`.claude/skills/ide-update-loop/scripts/`. + +**Control** means two things here: a change counts only when a rebuild proves it, and nothing reaches git +history or the remote without the user's word. + +## 1. Prepare + +- Read the run's `report.md` and `analysis.md`. Restate each accepted item in one line. Done when every + number maps to exactly one item; ask about any that does not. +- Work on a branch: from an up-to-date `main`, create `ide-update/` (or continue the branch the + user names). `main` itself stays untouched. +- One Gradle build per checkout at a time, as in the loop (`run_build.py` exits with 3 otherwise). + +## 2. Apply + +1. **Bumps**: write the proposed versions of the accepted environments into `gradle-.properties`. + `customSinceBuild` stays unless the item says otherwise. +2. **Fixes**: the smallest change that removes the cause stated in the item, following "Handling Platform + Compatibility" in `CLAUDE.md` and `.claude/skills/ide-update-loop/reference/platform-breakage.md`. + Common code must compile against every supported environment; a part that cannot goes to + `branches//src` and gets a `// BACKCOMPAT: ` comment. + +## 3. Verify + +Iteration `k` = 1, 2, 3 for each accepted environment ``: + +1. `run_build.py --env --no-overrides --label fix`: the properties now hold the bump, so this builds + exactly what will be committed. While compile is red, `--stages compile` is enough. +2. `analyze_build.py`, then `analyze_build.py --compare -fix`. +3. **Green**: the item's signatures are under "fixed" and nothing is under "NEW"; stages that ran only in + the new build are read from its groups in `analysis.md`. **Red**: read the new evidence, adjust, next `k`. + +After three iterations without progress on an item, revert that item's change and record it as not fixed, +with what was tried. + +Then check the **blast radius**: common code and build scripts are shared, so compile every other +supported environment with `run_build.py --env --no-overrides --stages compile --label cross`. +Environments outside CI (`ci_environments` in `updates.json`) get no other check before release. When the +change touched shared runtime code, run all stages there, and follow "Runtime" in the reference when the +item names a moved module. + +Done when every accepted environment is green on compile, test and verify (known flakes rerun green), +every other environment compiles, and every item is marked fixed or not fixed with evidence. + +## 4. Report and hand off + +Append "Fix results" to the run's `report.md`: per item fixed / not fixed, the stage table before → after, +the `--compare` output, and `git diff --stat`. + +Show the user that summary. Commit on the branch and open a pull request only on their go-ahead. The +PR body lists the bumped versions, the items with their causes, and the per-environment evidence; CI then +checks its environments again. diff --git a/.claude/skills/ide-update-loop/SKILL.md b/.claude/skills/ide-update-loop/SKILL.md new file mode 100644 index 000000000..7fb82071a --- /dev/null +++ b/.claude/skills/ide-update-loop/SKILL.md @@ -0,0 +1,86 @@ +--- +name: ide-update-loop +description: Check for new IDE versions of every supported platform, build the plugin against them, analyze the failures and write a report to decide on. Changes nothing in the checkout; accepted items go to /ide-update-fix. +disable-model-invocation: true +--- + +# IDE update loop: check → build → analyze → report + +One **run** of the loop ends in a report the user decides on. The run edits nothing in the checkout: the +new IDE versions reach Gradle as `-P` overrides, and all evidence lands in `build/ide-update-loop//`. +Applying what the user accepts is `/ide-update-fix`. + +Scripts live in `.claude/skills/ide-update-loop/scripts/` (Python 3, standard library; `python` on Windows, +`python3` elsewhere). Each prints its options with `--help`. `$ARGUMENTS` may name environments (`262 263`) +or `full-tests`. + +## 1. Check + +Run `check_ide_updates.py` (with `--envs 262,263` when the user named environments). It starts the run +directory, records it in `build/ide-update-loop/LATEST`, and writes `updates.json`. + +Done when every environment has a verdict: a proposed **bump** or up to date, and any newly published +platform branch is noted. + +- No bumps and nothing else asked: show the table, say the plugin is up to date, and end the run. +- A new branch (say 271) goes into the report as a note. Supporting it is the procedure in + `documentation/SupportNewPlatformVersion.md`, outside this loop. + +## 2. Build + +Note `git status` first: the build compiles uncommitted changes too, and the report must say so. + +For each environment with a bump, one at a time, start `run_build.py --env ` in the background and wait +for it to exit (`--full-tests` when the user asked for it). One environment takes 15–40 minutes; the first +build against a new IDE also downloads it (several GB per product). + +- Exit code 3: another Gradle build is running. Two builds in one checkout corrupt each other's output. + Wait for it, or build from a git worktree and add + `--gradle-arg=-Porg.jetbrains.intellij.platform.intellijPlatformIdesCache=
/.intellijPlatform/ides` + to reuse the downloaded IDEs. +- Exit code 1 is a red build: that is the input of step 3. + +Done when every bumped environment has `summary.json` with each stage passed, failed or skipped. + +## 3. Analyze + +Run `analyze_build.py`. It writes `analysis.md`: the stage table and numbered error groups, each with a +class (`platform-change`, `known-cause`, `flake`, `environment`, `bump`, `new`) and, when known, a hint. + +Then take every group to a **cause**: + +- `environment`, `flake`: apply the hint once (clean the named cache, or rerun the failing classes with + `run_build.py --env --stages test --test-tasks " --tests " --label rerun`). A green rerun + closes the group; a red one makes it `new`. +- `platform-change`: run `diff_platform.py ` once per product (both IDEs sit in + `.intellijPlatform/ides/` after the build). Read the code at the reported location and the API in the new + IDE's jars. State what changed (removed, renamed, moved to module X, signature changed) and on which + supported environments the replacement exists. +- `new`: decide whether the bump caused it. The build is **bump-caused** only when the same build is green + on the current versions: the last CI run on `main` covers the CI environments (`ci_environments` in + `updates.json`); for the others rebuild the failing stage with `--no-overrides --label baseline`. +- `bump`: the proposed version is unusable; propose the next one from the check table. + +`reference/platform-breakage.md` holds the causes this repo has met and their fix patterns: read it before +writing a cause for any `platform-change`, `known-cause` or `new` group. + +Done when every group has a cause with evidence (file:line, jar or diff line, baseline result) and a +proposed fix with its place (common code, `branches//src`, build script, properties file), or is marked +"needs investigation" with what was tried. + +## 4. Report + +Write `build/ide-update-loop//report.md`, in the language the user writes in: + +1. One line per environment: current → proposed versions, green or red. +2. The stage table from `analysis.md`. +3. **Items**, numbered across the report. A green bump is one item ("apply 262 → 2026.2.5, no code + change"). Each error group with a cause is one item: cause, evidence, proposed fix and where it goes, + the environments it touches, risk. +4. **Not covered**: environments not built, stages not run, and runtime-only breakage the run cannot see + (see "Runtime" in `reference/platform-breakage.md`). + +In the chat, give the report path and the numbered one-line list of items, and ask which to accept. The +user answers with `/ide-update-fix `. + +Done when the report exists and every item is something the user can accept or reject on its own. diff --git a/.claude/skills/ide-update-loop/reference/platform-breakage.md b/.claude/skills/ide-update-loop/reference/platform-breakage.md new file mode 100644 index 000000000..6d6d3c9c0 --- /dev/null +++ b/.claude/skills/ide-update-loop/reference/platform-breakage.md @@ -0,0 +1,73 @@ +# Platform breakage: causes and fixes + +Shared by `/ide-update-loop` (to name a cause) and `/ide-update-fix` (to fix it). Each entry: symptom → +cause → fix. The general rules of where version-specific code goes are in "Handling Platform +Compatibility" in `CLAUDE.md`; this file holds what those rules don't say. + +## Where the facts are + +- The IDE a build used: `.intellijPlatform/ides/-/` (`lib/`, `plugins/`, + `product-info.json`). Check an API in its jars (`javap -cp `, or list the jar) before + relying on it; the same check on the **oldest** supported IDE tells whether common code may use it. +- `scripts/diff_platform.py ` lists jars that left the core classpath and modules that changed + kind. Most compile failures of a platform update are predicted there. +- Common code compiles against every environment in `gradle-*.properties`. + `-PenvironmentName=` switches the target without editing `gradle.properties`. + +## Compile + +- **Unresolved reference / cannot find symbol** on a platform or bundled-plugin API: removed or renamed. + Prefer a call that exists on every supported version over a per-version shim. Example: Rust 263 removed + `org.rust.openapiext.toPsiFile`; the plugin calls `PsiManager.findFile`, which that helper wrapped. +- **Cannot access class** / class missing from the classpath: the class moved into a content module or a + separate bundled plugin. Compilation needs `bundledModule("")`; the build scripts' + `bundledModulesSince(version, , ...)` adds it only from the branch where the move happened. + Runtime needs `` in the content module's descriptor. A module with + `visibility="internal"` cannot be a dependency at all: find a public route (example: `UpdateChecker` + went internal in 263; the plugin uses its notification group id instead). +- **Signature changed inside one platform branch** (a Kotlin data class constructor, an `inline` builder): + Kotlin inlines the unstable signature into the plugin's bytecode. Build the object from Java, which + cannot inline Kotlin `inline` functions; see `hs-core/.../platform/OpenProjectTaskFactory.java`. +- **Version catalog**: `compileOnly` libraries in `gradle/libs.versions.toml` (kotlinx-serialization, + annotations) come from the IDE at runtime, so their version must not exceed what the oldest supported IDE + bundles. The catalog is shared by all environments. Shipped (`implementation`) libraries may be newer. +- The IntelliJ Platform Gradle plugin sometimes rewrites `.intellijPlatform/localPlatformArtifacts// + bundledModule-*.xml` with empty dependencies, and transitive classes vanish between runs. Declare every + module the code uses directly rather than relying on transitivity. + +## Tests + +- A run with `--tests` is not comparable with a full run: platform tests leak state between classes. + Confirm a fix with the same task set that failed. +- Bundled plugins of the test IDE all land on the test classpath. One that breaks there is excluded via + `org.jetbrains.intellij.platform.testIdeBundledPluginsClasspathExcludes` in `gradle.properties`; the + property replaces the default list, so keep the existing entries when adding one. +- Marketplace plugins (Python, Rust, Go, PHP, Scala) resolve as `:latest` compatible with the target IDE, + so a bump can change them too. Rust builds are per OS since 263. + +## Verify (Plugin Verifier) + +- **"Package not found"** for an optional-plugin API (`com.jetbrains.php.*`, `org.rust.*`, ...), reported + against hs-core: a lambda passed to an hs-core `inline` function (`invokeLater`, + `runReadActionInSmartMode`) calls that API, and the inlined class is attributed to hs-core. Make the + lambda body a single call to a private non-inline method that holds the optional-plugin calls. +- Internal, experimental and deprecated API usages are reported but do not fail the build (see + `pluginVerification.failureLevel` in `intellij-plugin/build.gradle.kts`); a growing count is a note for + the report, not a red item. + +## Runtime + +Tests run on one flat classpath; compile sees every module jar. Neither notices a class that is reachable +only through a content module's own classloader. When `diff_platform.py` shows a module the plugin uses +changing kind or leaving the core classpath (debugger and execution modules of the Java plugin did on +2026.2), the item's fix needs a runtime check: + +1. `./gradlew -PenvironmentName= :intellij-plugin:runIdea --args="inspect -v2"` + starts the sandbox IDE headless with the real classloaders, opens the project and exits. The project + needs only an empty `.idea/`; a minimal profile is + ``. +2. Search `intellij-plugin/build/idea-sandbox/*/log_runIdea/idea.log` for `ClassNotFoundException` and + `NoClassDefFoundError`. A content module whose dependency is unresolved is skipped silently, so "no + error" proves less than a class-load log (`-Xlog:class+load`) showing the class loaded. + +Use a release IDE for this: EAP builds expire ("This IDE build has expired"). diff --git a/.claude/skills/ide-update-loop/scripts/_common.py b/.claude/skills/ide-update-loop/scripts/_common.py new file mode 100644 index 000000000..ad00470f1 --- /dev/null +++ b/.claude/skills/ide-update-loop/scripts/_common.py @@ -0,0 +1,48 @@ +"""Paths shared by the ide-update-loop scripts. Standard library only.""" + +import subprocess +from datetime import datetime +from pathlib import Path + + +def repo_root(arg=None): + """The checkout the scripts work on: --repo-root, else the git top level of the current directory.""" + if arg: + return Path(arg).resolve() + try: + out = subprocess.run(["git", "rev-parse", "--show-toplevel"], capture_output=True, text=True, check=True) + return Path(out.stdout.strip()).resolve() + except (OSError, subprocess.CalledProcessError): + return Path(__file__).resolve().parents[4] + + +def loop_root(root): + return root / "build" / "ide-update-loop" + + +def new_run_dir(root): + run = loop_root(root) / datetime.now().strftime("%Y%m%d-%H%M%S") + run.mkdir(parents=True, exist_ok=False) + (loop_root(root) / "LATEST").write_text(run.name, encoding="utf-8") + return run + + +def run_dir(root, arg=None): + """--run-dir if given, else the run named in build/ide-update-loop/LATEST.""" + if arg: + return Path(arg).resolve() + latest = loop_root(root) / "LATEST" + if not latest.exists(): + raise SystemExit("No run yet: start one with check_ide_updates.py") + return loop_root(root) / latest.read_text(encoding="utf-8").strip() + + +def read_properties(path): + props = {} + for line in Path(path).read_text(encoding="utf-8").splitlines(): + line = line.strip() + if not line or line.startswith("#") or "=" not in line: + continue + key, value = line.split("=", 1) + props[key.strip()] = value.strip() + return props diff --git a/.claude/skills/ide-update-loop/scripts/analyze_build.py b/.claude/skills/ide-update-loop/scripts/analyze_build.py new file mode 100644 index 000000000..cef130d30 --- /dev/null +++ b/.claude/skills/ide-update-loop/scripts/analyze_build.py @@ -0,0 +1,360 @@ +#!/usr/bin/env python3 +"""Turn the evidence of run_build.py into error groups with a class and a signature. + +Classes: + platform-change the bumped IDE changed or moved an API (compile errors, missing classes at runtime) + known-cause a failure this repo has met before, with a known fix (see the hint) + flake a known flaky failure: rerun once, a pass means no regression + environment caches, memory, network or another build in the checkout: not the code + bump the proposed version itself is unusable (cannot be resolved) + new nothing above matches: needs investigation + +Usage: + analyze_build.py [--run-dir DIR] # every [-label] directory of the run + analyze_build.py --compare BEFORE AFTER # two env directories: fixed / still failing / new + +Writes /analysis.md and /analysis.json (the signatures --compare reads). +Standard library only. +""" + +import argparse +import json +import re +import sys +import xml.etree.ElementTree as ET +from pathlib import Path + +from _common import repo_root, run_dir + +# (id, class, pattern, hint) -- matched against failure messages, stack traces and failed-stage logs. +KNOWN = [ + ("windows-temp-lock", "flake", r"FileSystemException[\s\S]{0,300}being used by another process", + "Windows holds a file of %TEMP%\\unitTest_* open in teardown; a different test fails every run. Rerun the class once."), + ("sandbox-index", "environment", + r"StubUpdatingIndex[\s\S]{0,3000}StorageException|StorageException[\s\S]{0,3000}StubUpdatingIndex|index \w+ has status REQUIRES_REBUILD", + "Stale or corrupted test sandbox indexes (e.g. after the set of bundled/marketplace plugins changed). Rerun the " + "class once; if it fails again, delete system-test and config-test under .intellijPlatform/sandbox///."), + ("truncated-jar", "environment", r"ZipResourceFile|zip END header not found|error in opening zip file|ZipException: invalid", + "Truncated jar in the Gradle dependency cache (a killed run): delete that artifact's version dir under /caches/modules-2."), + ("build-cache", "environment", r"Corrupted TAR archive|invalid distance too far back|Failed to load cache entry", + "Corrupted entry in the build cache: Gradle renames it to *.failed; delete those and rerun."), + ("gradle-journal", "environment", r"CorruptedCacheException", + "Corrupted /caches/journal-1/file-access.bin: move it aside when no Gradle runs."), + ("checkout-collision", "environment", r"Unable to delete directory|Could not delete [^\n]*caches-jvm|Source file or directory not found", + "Another build ran in the same checkout. Rerun alone or from a worktree; no test result of this run counts."), + ("out-of-memory", "environment", r"OutOfMemoryError|Java heap space|GC overhead limit exceeded|daemon disappeared unexpectedly", + "The build or test JVM ran out of memory; close other builds and rerun."), + ("dead-space-repo", "known-cause", r"maven\.pkg\.jetbrains\.space", + "JetBrains Space package hosting is shut down (the host no longer resolves). Gradle asks repositories in order, " + "so this one fails every artifact not yet cached. Remove it from the repositories block; its artifacts are on " + "Maven Central or packages.jetbrains.team."), + ("network", "environment", r"UnknownHostException|Connection (timed out|reset|refused)|Read timed out|Could not (GET|HEAD) 'http", + "Network failure while downloading. Rerun once; if the same host fails again, check that it resolves at all " + "(`nslookup 1.1.1.1`): a dead repository host fails every uncached artifact."), + ("expired-build", "bump", r"This IDE build has expired", + "The EAP/snapshot build expired; use a release or a newer snapshot."), + ("unresolvable-ide", "bump", r"Could not (find|resolve)[^\n]*(com\.jetbrains\.intellij|jetbrains\.intellij\.(idea|clion|pycharm|rider))", + "The proposed IDE version is not in the IntelliJ Maven repository; pick another one."), + ("grazie-classpath", "known-cause", r"NoSuchMethodError[\s\S]{0,500}ai\.grazie|ai\.grazie[\s\S]{0,500}NoSuchMethodError|Language\.getEntries", + "A bundled plugin on the test classpath clashes with the AI debugger's ai.grazie libraries: add its id to " + "org.jetbrains.intellij.platform.testIdeBundledPluginsClasspathExcludes in gradle.properties."), + ("bundled-plugin-init", "known-cause", r"lib[\\/]modules should be lib directory", + "A bundled plugin fails to initialize on the test classpath: exclude it with the same gradle.properties key."), + ("rust-test-service", "known-cause", r"TestCargoProjectsServiceImpl", + "The Rust plugin needs its unshipped test service: keep it in idea.suppressed.plugins.id for :intellij-plugin:test."), + ("missing-test-dep", "known-cause", r"NoClassDefFoundError: okhttp3/mockwebserver", + "Test dependencies of hs-core come from the common conventions; check the module applies them."), + ("class-moved", "platform-change", r"NoClassDefFoundError|ClassNotFoundException|Cannot access class", + "A platform class left the classpath (moved into a content module or plugin): run diff_platform.py, declare " + "bundledModule(...) for compilation and in the descriptor for runtime."), +] +KNOWN = [(kid, cls, re.compile(pattern), hint) for kid, cls, pattern, hint in KNOWN] + +KOTLIN_ERROR = re.compile(r"^e: (?:file:///)?(.+?\.kts?):(\d+):(\d+) (.+)$") +JAVA_ERROR = re.compile(r"^(.+?\.java):(\d+): error: (.+)$") +FAILED_TASK = re.compile(r"^> Task (\S+) FAILED") + + +def match_known(text): + for kid, cls, pattern, hint in KNOWN: + if pattern.search(text): + return kid, cls, hint + return None + + +def module_of(path, root): + try: + rel = Path(path).resolve().relative_to(root).as_posix() + except ValueError: + rel = Path(path).as_posix() + for marker in ("/src/", "/testSrc/", "/branches/", "/resources/"): + if marker in rel: + return rel.split(marker, 1)[0], rel + return rel.rsplit("/", 1)[0], rel + + +def what_went_wrong(text): + blocks = re.findall(r"\* What went wrong:\n([\s\S]*?)(?:\n\* Try:|\Z)", text) + return [b.strip()[:1500] for b in blocks] + + +def analyze_log_stage(name, log_text, root): + """Compile-style analysis: compiler errors grouped by message, else Gradle's own failure text.""" + groups = {} + lines = log_text.splitlines() + for i, line in enumerate(lines): + match = KOTLIN_ERROR.match(line) + java = JAVA_ERROR.match(line) if not match else None + if match: + path, line_no, message = match.group(1), match.group(2), match.group(4).strip() + elif java: + path, line_no, message = java.group(1), java.group(2), java.group(3).strip() + symbol = next((l.strip() for l in lines[i + 1:i + 4] if l.strip().startswith("symbol:")), "") + if symbol: + message = f"{message} ({symbol})" + else: + continue + module, rel = module_of(path, root) + group = groups.setdefault(message, {"message": message, "locations": [], "modules": set()}) + group["locations"].append(f"{rel}:{line_no}") + group["modules"].add(module) + + result = [] + for group in groups.values(): + known = match_known(group["message"]) + result.append({ + "stage": name, + "class": known[1] if known else "platform-change", + "known_id": known[0] if known else None, + "hint": known[2] if known else None, + "title": group["message"], + "count": len(group["locations"]), + "modules": sorted(group["modules"]), + "locations": group["locations"][:10], + "signatures": sorted({f"{name}|{loc.rsplit(':', 1)[0]}|{group['message']}" for loc in group["locations"]}), + }) + if not result: + failed_tasks = [m.group(1) for m in map(FAILED_TASK.match, lines) if m] + for block in what_went_wrong(log_text) or ["\n".join(lines[-30:])]: + known = match_known(block) or match_known(log_text) + first = block.splitlines()[0] if block else "no output" + result.append({ + "stage": name, + "class": known[1] if known else "new", + "known_id": known[0] if known else None, + "hint": known[2] if known else None, + "title": first[:200], + "detail": block, + "count": 1, + "modules": failed_tasks, + "signatures": [f"{name}|gradle|{first[:200]}"], + }) + return result + + +def normalize(message): + message = re.sub(r"[A-Za-z]:[\\/][^\s'\"]+|/(tmp|var|private)/[^\s'\"]+", "", message) + return re.sub(r"\d+", "N", message)[:200] + + +def analyze_tests(env_dir): + groups = {} + for xml_path in sorted((env_dir / "test-results").glob("**/TEST-*.xml")): + module = xml_path.parent.name.replace("__", "/") + try: + suite = ET.parse(xml_path).getroot() + except ET.ParseError: + continue + for case in suite.iter("testcase"): + problem = case.find("failure") + if problem is None: + problem = case.find("error") + if problem is None: + continue + message = (problem.get("message") or "").strip() + body = problem.text or "" + kind = problem.get("type") or "failure" + first = message.splitlines()[0] if message else (body.strip().splitlines() or [""])[0] + key = (kind, normalize(first)) + group = groups.setdefault(key, {"type": kind, "first": first, "tests": [], "modules": set(), "text": ""}) + group["tests"].append(f"{case.get('classname')}.{case.get('name')}") + group["modules"].add(module) + if len(group["text"]) < 8000: + group["text"] += f"{message}\n{body[:4000]}\n" + + result = [] + for group in groups.values(): + known = match_known(group["text"]) + result.append({ + "stage": "test", + "class": known[1] if known else "new", + "known_id": known[0] if known else None, + "hint": known[2] if known else None, + "title": group["first"][:200] if group["first"].startswith(group["type"]) else f"{group['type']}: {group['first'][:200]}", + "count": len(group["tests"]), + "modules": sorted(group["modules"]), + "tests": group["tests"][:10], + "excerpt": group["text"][:1200], + "signatures": sorted(f"test|{t}" for t in group["tests"]), + }) + return result + + +def analyze_verifier(env_dir, log_text): + result = [] + for verdict in sorted((env_dir / "verifier").glob("*/verification-verdict.txt")): + text = verdict.read_text(encoding="utf-8", errors="replace").strip() + ide = verdict.parent.name + problems_file = verdict.parent / "compatibility-problems.txt" + if text.startswith("Compatible") and not problems_file.exists(): + continue + problems = problems_file.read_text(encoding="utf-8", errors="replace") if problems_file.exists() else "" + lines = [l for l in problems.splitlines() if l.strip()] + result.append({ + "stage": "verify", + "class": "platform-change", + "known_id": None, + "hint": "Plugin Verifier sees what tests can't: content-module classloaders and inlined code. " + "See reference/platform-breakage.md.", + "title": f"{ide}: {text.splitlines()[0][:200]}", + "count": max(1, len(lines)), + "modules": [], + "detail": "\n".join(lines[:60]), + "signatures": [f"verify|{ide.split('-')[0]}|{l.strip()[:200]}" for l in lines[:200]] or [f"verify|{text[:200]}"], + }) + return result + + +def analyze_env(env_dir, root): + summary = json.loads((env_dir / "summary.json").read_text(encoding="utf-8")) + groups = [] + for stage, info in summary["stages"].items(): + if info["status"] != "failed": + continue + log_text = (env_dir / info["log"]).read_text(encoding="utf-8", errors="replace") + if stage == "test": + stage_groups = analyze_tests(env_dir) + if not stage_groups: # the task failed before any test ran + stage_groups = analyze_log_stage(stage, log_text, root) + elif stage == "verify": + stage_groups = analyze_verifier(env_dir, log_text) or analyze_log_stage(stage, log_text, root) + else: + stage_groups = analyze_log_stage(stage, log_text, root) + groups.extend(stage_groups) + signatures = sorted({s for g in groups for s in g["signatures"]}) + signatures += [f"stage|{name}|{info['status']}" for name, info in summary["stages"].items()] + analysis = {"env_dir": env_dir.name, "summary": summary, "groups": groups, "signatures": signatures} + (env_dir / "analysis.json").write_text(json.dumps(analysis, indent=2), encoding="utf-8") + return analysis + + +def render(run, analyses): + order = {"bump": 0, "platform-change": 1, "new": 2, "known-cause": 3, "environment": 4, "flake": 5} + out = [f"# IDE update loop: analysis of {run.name}", ""] + updates = run / "updates.json" + if updates.exists(): + data = json.loads(updates.read_text(encoding="utf-8")) + out += ["## Proposed versions", "", "| env | property | current | proposed |", "|---|---|---|---|"] + for env, info in data["environments"].items(): + for prop, value in info["overrides"].items(): + out.append(f"| {env} | {prop} | {info['products'][prop]['current']} | {value} |") + out.append("") + out += ["## Stages", "", "| build | overrides | compile | test | verify |", "|---|---|---|---|---|"] + for a in analyses: + stages = a["summary"]["stages"] + + def cell(name): + info = stages.get(name) + if not info: + return "-" + text = f"{info['status']}" + if "duration_s" in info: + text += f" ({info['duration_s'] // 60}m)" + totals = info.get("totals") + if totals: + text += f", {totals['failures'] + totals['errors']}/{totals['tests']} failed" + return text + + overrides = ", ".join(a["summary"]["overrides"].values()) or "properties file" + out.append(f"| {a['env_dir']} | {overrides} | {cell('compile')} | {cell('test')} | {cell('verify')} |") + out.append("") + number = 0 + for a in analyses: + if not a["groups"]: + continue + out += [f"## {a['env_dir']}: error groups", ""] + for g in sorted(a["groups"], key=lambda g: (order.get(g["class"], 9), -g["count"])): + number += 1 + out.append(f"### {number}. [{g['class']}] {g['stage']}: {g['title']}") + out.append(f"- count: {g['count']}; modules: {', '.join(g['modules']) or '-'}") + if g.get("known_id"): + out.append(f"- known: `{g['known_id']}`: {g['hint']}") + elif g.get("hint"): + out.append(f"- hint: {g['hint']}") + for key in ("locations", "tests"): + if g.get(key): + out.append(f"- {key}: " + ", ".join(f"`{x}`" for x in g[key][:6]) + + (f" (+{g['count'] - 6} more)" if g["count"] > 6 else "")) + for key in ("detail", "excerpt"): + if g.get(key): + out += ["", "```", g[key].strip()[:1500], "```"] + out.append("") + if number == 0: + out.append("No failures.") + return "\n".join(out) + "\n" + + +def compare(before_dir, after_dir): + """Error signatures of the stages that ran in both builds: an after-build of only `compile` + says nothing about the tests of the before-build.""" + before_a = json.loads((before_dir / "analysis.json").read_text(encoding="utf-8")) + after_a = json.loads((after_dir / "analysis.json").read_text(encoding="utf-8")) + ran = lambda a: {n for n, i in a["summary"]["stages"].items() if i["status"] != "skipped"} # noqa: E731 + common = ran(before_a) & ran(after_a) + errors = lambda a: {x for x in a["signatures"] if x.split("|", 1)[0] in common} # noqa: E731 + before, after = set(before_a["signatures"]), set(after_a["signatures"]) + fixed = errors(before_a) - errors(after_a) + persisting = errors(before_a) & errors(after_a) + new = errors(after_a) - errors(before_a) + print(f"Compare {before_dir.name} -> {after_dir.name} on stages: {', '.join(sorted(common)) or 'none'}") + only_after = ran(after_a) - common + if only_after: + print(f"Ran only in {after_dir.name} (read its analysis.md groups): {', '.join(sorted(only_after))}") + print("stages before: " + ", ".join(sorted(x[6:] for x in before if x.startswith("stage|")))) + print("stages after: " + ", ".join(sorted(x[6:] for x in after if x.startswith("stage|")))) + for title, items in (("fixed", fixed), ("still failing", persisting), ("NEW", new)): + print(f"\n{title}: {len(items)}") + for item in sorted(items)[:40]: + print(f" {item}") + return 1 if new else 0 + + +def main(): + parser = argparse.ArgumentParser(description=__doc__, formatter_class=argparse.RawDescriptionHelpFormatter) + parser.add_argument("--run-dir") + parser.add_argument("--repo-root") + parser.add_argument("--compare", nargs=2, metavar=("BEFORE", "AFTER")) + args = parser.parse_args() + sys.stdout.reconfigure(encoding="utf-8", errors="replace") + root = repo_root(args.repo_root) + run = run_dir(root, args.run_dir) + + if args.compare: + dirs = [Path(d) if Path(d).is_absolute() else run / d for d in args.compare] + for d in dirs: + if not (d / "analysis.json").exists(): + analyze_env(d, root) + sys.exit(compare(*dirs)) + + env_dirs = sorted(d for d in run.iterdir() if (d / "summary.json").exists()) + if not env_dirs: + sys.exit(f"No builds in {run}: run run_build.py first") + analyses = [analyze_env(d, root) for d in env_dirs] + report = render(run, analyses) + (run / "analysis.md").write_text(report, encoding="utf-8") + print(report) + print(f"Written: {run / 'analysis.md'}") + + +if __name__ == "__main__": + main() diff --git a/.claude/skills/ide-update-loop/scripts/check_ide_updates.py b/.claude/skills/ide-update-loop/scripts/check_ide_updates.py new file mode 100644 index 000000000..2bc265ff9 --- /dev/null +++ b/.claude/skills/ide-update-loop/scripts/check_ide_updates.py @@ -0,0 +1,234 @@ +#!/usr/bin/env python3 +"""Compare the IDE versions in gradle-.properties with the JetBrains Maven repository. + +The build resolves IDEs from Maven (`useInstaller = false`), so the repository's +maven-metadata.xml is the list of versions the build can actually use. + +For every environment (`gradle-252.properties`, `gradle-263.properties`, ...) and product +(ideaVersion, clionVersion, pycharmVersion, riderVersion) it reports the current version, +the newest release of the same platform branch and the newest pre-release, and proposes +a bump to that release. It also reports platform branches newer than every supported one. + +Usage: + check_ide_updates.py [--repo-root DIR] [--envs 261,262] [--json OUT | --no-save] + +Prints a Markdown table. Unless --no-save, it starts a new run directory +build/ide-update-loop// (named in build/ide-update-loop/LATEST) and writes +updates.json there; run_build.py and analyze_build.py pick that run up by default. +Standard library only. +""" + +import argparse +import json +import re +import sys +import urllib.request +import xml.etree.ElementTree as ET +from datetime import datetime, timezone +from pathlib import Path + +from _common import new_run_dir, read_properties, repo_root + +REPO_URL = "https://www.jetbrains.com/intellij-repository/{repo}/com/jetbrains/intellij/{artifact}/maven-metadata.xml" + +# property name -> (product code, Maven artifact path for a platform branch) +PRODUCTS = { + # 2025.3+ resolves the unified `idea` artifact (see intellijIde() in buildSrc/intellijUtils.kt) + "ideaVersion": ("IU", lambda branch: "idea/idea" if branch >= 253 else "idea/ideaIU"), + "clionVersion": ("CL", lambda branch: "clion/clion"), + "pycharmVersion": ("PC", lambda branch: "pycharm/pycharmPC"), + "riderVersion": ("RD", lambda branch: "rider/riderRD"), +} + +RELEASE_RE = re.compile(r"^20\d\d\.\d+(\.\d+)*$") +STAGE_RANK = {"SNAPSHOT": 0, "EAP": 1, "RC": 2} + + +def branch_of(version): + """Platform branch of a Maven version: 2026.2.5 -> 262, 263.8311.4-EAP-CANDIDATE -> 263, 2026.3-RC1-SNAPSHOT -> 263.""" + head = version.split("-", 1)[0] + if head.startswith("20"): + parts = head.split(".") + if len(parts) < 2 or not parts[1].isdigit(): + return None + return int(parts[0][2:] + parts[1]) + number = head.split(".", 1)[0] + return int(number) if number.isdigit() else None + + +def is_release(version): + return bool(RELEASE_RE.match(version)) + + +def numeric(version): + head = version.split("-", 1)[0] + return tuple(int(p) for p in head.split(".") if p.isdigit()) + + +def prerelease_key(version, index): + """Order pre-releases: numeric part, then SNAPSHOT < EAPn < RCn, then publication order.""" + rest = version.split("-", 1)[1] if "-" in version else "" + stage, stage_number = 0, 0 + match = re.search(r"\b(EAP|RC)(\d*)", rest) + if match: + stage = STAGE_RANK[match.group(1)] + stage_number = int(match.group(2) or 0) + return numeric(version), stage, stage_number, index + + +_metadata_cache = {} + + +def fetch_versions(repo, artifact): + key = (repo, artifact) + if key not in _metadata_cache: + url = REPO_URL.format(repo=repo, artifact=artifact) + request = urllib.request.Request(url, headers={"User-Agent": "ide-update-check"}) + with urllib.request.urlopen(request, timeout=60) as response: + root = ET.fromstring(response.read()) + _metadata_cache[key] = [v.text.strip() for v in root.iter("version") if v.text] + return _metadata_cache[key] + + +def check_product(env_branch, prop, value): + code, artifact_of = PRODUCTS[prop] + current_code, _, current = value.partition("-") + artifact = artifact_of(env_branch) + releases = [v for v in fetch_versions("releases", artifact) if is_release(v) and branch_of(v) == env_branch] + snapshots = fetch_versions("snapshots", artifact) + prereleases = [(v, i) for i, v in enumerate(snapshots) if not is_release(v) and branch_of(v) == env_branch] + + latest_release = max(releases, key=numeric) if releases else None + latest_pre = max(prereleases, key=lambda p: prerelease_key(*p))[0] if prereleases else None + + proposal = None + if latest_release: + if not is_release(current) or numeric(latest_release) > numeric(current): + proposal = f"{current_code}-{latest_release}" + + if proposal: + status = "update" + elif is_release(current): + status = "up-to-date" + else: + status = "pre-release" # no release of this branch yet: the build follows a snapshot or EAP + + return { + "artifact": artifact, + "current": value, + "latest_release": f"{current_code}-{latest_release}" if latest_release else None, + "latest_prerelease": f"{current_code}-{latest_pre}" if latest_pre else None, + "proposal": proposal, + "status": status, + } + + +def newer_branches(max_branch): + """Branches above every supported environment, with the versions that show them.""" + found = {} + for prop, (code, artifact_of) in PRODUCTS.items(): + artifact = artifact_of(max_branch + 1) + for repo in ("releases", "snapshots"): + try: + versions = fetch_versions(repo, artifact) + except Exception: # noqa: BLE001 - reported by the per-product check + continue + for v in versions: + b = branch_of(v) + if b and b > max_branch: + found.setdefault(b, set()).add(f"{code}-{v}") + return [{"branch": b, "evidence": sorted(found[b])[-4:]} for b in sorted(found)] + + +def ci_environments(root): + """Environments the CI matrix builds; the others are only ever checked locally.""" + workflow = root / ".github" / "workflows" / "ci.yaml" + if not workflow.exists(): + return [] + match = re.search(r"environmentName:\s*\n((?:\s*-\s*\d{3}\s*\n)+)", workflow.read_text(encoding="utf-8")) + return re.findall(r"\d{3}", match.group(1)) if match else [] + + +def main(): + parser = argparse.ArgumentParser(description=__doc__, formatter_class=argparse.RawDescriptionHelpFormatter) + parser.add_argument("--repo-root") + parser.add_argument("--envs", help="comma-separated environment names; default: every gradle-.properties") + output = parser.add_mutually_exclusive_group() + output.add_argument("--json", help="write the result to this JSON file instead of a new run directory") + output.add_argument("--no-save", action="store_true", help="only print the table") + args = parser.parse_args() + sys.stdout.reconfigure(encoding="utf-8", errors="replace") + + root = repo_root(args.repo_root) + env_files = sorted(root.glob("gradle-[0-9][0-9][0-9].properties")) + if not env_files: + sys.exit(f"No gradle-.properties under {root}") + wanted = set(args.envs.split(",")) if args.envs else None + + result = { + "checked_at": datetime.now(timezone.utc).isoformat(timespec="seconds"), + "repo_root": str(root), + "ci_environments": ci_environments(root), + "environments": {}, + "new_branches": [], + "errors": [], + } + + for path in env_files: + env = path.stem.split("-", 1)[1] + if wanted and env not in wanted: + continue + props = read_properties(path) + env_result = {"properties_file": path.name, "products": {}, "overrides": {}} + for prop in PRODUCTS: + if prop not in props: + continue + try: + info = check_product(int(env), prop, props[prop]) + except Exception as error: # noqa: BLE001 - one product's failure must not hide the others + result["errors"].append(f"{env} {prop}: {error}") + info = {"current": props[prop], "status": "error", "error": str(error)} + env_result["products"][prop] = info + if info.get("proposal"): + env_result["overrides"][prop] = info["proposal"] + env_result["has_updates"] = bool(env_result["overrides"]) + result["environments"][env] = env_result + + all_envs = [int(p.stem.split("-", 1)[1]) for p in env_files] + result["new_branches"] = newer_branches(max(all_envs)) + + print(f"IDE versions checked against the JetBrains Maven repository ({result['checked_at']})\n") + print("| env | property | current | latest release | latest pre-release | status |") + print("|---|---|---|---|---|---|") + for env, env_result in result["environments"].items(): + for prop, info in env_result["products"].items(): + status = info["status"] + if info.get("proposal"): + status = f"**update -> {info['proposal']}**" + print(f"| {env} | {prop} | {info['current']} | {info.get('latest_release') or '-'} " + f"| {info.get('latest_prerelease') or '-'} | {status} |") + print() + to_build = [env for env, r in result["environments"].items() if r["has_updates"]] + print(f"Environments with updates: {', '.join(to_build) if to_build else 'none'}") + local_only = [env for env in result["environments"] if env not in result["ci_environments"]] + if result["ci_environments"]: + print(f"CI builds {', '.join(result['ci_environments'])}; only checked locally: {', '.join(local_only) or 'none'}") + for nb in result["new_branches"]: + print(f"New platform branch {nb['branch']} is published: {', '.join(nb['evidence'])} " + f"(not supported yet, see documentation/SupportNewPlatformVersion.md)") + for error in result["errors"]: + print(f"ERROR {error}") + + if not args.no_save: + out = Path(args.json) if args.json else new_run_dir(root) / "updates.json" + out.parent.mkdir(parents=True, exist_ok=True) + out.write_text(json.dumps(result, indent=2), encoding="utf-8") + print(f"\nRun directory: {out.parent}") + + total = sum(len(r["products"]) for r in result["environments"].values()) + if total and len(result["errors"]) == total: + sys.exit(2) + + +if __name__ == "__main__": + main() diff --git a/.claude/skills/ide-update-loop/scripts/diff_platform.py b/.claude/skills/ide-update-loop/scripts/diff_platform.py new file mode 100644 index 000000000..cec40b9b5 --- /dev/null +++ b/.claude/skills/ide-update-loop/scripts/diff_platform.py @@ -0,0 +1,86 @@ +#!/usr/bin/env python3 +"""Diff the layout of two extracted IDEs: what left the core classpath, which modules and plugins +appeared, disappeared or changed kind. + +On 2026.3 most compile and runtime breakage came from jars leaving the `com.intellij` classPath +into content modules with their own classloader; this diff predicts that before reading any error. + +Usage: + diff_platform.py IU-2026.2.1 IU-2026.2.5 # directories under /.intellijPlatform/ides + diff_platform.py + +The new IDE exists there once a build has resolved it (run_build.py with the proposed version). +Standard library only. +""" + +import argparse +import json +import sys +from pathlib import Path + +from _common import repo_root + + +def load(arg, root): + path = Path(arg) + if not path.is_dir(): + path = root / ".intellijPlatform" / "ides" / arg + info = path / "product-info.json" + if not info.exists(): + sys.exit(f"{info} not found: the IDE has not been resolved yet (build against it first)") + return json.loads(info.read_text(encoding="utf-8")), path.name + + +def section(title, items, limit=80): + items = sorted(items) + if not items: + return [] + lines = [f"### {title} ({len(items)})", ""] + lines += [f"- `{item}`" for item in items[:limit]] + if len(items) > limit: + lines.append(f"- ... {len(items) - limit} more") + return lines + [""] + + +def main(): + parser = argparse.ArgumentParser(description=__doc__, formatter_class=argparse.RawDescriptionHelpFormatter) + parser.add_argument("old") + parser.add_argument("new") + parser.add_argument("--repo-root") + args = parser.parse_args() + sys.stdout.reconfigure(encoding="utf-8", errors="replace") + root = repo_root(args.repo_root) + old, old_name = load(args.old, root) + new, new_name = load(args.new, root) + + def core(info): + entry = next((e for e in info.get("layout", []) if e.get("name") == "com.intellij"), {}) + return {Path(p).name for p in entry.get("classPath", [])} + + def layout(info): + return {e["name"]: e.get("kind") for e in info.get("layout", [])} + + def bundled(info): + return set(info.get("bundledPlugins", [])) + + old_layout, new_layout = layout(old), layout(new) + kind_changes = {f"{name}: {old_layout[name]} -> {new_layout[name]}" + for name in old_layout.keys() & new_layout.keys() if old_layout[name] != new_layout[name]} + + out = [f"## Platform diff {old_name} ({old.get('buildNumber')}) -> {new_name} ({new.get('buildNumber')})", ""] + out += section("Jars that left the core classPath: code using them needs bundledModule(...) / ", + core(old) - core(new)) + out += section("Jars that joined the core classPath", core(new) - core(old)) + out += section("Layout entries that changed kind", kind_changes) + out += section("Layout entries removed (modules or plugins gone or renamed)", + {f"{n} ({k})" for n, k in old_layout.items() if n not in new_layout}) + out += section("Layout entries added", {f"{n} ({k})" for n, k in new_layout.items() if n not in old_layout}) + out += section("Bundled plugins removed", bundled(old) - bundled(new)) + out += section("Bundled plugins added", bundled(new) - bundled(old)) + if len(out) == 2: + out.append("No layout differences: compile errors, if any, come from changed signatures, not moved classes.") + print("\n".join(out)) + + +if __name__ == "__main__": + main() diff --git a/.claude/skills/ide-update-loop/scripts/run_build.py b/.claude/skills/ide-update-loop/scripts/run_build.py new file mode 100644 index 000000000..3772e0b30 --- /dev/null +++ b/.claude/skills/ide-update-loop/scripts/run_build.py @@ -0,0 +1,204 @@ +#!/usr/bin/env python3 +"""Build one environment the way CI does, against the proposed IDE versions, and keep the evidence. + +Stages (CI order): compile -> test -> verify. A red compile skips the rest; a red test still runs verify. +IDE versions are passed as -P overrides (they beat gradle-.properties), so nothing in the +checkout is edited. Every stage's full log, the failing JUnit XML files and the Plugin Verifier +verdicts are saved to /[-