TenantAtlas/specs/208-heavy-suite-segmentation/contracts/heavy-test-classification.schema.json
2026-04-17 11:44:04 +02:00

809 lines
18 KiB
JSON

{
"$schema": "https://json-schema.org/draft/2020-12/schema",
"$id": "https://tenantatlas.local/schemas/heavy-test-classification.schema.json",
"title": "HeavyTestClassificationCatalog",
"type": "object",
"additionalProperties": false,
"required": [
"version",
"artifactDirectory",
"classifications",
"families",
"mixedFileResolutions",
"placementRules",
"driftGuards",
"budgetTargets"
],
"properties": {
"version": {
"type": "integer",
"minimum": 1
},
"artifactDirectory": {
"type": "string",
"const": "storage/logs/test-lanes"
},
"classifications": {
"type": "array",
"minItems": 5,
"items": {
"$ref": "#/$defs/classification"
},
"allOf": [
{
"contains": {
"type": "object",
"required": ["classificationId"],
"properties": {
"classificationId": {
"const": "ui-light"
}
}
}
},
{
"contains": {
"type": "object",
"required": ["classificationId"],
"properties": {
"classificationId": {
"const": "ui-workflow"
}
}
}
},
{
"contains": {
"type": "object",
"required": ["classificationId"],
"properties": {
"classificationId": {
"const": "surface-guard"
}
}
}
},
{
"contains": {
"type": "object",
"required": ["classificationId"],
"properties": {
"classificationId": {
"const": "discovery-heavy"
}
}
}
},
{
"contains": {
"type": "object",
"required": ["classificationId"],
"properties": {
"classificationId": {
"const": "browser"
}
}
}
}
]
},
"families": {
"type": "array",
"minItems": 1,
"items": {
"$ref": "#/$defs/family"
}
},
"mixedFileResolutions": {
"type": "array",
"items": {
"$ref": "#/$defs/mixedFileResolution"
}
},
"placementRules": {
"type": "array",
"minItems": 5,
"items": {
"$ref": "#/$defs/placementRule"
}
},
"driftGuards": {
"type": "array",
"minItems": 1,
"items": {
"$ref": "#/$defs/driftGuard"
},
"allOf": [
{
"contains": {
"type": "object",
"required": [
"targetRefs"
],
"properties": {
"targetRefs": {
"type": "array",
"contains": {
"const": "browser"
}
}
}
}
},
{
"contains": {
"type": "object",
"required": [
"targetRefs"
],
"properties": {
"targetRefs": {
"type": "array",
"contains": {
"const": "discovery-heavy"
}
}
}
}
},
{
"contains": {
"type": "object",
"required": [
"targetRefs"
],
"properties": {
"targetRefs": {
"type": "array",
"contains": {
"const": "surface-guard"
}
}
}
}
}
]
},
"budgetTargets": {
"type": "array",
"minItems": 1,
"items": {
"$ref": "#/$defs/budgetTarget"
},
"allOf": [
{
"contains": {
"type": "object",
"required": [
"targetType",
"targetId"
],
"properties": {
"targetType": {
"const": "lane"
},
"targetId": {
"const": "heavy-governance"
}
}
}
},
{
"contains": {
"type": "object",
"required": [
"targetType"
],
"properties": {
"targetType": {
"const": "classification"
}
}
}
},
{
"contains": {
"type": "object",
"required": [
"targetType"
],
"properties": {
"targetType": {
"const": "family"
}
}
}
}
]
}
},
"$defs": {
"classificationId": {
"type": "string",
"enum": [
"ui-light",
"ui-workflow",
"surface-guard",
"discovery-heavy",
"browser"
]
},
"laneId": {
"type": "string",
"enum": [
"fast-feedback",
"confidence",
"heavy-governance",
"browser",
"profiling",
"junit"
]
},
"selector": {
"type": "object",
"additionalProperties": false,
"required": [
"selectorType",
"selectorValue",
"selectorRole",
"sourceOfTruth"
],
"properties": {
"selectorType": {
"type": "string",
"enum": [
"suite",
"path",
"group",
"file"
]
},
"selectorValue": {
"type": "string",
"minLength": 1
},
"selectorRole": {
"type": "string",
"enum": [
"include",
"exclude",
"inventory-only"
]
},
"sourceOfTruth": {
"type": "string",
"enum": [
"manifest",
"pest-group",
"guard-test",
"report-attribution"
]
},
"rationale": {
"type": "string"
}
}
},
"classification": {
"type": "object",
"additionalProperties": false,
"required": [
"classificationId",
"purpose",
"dominantCostDrivers",
"defaultLaneId",
"allowedLaneIds",
"forbiddenLaneIds",
"reviewerSignals",
"escalationTriggers"
],
"properties": {
"classificationId": {
"$ref": "#/$defs/classificationId"
},
"purpose": {
"type": "string",
"minLength": 1
},
"dominantCostDrivers": {
"$ref": "#/$defs/nonEmptyStringArray"
},
"defaultLaneId": {
"$ref": "#/$defs/laneId"
},
"allowedLaneIds": {
"$ref": "#/$defs/nonEmptyLaneArray"
},
"forbiddenLaneIds": {
"type": "array",
"items": {
"$ref": "#/$defs/laneId"
},
"uniqueItems": true
},
"reviewerSignals": {
"$ref": "#/$defs/nonEmptyStringArray"
},
"escalationTriggers": {
"$ref": "#/$defs/nonEmptyStringArray"
}
},
"allOf": [
{
"if": {
"properties": {
"classificationId": {
"const": "browser"
}
}
},
"then": {
"properties": {
"defaultLaneId": {
"const": "browser"
},
"allowedLaneIds": {
"type": "array",
"minItems": 1,
"maxItems": 1,
"items": {
"const": "browser"
}
}
}
}
},
{
"if": {
"properties": {
"classificationId": {
"const": "ui-workflow"
}
}
},
"then": {
"properties": {
"defaultLaneId": {
"const": "confidence"
}
}
}
},
{
"if": {
"properties": {
"classificationId": {
"const": "surface-guard"
}
}
},
"then": {
"properties": {
"defaultLaneId": {
"const": "heavy-governance"
},
"forbiddenLaneIds": {
"allOf": [
{
"contains": {
"const": "fast-feedback"
}
},
{
"contains": {
"const": "confidence"
}
}
]
}
}
}
},
{
"if": {
"properties": {
"classificationId": {
"const": "discovery-heavy"
}
}
},
"then": {
"properties": {
"defaultLaneId": {
"const": "heavy-governance"
},
"forbiddenLaneIds": {
"allOf": [
{
"contains": {
"const": "fast-feedback"
}
},
{
"contains": {
"const": "confidence"
}
}
]
}
}
}
}
]
},
"family": {
"type": "object",
"additionalProperties": false,
"required": [
"familyId",
"classificationId",
"purpose",
"currentLaneId",
"targetLaneId",
"selectors",
"hotspotFiles",
"costSignals",
"validationStatus"
],
"properties": {
"familyId": {
"type": "string",
"pattern": "^[a-z0-9]+(?:-[a-z0-9]+)*$"
},
"classificationId": {
"$ref": "#/$defs/classificationId"
},
"purpose": {
"type": "string",
"minLength": 1
},
"currentLaneId": {
"$ref": "#/$defs/laneId"
},
"targetLaneId": {
"$ref": "#/$defs/laneId"
},
"selectors": {
"type": "array",
"minItems": 1,
"items": {
"$ref": "#/$defs/selector"
}
},
"hotspotFiles": {
"$ref": "#/$defs/nonEmptyStringArray"
},
"costSignals": {
"$ref": "#/$defs/nonEmptyStringArray"
},
"confidenceRationale": {
"type": "string"
},
"validationStatus": {
"type": "string",
"enum": [
"seeded",
"reviewed",
"migrated",
"guarded"
]
}
},
"allOf": [
{
"if": {
"properties": {
"targetLaneId": {
"const": "confidence"
}
}
},
"then": {
"required": [
"confidenceRationale"
],
"properties": {
"confidenceRationale": {
"type": "string",
"minLength": 1
}
}
}
},
{
"if": {
"properties": {
"classificationId": {
"const": "ui-light"
}
}
},
"then": {
"properties": {
"targetLaneId": {
"enum": [
"fast-feedback",
"confidence"
]
}
}
}
},
{
"if": {
"properties": {
"classificationId": {
"const": "ui-workflow"
}
}
},
"then": {
"properties": {
"targetLaneId": {
"enum": [
"confidence",
"heavy-governance"
]
}
}
}
},
{
"if": {
"properties": {
"classificationId": {
"const": "surface-guard"
}
}
},
"then": {
"properties": {
"targetLaneId": {
"const": "heavy-governance"
}
}
}
},
{
"if": {
"properties": {
"classificationId": {
"const": "discovery-heavy"
}
}
},
"then": {
"properties": {
"targetLaneId": {
"const": "heavy-governance"
}
}
}
},
{
"if": {
"properties": {
"classificationId": {
"const": "browser"
}
}
},
"then": {
"properties": {
"targetLaneId": {
"const": "browser"
}
}
}
}
]
},
"mixedFileResolution": {
"type": "object",
"additionalProperties": false,
"required": [
"filePath",
"primaryClassificationId",
"resolutionStrategy",
"rationale",
"followUpRequired"
],
"properties": {
"filePath": {
"type": "string",
"minLength": 1
},
"primaryClassificationId": {
"$ref": "#/$defs/classificationId"
},
"secondaryClassificationIds": {
"type": "array",
"items": {
"$ref": "#/$defs/classificationId"
},
"uniqueItems": true
},
"resolutionStrategy": {
"type": "string",
"enum": [
"split-file",
"broadest-cost-wins"
]
},
"rationale": {
"type": "string",
"minLength": 1
},
"followUpRequired": {
"type": "boolean"
}
}
},
"placementRule": {
"type": "object",
"additionalProperties": false,
"required": [
"ruleId",
"classificationId",
"laneId",
"allowance",
"reason"
],
"properties": {
"ruleId": {
"type": "string",
"pattern": "^[a-z0-9]+(?:-[a-z0-9]+)*$"
},
"classificationId": {
"$ref": "#/$defs/classificationId"
},
"laneId": {
"$ref": "#/$defs/laneId"
},
"allowance": {
"type": "string",
"enum": [
"required",
"allowed",
"discouraged",
"forbidden"
]
},
"reason": {
"type": "string",
"minLength": 1
},
"exceptionPolicy": {
"type": "string"
}
}
},
"driftGuard": {
"type": "object",
"additionalProperties": false,
"required": [
"guardId",
"scope",
"assertionType",
"targetRefs",
"owningTestPaths",
"failureContract"
],
"properties": {
"guardId": {
"type": "string",
"pattern": "^[a-z0-9]+(?:-[a-z0-9]+)*$"
},
"scope": {
"type": "string",
"enum": [
"classification",
"family",
"lane",
"report"
]
},
"assertionType": {
"type": "string",
"enum": [
"forbidden-membership",
"required-membership",
"required-attribution",
"required-selector",
"browser-isolation"
]
},
"targetRefs": {
"$ref": "#/$defs/nonEmptyStringArray"
},
"owningTestPaths": {
"$ref": "#/$defs/nonEmptyStringArray"
},
"failureContract": {
"type": "string",
"minLength": 1
}
}
},
"budgetTarget": {
"type": "object",
"additionalProperties": false,
"required": [
"budgetId",
"targetType",
"targetId",
"thresholdSeconds",
"baselineSource",
"enforcement",
"lifecycleState"
],
"properties": {
"budgetId": {
"type": "string",
"pattern": "^[a-z0-9]+(?:-[a-z0-9]+)*$"
},
"targetType": {
"type": "string",
"enum": [
"lane",
"classification",
"family"
]
},
"targetId": {
"type": "string",
"minLength": 1
},
"thresholdSeconds": {
"type": "integer",
"minimum": 1
},
"baselineSource": {
"type": "string",
"enum": [
"measured-current-suite",
"measured-lane",
"measured-post-spec-207"
]
},
"enforcement": {
"type": "string",
"enum": [
"report-only",
"warn",
"hard-fail"
]
},
"lifecycleState": {
"type": "string",
"enum": [
"draft",
"measured",
"documented",
"enforced"
]
},
"reviewCadence": {
"type": "string"
}
}
},
"nonEmptyStringArray": {
"type": "array",
"minItems": 1,
"items": {
"type": "string",
"minLength": 1
},
"uniqueItems": true
},
"nonEmptyLaneArray": {
"type": "array",
"minItems": 1,
"items": {
"$ref": "#/$defs/laneId"
},
"uniqueItems": true
}
}
}