Markdown OKF-Schema Studio

Contributing

Setup

Install just, fnm, and uv, then set up the development environment:

just dev

This installs Node.js 24 from .nvmrc, installs the locked JavaScript dependencies with fnm exec -- npm ci, synchronizes the Python environment including the docs group, and downloads Playwright’s Chromium runtime for visual tests. just install remains a compatible entry point for the same setup. Run just dev again after dependency changes or just mr-proper.

Dependencies are downloaded from the official npm registry (registry.npmjs.org) and PyPI (pypi.org). Node.js releases are installed through fnm from the official Node.js distribution. Linux hosts may also need Playwright system libraries; install those using your system’s package manager or run uv run --group docs playwright install-deps chromium with the required permissions. Integration tests download their isolated VS Code test runtime on first use. The full visual campaign also requires plantuml and Graphviz on PATH for its successful diagram cases. In GitHub Actions only the visual jobs install them, with Playwright’s system libraries, through just dev-ci visual, from cached Ubuntu package archives; on macOS use brew install plantuml graphviz.

Windows

just check and just ci-static run on Windows; the visual and real VS Code stages run on Linux and macOS only, so just preflight runs the static stage there and leaves the others to CI. The recipes need a POSIX shell: install Git for Windows and put sh, bash and cygpath on PATH (its usr\bin folder, or one shim per tool with Scoop), plus node (for example fnm default 24 and fnm env in your PowerShell profile). The justfile calls npm.cmd through fnm on Windows. just dev sets git config core.longpaths true in the repository, so worktrees and checkouts whose paths pass Windows’ 260-character limit do not fail with “Filename too long”. Python 3.12 comes from .python-version: the next interpreter may lack prebuilt wheels and need a C compiler. Tests that create symbolic links are skipped unless Windows allows them (Developer Mode or administrator rights), and the hang-watchdog tests, which read the process list with ps, are skipped; the Linux job runs them all.

Dependency Updates

Run just update to upgrade JavaScript dependencies, regenerate the npm lockfile against the public registry, upgrade the Python environment and lockfile, and refresh Playwright Chromium. The Node.js runtime stays on the version selected by .nvmrc; its type declarations stay on Node 24, and the VS Code API declaration floor stays aligned with engines.vscode. The Python tools (docs, visual captures, release scripts) require Python 3.11 or later, the floor of Pillow 13; the lockfile selects newer releases for newer interpreters. Run just preflight after updating. CI uses STUDIO_NPM to run the Node.js version selected by actions/setup-node without fnm.

Dependency overrides

The overrides field in package.json forces two parsers of the MyST packages onto current releases. The MyST packages still declare release lines that no longer get fixes:

Nothing writes into node_modules: there is no postinstall script. myst-parser and myst-to-html are pinned to exact versions, and three source patches (the import-path correction for myst-to-html and markdown-it-dollarmath with Markdown-It 14, and the single line split of markdown-it-myst) are applied in memory by scripts/myst-patches.mjs. The esbuild bundle uses it as a plugin; Node-run code (unit, contract and security tests, visual:render, site) loads it with node --import ./scripts/register-myst-patches.mjs. A package version or file content that differs from the reviewed one fails the build or the run with a message asking for a review.

Revisit the overrides when you update a MyST package, during just update, or when an advisory names one of these parsers. Run npm ls markdown-it csv-parse: remove an override once every package that pulls the parser asks for the forced line itself. Check that the parser is still on a patched release, and remove the matching patch of scripts/myst-patches.mjs when Markdown-It 14 support arrives in the MyST packages.

Cleanup

just clean removes compiled output, reports, the generated Pages site, VSIX packages, generated README gallery captures, and Python test caches. Dependencies, .env, manual images, and source fixtures are preserved. Campaign screenshots are generated under out/reports/e2e/screenshots/ (static-page scenarios in visual/<group>/, named vNN-<slug>-<theme>-<width>.png, step captures …--<step>.png); the obsolete test/visual/screenshots/ directory is not tracked.

just mr-proper also removes .env, node_modules/, .venv/, the downloaded VS Code test runtime, and local tool caches. It returns the local build environment to an uninstalled checkout.

Architecture

src/ is split into layers, one folder each. The dependencies point down the list: a layer may import the layers below it, never one above it.

Folder What it holds May import
src/core/ Host-neutral logic: protocol (core/protocol/), rendering, sanitizing, source mapping, edit operations, comments, frontmatter, the registries of settings (core/configuration/), palette actions (core/palette/) and MyST directives (core/directives/), page assets built in Node (core/preview/) core and npm packages; no vscode, no DOM-only package, no Node built-in
src/host-api/ The port interfaces every host implements (documents, files, settings, watchers, processes...) core types
src/page/ The preview page, bundled for the browser: runtime, typed features, page modules (page/modules/) core, npm packages
src/node-services/ Node implementations of ports and Node-only services (file system, processes, Sphinx build, watchers) core, host-api, Node, npm packages
src/session/ The host-neutral controllers: PreviewManager, PreviewSession, feature controllers, page HTML core, host-api (paths through src/core/path/hostPath.ts, no Node built-in)
src/host-memory/ An in-memory host for tests and future headless hosts core, host-api
src/host-vscode/ The VS Code host (with src/extension.ts): activation, port adapters, test hooks everything except page and other hosts; the only code that imports vscode

