Use JSON hygiene reports in local automation without overclaiming
Direct answer
JSON helps local automation when its fields remain observations rather than verdicts. The example includes a check record, a score, and a caller-owned policy marker. A consumer can decide what a passing root README means for its own workflow, but the producer has not claimed that the project is ready. The encoding round trip verifies the concrete shape a caller receives.
The edge case is a downstream script that equates any positive score with approval. Keeping policy explicit makes that assumption visible instead of burying it in a status label. The list of checks also preserves room for multiple observations without forcing a consumer to parse prose.
This tiny contract is not a signed format, JSON Schema, or proof that a caller honors its policy field. Version a real interchange format when independent tools depend on it, and keep evidence from test execution or deployment separate from filename observations.
Complete example
import json
report = {
"checks": [{"id": "root-readme", "status": "pass"}],
"score": 1,
"policy": "caller-owned",
}
encoded = json.dumps(report, sort_keys=True)
decoded = json.loads(encoded)
assert decoded["checks"][0]["status"] == "pass"
assert decoded["policy"] == "caller-owned"
print(encoded)
Expected stdout:
{"checks": [{"id": "root-readme", "status": "pass"}], "policy": "caller-owned", "score": 1}
Sources
Prepared with AI assistance. The example uses synthetic data; its stated limits apply.
Comments
Post a Comment