Esta página fue traducida por una máquina y aún no ha sido revisada por una persona. El inglés es la referencia; las correcciones son bienvenidas en GitHub. GitHub
Cookwala / SDK y escenarios / 092
The hub's self-declared claim and the reference report with 137 vectors
A hub answers GET /v1/conformance with the classes it claims and a pointer to a report. The reference hub claims executor and has no report: self-declared. The reference report (claim verifier, 15 suites, 137 vectors, all passed on 2026-10-04) is the shape a certifier reads.
Leer primero: /docs/CERTIFICATION/ /docs/CORE/
Pasos
Ask the hub what it claims. report is null: a claim without a report is a self-declaration, which the note says plainly.
conformanceValidate the reference ConformanceReport produced by tools/run_conformance.py. The reference hub's validate checks the document against the schema file's root; this schema keeps its kinds under $defs, so today this call reports ok for any document, and `cookwala validate` (the CLI line) is the real check.
validateHash the report; this is the value a DirectoryEntry or a registry entry points at (scenario 091).
hash
Resultado
You can tell a self-declared claim from a report, and you know a report proves behaviour on the vectors on one day, not safety in every kitchen (CERTIFICATION section 4). Next: 093 reads the operation vocabulary the vectors test.
Línea de comandos
curl -s ${COOKWALA_HUB:-http://localhost:7878}/v1/conformance
cookwala conformance --report report.json
jq '[.suites[].total] | add' examples/conformance/report-reference.jsonSalida grabada
Estado: ok
[1] conformance: {"claims": ["executor"], "report": null, "note": "reference hub, self-declared; run tools/run_conformance.py --report"}
[2] validate: {"ok": true, "errors": []}
[3] hash: {"hash": "sha256:85da323d7ac0c25cf8ff5e7041c266c894c83382deee8b80e9fe24640985bc58"}Código
Ejecutar: python scenarios/out/092-conformance-claim-and-reference-report/python.py
# Scenario 092: The hub's self-declared claim and the reference report with 137 vectors
# A hub answers GET /v1/conformance with the classes it claims and a pointer to a report. The reference hub claims executor and has no report: self-declared. The reference report (claim verifier, 15 suites, 137 vectors, all passed on 2026-10-04) is the shape a certifier reads.
# Run a hub first: python hub/cookwala_hub.py --recipes examples
import json, os
from cookwala.client import CookwalaClient, CookwalaProblem
def load(path):
with open(path, encoding="utf-8") as f:
return json.load(f)
def pick(obj, path):
for part in path.replace("]", "").replace("[", ".").split("."):
obj = obj[int(part)] if part.isdigit() else (len(obj) if part == "length" else obj.get(part))
return obj
c = CookwalaClient(os.environ.get("COOKWALA_HUB", "http://localhost:7878"))
# Step 1: Ask the hub what it claims. report is null: a claim without a report is a self-declaration, which the note says plainly.
claim = c.conformance()
assert pick(claim, "claims") == ["executor"], pick(claim, "claims")
print("ok", "claims", "=", ["executor"])
assert pick(claim, "report") == None, pick(claim, "report")
print("ok", "report", "=", None)
# Step 2: Validate the reference ConformanceReport produced by tools/run_conformance.py. The reference hub's validate checks the document against the schema file's root; this schema keeps its kinds under $defs, so today this call reports ok for any document, and `cookwala validate` (the CLI line) is the real check.
report = c.validate("conformance", load("examples/conformance/report-reference.json"))
assert pick(report, "ok") == True, pick(report, "ok")
print("ok", "ok", "=", True)
# Step 3: Hash the report; this is the value a DirectoryEntry or a registry entry points at (scenario 091).
h = c.hash(load("examples/conformance/report-reference.json"))
assert pick(h, "hash") == "sha256:85da323d7ac0c25cf8ff5e7041c266c894c83382deee8b80e9fe24640985bc58", pick(h, "hash")
print("ok", "hash", "=", "sha256:85da323d7ac0c25cf8ff5e7041c266c894c83382deee8b80e9fe24640985bc58")
print("scenario complete")