Skip to content

Commit 9c14862

Browse files
1.3.0: tests as mcpp states them, the backend's tests on mtest, a backend change begins a series, mcppls 0.21 (#8)
* 1.3.0: a change of the backend begins a series; mcpp-clion over mcppls 0.21 The VS Code and CLion packages carry the backend, so a change of it is a change of every package: it is a series release, every component at X.Y.0, and the backend is always X.Y.0. backend-v tags are refused, and so is a plugin's patch when a path of the backend changed since its series' tag. Backend 1.2.1's change reaches every package in 1.3.0. mcpp-clion builds and tests against the mcppls CLion plugin 0.21.0, one package for every system. Co-authored-by: speak-agent <248744407+speak-agent@users.noreply.github.com> * test(vscode): the release has no backend patch tag Co-authored-by: speak-agent <248744407+speak-agent@users.noreply.github.com> * test(nvim): the plugin's series is read from the package's version Co-authored-by: speak-agent <248744407+speak-agent@users.noreply.github.com> * backend: tests as mcpp states them (programs, parts, live cases, metrics, the store); the backend's tests are mtest's Co-authored-by: speak-agent <248744407+speak-agent@users.noreply.github.com> * vscode: programs of several files, live cases, diffs, case lines and Test Insights Co-authored-by: speak-agent <248744407+speak-agent@users.noreply.github.com> * webui: the tests page, drawn from test/insights, with its Chromium test Co-authored-by: speak-agent <248744407+speak-agent@users.noreply.github.com> * clion, nvim: programs of several files, live cases, both sides of a failure, and the test insights Co-authored-by: speak-agent <248744407+speak-agent@users.noreply.github.com> * docs, ci: tests as mcpp states them; mtest's report of each run; mcpp 2026.11.9.1 Co-authored-by: speak-agent <248744407+speak-agent@users.noreply.github.com> * testsupport: the repository's path is absolute in an ok image's build too Co-authored-by: speak-agent <248744407+speak-agent@users.noreply.github.com> * testing: a file is found in its program by any spelling of it Co-authored-by: speak-agent <248744407+speak-agent@users.noreply.github.com> * spec: a deprecated command is offered to VS Code alone Co-authored-by: speak-agent <248744407+speak-agent@users.noreply.github.com> --------- Co-authored-by: speak-agent <248744407+speak-agent@users.noreply.github.com>
1 parent c0c1777 commit 9c14862

127 files changed

