Skip to content

Commit ae67cdc

Browse files
Aitomatesclaude
andcommitted
test(contracts): add consumer-side contract-compatibility gate
Pins cas-contracts v1.1.0 and validates the SDLC wire payload in CI. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
1 parent d84612c commit ae67cdc

10 files changed

Lines changed: 522 additions & 0 deletions

.github/workflows/ci.yml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,12 @@ jobs:
3838
- name: Verify dependency consistency
3939
run: python -m pip check
4040

41+
- name: Contract compatibility (pinned cas-contracts v1.1)
42+
# Consumer-side gate: fails red if autogen's pinned CAS contract version
43+
# or the vendored v1.1 schema release drifts. See
44+
# tests/test_contract_compatibility.py for the validated contract surface.
45+
run: python -m pytest tests/test_contract_compatibility.py -q --tb=short
46+
4147
- name: Run full test suite
4248
run: python -m pytest -q --tb=short
4349

requirements.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ autogen-agentchat>=0.7.5,<0.8.0
55
autogen-core>=0.7.5,<0.8.0
66
autogen-ext[anthropic,ollama,openai]>=0.7.5,<0.8.0
77
fastapi>=0.115,<1.0
8+
jsonschema>=4.23,<5.0
89
openapi-spec-validator>=0.7,<1.0
910
pydantic>=2.0,<3.0
1011
pytest>=8.0,<10.0
Lines changed: 103 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,103 @@
1+
{
2+
"$schema": "https://json-schema.org/draft/2020-12/schema",
3+
"$id": "https://schemas.coding-autopilot.dev/v1.1/common.schema.json",
4+
"title": "CAS Common Definitions v1.1",
5+
"$defs": {
6+
"actor": {
7+
"type": "object",
8+
"additionalProperties": false,
9+
"required": ["id", "type"],
10+
"properties": {
11+
"id": { "type": "string", "minLength": 1, "maxLength": 256 },
12+
"type": {
13+
"type": "string",
14+
"enum": ["human", "agent", "service", "workflow"]
15+
},
16+
"displayName": { "type": "string", "minLength": 1, "maxLength": 256 }
17+
}
18+
},
19+
"traceContext": {
20+
"type": "object",
21+
"additionalProperties": false,
22+
"required": ["traceparent"],
23+
"properties": {
24+
"traceparent": {
25+
"type": "string",
26+
"pattern": "^[\\da-f]{2}-[\\da-f]{32}-[\\da-f]{16}-[\\da-f]{2}$"
27+
},
28+
"tracestate": { "type": "string", "maxLength": 512 }
29+
}
30+
},
31+
"lifecycleMetadata": {
32+
"type": "object",
33+
"required": [
34+
"correlationId",
35+
"promptId",
36+
"runId",
37+
"repo",
38+
"actor",
39+
"timestamp",
40+
"schemaVersion",
41+
"traceContext"
42+
],
43+
"properties": {
44+
"correlationId": { "type": "string", "minLength": 1, "maxLength": 128 },
45+
"promptId": { "type": "string", "minLength": 1, "maxLength": 128 },
46+
"runId": { "type": "string", "minLength": 1, "maxLength": 128 },
47+
"repo": {
48+
"type": "string",
49+
"pattern": "^[A-Za-z0-9_.-]+/[A-Za-z0-9_.-]+$"
50+
},
51+
"actor": { "$ref": "#/$defs/actor" },
52+
"timestamp": { "type": "string", "format": "date-time" },
53+
"schemaVersion": { "const": "1.1.0" },
54+
"traceContext": { "$ref": "#/$defs/traceContext" }
55+
}
56+
},
57+
"evidence": {
58+
"type": "object",
59+
"additionalProperties": false,
60+
"required": ["kind", "uri"],
61+
"properties": {
62+
"kind": { "type": "string", "minLength": 1, "maxLength": 64 },
63+
"uri": { "type": "string", "format": "uri" },
64+
"sha256": { "type": "string", "pattern": "^[\\da-f]{64}$" }
65+
}
66+
},
67+
"phaseId": {
68+
"type": "string",
69+
"enum": [
70+
"understand",
71+
"research",
72+
"analyze",
73+
"plan",
74+
"risk-assessment",
75+
"implement",
76+
"verify",
77+
"review",
78+
"improve",
79+
"document",
80+
"update-memory",
81+
"finished"
82+
]
83+
},
84+
"executionBatch": {
85+
"type": "string",
86+
"enum": ["discovery", "design", "change", "assurance", "closure"]
87+
},
88+
"phaseStatus": {
89+
"type": "string",
90+
"enum": [
91+
"pending",
92+
"ready",
93+
"running",
94+
"passed",
95+
"failed",
96+
"invalidated",
97+
"rolled-back",
98+
"waiting",
99+
"terminal"
100+
]
101+
}
102+
}
103+
}
Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
{
2+
"version": "1.1.0",
3+
"schemas": [
4+
{
5+
"id": "https://schemas.coding-autopilot.dev/v1.1/common.schema.json",
6+
"path": "common.schema.json",
7+
"sha256": "078026d60c219658fe0fc5cf7c4f786acdcf0c492121f7d688d5078b33ca25af"
8+
},
9+
{
10+
"id": "https://schemas.coding-autopilot.dev/v1.1/phase-execution-request.schema.json",
11+
"path": "phase-execution-request.schema.json",
12+
"sha256": "927ffda5ba809e58627ba25b3275355644b510b0ae1c76f446aa7b7f291f08fd"
13+
},
14+
{
15+
"id": "https://schemas.coding-autopilot.dev/v1.1/phase-execution-result.schema.json",
16+
"path": "phase-execution-result.schema.json",
17+
"sha256": "1d353e20cf6338c2de4a9bec0bad83ca0dec6c9feb5434c5e6264fdc075e7c25"
18+
},
19+
{
20+
"id": "https://schemas.coding-autopilot.dev/v1.1/phase-verification-result.schema.json",
21+
"path": "phase-verification-result.schema.json",
22+
"sha256": "ec5b97a2bf75892530442f666d23a8b6dbb8f13bda0efe49553d3f64cd41b995"
23+
},
24+
{
25+
"id": "https://schemas.coding-autopilot.dev/v1.1/sdlc-lifecycle-event.schema.json",
26+
"path": "sdlc-lifecycle-event.schema.json",
27+
"sha256": "bd955637761679d3b6e8ee09fb7b693b1d0362615b0865204c5ae3bacb3809dc"
28+
},
29+
{
30+
"id": "https://schemas.coding-autopilot.dev/v1.1/sdlc-profile.schema.json",
31+
"path": "sdlc-profile.schema.json",
32+
"sha256": "f4974e911e7cb88191c1a331470c8cd7a79d1c7311c963dd70cd9c8f524ebe45"
33+
}
34+
]
35+
}
Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
{
2+
"$schema": "https://json-schema.org/draft/2020-12/schema",
3+
"$id": "https://schemas.coding-autopilot.dev/v1.1/phase-execution-request.schema.json",
4+
"title": "PhaseExecutionRequest",
5+
"type": "object",
6+
"allOf": [
7+
{ "$ref": "common.schema.json#/$defs/lifecycleMetadata" },
8+
{
9+
"type": "object",
10+
"required": ["kind", "profileVersion", "phase", "batch", "goal", "constraints"],
11+
"properties": {
12+
"kind": { "const": "PhaseExecutionRequest" },
13+
"profileVersion": { "type": "string", "const": "v1.1" },
14+
"phase": { "$ref": "common.schema.json#/$defs/phaseId" },
15+
"batch": { "$ref": "common.schema.json#/$defs/executionBatch" },
16+
"goal": { "type": "string", "minLength": 1, "maxLength": 5000 },
17+
"constraints": {
18+
"type": "array",
19+
"items": { "type": "string", "minLength": 1, "maxLength": 1000 }
20+
},
21+
"validatedInputs": { "type": "array", "items": { "type": "string" } },
22+
"priorEvidence": { "type": "array", "items": { "$ref": "common.schema.json#/$defs/evidence" } },
23+
"requiredOutputSchema": { "type": "string", "minLength": 1, "maxLength": 256 },
24+
"requiredArtifacts": { "type": "array", "items": { "type": "string", "minLength": 1, "maxLength": 256 } },
25+
"successCriteria": { "type": "array", "items": { "type": "string", "minLength": 1, "maxLength": 1000 } },
26+
"verifier": { "type": "string", "minLength": 1, "maxLength": 256 },
27+
"failureBehavior": { "type": "string", "minLength": 1, "maxLength": 5000 },
28+
"rollbackBehavior": { "type": "string", "minLength": 1, "maxLength": 5000 },
29+
"memoryCandidateFields": { "type": "array", "items": { "type": "string", "minLength": 1, "maxLength": 256 } },
30+
"humanEscalationConditions": { "type": "array", "items": { "type": "string", "minLength": 1, "maxLength": 1000 } }
31+
}
32+
}
33+
],
34+
"unevaluatedProperties": false
35+
}
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
{
2+
"$schema": "https://json-schema.org/draft/2020-12/schema",
3+
"$id": "https://schemas.coding-autopilot.dev/v1.1/phase-execution-result.schema.json",
4+
"title": "PhaseExecutionResult",
5+
"type": "object",
6+
"allOf": [
7+
{ "$ref": "common.schema.json#/$defs/lifecycleMetadata" },
8+
{
9+
"type": "object",
10+
"required": ["kind", "phase", "status", "promptDigest"],
11+
"properties": {
12+
"kind": { "const": "PhaseExecutionResult" },
13+
"phase": { "$ref": "common.schema.json#/$defs/phaseId" },
14+
"batch": { "$ref": "common.schema.json#/$defs/executionBatch" },
15+
"status": { "$ref": "common.schema.json#/$defs/phaseStatus" },
16+
"promptDigest": { "type": "string", "pattern": "^[\\da-f]{64}$" },
17+
"artifacts": { "type": "array", "items": { "$ref": "common.schema.json#/$defs/evidence" } },
18+
"output": { "type": "object" },
19+
"promptMetadata": { "type": "object" },
20+
"sanitizedPrompt": { "type": "string", "maxLength": 50000 },
21+
"verifier": { "type": "string", "minLength": 1, "maxLength": 256 },
22+
"checkpoint": { "type": "string", "minLength": 1, "maxLength": 256 }
23+
}
24+
}
25+
],
26+
"unevaluatedProperties": false
27+
}
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
{
2+
"$schema": "https://json-schema.org/draft/2020-12/schema",
3+
"$id": "https://schemas.coding-autopilot.dev/v1.1/phase-verification-result.schema.json",
4+
"title": "PhaseVerificationResult",
5+
"type": "object",
6+
"allOf": [
7+
{ "$ref": "common.schema.json#/$defs/lifecycleMetadata" },
8+
{
9+
"type": "object",
10+
"required": ["kind", "phase", "verifier", "outcome"],
11+
"properties": {
12+
"kind": { "const": "PhaseVerificationResult" },
13+
"phase": { "$ref": "common.schema.json#/$defs/phaseId" },
14+
"verifier": { "type": "string", "minLength": 1, "maxLength": 256 },
15+
"outcome": { "enum": ["passed", "failed", "inconclusive"] },
16+
"invalidatedPhaseIds": {
17+
"type": "array",
18+
"items": { "$ref": "common.schema.json#/$defs/phaseId" },
19+
"uniqueItems": true
20+
},
21+
"evidence": { "type": "array", "items": { "$ref": "common.schema.json#/$defs/evidence" } },
22+
"reason": { "type": "string", "maxLength": 5000 }
23+
}
24+
}
25+
],
26+
"unevaluatedProperties": false
27+
}
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
{
2+
"$schema": "https://json-schema.org/draft/2020-12/schema",
3+
"$id": "https://schemas.coding-autopilot.dev/v1.1/sdlc-lifecycle-event.schema.json",
4+
"title": "SdlcLifecycleEvent",
5+
"type": "object",
6+
"allOf": [
7+
{ "$ref": "common.schema.json#/$defs/lifecycleMetadata" },
8+
{
9+
"type": "object",
10+
"required": ["kind", "eventType", "phase"],
11+
"properties": {
12+
"kind": { "const": "SdlcLifecycleEvent" },
13+
"eventType": { "type": "string", "minLength": 1, "maxLength": 128 },
14+
"phase": { "$ref": "common.schema.json#/$defs/phaseId" },
15+
"batch": { "$ref": "common.schema.json#/$defs/executionBatch" },
16+
"status": { "$ref": "common.schema.json#/$defs/phaseStatus" },
17+
"message": { "type": "string", "maxLength": 5000 },
18+
"evidence": { "type": "array", "items": { "$ref": "common.schema.json#/$defs/evidence" } }
19+
}
20+
}
21+
],
22+
"unevaluatedProperties": false
23+
}
Lines changed: 67 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,67 @@
1+
{
2+
"$schema": "https://json-schema.org/draft/2020-12/schema",
3+
"$id": "https://schemas.coding-autopilot.dev/v1.1/sdlc-profile.schema.json",
4+
"title": "SdlcProfile",
5+
"type": "object",
6+
"allOf": [
7+
{ "$ref": "common.schema.json#/$defs/lifecycleMetadata" },
8+
{
9+
"type": "object",
10+
"required": ["kind", "profileId", "profileVersion", "phases", "goalBudget"],
11+
"properties": {
12+
"kind": { "const": "SdlcProfile" },
13+
"profileId": { "type": "string", "minLength": 1, "maxLength": 128 },
14+
"profileVersion": { "type": "string", "pattern": "^v1\\.1$" },
15+
"goalBudget": { "type": "integer", "minimum": 1 },
16+
"phases": {
17+
"type": "array",
18+
"minItems": 12,
19+
"maxItems": 12,
20+
"items": {
21+
"type": "object",
22+
"additionalProperties": false,
23+
"required": ["id", "name", "batch", "dependencies", "verifier"],
24+
"properties": {
25+
"id": { "$ref": "common.schema.json#/$defs/phaseId" },
26+
"name": { "type": "string", "minLength": 1, "maxLength": 128 },
27+
"batch": { "$ref": "common.schema.json#/$defs/executionBatch" },
28+
"dependencies": {
29+
"type": "array",
30+
"items": { "$ref": "common.schema.json#/$defs/phaseId" },
31+
"uniqueItems": true
32+
},
33+
"verifier": { "type": "string", "minLength": 1, "maxLength": 256 },
34+
"requiredArtifacts": {
35+
"type": "array",
36+
"items": { "type": "string", "minLength": 1, "maxLength": 256 }
37+
},
38+
"successCriteria": {
39+
"type": "array",
40+
"minItems": 1,
41+
"items": { "type": "string", "minLength": 1, "maxLength": 1000 }
42+
},
43+
"rollbackTo": { "$ref": "common.schema.json#/$defs/phaseId" },
44+
"maxAttempts": { "type": "integer", "minimum": 1 }
45+
}
46+
}
47+
},
48+
"goalAttempts": { "type": "integer", "minimum": 1 },
49+
"iterations": { "type": "integer", "minimum": 1 },
50+
"runtimeMinutes": { "type": "integer", "minimum": 1 },
51+
"modelCalls": { "type": "integer", "minimum": 1 },
52+
"noProgressLimit": { "type": "integer", "minimum": 1 },
53+
"repositoryOverrides": {
54+
"type": "object",
55+
"additionalProperties": false,
56+
"properties": {
57+
"promptFragments": { "type": "object" },
58+
"verifierCommands": { "type": "object" },
59+
"requiredArtifacts": { "type": "object" },
60+
"phaseLimits": { "type": "object" }
61+
}
62+
}
63+
}
64+
}
65+
],
66+
"unevaluatedProperties": false
67+
}

0 commit comments

Comments
 (0)