Tests mirror this tree under test/ (test/core/render/ tests src/core/render/). test/security/, test/integration/ and test/visual/ are suites that span the layers.

just check enforces the layout:

Inside the core

Extension points

Four registries hold what used to be spread over many files. Each keeps the pure data in core and the code that needs the page or a host in its own layer.

Add a palette action (a button of the edition palette, an entry of the / menu):

  1. Add its descriptor to PALETTE_ACTIONS in src/core/palette/paletteActions.ts, at the place it should show: label, icon, group, modes (strict shows in every mode, gfm in GFM and MyST, myst in MyST only), scopes, and the optional shortcut, popover, panel, host list or dialog and / menu data (slash: aliases, variants, menuOnly).

  2. A new icon goes in PALETTE_ICONS (src/core/palette/paletteIcons.ts); the descriptor’s icon must name one.

  3. Add its handler to handlers in createEditActions (src/page/modules/editActions.ts): apply returns the text edit; available, explain, current, validateColor and computed options are optional; the edit functions live in the subject modules next to it (inlineEditActions.ts, blockEditActions.ts, linkEditActions.ts, tableEditActions.ts, colourEditActions.ts). TypeScript refuses a descriptor without a handler and the reverse.

  4. The palette and the / menu pick the action up from the registry; nothing else to wire. Test the edit in test/page/modules/editActions.test.ts.

Add a MyST directive plug-in (a directive that needs more than what the MyST writer does):

  1. Create src/core/directives/<name>.ts exporting a MystDirectiveDescriptor (src/core/directives/directive.ts): the directive names, the render pass on the parsed mystDirective node (helpers in src/core/render/mystNode.ts), the sanitizer attributes rules of the HTML attributes the pass writes (data-* attributes only: the registry refuses any other name), the style rules of its output and the paletteActions that insert it (ids of PALETTE_ACTIONS).

  2. Register it in MYST_DIRECTIVES (src/core/directives/registry.ts). The renderer runs the pass for every directive of those names and the sanitizer applies the attribute rules.

  3. Place its stylesheet with ${directiveStyle("<id>")} in src/core/preview/styles/contentBlockStyles.ts, where the rules belong in the cascade.

  4. Test the plug-in in test/core/directives/ and its rendering in test/core/render/ (mystFeatures.test.ts, or mystPaletteRendering.test.ts for what the palette inserts).

Add a setting:

  1. Add it to its section table in src/core/configuration/settingsRegistry.ts (PREVIEW_SETTINGS, EDITING_SETTINGS, …; a new section also needs an entry in SETTING_CATEGORIES): the package.json schema fields in the order they are written (type, enum, enumDescriptions, default, minimum, maximum, step, markdownDescription, order), and normalize, which turns the stored value into the value the core uses. A setting the page needs at startup is a startupSetting (the content patch then compares it) and one it also follows while open a liveSetting; both give the page’s read of the boot context entry. A liveSetting still needs its own update message: add it to src/core/protocol/hostToPage.ts, post it from the session when the setting changes (as postShowComments does for preview.showComments) and handle it in src/page/features/hostHandlers.ts.

  2. Run just generate-settings: it writes the contributes.configuration of package.json, which is never edited by hand (just check-settings fails otherwise).

  3. Read it on the host with readSettings (or the section module, previewConfiguration.ts, …), which also types it. Boot settings (the startupSetting and liveSetting entries of PREVIEW_SETTINGS) reach the page at startup without more code: the host writes previewBootSettings(configuration) and the page reads readPreviewBootSettings(context).

Add a message (between the page and the host; both sides use the typed router of src/core/protocol/router.ts, one handler per type):

  1. Page to host: add its interface to the PageToHostMessage union and its payload validator to PAGE_TO_HOST_VALIDATORS in src/core/protocol/pageToHost.ts. The envelope (document id, revision, request) is checked before the validator runs. The table is typed by the union, so a type without a validator does not compile.

  2. Host to page: add its interface to the HostToPageMessage union and its rule to the table in createHostMessageFilter (src/core/protocol/hostToPage.ts): the addressing (render, document or own-id) and, when the page must refuse some payloads, a validator. The filter only matches the message to the page and checks its payload; it cannot tell whether the host had a reason to send it.

  3. Give a page-to-host message its gate in PAGE_MESSAGE_GATES (src/session/pageMessages.ts), the rule that drops a stale message before its handler runs, and its handler with router.on(type, …) in the register method of the session feature controller that owns it (src/session/features/). The page posts it through its PageHost.

  4. Register the handler of a host-to-page message with hostMessages.on(type, …) in the page feature that owns it, or in src/page/features/hostHandlers.ts for the runtime’s own features. The host sends it with preview.postToPage(…).

  5. Test the validator or the filter rule in test/core/protocol/ (pageToHost.test.ts, hostToPage.test.ts). test/session/previewManager.test.ts checks that every page-to-host type has exactly one handler and pins their count: raise it by one. tsc refuses a page-to-host type without a gate or a validator, and a host-to-page type without a filter rule. Run npx tsc -p . and npm run test:unit.

Checks

How we test explains each test level and the requirement it proves.

Run the package-local checks before opening a pull request:

just check
just sphinx-check
just e2e
just site
just preflight
just package

