Skip to content

Commit 497becb

Browse files
authored
fix: restore CLion sessions and validate stable IDE functionality (#4)
* fix: locate the CLion backend and verify stable IDE runtimes * test: exercise CLion build run and test actions * fix: keep CLion completion and native views usable during analysis * fix: start native CLion debug sessions and repair stable CI setup * test: verify native CLion breakpoints stepping and stop * test: check native debugger values and keyboard completion * fix: load and validate settings in stable CLion dialogs * fix: report graph query failures and verify stable CLion rendering * fix: preserve the selected configuration in debugger launches * build: align IDE payloads with the public OpenKal 0.24 group * ci: align the project shim with the published bootstrap * ci: record sanitized CLion IDE error fingerprints * ci: classify stock CLion debugger stop only after functional checks * ci: publish verified CLion release to JetBrains Marketplace * test: assert verified Marketplace release jobs * fix(release): upload JetBrains artifact once per release * feat(ide): notify once when an active action needs missing mcpp * fix(vscode): keep missing-tool notice out of autosave builds
1 parent 421613a commit 497becb

55 files changed

Lines changed: 2413 additions & 123 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

‎.agents/docs/2026-11-05-clion-backend-location-and-stable-runtime.md‎

Lines changed: 235 additions & 0 deletions
Large diffs are not rendered by default.
Lines changed: 71 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,71 @@
1+
# Debug launches from the selected build configuration
2+
3+
Status, 2026-11-06: implemented in the current core and IDE worktrees. Local
4+
core/backend controls and compilation against both stable CLion SDKs pass.
5+
Final public-group CI, packaged IDE runtime and release qualification remain
6+
separate requirements.
7+
8+
## Responsibility and selection
9+
10+
The core describes the program that `run` or `test --print-launch` actually
11+
selected. The additive `configuration` object contains its triple, profile,
12+
resolved platform and available named runners. The runner names remain
13+
available when a project uses no active platform. This avoids querying a
14+
default configuration separately or taking the first leg of a target-set
15+
environment report, neither of which identifies the program selected to run.
16+
17+
The IDE first asks for that ordinary launch. If it declares `debuggee` and the
18+
request did not explicitly choose a runner, the IDE asks for that named runner
19+
with the selected triple and profile. A different triple, profile or platform
20+
in the second answer is refused. An explicit runner, including an explicit
21+
empty/default runner, takes precedence. A device action named `debug` is not
22+
interpreted as a host-debugger launch. Older cores that omit the additive
23+
configuration retain their ordinary behavior.
24+
25+
The core assigns no OpenKal meaning to `debuggee`. Platform 0.24 declares
26+
`okrun --debugger` through the existing named-runner mechanism. `mcpp test`
27+
accepts `--runner` through the same resolver as `run`, including launch
28+
descriptions and archive execution. A missing name or a simultaneous
29+
`--no-runner` is refused. The core feature version is 2026.11.6.1.
30+
31+
## Editor behavior
32+
33+
Custom profile names are passed with `--profile`; the CLion run-configuration
34+
profile selector accepts typed values. CLion obtains the backend's debug
35+
configuration for its selected native debugger. The adapter enables LLDB's
36+
GDB JIT reader in that session before loading the target. It does not change
37+
a user's global debugger initialization file. Other runners keep their own
38+
semantics and do not implicitly promise source symbols.
39+
40+
The backend describes both program and individual-test debug launches. The
41+
existing CLion debug executor remains limited to program run configurations;
42+
no CLion test-debug UI is claimed by the backend protocol tests.
43+
44+
## Validation and current boundaries
45+
46+
The actual protocol test drives the mock executable through the backend's
47+
wire. It covers older-core fallback, ordinary board actions, target-set
48+
selection, a custom profile, program and test paths, explicit runner
49+
precedence, missing configuration and changed target/profile/platform refusal.
50+
It also checks space-containing and empty arguments.
51+
52+
A separate native integration starts the actual backend with the newly built
53+
core and a real project. Eleven checks cover ordinary and debug launches for
54+
both a program and a test: actual profile and runner declarations, unchanged
55+
configuration, no execution while describing a launch, execution of the
56+
returned argv, argument preservation and explicit default-runner precedence.
57+
It uses no mock and does not stand in for CLion GUI or JIT qualification.
58+
59+
The fresh core passes E2E 01, 333, 993 and 936. E2E 993 includes the actual
60+
named runner, archive execution, missing-name and contradictory-option
61+
controls. E2E 936 initially inherited `NO_COLOR=1`; removing that external
62+
setting passes the unchanged color-precedence checks. The core build uses
63+
the OS 0.3 candidate source path and is not final public dependency evidence.
64+
65+
The changed Kotlin adapters compile against CLion 2026.1.5.2 and 2026.2.4.1.
66+
Compilation does not establish packaged runtime behavior. Image source
67+
debugging still requires retained debug relocations and discoverable JIT
68+
registration symbols in the packaged runner. The source-runner GDB/LLDB
69+
controls and the precompiled-runner packaging qualification are separate.
70+
The independently reproduced CLion 2026.2 native frame-variable cancellation
71+
error remains separate from these changes and is not suppressed.

‎.github/actions/setup-mcpp/action.yml‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,8 @@ runs:
1111
shell: bash
1212
run: |
1313
set -euo pipefail
14+
python=python3; [ "$RUNNER_OS" = Windows ] && python=python
15+
"$python" .github/scripts/check-bootstrap-pin.py
1416
while IFS='=' read -r name value; do
1517
case "$name" in ''|\#*) continue ;; esac
1618
if [ -z "${!name:-}" ]; then echo "$name=$value" >> "$GITHUB_ENV"; fi
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
"""Check the project's shim pin against the declared CI bootstrap before installation."""
2+
import json
3+
from pathlib import Path
4+
5+
values = dict(line.split('=', 1) for line in Path('.github/versions.env').read_text().splitlines()
6+
if line and not line.startswith('#'))
7+
declared = values['MCPP_VERSION']
8+
project = json.loads(Path('.xlings.json').read_text())['workspace']['mcpp']
9+
if project != declared:
10+
raise SystemExit(f'bootstrap mismatch: .xlings.json selects {project}, versions.env installs {declared}')
11+
print(f'project shim and CI bootstrap both select mcpp {declared}')
Lines changed: 98 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,98 @@
1+
"""Submit one verified release archive to the documented Marketplace update API."""
2+
import argparse
3+
import hashlib
4+
import io
5+
import json
6+
import os
7+
from pathlib import Path
8+
import re
9+
import time
10+
import urllib.error
11+
import urllib.request
12+
import uuid
13+
import xml.etree.ElementTree as ET
14+
import zipfile
15+
16+
17+
def validate(archive, xml_id, version, sha256):
18+
data = archive.read_bytes()
19+
assert hashlib.sha256(data).hexdigest() == sha256, 'Release archive digest differs'
20+
assert re.fullmatch(r'[A-Za-z0-9_.-]+', xml_id)
21+
assert re.fullmatch(r'\d+(?:\.\d+)+(?:[-+][A-Za-z0-9.-]+)?', version)
22+
assert re.fullmatch(r'[A-Za-z0-9_.-]+\.(?:zip|jar)', archive.name)
23+
descriptors = []
24+
with zipfile.ZipFile(io.BytesIO(data)) as outer:
25+
for name in outer.namelist():
26+
if not name.endswith('.jar'):
27+
continue
28+
with zipfile.ZipFile(io.BytesIO(outer.read(name))) as jar:
29+
if 'META-INF/plugin.xml' in jar.namelist():
30+
root = ET.fromstring(jar.read('META-INF/plugin.xml'))
31+
descriptors.append((root.findtext('id'), root.findtext('version')))
32+
assert descriptors == [(xml_id, version)], descriptors
33+
return data
34+
35+
36+
def submit(data, archive, xml_id, token, receipt):
37+
boundary = 'mcpp-marketplace-' + uuid.uuid4().hex
38+
prefix = ('--' + boundary + '\r\nContent-Disposition: form-data; name="xmlId"\r\n\r\n'
39+
+ xml_id + '\r\n--' + boundary
40+
+ '\r\nContent-Disposition: form-data; name="file"; filename="' + archive.name
41+
+ '"\r\nContent-Type: application/zip\r\n\r\n').encode()
42+
body = prefix + data + ('\r\n--' + boundary + '--\r\n').encode()
43+
request = urllib.request.Request('https://plugins.jetbrains.com/api/updates/upload', body,
44+
headers={'Authorization': 'Bearer ' + token,
45+
'Content-Type': 'multipart/form-data; boundary=' + boundary}, method='POST')
46+
class NoRedirect(urllib.request.HTTPRedirectHandler):
47+
def redirect_request(self, request, stream, code, message, headers, new_url):
48+
return None
49+
try:
50+
with urllib.request.build_opener(NoRedirect).open(request, timeout=120) as response:
51+
raw = response.read().decode(errors='replace').replace(token, '<redacted>')
52+
receipt['http'] = response.status
53+
except urllib.error.HTTPError as error:
54+
raw = error.read().decode(errors='replace').replace(token, '<redacted>')
55+
receipt.update(http=error.code, accepted=False, error=raw[:4000])
56+
return False
57+
except (urllib.error.URLError, TimeoutError) as error:
58+
receipt.update(accepted=False, result_uncertain=True,
59+
error='Network error during the single upload; inspect Marketplace before retrying',
60+
error_type=type(error).__name__)
61+
return False
62+
try:
63+
result = json.loads(raw)
64+
except json.JSONDecodeError:
65+
result = {'text': raw[:4000]}
66+
receipt['marketplace_response'] = result
67+
receipt['accepted'] = receipt['http'] in (200, 201, 202) and not (isinstance(result, dict) and result.get('error'))
68+
return receipt['accepted']
69+
70+
71+
def main():
72+
parser = argparse.ArgumentParser(description=__doc__)
73+
parser.add_argument('--archive', required=True, type=Path)
74+
for name in ('xml-id', 'version', 'sha256'):
75+
parser.add_argument('--' + name, required=True)
76+
parser.add_argument('--output', required=True, type=Path)
77+
parser.add_argument('--verify-only', action='store_true')
78+
args = parser.parse_args()
79+
data = validate(args.archive, args.xml_id, args.version, args.sha256)
80+
receipt = dict(xml_id=args.xml_id, version=args.version, archive=args.archive.name,
81+
sha256=args.sha256, bytes=len(data), verified=True,
82+
utc=time.strftime('%Y-%m-%dT%H:%M:%SZ', time.gmtime()))
83+
if args.verify_only:
84+
receipt['upload_attempted'] = False
85+
success = True
86+
else:
87+
token = os.environ.get('JETBRAINS_TOKEN')
88+
assert token, 'JETBRAINS_TOKEN is required'
89+
receipt['upload_attempted'] = True
90+
success = submit(data, args.archive, args.xml_id, token, receipt)
91+
args.output.parent.mkdir(parents=True, exist_ok=True)
92+
args.output.write_text(json.dumps(receipt, indent=2) + '\n')
93+
print(json.dumps(receipt))
94+
return 0 if success else 1
95+
96+
97+
if __name__ == '__main__':
98+
raise SystemExit(main())

‎.github/versions.env‎

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,12 @@
11
# The versions CI builds and tests with, in one file; .github/actions/setup-mcpp exports them.
2-
# The released mcpp CI installs and uses: it states its features (`features`, the project's mcpp of
3-
# part 2 §4.3), test-launch among them (2026.10.31.2), and builds the backend's ok images on
4-
# openkal-platform 0.23.3, which it compiles the std module for with the platform's words
5-
# (2026.11.3.1). The mock replays the control contract the fixtures were captured from
6-
# (protocol/fixtures/version.txt).
7-
MCPP_VERSION=2026.11.3.1
2+
# The published bootstrap; the project explicitly selects platform 0.24.
3+
MCPP_VERSION=2026.11.5.1
84
# A ref of mcpp-community/mcpp CI builds mcpp from and uses instead, for a contract not yet released.
95
# Empty: the release above is used.
106
MCPP_SOURCE_REF=
117
# The LLVM the backend builds with on macOS and Windows (the targets mcpp reaches there with it).
128
LLVM_VERSION=23.1.3
13-
# The xlings mcpp 2026.11.3.1 bundles, which reads the current index.
9+
# The xlings mcpp 2026.11.5.1 bundles, which reads the current index.
1410
XLINGS_VERSION=v2026.10.26.1
1511
# The oldest VS Code the extension supports (engines.vscode), which its tests run in.
1612
VSCODE_VERSION=1.91.0

‎.github/workflows/ci.yml‎

Lines changed: 20 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ jobs:
3636
- { os: ubuntu-24.04-arm, platform: linux-arm64, llvm: 'false' }
3737
- { os: macos-15, platform: darwin-arm64, llvm: 'true' }
3838
- { os: windows-2022, platform: win32-x64, llvm: 'true' }
39-
- { os: ubuntu-24.04, platform: linux-x64, llvm: 'false', host-platform: 'openkal-platform@0.23.3' }
39+
- { os: ubuntu-24.04, platform: linux-x64, llvm: 'false', host-platform: 'openkal-platform@0.24.0' }
4040
defaults:
4141
run:
4242
shell: bash
@@ -454,6 +454,17 @@ jobs:
454454
unzip -l plugin.jar | tee jar.txt | grep -q "webui/files.txt"
455455
for f in $(unzip -p plugin.jar webui/files.txt); do grep -q " webui/$f$" jar.txt; done
456456
ls -l build/distributions/*.zip
457+
- name: The Marketplace submission would name this verified plugin
458+
run: |
459+
set -euo pipefail
460+
version="$(sed -n 's/^version *= *"\(.*\)"/\1/p' mcpp.toml | head -1)"
461+
archive="mide-plugins/clion/build/distributions/mcpp-clion-$version.zip"
462+
test -f "$archive"
463+
digest="$(sha256sum "$archive" | cut -d ' ' -f1)"
464+
python3 .github/scripts/publish-jetbrains.py --verify-only \
465+
--archive "$archive" --xml-id io.github.mcpp-community.mcpp-clion \
466+
--version "$version" --sha256 "$digest" \
467+
--output "$RUNNER_TEMP/jetbrains-archive-verification.json"
457468
# The plugin's icon and its tool window's are the mcpp logo, an embedded image (design 2026-10-29
458469
# §10.4), not text; the VS Code extension's logo is mcpp-vscode 0.9.0's, byte for byte.
459470
- name: The icons are the mcpp logo
@@ -471,6 +482,14 @@ jobs:
471482
name: mcpp-clion-zip
472483
path: mide-plugins/clion/build/distributions/*.zip
473484

485+
# Both stable families load the exact same packaged ZIP. These are actual
486+
# IDE startup/session checks, in addition to the static Plugin Verifier.
487+
clion-stable:
488+
needs: clion
489+
uses: ./.github/workflows/clion-stable.yml
490+
with:
491+
plugin_artifact: mcpp-clion-zip
492+
474493
# The Neovim plugin (mide-plugins/nvim) in a headless Neovim, against the backend built here: over
475494
# the mock mcpp on the oldest and the newest Neovim it supports, then over the real mcpp, which
476495
# builds the test's project. Neovim comes from xlings (`nvim` in xim-pkgindex), each version

‎.github/workflows/clion-stable.yml‎

Lines changed: 135 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,135 @@
1+
name: CLion stable runtime
2+
3+
on:
4+
workflow_call:
5+
inputs:
6+
plugin_artifact:
7+
type: string
8+
required: true
9+
workflow_dispatch:
10+
inputs:
11+
release_tag:
12+
description: Published plugin release to install without rebuilding the backend
13+
type: string
14+
default: v0.2.0
15+
16+
permissions:
17+
contents: read
18+
19+
env:
20+
XLINGS_NON_INTERACTIVE: '1'
21+
22+
jobs:
23+
runtime:
24+
name: packaged plugin on CLion ${{ matrix.version }}
25+
runs-on: ubuntu-24.04
26+
timeout-minutes: 35
27+
strategy:
28+
fail-fast: false
29+
matrix:
30+
version: ['2026.1.5.2', '2026.2.4.1']
31+
defaults:
32+
run:
33+
shell: bash
34+
steps:
35+
- uses: actions/checkout@v5
36+
- uses: ./.github/actions/setup-mcpp
37+
- name: Gradle and a virtual display
38+
run: |
39+
xlings install gradle -y -g
40+
sudo apt-get update -qq
41+
sudo apt-get install -y xvfb
42+
- name: The compiler for actual build, run and test actions
43+
run: |
44+
mcpp toolchain install gcc 16.1.0
45+
mcpp toolchain default gcc@16.1.0
46+
- uses: actions/cache@v5
47+
with:
48+
path: ~/.gradle/caches/modules-2
49+
key: clion-stable-runtime-${{ hashFiles('mide-plugins/clion/integration-tests/*.gradle.kts') }}
50+
- name: The candidate ZIP built once by CI
51+
if: inputs.plugin_artifact != ''
52+
uses: actions/download-artifact@v5
53+
with:
54+
name: ${{ inputs.plugin_artifact }}
55+
path: stable-plugin
56+
- name: The published ZIP for an isolated release check
57+
if: inputs.plugin_artifact == ''
58+
env:
59+
GH_TOKEN: ${{ github.token }}
60+
RELEASE_TAG: ${{ inputs.release_tag || 'v0.2.0' }}
61+
run: |
62+
set -euo pipefail
63+
[[ "$RELEASE_TAG" =~ ^v[0-9]+\.[0-9]+\.[0-9]+$ ]]
64+
mkdir -p stable-plugin
65+
gh release download "$RELEASE_TAG" --repo "$GITHUB_REPOSITORY" \
66+
--pattern 'mcpp-clion-*.zip' --dir stable-plugin
67+
- name: The pinned language-service plugin
68+
env:
69+
GH_TOKEN: ${{ github.token }}
70+
run: |
71+
set -euo pipefail
72+
version="$(sed -n 's/^mcpplsPluginVersion *= *//p' mide-plugins/clion/gradle.properties)"
73+
gh release download "v$version" --repo Sunrisepeak/mcpp-language-server \
74+
--pattern "mcppls-clion-$version-linux-x64.zip" --dir stable-plugin
75+
- name: Start the real IDE and complete the plugin startup chain
76+
env:
77+
IDE_VERSION: ${{ matrix.version }}
78+
run: |
79+
set -euo pipefail
80+
plugin="$(find stable-plugin -maxdepth 1 -name 'mcpp-clion-*.zip' -print)"
81+
language="$(find stable-plugin -maxdepth 1 -name 'mcppls-clion-*.zip' -print)"
82+
test -n "$plugin" && test -n "$language"
83+
# Ubuntu's userns AppArmor restriction prevents JCEF's sandbox from
84+
# creating its browser. Permit userns only for this hosted UI check;
85+
# Chromium/JCEF sandbox flags and the tests remain unchanged.
86+
original=$(cat /proc/sys/kernel/apparmor_restrict_unprivileged_userns)
87+
[[ "$original" =~ ^[01]$ ]]
88+
printf '%s\n' "$original" > "$RUNNER_TEMP/clion-userns-policy"
89+
restore_userns_policy() {
90+
local status=$?
91+
trap - EXIT
92+
if ! sudo sysctl -w "kernel.apparmor_restrict_unprivileged_userns=$original" >/dev/null ||
93+
[ "$(cat /proc/sys/kernel/apparmor_restrict_unprivileged_userns)" != "$original" ]; then
94+
echo '::error::Could not restore the original user namespace policy'
95+
exit 1
96+
fi
97+
exit "$status"
98+
}
99+
trap restore_userns_policy EXIT
100+
sudo sysctl -w kernel.apparmor_restrict_unprivileged_userns=0 >/dev/null
101+
unshare -Ur true
102+
xvfb-run -a gradle --no-daemon --max-workers=4 \
103+
-p mide-plugins/clion/integration-tests test \
104+
-PpluginZip="$GITHUB_WORKSPACE/$plugin" \
105+
-PmcpplsZip="$GITHUB_WORKSPACE/$language" \
106+
-PideVersion="$IDE_VERSION" \
107+
-Poutput="$RUNNER_TEMP/clion-stable-result"
108+
- name: Restore the hosted user namespace policy
109+
if: always()
110+
run: |
111+
set -euo pipefail
112+
state="$RUNNER_TEMP/clion-userns-policy"
113+
if [ -f "$state" ]; then
114+
original=$(cat "$state")
115+
[[ "$original" =~ ^[01]$ ]]
116+
sudo sysctl -w "kernel.apparmor_restrict_unprivileged_userns=$original" >/dev/null
117+
test "$(cat /proc/sys/kernel/apparmor_restrict_unprivileged_userns)" = "$original"
118+
fi
119+
# The report contains public versions and assertions only. Private user
120+
# logs and arbitrary IDE process output are not uploaded as artifacts.
121+
- uses: actions/upload-artifact@v5
122+
if: always()
123+
with:
124+
name: clion-stable-${{ matrix.version }}
125+
path: |
126+
${{ runner.temp }}/clion-stable-result/result.json
127+
${{ runner.temp }}/clion-stable-result/checks.json
128+
${{ runner.temp }}/clion-stable-result/ide-errors.ndjson
129+
${{ runner.temp }}/clion-stable-result/settings/result.json
130+
${{ runner.temp }}/clion-stable-result/settings/observations.json
131+
${{ runner.temp }}/clion-stable-result/graphs/result.json
132+
${{ runner.temp }}/clion-stable-result/graphs/checks.json
133+
${{ runner.temp }}/clion-stable-result/graphs-no-jcef/result.json
134+
${{ runner.temp }}/clion-stable-result/graphs-no-jcef/checks.json
135+
if-no-files-found: warn

0 commit comments

Comments
 (0)