generated from coulomb/repo-seed
command-runner support and first OpenCMIS TCK wrapper boundary
This commit is contained in:
@@ -15,11 +15,13 @@
|
||||
"runner_entrypoints": [
|
||||
{
|
||||
"id": "replace-with-runner-id",
|
||||
"kind": "external",
|
||||
"kind": "command",
|
||||
"module_path": null,
|
||||
"callable": null,
|
||||
"command": null,
|
||||
"description": "Describe how this runner is provided."
|
||||
"command": [
|
||||
"replace-with-command"
|
||||
],
|
||||
"description": "Describe how this manifest-declared command produces JSON runner output."
|
||||
}
|
||||
],
|
||||
"normalizers": [],
|
||||
|
||||
@@ -69,11 +69,16 @@
|
||||
},
|
||||
{
|
||||
"id": "opencmis-tck",
|
||||
"kind": "external",
|
||||
"kind": "command",
|
||||
"module_path": null,
|
||||
"callable": null,
|
||||
"command": null,
|
||||
"description": "Placeholder for the Java/Maven Apache Chemistry OpenCMIS TCK runner."
|
||||
"command": [
|
||||
"python3",
|
||||
"runners/opencmis_tck.py",
|
||||
"--context",
|
||||
"{context_json}"
|
||||
],
|
||||
"description": "Checks Java/Maven availability and prepares the future Apache Chemistry OpenCMIS TCK invocation."
|
||||
}
|
||||
],
|
||||
"normalizers": [
|
||||
|
||||
116
extensions/open-cmis-tck/runners/opencmis_tck.py
Normal file
116
extensions/open-cmis-tck/runners/opencmis_tck.py
Normal file
@@ -0,0 +1,116 @@
|
||||
#!/usr/bin/env python3
|
||||
"""OpenCMIS TCK wrapper boundary.
|
||||
|
||||
This wrapper intentionally stops before invoking Apache Chemistry. Its current
|
||||
job is to prove the command-runner contract, verify local Java/Maven posture, and
|
||||
return structured evidence that the actual TCK execution remains pending.
|
||||
"""
|
||||
|
||||
from __future__ import annotations
|
||||
|
||||
import argparse
|
||||
import json
|
||||
import shutil
|
||||
import subprocess
|
||||
from pathlib import Path
|
||||
from typing import Any
|
||||
|
||||
|
||||
def main() -> int:
|
||||
parser = argparse.ArgumentParser()
|
||||
parser.add_argument("--context", required=True)
|
||||
args = parser.parse_args()
|
||||
|
||||
context = _load_context(Path(args.context))
|
||||
selected_group = context["step"].get("check_group")
|
||||
dependency_results = {
|
||||
"java": _probe_command(["java", "-version"]),
|
||||
"maven": _probe_command(["mvn", "-version"]),
|
||||
}
|
||||
missing = [
|
||||
name
|
||||
for name, result in dependency_results.items()
|
||||
if not result["available"]
|
||||
]
|
||||
|
||||
if missing:
|
||||
_emit(
|
||||
{
|
||||
"result": "blocked",
|
||||
"observations": [
|
||||
"OpenCMIS TCK execution skipped because required local dependencies are missing: "
|
||||
+ ", ".join(missing)
|
||||
+ "."
|
||||
],
|
||||
"facts": {
|
||||
"blocked_reason": "missing_dependency",
|
||||
"selected_check_group": selected_group,
|
||||
"dependencies": dependency_results,
|
||||
},
|
||||
"artifact_refs": [],
|
||||
}
|
||||
)
|
||||
return 0
|
||||
|
||||
_emit(
|
||||
{
|
||||
"result": "blocked",
|
||||
"observations": [
|
||||
"Java and Maven are available, but the Apache Chemistry OpenCMIS TCK invocation is not configured yet."
|
||||
],
|
||||
"facts": {
|
||||
"blocked_reason": "tck_invocation_not_configured",
|
||||
"selected_check_group": selected_group,
|
||||
"dependencies": dependency_results,
|
||||
"next_step": "Resolve the Maven artifact, classpath, TCK group mapping, and raw artifact capture contract.",
|
||||
},
|
||||
"artifact_refs": [],
|
||||
}
|
||||
)
|
||||
return 0
|
||||
|
||||
|
||||
def _load_context(path: Path) -> dict[str, Any]:
|
||||
with path.open("r", encoding="utf-8") as handle:
|
||||
value = json.load(handle)
|
||||
if not isinstance(value, dict):
|
||||
raise ValueError("context must be a JSON object")
|
||||
return value
|
||||
|
||||
|
||||
def _probe_command(command: list[str]) -> dict[str, Any]:
|
||||
executable = shutil.which(command[0])
|
||||
if executable is None:
|
||||
return {
|
||||
"available": False,
|
||||
"path": None,
|
||||
"returncode": None,
|
||||
"version_output": None,
|
||||
}
|
||||
|
||||
completed = subprocess.run(
|
||||
command,
|
||||
capture_output=True,
|
||||
text=True,
|
||||
timeout=10,
|
||||
check=False,
|
||||
)
|
||||
output = "\n".join(
|
||||
part.strip()
|
||||
for part in [completed.stdout, completed.stderr]
|
||||
if part.strip()
|
||||
)
|
||||
return {
|
||||
"available": completed.returncode == 0,
|
||||
"path": executable,
|
||||
"returncode": completed.returncode,
|
||||
"version_output": output[:2000],
|
||||
}
|
||||
|
||||
|
||||
def _emit(value: dict[str, Any]) -> None:
|
||||
print(json.dumps(value, indent=2, sort_keys=True))
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
raise SystemExit(main())
|
||||
@@ -114,7 +114,7 @@ Progress:
|
||||
|
||||
```task
|
||||
id: OPEN-CMIS-TCK-WP-0001-T004
|
||||
status: todo
|
||||
status: in_progress
|
||||
priority: high
|
||||
state_hub_task_id: "502d7586-6f9e-475e-9683-43260666d5d9"
|
||||
```
|
||||
@@ -126,6 +126,14 @@ Acceptance:
|
||||
- Raw logs and machine-readable run metadata are written under a run directory.
|
||||
- TCK execution can be skipped cleanly when Java/Maven are unavailable.
|
||||
|
||||
Progress:
|
||||
|
||||
- `opencmis-tck` is now a manifest-declared command runner.
|
||||
- The wrapper checks Java and Maven availability and returns structured blocked
|
||||
evidence when dependencies or final TCK invocation details are missing.
|
||||
- Actual Apache Chemistry TCK classpath resolution, group invocation, and raw log
|
||||
capture remain to be implemented.
|
||||
|
||||
## D1.5 - CMIS Result Normalization
|
||||
|
||||
```task
|
||||
|
||||
Reference in New Issue
Block a user