The full integration and screenshot campaigns require a local VS Code installation and the Playwright browser runtime. They can be run with just integration, just visual, and just e2e. Generated reports are stored under out/reports/; the README-derived Pages tree is stored under out/site/. just preflight runs every stage and returns a failure if any stage fails. On macOS a locked screen stops ci-integration and ci-acceptance at once (exit code 3) and preflight skips report and gallery.

On macOS the real VS Code window tests use /Applications/Visual Studio Code.app when it exists (CI downloads the current stable build); set STUDIO_VSCODE_EXECUTABLE to the Contents/MacOS/Code binary of another build to run them there. They need an unlocked session: each test window must become the active window once, or VS Code sees no focused editor and undo, cursor commands and typed keys reach nothing. macOS keeps a newly launched app in the background while you work in another app, so each test window (the trusted, untrusted and scroll-sync suites, the reload campaign and the acceptance windows that take real input) is first brought to the front, and the run waits until VS Code reports the window focused; on a locked screen it fails at once with the window state instead of timing out later. Losing the focus afterwards, for example by switching to another app, does not affect the run. Bringing a window to the front goes through System Events, so the first run asks once per app (each VS Code build, and the terminal or editor that runs npm) to allow it under System Settings > Privacy & Security > Automation; allow it, or the run fails with a message that names the permission.

CI runs the same stages as parallel jobs, each calling one target after just dev-ci: just ci-static (check-no-merge-commits against the target branch, justfile format, check, audit, sphinx-check), just ci-visual 1 and just ci-visual 2 (the jobs visual and visual-2, one part of the screenshot campaign each, in parallel; just ci-visual runs both parts one after the other, then merges them), just ci-viewer-graph, just ci-integration, just ci-acceptance <group> (the acceptance job, one shard per e2e group that has an acceptance file), then just ci-report (first merges the two visual parts into one run manifest, index and machine-check report, then merges the visual, integration and acceptance outputs into the review index, out/reports/e2e/e2e-manifest.json and out/reports/acceptance/acceptance-manifest.json; it fails when a visual part, a stage manifest, or the manifest of an acceptance group, is missing or failed) and just ci-gallery (gallery and site from the existing outputs, no E2E re-run). On a pull request, CI runs only the simulated tests, which make up the required checks job: ci-static (on Linux, and again on Windows in the static-windows job), ci-visual (in two jobs: Playwright/Chromium against a mock host, and in part 1 then the page tests that need Chromium, run with STUDIO_REQUIRE_CHROMIUM=1 so that a Chromium that cannot start fails them; the static jobs have no Chromium and skip those tests; their report is under out/reports/breakout/. The table and code block breakout width tests assert the widths and the owner’s verdicts on Windows, the reference, and are report-only on Linux CI: they print the widths and the verdicts and name each difference from Windows, and never fail on one. The tests of the aligned-float layout, of the style cost of one comment and of the selected text of a scroll assert wherever Chromium runs), ci-viewer-graph (the use case map tests, in a job of their own so that the visual jobs keep their time budget: they write the JSON requirements report and check in Chromium, in pinned fonts, that no text or pill of any use case map overlaps another at 1280 px and at 800 px, with captures of six frozen maps under out/reports/requirements-viewer-graph/; the same target runs the gallery link tests in Chromium) and just ci-report visual, which reports the real VS Code stages as skipped. The real VS Code window jobs (ci-integration, the ci-acceptance shards and the stress repetitions) are heavy, so they run on every push to main and never on a pull request. On a branch, start them with gh workflow run ci.yml --ref <branch> -f heavy=true (the gallery and site artifact, studio-site-attempt-<n>, are built too when integration and report succeed; -f gallery=false skips them, for example in a stress loop), or with “Run workflow” in the Actions tab. Run them, or npm run test:integration and npm run test:acceptance locally, before merging a change to the extension host, the webview or the real-window tests. On a push to main that changes the package version (a release), the release-check job detects the change, and the release is tagged only when the three heavy jobs (integration, every acceptance shard and stress) succeed (see “Releases” below). The acceptance tests (test/integration/acceptance/) walk main paths of the use cases in real VS Code, one window per file: trusted, Restricted Mode, or one whose extension under test is the built VSIX. npm run test:acceptance runs them all (-- --group <id> for one e2e group of test/shared/e2eGroups.ts), and each group writes out/reports/acceptance/<group>/acceptance-manifest.json. just ci-acceptance [GROUP] starts the stage over: it first removes the earlier acceptance manifests, those of the other groups too. A flake that only shows in the real window can be hunted with the toc-loop job, a repro tool that never gates a merge and never runs on its own: gh workflow run ci.yml --ref <branch> -f toc_loop=30 [-f toc_delay_ms=300] repeats the toc scenario in one trusted window (just ci-toc-loop, at most 40 rounds, launch deadline 30 minutes, step timeout 35). toc_delay_ms (0 to 2000) injects a random pause around the edit toggle and after a host theme change. Failed rounds are counted, not fatal, and the job is red if any failed; out/reports/e2e/toc-loop-summary.json is rewritten after each round. just preflight calls these targets in sequence. Each stage records its own start time and they share a run id, so just ci-visual, just ci-viewer-graph, just ci-integration, just ci-acceptance and just ci-report also work one by one; just clean starts a fresh campaign. The two visual parts are the exception: without a pinned STUDIO_E2E_RUN_ID, just ci-report refuses a visual stage whose parts ran one by one, so that an older part never passes beside a newer one; run just ci-visual with no part. just dev-ci is for CI machines only: npm ci replaces node_modules.

