mirror of
https://github.com/microsoft/BCQuality.git
synced 2026-10-05 14:46:55 +01:00
Add machine-readable review contracts (#182)
Generate a deterministic action-skill index from frontmatter, publish structural schemas for orchestration and findings, and validate flat review composition in CI. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Co-authored-by: dayland <dayland@microsoft.com> Copilot-Session: 76eb42c4-2acd-4f9c-a898-f4a44f9d46f7
This commit is contained in:
parent
852a676285
commit
b74967bc5b
8 changed files with 803 additions and 3 deletions
159
schemas/findings-report.schema.json
Normal file
159
schemas/findings-report.schema.json
Normal file
|
|
@ -0,0 +1,159 @@
|
|||
{
|
||||
"$schema": "http://json-schema.org/draft-07/schema#",
|
||||
"$id": "https://github.com/microsoft/BCQuality/schemas/findings-report.schema.json",
|
||||
"title": "BCQuality findings report",
|
||||
"type": "object",
|
||||
"additionalProperties": false,
|
||||
"required": ["skill", "outcome", "summary", "findings", "suppressed"],
|
||||
"properties": {
|
||||
"skill": { "$ref": "#/definitions/skillReference" },
|
||||
"outcome": {
|
||||
"enum": ["completed", "not-applicable", "no-knowledge", "partial", "failed"]
|
||||
},
|
||||
"outcome-reason": { "type": "string", "minLength": 1 },
|
||||
"summary": { "$ref": "#/definitions/summary" },
|
||||
"findings": {
|
||||
"type": "array",
|
||||
"items": { "$ref": "#/definitions/finding" }
|
||||
},
|
||||
"suppressed": {
|
||||
"type": "array",
|
||||
"items": { "$ref": "#/definitions/suppressed" }
|
||||
},
|
||||
"sub-results": {
|
||||
"type": "array",
|
||||
"items": { "$ref": "#" }
|
||||
},
|
||||
"skipped-sub-skills": {
|
||||
"type": "array",
|
||||
"items": { "$ref": "#/definitions/skippedSubSkill" }
|
||||
}
|
||||
},
|
||||
"allOf": [
|
||||
{
|
||||
"if": {
|
||||
"properties": {
|
||||
"outcome": { "enum": ["partial", "failed"] }
|
||||
}
|
||||
},
|
||||
"then": { "required": ["outcome-reason"] }
|
||||
},
|
||||
{
|
||||
"if": {
|
||||
"properties": {
|
||||
"outcome": { "enum": ["not-applicable", "no-knowledge", "failed"] }
|
||||
}
|
||||
},
|
||||
"then": {
|
||||
"properties": {
|
||||
"findings": { "maxItems": 0 }
|
||||
}
|
||||
}
|
||||
}
|
||||
],
|
||||
"definitions": {
|
||||
"skillReference": {
|
||||
"type": "object",
|
||||
"additionalProperties": false,
|
||||
"required": ["id", "version"],
|
||||
"properties": {
|
||||
"id": { "type": "string", "pattern": "^[a-z0-9]+(-[a-z0-9]+)*$" },
|
||||
"version": { "type": "integer", "minimum": 1 }
|
||||
}
|
||||
},
|
||||
"counts": {
|
||||
"type": "object",
|
||||
"additionalProperties": false,
|
||||
"required": ["blocker", "major", "minor", "info"],
|
||||
"properties": {
|
||||
"blocker": { "type": "integer", "minimum": 0 },
|
||||
"major": { "type": "integer", "minimum": 0 },
|
||||
"minor": { "type": "integer", "minimum": 0 },
|
||||
"info": { "type": "integer", "minimum": 0 }
|
||||
}
|
||||
},
|
||||
"coverage": {
|
||||
"type": "object",
|
||||
"additionalProperties": false,
|
||||
"required": ["worklist-size", "items-evaluated"],
|
||||
"properties": {
|
||||
"worklist-size": { "type": "integer", "minimum": 0 },
|
||||
"items-evaluated": { "type": "integer", "minimum": 0 }
|
||||
}
|
||||
},
|
||||
"summary": {
|
||||
"type": "object",
|
||||
"additionalProperties": false,
|
||||
"required": ["counts", "coverage"],
|
||||
"properties": {
|
||||
"counts": { "$ref": "#/definitions/counts" },
|
||||
"coverage": { "$ref": "#/definitions/coverage" }
|
||||
}
|
||||
},
|
||||
"reference": {
|
||||
"type": "object",
|
||||
"additionalProperties": false,
|
||||
"required": ["path"],
|
||||
"properties": {
|
||||
"path": { "type": "string", "minLength": 1, "pattern": "^[^\\\\]+$" },
|
||||
"sha": { "type": "string", "pattern": "^[a-fA-F0-9]{40}$" }
|
||||
}
|
||||
},
|
||||
"location": {
|
||||
"type": "object",
|
||||
"additionalProperties": false,
|
||||
"required": ["file", "line"],
|
||||
"properties": {
|
||||
"file": { "type": "string", "minLength": 1, "pattern": "^[^\\\\]+$" },
|
||||
"line": { "type": "integer", "minimum": 1 },
|
||||
"range": {
|
||||
"type": "object",
|
||||
"additionalProperties": false,
|
||||
"required": ["start-line", "end-line"],
|
||||
"properties": {
|
||||
"start-line": { "type": "integer", "minimum": 1 },
|
||||
"end-line": { "type": "integer", "minimum": 1 }
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"finding": {
|
||||
"type": "object",
|
||||
"additionalProperties": false,
|
||||
"required": ["id", "severity", "message", "references", "confidence"],
|
||||
"properties": {
|
||||
"id": { "type": "string", "minLength": 1 },
|
||||
"severity": { "enum": ["blocker", "major", "minor", "info"] },
|
||||
"message": { "type": "string", "minLength": 1 },
|
||||
"location": { "$ref": "#/definitions/location" },
|
||||
"references": {
|
||||
"type": "array",
|
||||
"items": { "$ref": "#/definitions/reference" }
|
||||
},
|
||||
"confidence": { "enum": ["high", "medium", "low"] },
|
||||
"from-sub-skill": { "type": "string", "minLength": 1 },
|
||||
"domain": { "type": "string", "minLength": 1, "pattern": "^[^\\r\\n]+$" },
|
||||
"suggested-code": { "type": "string", "minLength": 1 },
|
||||
"suggested-code-omission-reason": { "type": "string", "minLength": 1 }
|
||||
}
|
||||
},
|
||||
"suppressed": {
|
||||
"type": "object",
|
||||
"additionalProperties": false,
|
||||
"required": ["reference", "reason"],
|
||||
"properties": {
|
||||
"reference": { "$ref": "#/definitions/reference" },
|
||||
"reason": { "enum": ["layer-precedence", "configuration"] }
|
||||
}
|
||||
},
|
||||
"skippedSubSkill": {
|
||||
"type": "object",
|
||||
"additionalProperties": false,
|
||||
"required": ["skill", "reason"],
|
||||
"properties": {
|
||||
"skill": { "$ref": "#/definitions/skillReference" },
|
||||
"reason": { "enum": ["configuration", "not-applicable"] }
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
84
schemas/skill-index.schema.json
Normal file
84
schemas/skill-index.schema.json
Normal file
|
|
@ -0,0 +1,84 @@
|
|||
{
|
||||
"$schema": "http://json-schema.org/draft-07/schema#",
|
||||
"$id": "https://github.com/microsoft/BCQuality/schemas/skill-index.schema.json",
|
||||
"title": "BCQuality action-skill index",
|
||||
"type": "object",
|
||||
"additionalProperties": false,
|
||||
"required": ["version", "generatedAt", "skillCount", "sourceSnapshot", "skills"],
|
||||
"properties": {
|
||||
"version": { "const": 1 },
|
||||
"generatedAt": { "type": "string", "format": "date-time" },
|
||||
"skillCount": { "type": "integer", "minimum": 0 },
|
||||
"sourceSnapshot": { "type": "string", "pattern": "^[a-f0-9]{64}$" },
|
||||
"skills": {
|
||||
"type": "array",
|
||||
"items": { "$ref": "#/definitions/skill" }
|
||||
}
|
||||
},
|
||||
"definitions": {
|
||||
"stringArray": {
|
||||
"type": "array",
|
||||
"items": { "type": "string", "minLength": 1 }
|
||||
},
|
||||
"skill": {
|
||||
"type": "object",
|
||||
"additionalProperties": false,
|
||||
"required": [
|
||||
"path",
|
||||
"layer",
|
||||
"id",
|
||||
"version",
|
||||
"title",
|
||||
"description",
|
||||
"inputs",
|
||||
"outputs",
|
||||
"filters",
|
||||
"subSkills",
|
||||
"sourceSha256"
|
||||
],
|
||||
"properties": {
|
||||
"path": { "type": "string", "pattern": "^(microsoft|community|custom)/skills/.+\\.md$" },
|
||||
"layer": { "enum": ["microsoft", "community", "custom"] },
|
||||
"id": { "type": "string", "pattern": "^[a-z0-9]+(-[a-z0-9]+)*$" },
|
||||
"version": { "type": "integer", "minimum": 1 },
|
||||
"title": { "type": "string", "minLength": 1 },
|
||||
"description": { "type": "string", "minLength": 1 },
|
||||
"inputs": { "$ref": "#/definitions/stringArray" },
|
||||
"outputs": {
|
||||
"type": "array",
|
||||
"minItems": 1,
|
||||
"maxItems": 1,
|
||||
"items": { "const": "findings-report" }
|
||||
},
|
||||
"filters": {
|
||||
"type": "object",
|
||||
"additionalProperties": false,
|
||||
"required": ["bc-version", "technologies", "countries", "application-area"],
|
||||
"properties": {
|
||||
"bc-version": {
|
||||
"type": "array",
|
||||
"items": {
|
||||
"oneOf": [
|
||||
{ "type": "integer", "minimum": 1 },
|
||||
{ "type": "string", "pattern": "^(all|[1-9][0-9]*\\.\\.[1-9][0-9]*|[1-9][0-9]*\\.\\.)$" }
|
||||
]
|
||||
}
|
||||
},
|
||||
"technologies": { "$ref": "#/definitions/stringArray" },
|
||||
"countries": { "$ref": "#/definitions/stringArray" },
|
||||
"application-area": { "$ref": "#/definitions/stringArray" }
|
||||
}
|
||||
},
|
||||
"subSkills": {
|
||||
"type": "array",
|
||||
"uniqueItems": true,
|
||||
"items": {
|
||||
"type": "string",
|
||||
"pattern": "^(microsoft|community|custom)/skills/.+\\.md$"
|
||||
}
|
||||
},
|
||||
"sourceSha256": { "type": "string", "pattern": "^[a-f0-9]{64}$" }
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue