diff --git a/CHANGELOG.md b/CHANGELOG.md index fec80adce..9e539b6a9 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,6 +4,14 @@ ### Changed +- Plugins built from a source checkout without `--release-version` now report + `0.0.0+source` as their own version instead of `0.1.0` (Codex, WorkSwarm) or + `0.0.0` (DSH) (Refs #511). This covers the template version, `plugin_version` in + `runtime/manifest.json` and `--plugin-info`. `runtime_version` still reports the + bundled runtime, so the two differ in a source build. Release builds are + unchanged: `--release-version` still accepts only `MAJOR.MINOR.PATCH`, must match + the built runtime and is rejected before any output is written. The DSH bundle + has no release mode. - Apps workflow implementations now live in `apps/workflows/`: campaign capture, task launching, paired benchmark comparison, improvement and skill evaluation. The previous Apps imports retain explicit compatibility exports. New optimization diff --git a/docs/codex-plugin.md b/docs/codex-plugin.md index 927137fef..c3f8f803d 100644 --- a/docs/codex-plugin.md +++ b/docs/codex-plugin.md @@ -208,6 +208,14 @@ plugin manifest and pins the bundled README's video link to the release tag. The tracked source template remains unchanged. Unbuilt source previews use the runtime's explicit `0+unknown` fallback. +A build without `--release-version` is a source build, not a release. Its +`plugin.json` `version` and the `plugin_version` in `runtime/manifest.json` and +`--plugin-info` are `0.0.0+source`; the `+source` suffix is SemVer build +metadata that marks the package as not released. `runtime_version` still reports +the bundled runtime (`0+unknown`, or the generated version), so in a source +build the two fields differ on purpose. The marker does not identify the source: +use `content_sha256` and the source commit to compare builds. + Only the ZIP is attached to Releases. The raw `plugins/inferrsi/` source template does not contain the bundled runtime and is not an installation package. diff --git a/docs/dsh-plugin.md b/docs/dsh-plugin.md index 8b76b2a66..d2f81741d 100644 --- a/docs/dsh-plugin.md +++ b/docs/dsh-plugin.md @@ -231,7 +231,9 @@ the launcher is `scripts/inferrsi.py`. - Use `--plugin-info` to check the selected interpreter, bundled runtime version, and content SHA-256. An unbuilt source checkout can report `0+unknown` as the - runtime version. + runtime version. The bundle is always a source build with no release mode, so + `package.json` `version` and `plugin_version` are `0.0.0+source`, which marks + it as not a release. - For an inference engineering task, select the primary skill by the requested outcome. For example, load `skills enter task-performance` for a performance goal and read its returned procedure. Record the actual workload, device, diff --git a/docs/releases.md b/docs/releases.md index c6bdc4af3..138137ef8 100644 --- a/docs/releases.md +++ b/docs/releases.md @@ -191,6 +191,12 @@ uploaded wheel/sdist or explicitly select the SCM build version. Development builds without a stable tag may have a development version and are not stable releases. +Plugins built from a source checkout without `--release-version` report +`0.0.0+source` as their own version (the Codex and WorkSwarm builders and the +DSH bundle, which has no release mode). Only the release workflow's +`--release-version` stamps the tag version. A clean tag checkout does not +resolve to its tag version by itself. + ## Failure and concurrency behavior Runs are serialized across schedule and manual dispatch. A failed build creates diff --git a/docs/workswarm-plugin.md b/docs/workswarm-plugin.md index a4bbcc7a2..0e144a5df 100644 --- a/docs/workswarm-plugin.md +++ b/docs/workswarm-plugin.md @@ -205,6 +205,11 @@ Plain unbuilt source reports runtime version `0+unknown`; `--plugin-info` reports that development state explicitly. A versioned build can use `--release-version ` only when the already-built runtime agrees; this stamps generated host metadata without modifying canonical source bytes. +A build without it is a source build, not a release: `manifest.json` `version` +and `plugin_version` in `runtime/manifest.json` and `--plugin-info` are +`0.0.0+source`, while `runtime_version` still reports the bundled runtime. The +marker does not identify the source; compare builds by `content_sha256` and the +source commit. Actual end-to-end desktop/LLM journeys, cancellation/reconnect, other host releases and Linux/macOS installation require diff --git a/plugins/inferrsi-dsh/package.json b/plugins/inferrsi-dsh/package.json index d4bbb34d7..6a2d925f0 100644 --- a/plugins/inferrsi-dsh/package.json +++ b/plugins/inferrsi-dsh/package.json @@ -1,6 +1,6 @@ { "name": "inferrsi-dsh", - "version": "0.0.0", + "version": "0.0.0+source", "description": "InferRSI inference-engine research and evidence workflows for DeepSeek Harness", "license": "Apache-2.0", "type": "module", diff --git a/plugins/inferrsi/plugin.json b/plugins/inferrsi/plugin.json index d95c2731c..a3edfd12d 100644 --- a/plugins/inferrsi/plugin.json +++ b/plugins/inferrsi/plugin.json @@ -1,7 +1,7 @@ { "$schema": "https://agent-plugins.org/schemas/1.0.0/plugin.schema.json", "name": "inferrsi", - "version": "0.1.0", + "version": "0.0.0+source", "description": "Bring up models and engines, align inference stacks, diagnose performance, accuracy and runtime failures, and verify changes against evidence.", "author": {"name": "InferMatrixLab"}, "homepage": "https://github.com/InferMatrixLab/InferRSI", diff --git a/plugins/workswarm/inferrsi/manifest.json b/plugins/workswarm/inferrsi/manifest.json index 6d47f3a51..e31673967 100644 --- a/plugins/workswarm/inferrsi/manifest.json +++ b/plugins/workswarm/inferrsi/manifest.json @@ -1,5 +1,5 @@ { - "version": "0.1.0", + "version": "0.0.0+source", "package_type": "plugin", "id": "inferrsi", "name": "InferRSI", diff --git a/tests/test_plugin_source_version.py b/tests/test_plugin_source_version.py new file mode 100644 index 000000000..198af3634 --- /dev/null +++ b/tests/test_plugin_source_version.py @@ -0,0 +1,136 @@ +"""Source-built plugins report an explicit non-release version. + +Release builds stamp ``--release-version`` and are covered in test_codex_plugin +and test_workswarm_plugin. These tests pin what a build without it reports. +""" + +import json +import os +import shutil +import subprocess +import sys +import tarfile +from pathlib import Path + +import pytest + +from tools import build_dsh_plugin +from tools.build_codex_plugin import build_plugin as build_codex_plugin +from tools.build_workswarm_plugin import build_plugin as build_workswarm_plugin +from tools.plugin_bundle import PROJECT, _io_path + +SOURCE_VERSION = "0.0.0+source" +GENERATED_VERSION = "0.2.0" +TEMPLATES = { + "codex": "plugins/inferrsi/plugin.json", + "workswarm": "plugins/workswarm/inferrsi/manifest.json", + "dsh": "plugins/inferrsi-dsh/package.json", +} +METADATA_FILES = {"codex": "plugin.json", "workswarm": "manifest.json", "dsh": "package.json"} +RELEASE_BUILDERS = {"codex": build_codex_plugin, "workswarm": build_workswarm_plugin} + + +def make_checkout(root, generated_version): + """Copy only what the three builders read; optionally add the SCM-generated version.""" + project = root / "source" + ignore = shutil.ignore_patterns("__pycache__", "*.pyc") + for directory in ("src/inferrsi", "plugins"): + shutil.copytree(_io_path(PROJECT / directory), _io_path(project / directory), + ignore=ignore) + (project / "docs").mkdir() + for name in ("codex-plugin.md", "workswarm-plugin.md", "dsh-plugin.md", "dashboard.md"): + shutil.copyfile(PROJECT / "docs" / name, project / "docs" / name) + shutil.copyfile(PROJECT / "LICENSE", project / "LICENSE") + generated = _io_path(project / "src/inferrsi/_version.py") + # A developer's editable install may have left a generated file in the source tree. + generated.unlink(missing_ok=True) + if generated_version is not None: + generated.write_text(f'__version__ = version = "{generated_version}"\n', + encoding="utf-8") + return project, generated_version or "0+unknown" + + +@pytest.fixture(scope="module") +def unbuilt(tmp_path_factory): + return make_checkout(tmp_path_factory.mktemp("unbuilt"), None) + + +@pytest.fixture(scope="module") +def built(tmp_path_factory): + return make_checkout(tmp_path_factory.mktemp("built"), GENERATED_VERSION) + + +@pytest.fixture(params=["unbuilt", "built"]) +def checkout(request): + return request.getfixturevalue(request.param) + + +def build_package(host, project, tmp_path, monkeypatch, release_version=None): + """Build one host from ``project`` and return its metadata, manifest and --plugin-info.""" + if host == "dsh": + monkeypatch.setattr(build_dsh_plugin, "PROJECT", project) + result = build_dsh_plugin.build_bundle(tmp_path / "inferrsi-dsh.tgz") + extracted = _io_path(tmp_path / "extracted") + with tarfile.open(result["archive"]) as bundle: + bundle.extractall(extracted) + package = extracted / "package" + launcher = package / "assets/inferrsi/scripts/inferrsi.py" + else: + result = RELEASE_BUILDERS[host](tmp_path / "plugin", project=project, + release_version=release_version) + package = _io_path(Path(result["plugin"])) + launcher = package / "skills/inferrsi/scripts/inferrsi.py" + run = subprocess.run( + [sys.executable, "-I", "-S", "-X", "utf8", str(launcher), "--plugin-info"], + cwd=tmp_path, capture_output=True, text=True, encoding="utf-8", timeout=45, + env=dict(os.environ, LOCALAPPDATA=str(tmp_path / "runtime-cache")), + ) + assert run.returncode == 0, run.stderr + return { + "metadata": json.loads((package / METADATA_FILES[host]).read_text(encoding="utf-8")), + "manifest": json.loads((package / "runtime/manifest.json").read_text(encoding="utf-8")), + "info": json.loads(run.stdout), + } + + +@pytest.mark.parametrize("host", TEMPLATES) +def test_templates_carry_the_source_marker(host): + template = json.loads((PROJECT / TEMPLATES[host]).read_text(encoding="utf-8")) + assert template["version"] == SOURCE_VERSION + + +@pytest.mark.parametrize("host", TEMPLATES) +def test_source_build_reports_the_marker_beside_the_bundled_runtime( + host, checkout, tmp_path, monkeypatch, +): + project, runtime_version = checkout + package = build_package(host, project, tmp_path, monkeypatch) + # The plugin is not a release; the runtime keeps its own, possibly different, version. + assert package["metadata"]["version"] == SOURCE_VERSION + assert package["manifest"]["plugin_version"] == SOURCE_VERSION + assert package["manifest"]["runtime_version"] == runtime_version + assert package["info"]["plugin_version"] == SOURCE_VERSION + assert package["info"]["runtime_version"] == runtime_version + + +@pytest.mark.parametrize("host", RELEASE_BUILDERS) +def test_release_build_keeps_stamping_the_matching_runtime_version( + host, built, tmp_path, monkeypatch, +): + project, runtime_version = built + package = build_package(host, project, tmp_path, monkeypatch, + release_version=runtime_version) + assert package["metadata"]["version"] == runtime_version + assert package["manifest"]["plugin_version"] == runtime_version + assert package["manifest"]["runtime_version"] == runtime_version + assert package["info"]["plugin_version"] == runtime_version + assert package["info"]["runtime_version"] == runtime_version + + +@pytest.mark.parametrize("host", RELEASE_BUILDERS) +def test_release_build_rejects_a_version_other_than_the_runtime(host, checkout, tmp_path): + project, _ = checkout + output = tmp_path / "mismatch" + with pytest.raises(ValueError, match="match the built runtime"): + RELEASE_BUILDERS[host](output, project=project, release_version="9.9.9") + assert not output.exists() and not output.with_suffix(".zip").exists()