The focused site and gallery commands are:

just gallery
just site

just gallery runs the complete E2E campaign and copies the three selected real-input captures into images/. It also runs scripts/generate-readme-images.py, which uses Pillow to derive the compact install, feature, and theme images under images/readme/ from passing visual and real VS Code captures. It only overwrites those selected and derived filenames plus images/gallery.json; unrelated manual images and future video assets remain untouched. just site builds the E2E evidence, gallery, and static Pages tree. The published out/site/gallery.html includes every screenshot recursively from out/reports/e2e/screenshots/, not just the README selections. Each caption shows the sidecar summary. Selecting an image opens the full sidecar on the left and the image on the right; on narrow screens the sidecar appears above the image. Each screenshot has its own URL, gallery.html#<capture id>, which opens it directly, and Back and Forward step through the screenshots seen. The capture id is the path below the screenshot root without the file extension, with visual/ dropped (the scenario id, plus --<step>) and the run folder of a real-window capture dropped (the registry id <group>/rNN-<slug>), so it stays the same from one CI run to the next; when two captures share an id, only the first in name order keeps it and the others take their full path. Historical captures remain visible with their original metadata and are not certified as part of the latest passing campaign.

just site and just ci-gallery first write the requirements report (just requirements-report), and the published out/site/requirements/ (“Requirements” in the site navigation) is built from it, written by test/site/requirementsViewer/. The home holds the three layers, the areas, the chain from use case to test as a diagram, one real requirement as an example and the counts of active requirements (per scope, marker coverage, exemptions, known issues; retired ones apart), with the cards “StRS paths tested”, “StRS paths accepted”, “StRS covered” (it follows okfreq’s current coverage mode) and “SwRS scenarios tested”, and the columns “Paths tested” and “Paths accepted” of the area table. The paths and scenarios are counted from the scenarios: of each requirement; the files that test or accept each one come from out/reports/requirements/requirements-trace.json (okfreq trace requirements --json, written by just requirements-report and just requirements-report-json next to the report). Without that file the cards read “n/a” for the tested and accepted counts and no file is listed. Each area, use case and behaviour has its own page (requirements/<area>/<requirement id>/): a use case with a ### Main paths section is drawn as a map and lists each path with its tested and accepted files (with a “waived” badge when the StRS has an acceptance waiver), a behaviour lists its scenarios with their tests (an untested one is marked “missing”) and the files that implement and test it, and the retired requirements show behind the History button. The old address out/site/requirements.html redirects there. Without the report the site still builds and the home says it was not generated. The pages follow the reader’s light or dark colour scheme, and the viewer has its own search.

The shared logo source is images/logo.svg. After editing it, run fnm exec -- npm run logo:generate to regenerate the PNG used by the README and VS Code Marketplace, and the Sphinx favicon. Chromium must be installed through just dev. The generated site uses the SVG directly for its header and favicon.

The static-site URL tests cover rendered Markdown documents, the repository’s out/reports/ path, copied assets with query and fragment suffixes, and absolute URLs. The site publisher maps local report artifacts into the published reports/ tree without relativizing external URLs.

The E2E review index is only passed when the visual and integration artifacts share the current campaign UUID, start time, and command. A failed review:begin stops test:e2e; stale visual manifests cannot certify a later run. just ci-report holds the manifest of each acceptance group to the campaign of the visual stage too: both started less than two hours apart, or in the same CI run.

Mutation testing of src/core

just mutation-core [SAMPLE] runs a mutation campaign (StrykerJS 10.1.1, a pinned devDependency) on src/core against the test/core unit tests. It is a manual campaign, not part of just check, just preflight or CI: the whole of src/core takes hours, so run it in the background and give it a sample, comma-separated globs of src/core files (or the environment variable STUDIO_MUTATION_FILES), for example just mutation-core "src/core/find/**/*.ts".

The target compiles, runs the checker self-test (it stops there when the TypeScript 7 check cannot work), runs the core phase (scripts/stryker.config.mjs), then the others phase (scripts/stryker.others.config.mjs: only the holes of the core phase, against the tests of the other layers), then writes out/reports/mutation/summary.md and summary.json with scripts/mutation-report.mjs: score per sub-folder and per SwRS, tests that kill nothing, a greedy set of redundant tests, tests not judged, holes with a label, and test files left out. The Stryker plugins are in scripts/mutation/: a node:test runner (stable test IDs, per-test coverage), a TypeScript 7 checker through typescript/unstable/sync (the stock checker cannot run on TypeScript 7), and an ignorer for message strings. Stryker’s sandbox is .stryker-tmp/ (git-ignored).

Preview performance probe

The probe measures the live preview on a large generated chapter (about 99 KB, 80 sections, 80 links, 8 Mermaid diagrams, see test/probe/largeChapter.ts). Run it before and after a change to the webview runtime, the content patch or the edit lock, and compare the JSON reports.

npm run probe

It runs without a VS Code window: it builds the real preview page, opens it in headless Chromium with a stub host and writes out/reports/probe/preview-probe.json. It reports the page size, the script time of each scroll frame (normal CPU and four times slower), the page loads, the Mermaid redraws and the content blocks rebuilt while ten characters are typed as content patches, and whether an open inline editor survives a theme change and the Mermaid redraw. The first page is loaded as VS Code’s webview loader shows it (every link without a title gets its address as title). With --check (the npm script passes it), it exits with an error when a scroll frame’s 95th percentile goes over 4 ms, a page reloads while typing, typing redraws a diagram or rebuilds another block than the typed one, or the open editor is lost.

