diff --git a/CONTRACT.md b/CONTRACT.md index a34e112..4822464 100644 --- a/CONTRACT.md +++ b/CONTRACT.md @@ -26,7 +26,7 @@ works" claim. Unknown/newer protocol versions fail closed. | macOS arm64/x86_64 | **unverified** by this repository unless `tests/run_all.py` is run there with a native build | | Windows x86_64 | **unsupported** for plugin/provider C ABI in this fixture; the pure `.mq.md`, kernel and tool cases are portable but not claimed until run | -`plugin/build_all.sh` and `provider/build_all.sh` build for the *host* target +`plugin/build.sh` and `provider/build.sh` build for the *host* target and write that target triple + artifact SHA-256 into the generated manifest; the committed manifests contain zero digests and are templates only. @@ -55,7 +55,9 @@ repository never claims `strict` L2 or an OS sandbox for worker transports. ## Environment assumptions -Linux x86_64, Python 3 (stdlib only), a C compiler (`cc`), Git. No network is -required: the consumer test creates its pinned Git repository locally with -`git init` + `git commit` and a full SHA. No Node/Python runtime is required -for the kernel case: `mocklang` is a POSIX shell script. +Linux x86_64 with glibc, Python 3 (stdlib only), a C compiler (`cc`), Git and +OpenSSL's CLI for the ephemeral TLS fixture. The cases use loopback only. +The pinned Git consumer creates its source repository locally. The Agent +consumer stages a path dependency and runs the normal lock and sync path. +The foreign kernel is a POSIX shell script. The suite consumes an extracted +release archive with `marqdo`, `marqdo-provider-worker` and `stdlib/`. diff --git a/README.md b/README.md index ae5864e..2c630ee 100644 --- a/README.md +++ b/README.md @@ -1,7 +1,7 @@ # marqdo-extension-conformance Independent, physically separate conformance fixtures for -[RFC-EXT-0001](../marqdo-cli/docs/architecture/RFC-EXT-0001.md): a third-party +[RFC-EXT-0001](https://git.cflmy.cn/cflmy/marqdo-cli/src/branch/master/docs/architecture/RFC-EXT-0001.md): a third-party repository that provides all five extension kinds **without modifying or recompiling `marqdo-cli`**. @@ -17,22 +17,19 @@ the CLI workspace. | `kernel/` | Foreign kernel (`mocklang`) | `kernel/kernel.json`, one-shot process | | `provider/` | Resource provider v2 (`demo.sensor`) | `provider/provider.json`, worker helper + C ABI | | `tool/` | CLI Tool | `tool/tool.json`, `inspect-ext` command | +| [`marqdo-net/`](marqdo-net/README.md) | HTTP(S)/SSE library | Blocking streams over the published resource API | +| [`marqdo-agent/`](marqdo-agent/README.md) | Agent library | A sequential mock-model conversation with an explicit tool allowlist | ## Quick start ```bash -cargo build --release -p marqdo-cli # in ../marqdo-cli (once) -export MARQDO_BIN=/abs/path/to/target/release/marqdo -# Ship the provider helper sibling exactly as the release archive does: -cp /abs/path/to/target/release/marqdo-provider-worker "$(dirname "$MARQDO_BIN")"/ - -./scripts/build_all.sh -python3 tests/run_all.py # writes evidence/results.json +export MARQDO_BIN=/absolute/path/to/extracted/install/marqdo +python3 tests/run_all.py # builds the C fixtures and writes evidence/results.json ``` `tests/verify_frozen_cli.py` hashes `$MARQDO_BIN` before and after the suite and -fails if the binary changed. The committed `evidence/results.json` is generated, -not hand-edited; `evidence/manifest.json` is produced by the CLI repository's +fails if the binary changed. The runner checks both executable digests and +generates `evidence/results.json`; `evidence/manifest.json` is produced by the CLI repository's `tools/ci/verify_extension_contracts.py`. ## Contract diff --git a/plugin/build.sh b/plugin/build.sh index e5420b2..1cf69dc 100755 --- a/plugin/build.sh +++ b/plugin/build.sh @@ -6,7 +6,7 @@ set -euo pipefail here="$(cd "$(dirname "$0")" && pwd)" out="$here/build" mkdir -p "$out" -host="$(rustc -vV | sed -n 's/^host: //p')" +host="$("$here/../scripts/host-target.sh")" case "$host" in *apple-darwin*) ext="dylib"; flags=(-dynamiclib -fPIC) ;; *windows*) ext="dll"; flags=(-shared) ;; diff --git a/provider/build.sh b/provider/build.sh index 227fc43..1afe98f 100755 --- a/provider/build.sh +++ b/provider/build.sh @@ -5,7 +5,7 @@ set -euo pipefail here="$(cd "$(dirname "$0")" && pwd)" out="$here/build" mkdir -p "$out" -host="$(rustc -vV | sed -n 's/^host: //p')" +host="$("$here/../scripts/host-target.sh")" case "$host" in *windows*) echo "unsupported: Windows C ABI provider is not implemented in this fixture" >&2; exit 3 ;; *apple-darwin*) ext="dylib"; flags=(-dynamiclib -fPIC) ;; diff --git a/scripts/build_all.sh b/scripts/build_all.sh index 8fcaa8b..27d8f54 100755 --- a/scripts/build_all.sh +++ b/scripts/build_all.sh @@ -1,6 +1,6 @@ #!/usr/bin/env bash # Build every native fixture for the host target and generate complete -# manifests. Requires: cc, git, rustc (for the host triple), python3. +# manifests. Requires: cc, git, python3 (Linux x86_64 glibc). set -euo pipefail here="$(cd "$(dirname "$0")/.." && pwd)" "$here/plugin/build.sh" diff --git a/scripts/host-target.sh b/scripts/host-target.sh new file mode 100755 index 0000000..23a0bef --- /dev/null +++ b/scripts/host-target.sh @@ -0,0 +1,13 @@ +#!/usr/bin/env bash +# The supported lane builds public C ABI fixtures without a Rust toolchain. +set -euo pipefail +case "$(uname -s):$(uname -m)" in + Linux:x86_64) + getconf GNU_LIBC_VERSION >/dev/null + printf '%s\n' x86_64-unknown-linux-gnu + ;; + *) + # Preserve the original host-triple discovery for experimental lanes. + rustc -vV | sed -n 's/^host: //p' + ;; +esac diff --git a/tests/run_all.py b/tests/run_all.py index e528bef..d607dc3 100644 --- a/tests/run_all.py +++ b/tests/run_all.py @@ -26,6 +26,8 @@ import tempfile from dataclasses import dataclass, field from pathlib import Path +from reference_apps import CASES as REFERENCE_CASES + ROOT = Path(__file__).resolve().parents[1] EVIDENCE = ROOT / "evidence" RESULTS = EVIDENCE / "results.json" @@ -56,6 +58,8 @@ class Runner: self.cli = cli self.cases: list[Case] = [] self.cli_hash = sha256_file(cli) + self.provider_worker = cli.with_name("marqdo-provider-worker") + self.provider_worker_hash = sha256_file(self.provider_worker) if self.provider_worker.is_file() else None self.tool_sha = git_sha(ROOT) self.env = dict(os.environ) self.env["MARQDO_BIN"] = str(cli) @@ -507,6 +511,18 @@ class Runner: finally: shutil.rmtree(workspace, ignore_errors=True) + def check_reference_apps(self) -> None: + for name, check in REFERENCE_CASES.items(): + case = self.case("reference_applications", name) + try: + check(self.cli) + except Exception as error: + case.status = "FAIL" + case.detail = str(error) + else: + case.status = "PASS" + case.detail = "frozen CLI loopback check" + # -- utilities ------------------------------------------------------- @staticmethod def read_yaml_artifact(manifest: Path) -> str: @@ -526,6 +542,14 @@ class Runner: case = self.case("negative_security", "frozen CLI binary did not change") case.status = "PASS" case.detail = f"sha256 {self.cli_hash}" + if self.provider_worker_hash is not None: + worker = self.case("negative_security", "frozen provider worker did not change") + if self.provider_worker.is_file() and sha256_file(self.provider_worker) == self.provider_worker_hash: + worker.status = "PASS" + worker.detail = f"sha256 {self.provider_worker_hash}" + else: + worker.status = "FAIL" + worker.detail = "provider worker digest changed" results: dict[str, str] = {} for category in CATEGORIES: cases = [item for item in self.cases if item.category == category] @@ -561,6 +585,11 @@ class Runner: for item in self.cases ], } + if self.provider_worker_hash is not None: + payload["provider_worker_sha256"] = self.provider_worker_hash + payload["reference_applications"] = { + case.name: case.status for case in self.cases if case.category == "reference_applications" + } EVIDENCE.mkdir(exist_ok=True) RESULTS.write_text(json.dumps(payload, indent=2, ensure_ascii=False) + "\n") failures = [item for item in self.cases if item.status == "FAIL"] @@ -633,6 +662,7 @@ def main() -> int: runner.check_provider() runner.check_tool() runner.check_package() + runner.check_reference_apps() return runner.report()