Lines changed: 3979 additions & 730 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.
Lines changed: 183 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,183 @@
1+
# Tests as mcpp states them: programs, parts, cases, live results, metrics and history
2+
3+
Status, 2026-11-10: implemented in mcpp-ide 1.3.0 (mcpp-ide#8), with the client side of mcpp#917; the backend's own tests are mtest's.
4+
5+
## Scope and principle
6+
7+
The editors show tests as `mcpp test` states them. mcpp builds and runs the programs. mtest's protocol
8+
is how a program's cases report to mcpp. mtest's store (spec P12) is the form in which mcpp keeps a run
9+
(`target/mtest`). The backend reads three inputs:
10+
11+
- the records of `mcpp test --message-format json`;
12+
- the listings of `--list` and `--cases`;
13+
- the store.
14+
15+
It does not drive mtest's engine. A program that only mtest's own runner runs (a `[discover]` script of
16+
`mtest.toml`) is outside `mcpp test`, and the editors do not show it.
17+
18+
Each editor presents the same data in its own idiom:
19+
20+
- VS Code uses the Testing view, test messages, and editor decorations.
21+
- CLion uses the SMRunner test tree and its comparison view.
22+
- Neovim uses buffers, signs, virtual text, and the quickfix list.
23+
24+
An editor shows only what the project's mcpp provides. A missing input removes the view that needs it.
25+
It does not remove the views that do not need it.
26+
27+
## What mcpp provides, by version
28+
29+
| mcpp | Provides | The editors show |
30+
|---|---|---|
31+
| before 2026.11.8.1 | one record per program | programs and their results |
32+
| 2026.11.8.1 (`test-protocol`) | `listed` and `cases` of a protocol program | cases, their results at the program's end, their failures' places, `kind`, `tags`, `expect` and `expected`/`actual` |
33+
| 2026.11.9.1 | a protocol program of several files runs as one process per file (`<program>/<file>`); the run is kept in `target/mtest` | a program of several files with its files as children; results of a part attach to its program; history, trends of durations, and the schedule from the store |
34+
| `test-parts` (mcpp#917) | `files`, `parts`, `main: null`, `part_of` | the same tree, from mcpp's statement instead of the backend's derivation |
35+
| `test-case-stream` (mcpp#917) | `case` records as cases begin and end | live results per case |
36+
| `test-metrics` (mcpp#917) | `metrics`, `bounds`, `usage`; the store's P12 fields | metrics beside their bounds, their trends, and a case-level schedule |
37+
38+
A view that needs an input names the missing feature in `capabilities/explain` (`tests.parts`,
39+
`tests.live`, `tests.metrics`).
40+
41+
## The model
42+
43+
A **program** is what `mcpp test --list` names: `unit` for the directory `tests/unit/` under
44+
`[test] programs = "directory"`, and `00-a/0` for one file. Its fields are:
45+
46+
- `files`: its own sources;
47+
- `main`: the file that defines `main`, if one does;
48+
- `layout`: `file` or `directory`;
49+
- `parts`: the processes a run divides it into, each `{name, file}`.
50+
51+
With `test-parts`, these fields are mcpp's. Without it, the backend derives them from what mcpp
52+
2026.11.9.1 states (docs/08):
53+
54+
- A program whose `main` file lies in a directory whose path below the test root is the program's name
55+
is of layout `directory`.
56+
- Its files are the C++ sources directly in that directory.
57+
- Its parts are `<program>/<stem>`, one per file.
58+
- `main` is the file whose source defines `main`, found by the scanner; otherwise it is absent.
59+
60+
A **case** belongs to a program and a file. Its fields are `id`, `file`, `line`, `kind`, `tags`,
61+
`expect` and, with `test-metrics`, `bounds`. Static cases are read from each file with mtest's manifest.
62+
A listing (`--cases`) replaces them case by case.
63+
64+
A result names the program it belongs to:
65+
66+
- `part_of` when mcpp states it;
67+
- else the longest listed program whose name is the record's name or a prefix of it followed by `/`;
68+
- else the record's name.
69+
70+
## The backend's protocol (protocol 2, additions only)
71+
72+
- `test/list`: each test gains `files`, `layout`, `parts`, and `main` as described above.
73+
- `source/entries`: a file of a directory program answers `test` (the program) and `part` (its own
74+
part).
75+
- `test/cases`: reads every file of the program. Each case gains `file`, `kind`, `tags`, `expect` and
76+
`bounds`.
77+
- `test/result` gains:
78+
- `program` and `part`;
79+
- `cases`, each with `id`, `status`, `durationMs`, `reason`, `failures` (`path`, `line`, `message`,
80+
`expected`, `actual`), `metrics`, `bounds`, `kind` and `tags`.
81+
82+
A case's status is mapped as follows:
83+
84+
| mcpp | protocol |
85+
|---|---|
86+
| `pass` | `passed` |
87+
| `fail` | `failed` |
88+
| `skip` | `skipped` |
89+
| `xfail` | `passed` with `expectedFailure` |
90+
| `xpass` | `failed` with `unexpectedPass` |
91+
| `invalid` | `errored` |
92+
93+
A whole-program run therefore marks every case.
94+
- `test/caseResult`: gains the fields of a case above. It is sent for every record of the job, not
95+
only the last one; a run of a directory program writes one record per part.
96+
- `test/caseEvent` (new): `{jobId, root, program, part, case, event: "begin" | "end", tMs, ...}` with
97+
the fields of a case on `end`. It is sent as mcpp writes a `case` record (`test-case-stream`).
98+
- `test/history {root, program?, case?, runs?}` (new): the store's last runs (20 by default) and each
99+
selected case's results across them.
100+
- `test/insights {root, runs?}` (new):
101+
- the last run: its counts and its counts by kind;
102+
- its failures, each with the run since which it has failed;
103+
- the slowest cases, with their median over the window;
104+
- the cases whose status changed within the window (flaky);
105+
- each metric's series, its bounds, its last value and its margin;
106+
- the schedule: one lane per worker, each process with its start, duration and build, and the
107+
critical path (the chain of processes on one worker that ends last, with the build before it).
108+
- `capabilities/explain` gains `tests.parts`, `tests.live` and `tests.metrics`.
109+
110+
The store is read from `[test] store` when the manifest sets it, else from `target/mtest`. The backend
111+
reads it as P12 specifies it. It reads `index.ndjson`, then the last N runs' files, and keeps them by
112+
run id. A run already read is not read again. A store that is absent is not an error: the history and
113+
insights are empty and say so.
114+
115+
## Each editor
116+
117+
**VS Code.**
118+
119+
- The Testing view shows each project, then its programs, then the files of a directory program, then
120+
the cases.
121+
- Each case carries the test tags `kind:<kind>` and its own tags, so `@kind:bench` filters the view.
122+
- Results arrive per case as they happen (`test/caseEvent`), else per part.
123+
- A failure with `expected` and `actual` is a `TestMessage.diff`, and VS Code's diff view compares them.
124+
- After a run, a case's line ends with a dim decoration: its duration, and its metrics against their
125+
bounds (`ready 4.2 s ≤ 15 s`).
126+
- "mcpp: Test Insights" is a webview with these sections:
127+
- the run's summary;
128+
- its failures, each opening its place;
129+
- the slowest cases;
130+
- the flaky cases;
131+
- each metric's trend against its bounds;
132+
- the schedule, with its critical path.
133+
134+
It refreshes when a run ends.
135+
136+
**CLion.**
137+
138+
- The SMRunner tree shows a program as a suite, the files of a directory program as nested suites, and
139+
the cases as tests, each located at its line.
140+
- Live case events start and finish tests as they come.
141+
- A failure with `expected` and `actual` is a comparison failure, whose "Click to see difference" opens
142+
the IDE's diff.
143+
- Metrics appear in a case's output beside their bounds.
144+
- The mcpp tool window gains a Tests tab: the same insights in JCEF (`webui/tests.html`), as the graph
145+
page is drawn.
146+
147+
**Neovim.**
148+
149+
- `mcpp://tests` gains sections per program, part and case as results arrive, live with
150+
`test-case-stream`.
151+
- A failure's `expected` and `actual` appear as two lines under it, and in its quickfix text.
152+
- A case's line carries its sign (✓, ✗) and, as virtual text, its duration and its metrics against
153+
their bounds.
154+
- `:Mcpp testInsights` opens the insights as text in a floating window. A metric's trend is drawn with
155+
block characters (▁▂▃▅▇), and the schedule as bars.
156+
157+
## Performance
158+
159+
- The suite types of a project's tests are read once and kept with a signature of the files: their
160+
count, their largest modification time, and their total size, from a walk that only stats.
161+
`source/entries` and `test/cases` no longer read every file of `tests/` on each call.
162+
- Live results are sent as they come. VS Code and CLion apply them as their test APIs do.
163+
- Neovim redraws the results buffer at most every 100 ms.
164+
- The store is read incrementally: only runs not read before.
165+
- The insights window is bounded: 20 runs by default, 50 at most.
166+
167+
## Tests
168+
169+
- Backend:
170+
- the derivation of parts from a 2026.11.9.1 listing;
171+
- the attribution of part records to their program;
172+
- the mapping of the protocol's statuses;
173+
- `expected`/`actual`;
174+
- `case` records into `test/caseEvent`;
175+
- the store reader, and the insights (the window, flaky, the critical path, the margins);
176+
- the schema of the new methods and notifications.
177+
- The mock mcpp gains the fixtures of a directory program, with and without the #917 shapes. A
178+
directory's `.mock-mcpp-tests` selects them, as `.mock-mcpp-features` selects the features.
179+
- VS Code: the tree of a directory program; part results attributed to it; the diff message; the
180+
decorations' text.
181+
- Neovim: the smoke test covers live results, the virtual text and `:Mcpp testInsights`.
182+
- CLion: the comparison failure and the nested suites, in the plugin's unit tests.
183+
- The insights page is rendered by a Chromium test, as the graph page is.
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
name: The tests' report
2+
description: mtest's Markdown report of the last run `mcpp test` kept (target/mtest, mtest spec P12) -- its failures, its slowest cases, its metrics and its critical path -- in the job's summary.
3+
runs:
4+
using: composite
5+
steps:
6+
- name: The run, as mtest reports it
7+
shell: bash
8+
run: |
9+
set -uo pipefail
10+
[ -f target/mtest/index.ndjson ] || { echo "mcpp test kept no run"; exit 0; }
11+
xlings install "mtest@$MTEST_VERSION" -y -g > /dev/null 2>&1 || { echo "::warning::mtest@$MTEST_VERSION could not be installed: no report"; exit 0; }
12+
exe=""; [ "$RUNNER_OS" = Windows ] && exe=.exe
13+
# The package's launcher, not the shim: on Windows the shim runs its alias through cmd.
14+
mtest="$HOME/.xlings/data/xpkgs/xim-x-mtest/$MTEST_VERSION/bin/mtest$exe"
15+
[ -x "$mtest" ] || { echo "::warning::no mtest at $mtest: no report"; exit 0; }
16+
store="$RUNNER_TEMP/mtest-report"
17+
mkdir -p "$store" && cd "$store"
18+
"$mtest" store import --from "$GITHUB_WORKSPACE/target/mtest" > /dev/null
19+
"$mtest" report --format md --run last --title "$GITHUB_JOB" >> "$GITHUB_STEP_SUMMARY" || true

‎.github/scripts/release-plan.sh‎

Lines changed: 30 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,16 @@
11
#!/usr/bin/env bash
22
# release-plan.sh [TAG] -- the components a release tag publishes, and its version (design 2026-11-07, D15).
33
#
4-
# A version is X.Y.Z: X.Y, the series, is shared by the backend and every editor plugin; Z is each
5-
# component's own patch. Two kinds of tag:
4+
# A version is X.Y.Z: X.Y, the series, is shared by the backend and every editor plugin; Z is an editor
5+
# plugin's own patch. The backend is always X.Y.0: the VS Code and CLion packages carry it, so a change
6+
# of the backend changes every package, and it begins a series. Two kinds of tag:
67
#
7-
# vX.Y.0 a series release: every component, each at X.Y.0
8-
# <component>-vX.Y.Z one component's patch: backend, vscode, clion or nvim, at X.Y.Z
8+
# vX.Y.0 a series release: every component, each at X.Y.0 (a change of the backend)
9+
# <plugin>-vX.Y.Z one editor plugin's patch: vscode, clion or nvim, at X.Y.Z
910
#
1011
# Prints `components=...`, `version=...` and `title=...` for $GITHUB_OUTPUT. Without a tag it only
11-
# checks that every component states one series and the backend's two statements agree (CI).
12+
# checks that every component states one series, the backend's two statements agree and the backend
13+
# is its series' X.Y.0 (CI).
1214
set -euo pipefail
1315
root="$(cd "$(dirname "${BASH_SOURCE[0]}")/../.." && pwd)"
1416
declare -A version
@@ -26,6 +28,8 @@ for c in backend vscode clion nvim; do
2628
done
2729
[ "$backend_source" = "${version[backend]}" ] || fail "src/server.cppm says $backend_source and mcpp.toml ${version[backend]}"
2830
the_series="$(series "${version[backend]}")"
31+
[ "${version[backend]}" = "$the_series.0" ] \
32+
|| fail "the backend is ${version[backend]}; it is always its series' X.Y.0 (the editor packages carry it, so a change of it begins a series)"
2933
[ "$series_source" = "$the_series" ] || fail "src/server.cppm's kSeries is $series_source, the backend's series $the_series"
3034
for c in vscode clion nvim; do
3135
[ "$(series "${version[$c]}")" = "$the_series" ] \
@@ -45,13 +49,31 @@ if [[ "$tag" =~ ^v([0-9]+\.[0-9]+\.0)$ ]]; then
4549
echo "components=backend vscode clion nvim"
4650
echo "version=$v"
4751
echo "title=mcpp-ide $v"
48-
elif [[ "$tag" =~ ^(backend|vscode|clion|nvim)-v([0-9]+\.[0-9]+\.[0-9]+)$ ]]; then
52+
elif [[ "$tag" =~ ^backend-v ]]; then
53+
fail "$tag: the backend has no patch of its own; a change of it is a series release vX.Y.0"
54+
elif [[ "$tag" =~ ^(vscode|clion|nvim)-v([0-9]+\.[0-9]+\.[0-9]+)$ ]]; then
4955
c="${BASH_REMATCH[1]}"; v="${BASH_REMATCH[2]}"
5056
[ "${version[$c]}" = "$v" ] || fail "the tag $tag names $c $v, and $c is ${version[$c]}"
51-
declare -A names=([backend]=mcpp-ide [vscode]=mcpp-vscode [clion]=mcpp-clion [nvim]=mcpp-nvim)
57+
# A plugin's patch carries its series' backend: no path of the backend (.github/components.tsv)
58+
# has changed since the series' tag.
59+
if git -C "$root" rev-parse -q --verify "refs/tags/v$the_series.0" > /dev/null; then
60+
mapfile -t backend_rows < <(awk -F'\t' '$1 !~ /^(#|@)/ && NF == 2 {print $1 "\t" $2}' "$root/.github/components.tsv")
61+
while IFS= read -r path; do
62+
for row in "${backend_rows[@]}"; do
63+
pattern="${row#*$'\t'}"
64+
# shellcheck disable=SC2254
65+
case "$path" in $pattern)
66+
[ "${row%%$'\t'*}" != backend ] \
67+
|| fail "$tag: the backend changed since v$the_series.0 ($path); a change of the backend is a series release"
68+
break ;;
69+
esac
70+
done
71+
done < <(git -C "$root" diff --name-only "v$the_series.0" HEAD)
72+
fi
73+
declare -A names=([vscode]=mcpp-vscode [clion]=mcpp-clion [nvim]=mcpp-nvim)
5274
echo "components=$c"
5375
echo "version=$v"
5476
echo "title=${names[$c]} $v"
5577
else
56-
fail "$tag is neither vX.Y.0 nor <backend|vscode|clion|nvim>-vX.Y.Z"
78+
fail "$tag is neither vX.Y.0 nor <vscode|clion|nvim>-vX.Y.Z"
5779
fi

‎.github/versions.env‎

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,14 @@
11
# The versions CI builds and tests with, in one file; .github/actions/setup-mcpp exports them.
22
# The published bootstrap; the project explicitly selects platform 0.24.
3-
MCPP_VERSION=2026.11.7.2
3+
MCPP_VERSION=2026.11.9.1
44
# A ref of mcpp-community/mcpp CI builds mcpp from and uses instead, for a contract not yet released.
55
# Empty: the release above is used.
66
MCPP_SOURCE_REF=
77
# The LLVM the backend builds with on macOS and Windows (the targets mcpp reaches there with it).
88
LLVM_VERSION=23.1.3
9-
# The xlings mcpp 2026.11.7.2 bundles, which reads the current index.
9+
# The xlings mcpp 2026.11.9.1 bundles, which reads the current index.
1010
XLINGS_VERSION=v2026.10.26.1
1111
# The oldest VS Code the extension supports (engines.vscode), which its tests run in.
1212
VSCODE_VERSION=1.91.0
13+
# The mtest whose report of each `mcpp test` run is the job's summary (.github/actions/mtest-report).
14+
MTEST_VERSION=0.5.2

‎.github/workflows/ci.yml‎

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -155,6 +155,9 @@ jobs:
155155
run: mcpp build
156156
- name: Test
157157
run: mcpp test
158+
- name: The tests' report
159+
if: always()
160+
uses: ./.github/actions/mtest-report
158161
- name: Every string has its translation
159162
run: mcpp run mcpp-ide-dev -- check-i18n
160163
- name: No header, no preprocessor branch, no compile-time platform question
@@ -218,6 +221,9 @@ jobs:
218221
run: mcpp build
219222
- name: The tests, as ok images, through the runner
220223
run: mcpp test --profile release --target ${{ matrix.arch }}-openkal
224+
- name: The tests' report
225+
if: always()
226+
uses: ./.github/actions/mtest-report
221227

222228
# The VS Code extension (mide-plugins/vscode), mcpp-vscode 0.9.0 over the backend. Its gates
223229
# (the registry, the translations, the unit suite) on the three desktop systems; the manifest

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ jobs:
7171
set -euo pipefail
7272
version="$(sed -n 's/^mcpplsPluginVersion *= *//p' mide-plugins/clion/gradle.properties)"
7373
gh release download "v$version" --repo Sunrisepeak/mcpp-language-server \
74-
--pattern "mcppls-clion-$version-linux-x64.zip" --dir stable-plugin
74+
--pattern "mcppls-clion-$version.zip" --dir stable-plugin
7575
- name: Start the real IDE and complete the plugin startup chain
7676
env:
7777
IDE_VERSION: ${{ matrix.version }}

‎.github/workflows/release.yml‎

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -6,11 +6,12 @@ name: Release
66
# independently after that release exists.
77
#
88
# WHAT A TAG PUBLISHES (design 2026-11-07, D15; .github/scripts/release-plan.sh): a version is X.Y.Z,
9-
# X.Y the series every component shares and Z each component's own patch.
9+
# X.Y the series every component shares and Z an editor plugin's own patch. The backend is always
10+
# X.Y.0: the VS Code and CLion packages carry it, so a change of it is a series release.
1011
#
11-
# vX.Y.0 a series release: the backend, the VS Code extension, the CLion plugin and
12-
# the Neovim plugin (a source tree, which xim takes from the tag's archive)
13-
# backend-vX.Y.Z the backend's ok-image bundle and package (xim's mcpp-ide)
12+
# vX.Y.0 a series release: the backend's ok-image bundle and package (xim's mcpp-ide),
13+
# the VS Code extension, the CLion plugin and the Neovim plugin (a source tree,
14+
# which xim takes from the tag's archive)
1415
# vscode-vX.Y.Z the VSIX (Open VSX)
1516
# clion-vX.Y.Z the CLion ZIP (JetBrains Marketplace)
1617
# nvim-vX.Y.Z the Neovim plugin: the tag's source archive (xim's mcpp-ide-nvim)
@@ -20,7 +21,7 @@ name: Release
2021
on:
2122
workflow_dispatch:
2223
push:
23-
tags: ['v*', 'backend-v*', 'vscode-v*', 'clion-v*', 'nvim-v*']
24+
tags: ['v*', 'vscode-v*', 'clion-v*', 'nvim-v*']
2425

2526
permissions:
2627
contents: read
@@ -34,6 +35,8 @@ jobs:
3435
title: ${{ steps.plan.outputs.title }}
3536
steps:
3637
- uses: actions/checkout@v5
38+
with:
39+
fetch-depth: 0 # a plugin's patch is checked against its series' tag
3740
- id: plan
3841
shell: bash # -eo pipefail: a refused tag fails the step through tee
3942
run: bash .github/scripts/release-plan.sh "$GITHUB_REF_NAME" | tee -a "$GITHUB_OUTPUT"

‎.xlings.json‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
{
22
"workspace": {
3-
"mcpp": "2026.11.7.2"
3+
"mcpp": "2026.11.9.1"
44
}
55
}

0 commit comments

Comments
 (0)