The real-window probe measures the same in VS Code: webview.html assignments while typing in the text editor, scroll frames of the webview, and an open editor through a save, a colour theme change and the Mermaid redraw. It writes out/reports/probe/window-probe.json and asserts only what it needs to run:

STUDIO_REAL_INPUT_SCENARIO=probe npm run test:integration -- --trusted-only

A second real-window measure covers comments on a large document (issue 547): a generated review document with 22 tables, 11 images and 9 comment threads (test/probe/perf547Document.ts). It drags over running text and across table cells with the mouse, creates comments from the Comment button, and writes out/reports/probe/perf-547.json: every sample and the median of selectionRelease and commentCreate, the number of elements a comment creation restyles, and the longest main-thread task of each drag and release. The comment author setting stays empty and the fixture folder is its own Git repository (a local user.name, no commit), so the report also holds authorWait: how long each comment write waited for the Git user name. A Node step then adds threadIndex (test/probe/perf547ThreadIndex.ts): the time of createDocumentIndex and of reanchorThreads on that document and on one four times as large with 36 threads, all anchored, measured outside VS Code. It sets no limit and fails only when the measure cannot be taken.

just ci-perf-547

On CI it runs on demand only, three times on one commit when two states are compared: gh workflow run ci.yml --ref <branch> -f perf_547=true.

Scope

Keep the extension standalone. Runtime code and tests must not resolve files from a parent repository. The Sphinx configuration under sphinx/ is intentionally limited to the MyST features needed by Studio preview contracts.

Screenshot Review

Run fnm exec -- npm run test:e2e from the extension directory for the complete campaign. The command checks static captures, all integration hosts, scroll synchronization, frontmatter interactions, actual Developer: Reload Window restoration, and close/reopen persistence.

The ordered entry point is out/reports/e2e/REVIEW.md. Each new image has an adjacent JSON sidecar with summary (expected visible content), info (capture identity and environment), and applicable actions, captured state, checks, and limitations. Markdown review notes may also be generated. The gallery embeds complete sidecars, so image inspection also works when opened locally without a server. Legacy Markdown and TXT sidecars remain readable. Static captures use a mock host; real-window captures use isolated development profiles. Intentional schema errors and unresolved diagrams are labeled fixture states, not product failures. Manifests record revision, worktree state, campaign identity, assertions, and final suite outcomes. Historical runs are excluded from the current review index.

For focused campaigns, use fnm exec -- npm run test:scroll, fnm exec -- npm run test:reload, or fnm exec -- npm run test:visual.

Static screenshot capture uses four worker threads by default, each with its own Playwright instance and browser. Reports retain scenario order, and failures still fail the campaign. For serial debugging after rendering fixtures, run uv run --no-sync --group docs python test/visual/capture.py --workers 1. Real VS Code integration scenarios remain serial. The Pages workflow builds out/site/ through just preflight; just site also runs the E2E campaign before generating the gallery and site.

Static scenarios that hold on CI

The visual jobs render on Linux, whose fonts are wider than the macOS ones, so a scenario that passes locally can fail on CI when it depends on text metrics:

The floating toolbar’s width is an input to other layout. The conf.py warning banner reserves room for it (--sphinx-preview-warning-banner-reserve, SwRS-MDOKFSTUDIO-MYST-081, checked in test/core/preview/previewStyles.test.ts), README crops must reach the viewport’s right edge, and the 460 px scenarios leave room for it. A change that adds or removes a toolbar button, or changes a button’s size, updates these values in the same pull request.

Product-owner gallery and report pruning

npm run review:gallery writes out/reports/e2e/GALLERY.md and one page per feature group in out/reports/e2e/gallery/. The pages come from the scenario metadata (test/visual/scenarios.ts, test/shared/e2eGroups.ts) and the last visual run manifest: for each group, every captured scenario (thumbnail, locks statement, step images, README marks) and a table of the assertion-only scenarios with what they verify. Open them in VS Code’s Markdown preview. The gallery says STALE when the last visual run was partial, is from another revision, or lacks scenarios or images; run the full npm run test:visual first for a fresh one. npm run review:finish (the last test:e2e stage) refreshes it and links it as item 0 of REVIEW.md. It is unrelated to gallery:generate, which curates the tracked README images.

The README images cropped from static captures are declared by the readme metadata of their scenarios (README_BY_ID in test/visual/scenarioIds.ts: file, crop box, width); scripts/generate-readme-images.py reads it from the render manifest. Do not change a README scenario’s viewport, fixture, theme, scroll or crop unless the image is meant to change.

To refresh only these headless pictures (no real-window run, no REAL-INPUT-LATEST.md needed), run npm run visual:render, uv run --group docs python test/visual/capture.py, then uv run --group docs python scripts/generate-readme-images.py --visual-only; the real-window pictures in images/readme/ stay untouched. --visual-only also narrows --check <dir> to the visual-sourced images. --real-only writes only the six real-window pictures, cropped from the latest passing real-input run under out/reports/e2e/screenshots/ (a downloaded CI artifact works); it needs the manifest from npm run visual:render but no visual PNGs. The campaign runs with reduced motion, so these captures are settled frames. A README crop that starts at the top of the page must reach the viewport’s right edge, or it cuts the floating toolbar (test/site/scenarioInvariants.test.ts checks it).

