Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
62 changes: 62 additions & 0 deletions .claude/skills/ide-update-fix/SKILL.md
Original file line number Diff line number Diff line change
@@ -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/<YYYY-MM-DD>` (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-<N>.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/<N>/src` and gets a `// BACKCOMPAT: <N>` comment.

## 3. Verify

Iteration `k` = 1, 2, 3 for each accepted environment `<N>`:

1. `run_build.py --env <N> --no-overrides --label fix<k>`: 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 <N> <N>-fix<k>`.
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 <M> --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.
86 changes: 86 additions & 0 deletions .claude/skills/ide-update-loop/SKILL.md
Original file line number Diff line number Diff line change
@@ -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/<run>/`.
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 <N>` 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=<main checkout>/.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 <N> --stages test --test-tasks "<task> --tests <class>" --label rerun`). A green rerun
closes the group; a red one makes it `new`.
- `platform-change`: run `diff_platform.py <current IDE> <proposed IDE>` 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/<N>/src`, build script, properties file), or is marked
"needs investigation" with what was tried.

## 4. Report

Write `build/ide-update-loop/<run>/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 <numbers>`.

Done when the report exists and every item is something the user can accept or reject on its own.
73 changes: 73 additions & 0 deletions .claude/skills/ide-update-loop/reference/platform-breakage.md
Original file line number Diff line number Diff line change
@@ -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/<CODE>-<version>/` (`lib/`, `plugins/`,
`product-info.json`). Check an API in its jars (`javap -cp <jar> <class>`, 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 <old> <new>` 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=<N>` 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("<module>")`; the build scripts'
`bundledModulesSince(version, <branch>, ...)` adds it only from the branch where the move happened.
Runtime needs `<module name="..."/>` 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/<IDE>/
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=<N> :intellij-plugin:runIdea --args="inspect <emptyProjectDir> <profile.xml> <outDir> -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
`<component name="InspectionProjectProfileManager"><profile version="1.0"><option name="myName" value="Empty"/></profile></component>`.
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").
48 changes: 48 additions & 0 deletions .claude/skills/ide-update-loop/scripts/_common.py
Original file line number Diff line number Diff line change
@@ -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
Loading
Loading