Files
acdl/schemas/contract.schema.json
T
Jon Chery f8e99ed906 phase: 7, status: plan-as-execute, persona: platform-engineer+backend-engineer, task: T-7.2+T-7.3
---ci---
project: acdl
phase: 7
milestone: v1.1
status: plan-as-execute
persona: platform-engineer+backend-engineer
task: [T-7.2, T-7.3]
requirements.covered: [REQ-17, REQ-22]
---/ci---

Wave 2 (parallel): two independent JSON Schemas, different owners.

- T-7.2 (platform-engineer): schemas/ir.schema.json — Target Stack IR
  (JSON Schema draft 2020-12). Resources with typed inputs/outputs/NFRs,
  relationships (single parent per child), composition tree max-depth-5,
  policy hooks. Substrate-agnostic (no Terraform block keywords, no aws_
  provider prefixes; type values are IR types like aws:s3:bucket). module
  pins L1 by name@semver (W3.D). shared_keyword reserved for v2. Validates
  as Draft 2020-12; minimal l2-static-asset IR instance validates.

- T-7.3 (backend-engineer): schemas/contract.schema.json — consumer
  contract (JSON Schema draft 2020-12). Per-env mandatory (W3.E): dev
  stack+environment; qa adds validation.e2eSuite+loadTest; prod adds
  runbook+dashboard+oncall; dr adds drDrillRef. inputs always optional.
  profile: agentic marker; naturalLanguageIntent required when agentic
  (fixed: if-condition requires profile to be present before checking
  const). environment enum has no staging. Validates as Draft 2020-12;
  spike dev contract validates; qa/prod/dr/agentic negative cases reject.
2026-07-21 18:43:33 +00:00

82 lines
3.8 KiB
JSON

{
"$schema": "https://json-schema.org/draft/2020-12/schema",
"$id": "https://acdl.cloudinit.dev/schemas/contract.schema.json",
"title": "ACDL Contract",
"description": "Consumer-declared intent. The central pipeline resolves a contract to a Target Stack IR (schemas/ir.schema.json), the Terraform adapter compiles the IR to a plan. Strict fail-fast at schema stage with reason codes from a published vocabulary.",
"$comment": "Per-env mandatory inputs per W3.E (PROJECT.md). dev requires stack+environment; qa adds validation.e2eSuite + validation.loadTest; prod adds runbook+dashboard+oncall; dr adds drDrillRef. inputs always optional. profile: agentic fields optional everywhere (naturalLanguageIntent required when profile is agentic). W2.A (tag for dev/qa, SHA for prod) is a workflow-reference concern, not a schema field; the platform CLI resolves tag->SHA for prod-bound workflows.",
"type": "object",
"required": ["stack", "environment"],
"properties": {
"stack": {
"type": "string",
"pattern": "^l2-[a-z][a-z0-9-]*$",
"description": "L2 thin-composition reference (resolved by the pipeline to a Target Stack IR)."
},
"environment": {
"type": "string",
"enum": ["dev", "qa", "prod", "dr"],
"description": "Target environment. Staging does not exist (Path A locked, ARCHITECTURE.md §5)."
},
"inputs": {
"type": "object",
"description": "L2-level parameter map. Free-form in v1, typed per-L1 in v1.2 (W3.E).",
"additionalProperties": {"type": ["string", "number", "boolean"]}
},
"validation": {
"type": "object",
"description": "Validation evidence required in qa (W3.E).",
"properties": {
"e2eSuite": {"type": "string", "description": "Reference to the contract-declared e2e suite (last 24h, pass rate >= 99%)."},
"loadTest": {"type": "string", "description": "Reference to the load test report (last 7d, p99 < declared NFR)."}
}
},
"runbook": {"type": "string", "description": "Runbook reference, mandatory in prod (W3.E)."},
"dashboard": {"type": "string", "description": "Dashboard reference, mandatory in prod (W3.E)."},
"oncall": {"type": "string", "description": "On-call rotation reference, mandatory in prod (W3.E)."},
"drDrillRef": {"type": "string", "description": "DR drill report reference (last 180d), mandatory in dr (W3.E)."},
"profile": {
"type": "string",
"enum": ["developer", "agentic"],
"default": "developer",
"description": "Consumer surface. 'agentic' unlocks L3B fields (ARCHITECTURE.md §5)."
},
"naturalLanguageIntent": {
"type": "string",
"description": "L3B: the original natural-language prompt. Required when profile is agentic (W3.E)."
},
"confidenceAtSubmission": {
"type": "number",
"minimum": 0,
"maximum": 1,
"description": "L3B: the agent's self-reported confidence at submission time."
},
"agentTrace": {
"type": "string",
"description": "L3B: reference to the agent's execution trace."
},
"supersedes": {
"type": "string",
"format": "uuid",
"description": "Prior contractId this re-submission replaces (after rejection — ARCHITECTURE.md §10.6)."
}
},
"allOf": [
{
"if": {"properties": {"environment": {"const": "qa"}}},
"then": {"required": ["validation"],
"properties": {"validation": {"required": ["e2eSuite", "loadTest"]}}}
},
{
"if": {"properties": {"environment": {"const": "prod"}}},
"then": {"required": ["runbook", "dashboard", "oncall"]}
},
{
"if": {"properties": {"environment": {"const": "dr"}}},
"then": {"required": ["drDrillRef"]}
},
{
"if": {"required": ["profile"], "properties": {"profile": {"const": "agentic"}}},
"then": {"required": ["naturalLanguageIntent"]}
}
]
}