Real-window captures: registry and parallel runs

Every screenshot taken in a real VS Code window has a stable id <group>/rNN-<slug> registered in test/shared/captureRegistry.ts (group, suite, one locks sentence, clip, README and curated flags). All six suites (real-input, checkbox, frontmatter, scroll, reload, untrusted) write through the same RealWindowEvidence writer (test/integration/evidence.ts): it rejects an unregistered id, writes <run folder>/<group>/rNN-<slug>.png with its .md note and .json sidecar, lists the capture in the captures array of the run manifest.json, and fails a complete suite when a registered capture of it was not taken. A new capture takes the next free number of its group. Entries with capture: false keep their assertion and note but write no picture. clip: "preview" crops to the webview frame (falling back to the whole window), clip: "element" to the changed excerpt, and clip: "window" keeps the whole VS Code window, which the README crops need.

The LATEST pointer files, INDEX.md and the run folder prefixes (real-input-, checkbox-e2e-, frontmatter-e2e-, scroll-e2e-, reload-e2e-, and untrusted-e2e- with UNTRUSTED-LATEST.md) are unchanged; the per-group folders live inside the run folder. Every window with captures gets a loopback CDP port (STUDIO_CDP_PORT): the trusted and scroll launches, and the Restricted Mode window, which run-tests spawns directly (--untrusted-only runs it alone).

A new real-window scenario goes into the stress plan (STRESS_SCENARIOS_BY_HOST in test/shared/stressPlan.ts, by the window that runs it) and must pass the stress CI job before it stays in the integration job (CI rule 12). just ci-stress runs the trusted window, then the Restricted Mode window. npm run review:gallery lists the registered captures of the latest runs per group, and scripts/generate-readme-images.py --check <dir> compares the README images, real-window ones included, with a baseline directory.

Several real-window runs can be active at once on one checkout. Each run-tests process has an instance id (STUDIO_E2E_INSTANCE, generated when unset) and gives every VS Code launch its own user-data directory, extensions directory, CDP port and evidence folders; the manifests carry instanceId. The LATEST pointers and integration-manifest.json are shared files, so the last run to finish wins them; use the run folder named in the console for a specific run.

The trusted window runs as two launches, each with its own launch deadline. Part 1 runs setup, preview-smoke, the steps from project-features to find-in-preview, then those from edit-keys to workspace-disposal. Part 2 runs setup, preview-smoke, real-input and preview-editing. The two lists are in test/shared/trustedParts.ts; a new step goes into one of them, gets its runner in test/integration/trusted-suite.ts and its name in test/build/trustedParts.test.ts. run-tests (full run and --trusted-only) launches part 1, then part 2, and passes STUDIO_TRUSTED_PART; a STUDIO_REAL_INPUT_SCENARIO run stays one launch. Each launch prints TRUSTED LAUNCH: <name> (for example trusted-suite.js part 2/2).

A hung real-window run fails fast and leaves a dump (CI rule 11). Each step of the trusted window runs under step() (test/integration/stepWatchdog.ts), with a budget per step, STEP start and STEP done lines in the log, and bounded() around single VS Code calls that must return. The scroll, Restricted Mode and standalone windows run as one step each, each acceptance file runs its paths under step() in a window of its own, and the reload campaign has its own 3-minute deadline. Every suite writes a heartbeat file (out/reports/e2e/heartbeat-<instance>-<suite>.json) every 5 seconds; run-tests stops a launch whose heartbeat is silent for 90 seconds (frozen extension host or renderer) or that runs past its deadline (15 minutes, STUDIO_LAUNCH_TIMEOUT_MS; a stress run computes its own, 2 minutes plus 6 s per scenario run (rounds times scenarios) and at most 24 minutes, and just ci-toc-loop sets 30), kills its VS Code processes and names the last step. Thresholds live in test/shared/hangWatchdog.ts. Each timeout writes out/reports/e2e/hang-dumps/<time>-<step>/ (when a trusted part is stopped by LAUNCH TIMEOUT or LAUNCH HANG, that line names the launch and the folder is <time>-trusted-part-<n>-<step>/): ps output, the tails of the VS Code logs, the window state and tabs, the heartbeat and screenshots (through CDP, and of the X display when import or xwd exists). In CI the integration step stops at 20 minutes, the test step of each acceptance shard at 3 (the toc-loop step at 35, the perf-547 step at 4), and just ci-hang-dump adds the processes and logs left behind (post-step/). The acceptance step and the perf-547 step end before the step budget and the launch deadline can expire: a hang there that neither the heartbeat nor bounded() catches in time leaves post-step/ and no watchdog dump, with a STEP start line only if it is inside a step() call.

Run folders of the real-window suites pile up under out/reports/e2e/screenshots/. npm run review:finish keeps the latest 5 per kind (STUDIO_E2E_KEEP_RUNS changes it). Run npm run review:prune -- --dry-run to list what would go, npm run review:prune -- --keep 3 to prune by hand. The pruner only touches run folders inside out/reports, never the folders the LATEST pointers name, and never a folder that holds a git-tracked file.

Build And Install Locally

Build an ignored VSIX without publishing it:

just package

The artifact is written to:

out/reports/package/markdown-okf-schema-studio.vsix

Packaging uses vsce to rewrite relative README links only inside the VSIX. Image URLs target https://media.githubusercontent.com/media/gsemet/markdown-okf-schema-studio/v<VERSION>/, and document links target the same tag on GitHub. The source README keeps its relative paths for GitHub. Commit the README images before creating the matching release tag: Marketplace loads them anonymously from GitHub, not from the images bundled inside the VSIX. Local packages whose tag has not been pushed can therefore show broken images in the extension details page. Screenshots use Git LFS: the media endpoint serves image bytes rather than raw LFS pointer files. Push the LFS objects along with the tag. Publishing a new version containing the images is required to repair an already published release.

Install or update the default VS Code profile with:

just install-vsix

Install into a named profile with:

just install-vsix "My Profile"

The install recipe reports the VSIX path and the VS Code Install from VSIX... action when the code CLI is unavailable. After installation or an update, reload the current VS Code window manually.

How to Release

Releases start with a committed version change, not a manually created tag. The extension version lives in package.json; package-lock.json must match it. The Python project’s version is tooling metadata and is not the extension release version. The release notes, the announcement thread and their images are committed in the version pull request, under docs/releases-notes/YYYY-MM-DD-vX.Y.Z/, and just check fails without valid notes: see release-process.guidelines.md, which also gives the order of a release. Make the version commit (step 3) only after a green heavy run of main HEAD (step 1), or of the top branch of the stack when the version PR tops it (see “The version PR on top of a stack” in the release guideline).

  1. Merge everything the release needs into main. The push runs the heavy jobs (integration, acceptance and stress) on main HEAD: wait for all of them, every acceptance shard included, to be green on that exact commit, reading the result of each job, because a red stress does not turn this run red:

    gh run list --workflow ci.yml --branch main --limit 3
    gh run watch <run-id>
    gh run view <run-id> --json jobs --jq '.jobs[] | select(.name == "integration" or .name == "stress" or (.name | startswith("acceptance ("))) | "\(.name) \(.conclusion)"'
    

    A red job: fix, merge, run again. A flake: gh run rerun <run-id> --failed once, then treat it as red. When the version PR tops a ready stack, merge nothing first: dispatch gh workflow run ci.yml --ref <top-branch> -f heavy=true and wait for green on that head. Do not make the version commit before this run is green. The heavy run of the version push (step 5) stays the final gate.

  2. Fetch release tags and commit the changes to include in the release:

    git fetch origin --tags
    

    Then check that ## Unreleased in CHANGELOG.md has one user-facing line, ending with its references (see “CHANGELOG line” in the pull-request guideline), for every feat and fix commit since the last release tag, and treat a missing one as a gap of its PR: a fix PR adds it before the version commit. Each PR adds its own line, appended at the end of ## Unreleased (test, CI, build and documentation commits get none). This check is the release’s safety net:

    git log --format='%h %s' "$(git describe --tags --abbrev=0)"..origin/main | grep -E '^\S+ (feat|fix)'
    
  3. Calculate the next version with Python Commitizen:

    just bump-version
    

    feat: commits produce a minor bump. A ! before the colon or a BREAKING CHANGE: footer produces a major bump, including before version 1.0. Fixes, documentation, maintenance, other changes, and an empty release range produce a patch bump. Classification uses committed history since the baseline release tag; uncommitted feature changes do not count. The baseline is the newer of the current manifest version and the latest reachable stable release tag.

    To choose a version instead:

    just version 1.2.3
    

    Both commands update the npm manifest and lockfile, the two plugin manifests (plugin.json, .claude-plugin/plugin.json) and the plugin entry of the GitHub Copilot catalog (.github/plugin/marketplace.json), and create a commit with subject chore: version X.Y.Z. Neither creates a local tag. Only these files are committed; unrelated staged work stays staged. Commit or stash existing edits to these version files before running the command. Explicit versions must be stable X.Y.Z, newer than the baseline, and not already tagged.

    The commands leave CHANGELOG.md alone. First run just changelog-refs, which adds the commit of each line of ## Unreleased (just changelog-refs origin/main --skip-missing when the version PR tops a stack, whose commits are not on main yet). Then add a ## X.Y.Z - YYYY-MM-DD heading (the version just computed, today’s date) right under ## Unreleased, so the lines move under it and ## Unreleased stays empty, then amend the version commit. The version commit carries no Signed-off-by trailer, so the amend has no -s:

    git commit --amend --no-edit CHANGELOG.md
    
  4. Validate the version commit, then push it and merge it into main:

    just preflight
    git show --stat HEAD
    

    If just preflight stops at ci-integration because the screen is locked, do not wait: dispatch gh workflow run ci.yml --ref <branch> -f heavy=true at once on the release branch and go on; its integration job and acceptance shards are the real-window proof.

    Keep release images and their Git LFS objects committed and pushed, since Marketplace image URLs use the release tag.

  5. The push of the version commit to main runs the heavy jobs (integration, acceptance and stress) in its own CI run: release-check sees that the pushed version changed (scripts/version.py --bump-since). After successful main-branch CI, the tagging job checks whether the pushed version changed and whether vX.Y.Z exists remotely. It verifies matching lockfile versions and an increasing version, then tags the exact tested commit, but only when checks and the three heavy jobs of that run succeeded. Otherwise it creates no tag, writes “Release not tagged” with the result of checks, integration, acceptance and stress to the job summary, and fails (an integration or acceptance failure also fails report and checks; the summary is written all the same). Only that push can tag the version: see “Recovering from a red heavy job” below. Ordinary pushes (no version change) leave the tags unchanged. It never commits files back to main.

  6. CI dispatches Release VSIX with that tag on the default branch, as a run of its own. A tag pushed by GITHUB_TOKEN starts no workflow, but a dispatch does; and a dispatch (not a reusable-workflow call) is needed so that the OIDC token names release.yml, the workflow both trusted publishers are registered for. Watch that Release VSIX run (gh run list --workflow release.yml --limit 3), not only the CI run. The release job verifies the tag, manifest, and default-branch ancestry, prepares the reviewed notes of the tag, packages the extension, publishes to the VS Code Marketplace with trusted publishing (OIDC), attaches the VSIX, the notes and their images to a GitHub release, then publishes the same VSIX to Open VSX with trusted publishing. The notes must be valid before publication. After the release job, watch both registries as described in step 6 of the release guideline. CI also calls Deploy GitHub Pages with the tag: it builds the site from the end-to-end reports of that same run (its heavy jobs are green) instead of running the suite again. A later manual Pages dispatch of the tag finds that run as well (scripts/select_e2e_run.py accepts a manual heavy run or the release push of the commit).

Recovering from a red heavy job

A flake that fails integration, an acceptance shard or stress on the push of a version change is recovered in the same CI run, with no new commit and no manual tag:

  1. Open the run: Actions, workflow CI, the run of the version commit on main. Its tag-release summary says “Release not tagged” and lists each result.

  2. Choose Re-run jobs > Re-run failed jobs, then Re-run jobs. With the GitHub CLI:

    gh run rerun <run-id> --failed
    gh run watch <run-id>
    
  3. GitHub re-runs the failed jobs and the jobs that depend on them, including skipped ones: the heavy job (of the acceptance matrix, the failed shards only), then report and checks after an integration or acceptance failure, tag-release, then release (which dispatches Release VSIX, a separate run) and pages. Jobs that passed keep their results and outputs, so release-check still reports the version change. The re-run uses the same commit and push event, and tag-release tags that commit when everything is green.

  4. Each attempt uploads its own artifacts: every artifact name of the CI workflow ends with -attempt-<n> (for example studio-reports-attempt-2), and each consumer downloads the name that the producing job reports. report therefore merges the attempt-1 visual stage with the re-run integration stage, and Pages uses the merged reports of the newest attempt that ran report. A download by a fixed name would return the attempt-1 artifact. The visual stage comes from two artifacts, e2e-visual-attempt-<n> and e2e-visual-2-attempt-<n>, one per part, and report merges their manifests first. Each acceptance shard uploads e2e-acceptance-<group>-attempt-<n>, and report keeps the newest attempt of each group (scripts/select-acceptance-attempts.mjs). The visual, integration and acceptance stages of one CI run form one campaign however far apart they started, so a re-run hours or days later still passes report. To fetch the reports of a run by hand, use just site-from-run <run-id>, which picks the newest attempt.

  5. Once the tag exists, only re-run the failed jobs. Re-running tag-release then finds the existing tag, outputs no tag and skips release and pages. A failed publication is re-run in the Release VSIX run; in the CI run, re-run only release (if the dispatch itself failed) or pages.

When the failure is a real bug, or the same job fails again after a re-run, fix the cause in a new pull request, then release a new version (just version). GitHub allows re-runs for 30 days and at most 50 attempts per run; after that, release a new version.

GitHub Configuration

Create a GitHub environment named release, allowing releases from the default branch and v* tags. The workflow publishes to the VS Code Marketplace and to Open VSX with Trusted Publishing (GitHub Actions OIDC) and reads no stored token:

The workflow’s normal GITHUB_TOKEN is used for tags and GitHub releases. Repository rules must permit the CI token to create version tags. Environment approval rules, when configured, pause publication after tagging. All committed dependency settings and GitHub jobs use public PyPI and npm registries; corporate proxy and CA settings belong only in the developer’s local environment, never in workflow files or lockfile URLs.

Recovery and Release Notes

If tagging succeeded but publication failed, re-run the failed job of the Release VSIX run or dispatch Release VSIX with the existing vX.Y.Z tag. Do not move the tag or bump again just to retry. Marketplace and Open VSX publications skip an already published version, allowing a retry to finish the GitHub release. Manual pushes of valid vX.Y.Z tags also run this workflow.

If the Marketplace token exchange (OIDC) fails, the job fails before the GitHub release is written. Fix the cause, then dispatch Release VSIX with the existing tag. In an emergency the owner publishes locally with vsce publish and the PAT they keep. There is no automatic fallback to the PAT.

If the Open VSX step fails, the step is last: the Marketplace and the GitHub release are already done and the job is red. Fix the cause if any, then re-run the failed job or dispatch Release VSIX with the existing tag. The Marketplace step skips the duplicate, the GitHub release step rewrites the release body from the reviewed notes file (a hand edit made on GitHub in between is lost: redo it), and Open VSX is retried. In an emergency the owner publishes the VSIX of the GitHub release by hand with npx ovsx publish <file.vsix> -p <token> and a personal Open VSX token never stored in GitHub. There is no automatic fallback to a token.

A tag older than 1.4.0 has no notes folder: dispatch Release VSIX with notes: placeholder, then replace the notes by hand.

To check the notes of the current version locally:

just release-notes-check